Skip to content

Add root dir to determine paths for sast changed files#743

Merged
attiasas merged 2 commits intojfrog:devfrom
attiasas:fix_root_diff_sast
Apr 28, 2026
Merged

Add root dir to determine paths for sast changed files#743
attiasas merged 2 commits intojfrog:devfrom
attiasas:fix_root_diff_sast

Conversation

@attiasas
Copy link
Copy Markdown
Collaborator

@attiasas attiasas commented Apr 28, 2026

fix(audit/sast): use root dir for SAST changed-file paths

Summary

SAST “changed files” resolution now keys off the audit root directory (the CLI root when set) instead of only the scan targets’ common parent. AuditParams carries that root, and SastChangedFilesForTarget takes a rootDir and builds absolute paths under it. Path handling is simplified by dropping extra normalization of git paths before joining to the root.

Changes

  • commands/audit/auditparams.go: Add rootDir on AuditParams with SetRootDir / RootDir.
  • commands/audit/audit.go: Call SetRootDir(auditCmd.rootDir) when building audit params; introduce getRootDir to use an explicit root when non-empty, otherwise scanResults.GetCommonParentPath(); pass that into SastChangedFilesForTarget.
  • jas/sast/sastscanner.go: Rename the last parameter conceptually from common parent to rootDir; compute target-relative paths vs rootDir; simplify collectSastChangedAbsPaths (join commonAbs + changed path directly; remove normalizeRepoRelativeChangedPath).
  • jas/sast/sastscanner_test.go: Update TestSastChangedFilesForTarget for rootDir and adjust the absolute-path case to a repo-relative changed file.

@attiasas attiasas requested a review from a team April 28, 2026 14:30
@attiasas attiasas added ignore for release Automatically generated release notes safe to test Approve running integration tests on a pull request labels 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
@github-actions
Copy link
Copy Markdown

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


@attiasas attiasas merged commit b3269a8 into jfrog:dev Apr 28, 2026
61 of 62 checks passed
@attiasas attiasas deleted the fix_root_diff_sast branch April 28, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore for release Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants