Repository navigation
Description
Problem
5d34541 (#708, #763) made a scanner that raises report ScanOutcome("failed", [], str(exc)), and 36b2bee (#708, #785) writes every non-ran outcome's reason into SARIF toolExecutionNotifications[].message.text (security/sarif.py:167-174). Nothing masks the reason, and some paths don't cap it either:
commands/scan.py:905, the livedevops scan reportloop, and its unused twinsecurity/registry.py:84:str(exc), with no mask and no cap.ScannerRegistry.scan_allhas no production caller; onlytests/test_consolidation_security_scanner_base.py:125, 131call it.security/base.py:146and:182: scanner stderr capped at 256 but not masked.:312:str(exc)[:256], also not masked.:310:Scanner error: {exc}; used built-in patterns, neither masked nor capped.- The same reasons reach the CLI through
print_warning(scan.py:96-98,:793-795).print_warningdoes not mask, and it is called withoutsafe=True, so the text is parsed as Rich markup.
Checked against release/v0.2.24 at d5eb2f4:
- A mocked scanner raising
RuntimeErrorwith auser:password@URL, aghp_token and 5,000 characters gave a 5,135-character SARIF notification and a CLI warning, both containing both secrets. - A
TimeoutExpiredwith a token in its argv reached thebase.py:312reason, which was capped but still held the token. - No realistic secret source was found among the 11 built-in scanners: exceptions that escape
scan()are mostlyOSErrornaming a path. Unbounded length always happens. scan report --jsonis safe, becauseScanReport.as_dict(pipeline.py:74-98) leaves reasons out.- A reason containing
[/x]madedevops scan reportexit 1 with Rich'sMarkupErrorafter the SARIF file was written.
Copilot raised this reviewing release PR #905 (thread on security/registry.py:84). It is not a critical fix, so it goes to the backlog rather than into v0.2.24.
Acceptance criteria
-
ScanOutcome.__init__(security/base.py) storesmask_secrets(reason)[:CONST_MAX_ERROR_DETAIL_LENGTH], masking before the cap, so every producer is covered. The[:256]slices atbase.py:146,:182and:312go, because cutting before masking can leave a partial credential the patterns no longer match. -
print_warningcalls that print a reason (scan.py:98,:793,:795) passsafe=True. -
scan reportandScannerRegistryshare one handler that turns a scanner exception into an outcome. Eitherscan_allgains anamesparameter thatscan reportuses, orscan_allis deleted. - Tests, offline with no real scanners, in
tests/test_scan_outcomes_and_gating.py:- a scanner that raises with a
ghp_token, auser:password@URL and 5,000 characters yields a reason with neither secret, at mostCONST_MAX_ERROR_DETAIL_LENGTHlong, in the outcome, the SARIF notification and the CLI output; - the same holds for the
base.py:310built-in-patterns branch; - a reason containing
[/x]prints literally andscan reportexits 0.
- a scanner that raises with a
-
uv run devops cipasses.
Scope added 2026-10-02, and moved into v0.2.25 as a critical fix: #1009 (79e1e93) added a third unmasked producer and a new sink in this release. _non_json_failure_reason (security/base.py:146-158) quotes up to 100 characters of a failed scanner's stdout and caps the reason at CONST_SCANNER_FAILURE_REASON_CHARS = 300 (config/constants.py:1884), without mask_secrets. The review's Static Analyzers table then writes that reason into review.md (ai/review/pipeline.py, _build_static_analyzers_section), a file people share and attach to pull requests. A scanner that prints a matched secret before failing would put it in review.md (.data/review-evaluation-20261002-s6.md, section 4.1).
- The review.md Static Analyzers row for a failed analyzer carries the masked reason. A test drives a fake scanner whose non-JSON stdout holds a
ghp_token through the review's analyzer reporting and asserts the token is not in the rendered review.md section. - One cap applies to every scanner reason.
CONST_SCANNER_FAILURE_REASON_CHARSgoes,ScanOutcomecaps atCONST_MAX_ERROR_DETAIL_LENGTHafter masking, and fix(security): bandit reports failed on every review of more than 50 python files #1009's tests that pin 300 are updated to the shared cap.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 2, 2026
More evidence for this issue from the devsecops review session
20261001-224227(2026-10-02). Each finding below was triaged againstrelease/v0.2.25(c279c18), judged real and covered by this issue, and then upheld by a second agent that tried to refute it.src/devops_cli/commands/scan.py:164, re-rated LOW): The findings themselves carry nothing secret. trivy.py:79-91 maps secret hits to a fixed description ('Plaintext secret or token identified in workspace file.') without the match, and printing file paths is the purpose of a local scanner. The proposed hasattr filter is meaningless. The only unsanitized output on this path is in_handle_single_scanner_result(scan.py:95-99):print_warning(f"{tool_name} was not run{detail}.")prints the outcomereasonwithout masking and withoutsafe=True, so markup like[/x]crashes. Issue fix(security): scanner failure reasons are masked and capped before sarif and the cli print them #915 tracks exactly that.fix(security): scanner failure reasons are masked before they are cut…
dan-petty commentedon Oct 3, 2026
Closed by #1033, merged into
release/v0.2.25.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(release): v0.2.25 (#1089)