Add SAST incremental base-branch support(AST-177680) - #1574
Open
cx-atish-jadhav wants to merge 10 commits into
Open
cx-atish-jadhav wants to merge 10 commits into
cx-atish-jadhav wants to merge 10 commits into
Conversation
Introduce --sast-base-branch support for incremental SAST scans. Adds flag definition, validation (requires --sast-incremental), wiring into scan creation and resubmit override behavior, and ensures resubmitted config can populate BaseBranch when flag not provided. Updates SastConfig in wrappers, mock scan data, unit and integration tests (including createScanIncrementalWithBaseBranch), and a small govulncheck workflow timeout tweak. Files changed: internal/commands/scan.go, internal/params/flags.go, internal/wrappers/scans.go, internal/wrappers/mock/scans-mock.go, tests in internal/commands/scan_test.go and test/integration/scan_test.go, plus CI workflow.
Pass the SAST metadata wrapper into the scan show command and fetch SAST metadata for the displayed scan. When available, use the metadata to set the scan's incremental status (SastIncremental) before printing. Updated mock wrappers to add FakeMetadataErrorID and FakeMetadataEmptyID behaviors and adjusted the scans mock to return base SastIncremental values for those IDs. Added unit tests to verify enrichment, error-preserving behavior, and empty-metadata handling. Updated an integration incremental-scan test to create an explicit baseline scan, run an incremental scan against it, and assert the Incremental status and project ID consistency. Function signatures for scanShowSubCommand and runGetScanByIDCommand were updated to accept the new wrapper.
…/sast-incremental
…idation - Fix gofmt formatting in scan_test.go, filters_test.go, and sast-metadata-mock.go - Add exported symbol comments for FakeMetadataErrorID and FakeMetadataEmptyID - Initialize actualScanTypes in TestAddSastScan_BaseBranchInheritedFromResubmit to fix nil panic - Remove excessive comments from integration test file (filters_test.go) - Add three new filter test functions to CI workflow coverage validation patterns: - TestScanWithNewFileExtensions_VerifyIncluded - TestScanWithExistingExtensions_VerifyBackwardCompatibility - TestScanWithConservativeFiltering_VerifyGenericPatternsExcluded - Assign filter tests to scan-ops matrix group for coverage collection Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…rx/ast-cli into feature/sast-incremental
Contributor
Original alert (resolved)Security Policy Alert: Secret Policy ViolationThis workflow run has been blocked by StepSecurity's secrets policy because it accesses secrets and the workflow file differs from the default branch. Secret references detected:
To approve this workflow, please add the Note: The label must be added by someone other than the PR author (cx-atish-jadhav) or automation bots to ensure proper security review. After the label is added, you can re-run the blocked workflow to proceed. This workflow will be automatically approved once merged into the default branch. For more information, see StepSecurity's Secret Exfiltration Policy documentation. |
cx-rakesh-kadu
previously approved these changes
Sep 20, 2026
This branch has not been deployed
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
This PR consolidates three related enhancements to the SAST scanning pipeline:
AST-177680 — SAST Incremental Base-Branch Support
--sast-base-branchflag to explicitly specify baseline branch for incremental scans--sast-base-branchrequires--sast-incrementalflag--resubmitacross scan attemptsAST-177752 — SAST File-Extension Filters
sastsupported file extensions (exclude/include patterns)AST-180086 — Fix Scan Show Incremental Display
cx scan showoutput with real incremental status from SAST metadata APITest Coverage
Changes Breakdown
internal/commands/scan.go,internal/params/flags.go,internal/params/filters.gointernal/commands/scan_test.go,test/integration/scan_test.go,test/integration/filters_test.gointernal/wrappers/scans.go, mock implementations, test data filesFixes #AST-177680, #AST-177752, #AST-180086