WA-SEC-018: Sanitize Brakeman baseline metadata to reduce diff churn#984
Open
kitcommerce wants to merge 1 commit intonextfrom
Open
WA-SEC-018: Sanitize Brakeman baseline metadata to reduce diff churn#984kitcommerce wants to merge 1 commit intonextfrom
kitcommerce wants to merge 1 commit intonextfrom
Conversation
Strip machine-specific and time-varying fields from core/brakeman.baseline.json: - app_path: contributor-machine absolute path - start_time / end_time: scan timestamps - duration: run-time float Retains all stable fields (rails_version, ruby_version, brakeman_version, check counts, checks_performed) and all warning fingerprints unchanged. Add script/update_brakeman_baseline to generate a sanitized baseline reproducibly; contributors should use this script instead of running brakeman directly when refreshing the baseline. Fixes #980
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #980.
The committed Brakeman baseline included several machine-specific and
time-varying fields that caused noisy, unstable diffs every time the
baseline was regenerated on a different machine or at a different time.
Changes
core/brakeman.baseline.json— sanitized baselineRemoves the following keys from
scan_info:app_path/Users/alice/…/core)start_timeend_timedurationAll warning fingerprints, warning content, and stable metadata
(
rails_version,ruby_version,brakeman_version,checks_performed,security_warnings, etc.) are unchanged.script/update_brakeman_baseline— reproducible update scriptProvides a canonical way for contributors to regenerate the baseline.
The script runs Brakeman then post-processes the output with the same
sanitization (strip
app_path,start_time,end_time,duration), writes consistent JSON formatting, and adds a trailingnewline.
Usage:
Before / After
Before (
scan_infoexcerpt — machine-specific, time-varying):After (
scan_infoexcerpt — stable, portable):Regenerating the baseline on any machine now produces an identical diff
limited to actual warning changes — not contributor paths or timestamps.
Verification
script/update_brakeman_baselinefrom the repo root.git diff core/brakeman.baseline.json— diffs should be limited towarning content;
app_path,start_time,end_time, anddurationshould not appear.Client Impact
None. This change is internal to the development and CI workflow only;
no application behaviour is modified.