Skip to content

PR Scan - Option to scan only changed files in SAST#1284

Merged
attiasas merged 16 commits intojfrog:devfrom
attiasas:sast_diff_files_mode
Apr 28, 2026
Merged

PR Scan - Option to scan only changed files in SAST#1284
attiasas merged 16 commits intojfrog:devfrom
attiasas:sast_diff_files_mode

Conversation

@attiasas
Copy link
Copy Markdown
Contributor

@attiasas attiasas commented Apr 20, 2026

feat(sast): add changed-files-only mode for PR SAST scans

Depends on:

Description

This PR adds support for scanning only changed files in SAST mode for pull requests.
Reduces scan scope to modified files, improving performance and shortening Frogbot PR scan times, especially in large repositories.

It threads a new sastChangedFilesOnly configuration flag from schema or env (JF_SAST_CHANGED_FILES_MODE=true ) parsing into scan execution and enriches PR Git context with modified-file data so the scanner can scope analysis to the PR diff.

Changes

  • Added new config option sastChangedFilesOnly to schema and scan params parsing (schema/frogbot-schema.json, utils/params.go).
  • Added env var support via JF_SAST_CHANGED_FILES_MODE and corresponding constant (utils/consts.go, utils/params.go).
  • Passed the new flag into scan details and audit execution (scanpullrequest/scanpullrequest.go, utils/scandetails.go).
  • Added SetSastChangedFilesOnly to ScanDetails and wired audit params with SetSastChangedFilesMode(...).
  • Enhanced PR Git context creation to fetch and populate modified files (GetModifiedFiles) into ChangedFiles, while tolerating provider errors (utils/scandetails.go).
  • Updated tests to cover env parsing, changed-files context population, and error handling (utils/params_test.go, utils/scandetails_test.go, scanpullrequest/scanallpullrequests_test.go).
  • Updated dependencies in go.mod/go.sum (including jfrog-client-go bump and jfrog-cli-security replace to forked revision).

Testing

  • Added/updated unit tests for:
    • sastChangedFilesOnly env/default precedence.
    • PR Git context changed-files population.
    • Graceful handling when GetModifiedFiles fails.

@attiasas attiasas added safe to test Approve running integration tests on a pull request new feature Automatically generated release notes labels Apr 20, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 20, 2026
@attiasas attiasas added safe to test Approve running integration tests on a pull request improvement Automatically generated release notes and removed new feature Automatically generated release notes labels Apr 26, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 26, 2026
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Apr 26, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 26, 2026
@attiasas attiasas requested a review from a team April 26, 2026 13:55
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

👍 Frogbot scanned this pull request and did not find any new security issues.


@attiasas attiasas changed the title Fast SAST mode scanning changed files only Scan only changed files in SAST mode for pull requests Apr 28, 2026
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants