-
Notifications
You must be signed in to change notification settings - Fork 357
Skip validating SARIF produced by CodeQL #2894
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
Conversation
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.
Pull Request Overview
This PR improves performance by skipping SARIF schema validation for CodeQL-produced results outside of testing environments and reducing redundant file reads when uploading a single SARIF file.
- Introduce getTestingEnvironment to centralize test-environment checks.
- Split validateSarifFileSchema into readSarifFile + validate so a single-file upload is read only once.
- Update uploadFiles to skip validation for pure CodeQL SARIF in production and streamline multi-/single-file flows.
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/util.ts | Add getTestingEnvironment and refine JSDoc for test-mode logic. |
src/workflow.ts | Use getTestingEnvironment instead of direct process.env check. |
src/upload-lib.ts | Extract readSarifFile, update validateSarifFileSchema signature, skip validation by default for CodeQL SARIF. |
src/upload-lib.test.ts | Update schema tests to use readSarifFile before validation. |
src/status-report.ts | Use getTestingEnvironment for status payload and export logic. |
src/analyze.ts | Remove in-place validation in getPerQueryAlertCounts and update its signature. |
lib/… | Mirror changes in compiled JS for util, workflow, upload-lib, status-report, analyze, and tests. |
CHANGELOG.md | Document skipping SARIF validation for CodeQL. |
Comments suppressed due to low confidence (1)
src/analyze.ts:683
- Consider updating this JSDoc to reflect that the function no longer performs validation and no longer accepts a logger parameter.
/** Get an object with all queries and their counts parsed from a SARIF file path. */
Co-authored-by: Copilot <[email protected]>
Pushed a commit to rebuild the Action. Please mark the PR as ready for review to trigger PR checks. |
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.
LGTM!
export function getTestingEnvironment(): string | undefined { | ||
const testingEnvironment = process.env[EnvVar.TESTING_ENVIRONMENT] || ""; | ||
if (testingEnvironment === "") { | ||
return undefined; | ||
} | ||
return testingEnvironment; | ||
} |
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.
👍🏾
This PR skips validating SARIF files produced by CodeQL, unless we are running in a testing environment. This improves end-to-end performance.
We also only read the SARIF file once in the common case that only one file is being uploaded. Previously we read it twice. This should also speed things up, particularly for large SARIF files.
Merge / deployment checklist