Commit db71e64
authored
fix: resolve 14 bugs with TDD regression tests (#273)
* fix: resolve 14 verified production bugs with TDD regression tests
Bugs fixed (identified via semi-formal code reasoning analysis with
41 agents across 3 rounds + devil's advocate review):
Critical:
- C2: --output-formats CLI flag now propagates through orchestrator
to execution engine to report phase (was silently ignored)
- C5: hasattr-on-dict bugs in sarif_utils.py and
scanner_statistics_calculator.py replaced with proper dict key
checks, restoring issue_severity extraction from Bandit
High:
- H2: FlatJSON reporter no longer injects phantom test finding on
clean scans (test scaffolding removed from production)
- H3: Bedrock severity grouping uses "level" key (was "severity")
- H4: SecurityHub model_post_init__ renamed to model_post_init
- H5: Trivy scanner uses --severity with inclusion list mapping
(was --severity-threshold which does not exist in Trivy CLI)
- H8: report_id strftime uses %m month (was %M minute)
- H-NEW: GitLabSASTReporter and UnusedSuppressionsReporter added
to ASH_REPORTERS discovery list
Medium:
- M1: cancel_scan logs warning when process_id is None
- M3: EnginePhase uses AshEventType enum lookup (was string)
- M6: find_executable checks all command variants (was early return)
- M7: glob uses recursive=True for nested .gitignore discovery
- M8: Syft scanner preserves exclude paths after args rebuild
- M9: OCSF suppression counter uses StatusId.integer_3 (was 4)
Cleanup:
- Removed debug print statements from mcp_server.py
- Fixed split["."] syntax error in inspect_findings_app.py
- Deleted 409-line dead code file models/uv_tool_installation.py
- Deleted empty placeholder scan_tracking_modified.py
46 new regression tests added across 9 test files.
1016 tests pass, 0 failures, 0 regressions.
* fix: Windows CI compatibility for glob and find_executable tests
- Glob recursive tests now check both forward and backslash path separators
- find_executable test allows multiple which() calls (now iterates all variants)
* fix: replace hardcoded /tmp/ paths with tempfile.gettempdir() in tests
Resolves Bandit B108 findings flagged by ASH scan on test files.
* refactor(tests): organize regression tests by domain, not severity
Redistribute tests from test_low_fixes.py and test_medium_fixes.py
into domain-appropriate locations:
- M1 (cancel_scan) -> core/resource_management/test_cancel_scan_warning.py
- M3 (engine_phase) -> core/test_engine_phase_events.py
- M6 (find_executable) -> utils/test_find_executable_fix.py
- M7 (glob recursive) -> utils/test_glob_recursive_fix.py
- L1 (mcp debug) -> cli/test_mcp_debug_prints_fix.py
- L2 (inspect split) -> cli/test_inspect_split_fix.py
- Dead code -> test_dead_code_removal.py
No behavior change. Same 1016 tests pass.
* fix(syft): create target results directory before subprocess execution
The target_results_dir (e.g., /out/scanners/syft/source/) was not
created before calling syft, causing [Errno 2] when syft tried to
write its output file. Moved the mkdir call before _run_subprocess
and removed the redundant late mkdir that ran after the file read.
* fix(syft): use --exclude flag instead of --skip-path
Syft uses --exclude for path exclusion, not --skip-path (which is
silently ignored, causing syft to produce no output). Same class of
bug as H5 (Trivy wrong flag name). Previously masked by M8 bug
(exclude paths were discarded before reaching the command line).
* fix: proper exit code handling across all scanners
Two fixes for scanner exit code handling:
1. executionSuccessful in SARIF Invocation now reflects actual exit
codes instead of being hardcoded True. Exit 0 and 1 (findings
found) are treated as successful for most tools. Grype uses
inverted semantics (exit 1=error, 2=findings) and is handled
separately. 8 scanners fixed, 35 new tests.
2. Multi-subprocess scanners (cfn_nag, npm_audit) now retain the
worst exit code across loop iterations instead of only the last.
Uses max(self.exit_code, new_code) in plugin_base.py. 5 new tests.
Research verified exit code semantics from official documentation for
all 13 external tools ASH wraps: Bandit, Checkov, Grype, Syft,
Semgrep, OpenGrep, npm/yarn/pnpm audit, cfn_nag, CDK Nag, Trivy,
Snyk, detect-secrets, and Ferret.
* fix(syft): stop passing global_ignore_paths as --exclude to syft
global_ignore_paths (patterns like **/.venv/**) are designed for
SARIF-level finding suppression, not for syft's --exclude flag.
Passing them caused syft to produce empty output in Docker containers,
failing the container scan tests. Syft generates SBOMs (inventory),
not security findings, so SARIF ignore paths are irrelevant.
Scanner-specific exclude paths from config still work via
_process_config_options.
* chore: bump version to 3.3.01 parent f4a061d commit db71e64
59 files changed
Lines changed: 1716 additions & 574 deletions
File tree
- automated_security_helper
- base
- cli
- inspect
- core
- resource_management
- models
- plugin_modules
- ash_aws_plugins
- ash_builtin
- reporters
- scanners
- ash_trivy_plugins
- utils
- docs/content
- docs
- tutorials
- examples/streamlit_ui
- tests/unit
- cli
- core
- resource_management
- models
- plugin_modules
- ash_aws_plugins
- ash_trivy_plugins
- plugins
- reporters
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
91 | 99 | | |
92 | 100 | | |
93 | 101 | | |
| |||
126 | 134 | | |
127 | 135 | | |
128 | 136 | | |
129 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
130 | 145 | | |
131 | 146 | | |
132 | 147 | | |
| |||
213 | 228 | | |
214 | 229 | | |
215 | 230 | | |
216 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
217 | 236 | | |
218 | 237 | | |
219 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | | - | |
292 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
293 | 294 | | |
294 | 295 | | |
295 | 296 | | |
| |||
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
388 | | - | |
389 | | - | |
| 389 | + | |
| 390 | + | |
390 | 391 | | |
391 | 392 | | |
392 | 393 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
985 | 985 | | |
986 | 986 | | |
987 | 987 | | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | 988 | | |
995 | 989 | | |
996 | 990 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| 134 | + | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| |||
510 | 512 | | |
511 | 513 | | |
512 | 514 | | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
| 515 | + | |
518 | 516 | | |
519 | 517 | | |
520 | 518 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
387 | 392 | | |
388 | 393 | | |
389 | 394 | | |
| |||
Whitespace-only changes.
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
372 | 373 | | |
373 | 374 | | |
374 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
375 | 382 | | |
376 | 383 | | |
377 | | - | |
| 384 | + | |
378 | 385 | | |
379 | 386 | | |
380 | 387 | | |
| |||
0 commit comments