-
Notifications
You must be signed in to change notification settings - Fork 0
feat: send commit SHA with scan dispatch #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,9 @@ function getGitLabEnvVars() { | |
| // GitLab CI provides the branch name in CI_COMMIT_REF_NAME | ||
| const branch = process.env.CI_COMMIT_REF_NAME ?? undefined; | ||
|
|
||
| // GitLab CI provides the commit SHA in CI_COMMIT_SHA | ||
| const commitSha = process.env.CI_COMMIT_SHA ?? undefined; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GitLab bypasses centralized commit SHA resolutionMedium Severity The GitLab integration reads Additional Locations (1) |
||
|
|
||
| // Check if we should wait for completion | ||
| const wait = process.env.PENSAR_WAIT !== "false"; | ||
|
|
||
|
|
@@ -27,6 +30,7 @@ function getGitLabEnvVars() { | |
| environment, | ||
| wait, | ||
| scanLevel, | ||
| commitSha, | ||
| }; | ||
| } | ||
|
|
||
|
|
@@ -35,7 +39,7 @@ function getGitLabEnvVars() { | |
| */ | ||
| export async function runScan(): Promise<void> { | ||
| try { | ||
| const { apiKey, projectId, branch, environment, wait, scanLevel } = | ||
| const { apiKey, projectId, branch, environment, wait, scanLevel, commitSha } = | ||
| getGitLabEnvVars(); | ||
|
|
||
| console.log("Starting Pensar security pentest from GitLab CI..."); | ||
|
|
@@ -47,6 +51,7 @@ export async function runScan(): Promise<void> { | |
| scanLevel, | ||
| environment, | ||
| wait, | ||
| commitSha, | ||
| }); | ||
|
|
||
| if (result.status === "completed") { | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PENSAR_COMMIT_SHAoverride has lowest priority instead of highestHigh Severity
PENSAR_COMMIT_SHAis documented as a "Commit SHA override" in the README, but ingetCommitShaEnvVar()it's checked last in the??chain — afterGITHUB_SHA,CI_COMMIT_SHA, andBITBUCKET_COMMIT. Since those CI-specific env vars are always set automatically in their respective CI platforms,PENSAR_COMMIT_SHAcan never take effect, making it impossible for users to override the commit SHA via env var.Additional Locations (1)
README.md#L39-L40