Skip to content

Commit 81dc653

Browse files
Fix SARIF upload branch ref/sha (#1225)
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/VULN-226 ## 📔 Objective Add correct ref/sha reference for main and PR branches, since codeql/upload-sarif doesn't handle pull_request_target properly. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 4f3792b commit 81dc653

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

.github/workflows/build-cli-docker.yml

+2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ jobs:
132132
uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
133133
with:
134134
sarif_file: ${{ steps.container-scan.outputs.sarif }}
135+
sha: ${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.sha || github.sha }}
136+
ref: ${{ contains(github.event_name, 'pull_request') && format('refs/pull/{0}/head', github.event.pull_request.number) || github.ref }}
135137

136138
- name: Log out of Docker and disable Docker Notary
137139
if: ${{ env.is_publish_branch == 'true' }}

.github/workflows/lint.yml

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
4949
with:
5050
sarif_file: clippy_result.sarif
51+
sha: ${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.sha || github.sha }}
52+
ref: ${{ contains(github.event_name, 'pull_request') && format('refs/pull/{0}/head', github.event.pull_request.number) || github.ref }}
5153

5254
- name: Set up Node
5355
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0

.github/workflows/scan.yml

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
5050
with:
5151
sarif_file: cx_result.sarif
52+
sha: ${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.sha || github.sha }}
53+
ref: ${{ contains(github.event_name, 'pull_request') && format('refs/pull/{0}/head', github.event.pull_request.number) || github.ref }}
5254

5355
quality:
5456
name: Quality scan

0 commit comments

Comments
 (0)