| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Adds a new csra analysis kind to the CodeQL Action, intended to largely mirror code-scanning while uploading SARIF to a different endpoint with a different payload shape. The change introduces analysis-kind compatibility enforcement and extends unit + PR-check coverage to include the new kind.
Changes:
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file| File | Description |
|---|---|
| src/upload-lib/types.ts | Introduces typed payload interfaces (BasePayload, UploadPayload, AssessmentPayload). |
| src/upload-lib.ts | Uses typed payloads; routes upload payload through transformPayload prior to request. |
| src/upload-lib.test.ts | Updates SARIF grouping tests to account for all analysis kinds; updates upload payload fixtures typing. |
| src/config-utils.ts | Updates “primary analysis config” selection to handle single-kind configs (incl. CSRA) via getAnalysisConfig. |
| src/config-utils.test.ts | Adds tests for getPrimaryAnalysisConfig with single kind and CS+CQ special-case. |
| src/analyze.ts | Simplifies category computation by always using analysis.fixCategory(...). |
| src/analyze.test.ts | Extends SARIF extension tests to include .csra.sarif. |
| src/analyses.ts | Adds csra kind, endpoint, payload transform, compatibility matrix, and SARIF scan order updates. |
| src/analyses.test.ts | Adds compatibility-matrix-driven tests and verifies Code Scanning predicate rejects other extensions. |
| pr-checks/checks/analysis-kinds.yml | Expands PR-check matrix to include csra and sets required env for assessment id; updates artifact handling. |
| .github/workflows/__analysis-kinds.yml | Generated workflow updated to match pr-checks definition (auto-generated). |
| lib/upload-sarif-action.js | Generated JS output (not reviewed). |
| lib/upload-sarif-action-post.js | Generated JS output (not reviewed). |
| lib/upload-lib.js | Generated JS output (not reviewed). |
| lib/start-proxy-action.js | Generated JS output (not reviewed). |
| lib/start-proxy-action-post.js | Generated JS output (not reviewed). |
| lib/setup-codeql-action.js | Generated JS output (not reviewed). |
| lib/resolve-environment-action.js | Generated JS output (not reviewed). |
| lib/init-action.js | Generated JS output (not reviewed). |
| lib/init-action-post.js | Generated JS output (not reviewed). |
| lib/autobuild-action.js | Generated JS output (not reviewed). |
| lib/analyze-action.js | Generated JS output (not reviewed). |
| lib/analyze-action-post.js | Generated JS output (not reviewed). |
Sorry, something went wrong.
| const payload = uploadTarget.transformPayload( | ||
| buildPayload( | ||
| await gitUtils.getCommitOid(checkoutPath), | ||
| await gitUtils.getRef(), | ||
| postProcessingResults.analysisKey, | ||
| util.getRequiredEnvParam("GITHUB_WORKFLOW"), | ||
| zippedSarif, | ||
| actionsUtil.getWorkflowRunID(), | ||
| actionsUtil.getWorkflowRunAttempt(), | ||
| checkoutURI, | ||
| postProcessingResults.environment, | ||
| toolNames, | ||
| await gitUtils.determineBaseBranchHeadCommitOid(), | ||
| ), | ||
| ); |
There was a problem hiding this comment.
uploadPostProcessedFiles now routes the payload through uploadTarget.transformPayload(...) before calling uploadPayload, and CSRA relies on this to change the request shape. There isn’t a unit test asserting the transformed payload for CSRA (e.g., that assessment_id is included) or even that transformPayload is applied. Adding a focused test around this call site would help prevent regressions as more analysis kinds are added.
Sorry, something went wrong.
There was a problem hiding this comment.
Re the risk assessment, I wonder whether it is worth us adding some explicit checks for upload-sarif that upload static SARIF files for each analysis and check the exact data that was sent to the API?
Sorry, something went wrong.
There was a problem hiding this comment.
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)src/analyses.ts:1
import {
Sorry, something went wrong.
There was a problem hiding this comment.
Overall looks good, just some minor comments. Thanks for improving the type safety of the upload paths.
Sorry, something went wrong.
| t.deepEqual(expected, payload); | ||
| }); | ||
|
|
||
| test("CSRA configuration throws for negative assessment IDs", (t) => { |
There was a problem hiding this comment.
Minor: is 0 OK?
Sorry, something went wrong.
There was a problem hiding this comment.
I am not sure it matters too much. We don't expect this to ever be used other than with an automatically populated value, and the value is just passed back to the upload endpoint.
I'd suggest we leave it like this for now and only tighten the constraints later if we have a requirement for it.
Sorry, something went wrong.
| message: string | Error; | ||
| } | ||
|
|
||
| export class RecordingLogger implements Logger { |
There was a problem hiding this comment.
Should this replace the implementation in getRecordingLogger?
Sorry, something went wrong.
There was a problem hiding this comment.
Eventually perhaps, but adding this was already a tangential change in this PR since I wanted a way to track the log groups. I'll update the tests to use this new implementation in a follow-up PR as a low priority.
Sorry, something went wrong.
| */ | ||
| function addAssessmentId(payload: UploadPayload): AssessmentPayload { | ||
| const rawAssessmentId = getRequiredEnvParam(EnvVar.CSRA_ASSESSMENT_ID); | ||
| const assessmentId = parseInt(rawAssessmentId, 10); |
There was a problem hiding this comment.
Technically this will truncate floats, but I think that's fine in practice.
Sorry, something went wrong.
There was a problem hiding this comment.
Similar as with #3474 (comment), I don't think this is a practical concern for now.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
First stab at adding this new analysis kind. See the linked internal issues for more details. The new analysis kind largely mirrors code-scanning.
We do not plan this in combination with other analysis kinds, so I added some logic to prevent that.
The SARIF upload for this analysis kind is a bit different than the other two, so I added a transformPayload function to the AnalysisConfig interface that can change what's included in the payload. I preferred that over having a conditional block near the upload, since that's harder to see and less reusable.
I extended the existing tests for this new analysis kind.
Notes for reviewers
This is ready for an initial review to examine the high-level approach here. There's almost certainly room for polishing this and adding some more tests.
Best reviewed commit-by-commit.
Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
This change should not directly impact any of the below, but it may indirectly as a result of changes to code paths that are also hit by those.
Workflow types:
Products:
Environments:
How did/will you validate this change?
If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist