Repository navigation
ci: fix DevSkim SARIF upload on main (codeql-action v4, security-events permission) - #893
Open
vadim-korolik wants to merge 1 commit into
Open
vadim-korolik wants to merge 1 commit into
vadim-korolik wants to merge 1 commit into
Conversation
…nts permission) The upload-sarif step has failed on every push/schedule run since 2026-03-26 with 'Resource not accessible by integration': the repo's default GITHUB_TOKEN is read-only, so uploading to code scanning needs an explicit security-events: write. It also used github/codeql-action v2, which is deprecated and now fails the step. Move to v4 (what the repo's CodeQL default setup uses) and grant contents/actions read + security-events write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-by: termag
Merged
4 tasks done
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 75ec5b0. Configure here.
vadim-korolik
marked this pull request as ready for review
November 17, 2026 22:36
vadim-korolik
added a commit
that referenced
this pull request
Nov 18, 2026
…n the version is new (#894) <!-- TERMAG_PR_BODY_BEGIN --> ## Demo Before/fix/after transcript: https://app.termag.ldinfra.net/termag/files/vkorolik-observability-sdk/artifacts/ci-devskim-dotnet/dotnet-demo.md ## Why main fails Both jobs of `.NET SDK` have failed at "Push generated package to NuGet registry" on every push to `main` since 2026-04-16. The last green run was 2026-04-15, and no .NET code changed between the two. - `.github/workflows/dotnet.yml:35-39` (ASP.NET Core) and `:67-70` (ASP.NET4) push on **every** main push. The versions they push are Highlight.ASPCore 0.2.16 (published 2025-03-25) and Highlight.ASP4 0.2.10, both already on nuget.org. So each push was a duplicate, and `--skip-duplicate` / `-SkipDuplicate` turned nuget.org's 409 into a pass. - The `NUGET_API_KEY` repo secret was last updated **2025-04-16T19:49Z**. The first failure was 2026-04-16T21:02Z, which matches nuget.org's 365-day maximum key lifetime. nuget.org rejects an expired key before it checks for duplicates, so the push exits 1. ## Change - **Only push new versions.** A new step, "Check whether the package version is already on NuGet" (`.github/scripts/nuget-needs-publish.sh`), looks up each built `.nupkg`'s id and version (symbols skipped) in nuget.org's flat-container index. It writes `publish=true` only when a version isn't published yet. Pushes to `main` that don't bump a version no longer touch NuGet. - **Trusted publishing instead of `NUGET_API_KEY`**, as in [NuGet's docs](https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing): - Both jobs get `permissions: contents: read, id-token: write`. - A new step, `NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0` with `user: ${{ secrets.NUGET_USER }}`, runs only when a push will happen. This is the docs' `NuGet/login@v1`, pinned by SHA like the repo's other third-party actions (SEC-7924). It trades the job's GitHub OIDC token for a nuget.org API key that lasts one hour. - The push steps take that key from `steps.login.outputs.NUGET_API_KEY` through an env var. ASP.NET Core uses `dotnet nuget push --api-key "$NUGET_API_KEY"`. ASP.NET4 keeps its `nuget push bin\**\*.nupkg` command (now `-ApiKey $env:NUGET_API_KEY`). I dropped `-SymbolApiKey` because the project builds no symbol packages. - `dotnet.yml` no longer references `secrets.NUGET_API_KEY`. I didn't delete the secret. - No other workflow in the repo publishes to NuGet, so there was nothing to stay consistent with. `observability-dotnet` has no NuGet release workflow here. - No package versions or release-please files changed. ## Verification - PR run [44205999788](https://github.com/launchdarkly/observability-sdk/actions/runs/44205999788) passed on both jobs (Linux and Windows). Notices show `highlight.aspcore 0.2.16` and `highlight.asp4 0.2.10` are already on nuget.org. Both the "NuGet login" and "Push" steps were skipped, and nothing was published. - `actionlint` 1.7.12 reports only the custom runner label, which `main` also has. - After switching to `secrets.NUGET_USER` (3c4e6f9): PR run [44207123511](https://github.com/launchdarkly/observability-sdk/actions/runs/44207123511) passed on both jobs, with login and push skipped. actionlint is unchanged. - **Not exercised yet:** the OIDC login and push only run on `main` when a version is new, so they can't be tested until the next version bump of Highlight.ASPCore or Highlight.ASP4. Before that bump, do the setup below. Otherwise the first push fails at "NuGet login". ## Setup needed on nuget.org These must match `.github/workflows/dotnet.yml` exactly, or `NuGet/login` fails (fields are case-insensitive). - [ ] Sign in to nuget.org as a member of the **`Highlight`** organization, which owns both **Highlight.ASPCore** and **Highlight.ASP4**. Then choose your username → **Trusted Publishing** → add a GitHub Actions policy: - **Policy owner:** `Highlight`. The policy covers every package that owner has, which includes Highlight.ASPCore and Highlight.ASP4. - **Repository Owner:** `launchdarkly` - **Repository:** `observability-sdk` - **Workflow File:** `dotnet.yml` (file name only, no `.github/workflows/` path) - **Environment:** *leave empty*. Neither job sets `environment:`. - [x] Repository secret **`NUGET_USER`** (Settings → Secrets and variables → Actions → Secrets), set 2026-11-18. It holds the nuget.org **username (profile name, not email)** of the account that created the policy. The workflow passes it as `user: ${{ secrets.NUGET_USER }}` to `NuGet/login`, as NuGet's docs recommend. - [ ] Don't rename `dotnet.yml`. Renaming it breaks the policy. - [ ] After the first successful trusted-publishing push, delete the expired `NUGET_API_KEY` repo secret. Nothing in the repo uses it any more, and this PR leaves it in place. ## Related The DevSkim half of this ask: #893. Asked by `vkorolik` through `termag ask`; follow up with `termag ask … --thread cmwl8thxv0hs37bf97g5455aw`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-061783cb7582c0ce0 project=repo ask=cmwl8thxv0hs37bf97g5455aw --> <sub>Opened from termag</sub> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
abelonogov-ld
approved these changes
Nov 18, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Demo
Before/fix/after transcript: https://app.termag.ldinfra.net/termag/files/vkorolik-observability-sdk/artifacts/ci-devskim-dotnet/devskim-demo.md
DevSkim, dispatched on this branch (run 44187513739): passed, and the SARIF upload produced a
devskimcode-scanning analysis for the branch (376 results).Why main fails
DevSkim has failed on every push and schedule run on
mainsince 2026-03-26. The last green run was 2026-03-24. The failing step is "Upload DevSkim scan results to GitHub Security tab" (.github/workflows/devskim.yml:32-35):Resource not accessible by integration: the repo's defaultGITHUB_TOKENis read-only (default_workflow_permissions: read), and the workflow declared nopermissions:, so it couldn't writesecurity-events. PR runs pass this step, so the failure only appeared onmain.CodeQL Action major versions v1 and v2 have been deprecated:upload-sarif@v2(line 33) is now a hard failure.Change
github/codeql-action/upload-sarif@v2→@v4, the same major version as the repo's CodeQL default setup.contents: read. The job getscontents: read,security-events: writeandactions: read.Related
The other half of this ask, the
.NET SDKworkflow, is in #894.Asked by
vkorolikthroughtermag ask; follow up withtermag ask … --thread cmwl8thxv0hs37bf97g5455aw.🤖 Generated with Claude Code
Opened from termag
Note
Overview
Restores successful DevSkim runs on
mainby fixing the “Upload DevSkim scan results to GitHub Security tab” step indevskim.yml.The workflow now declares
contents: readat the workflow level, and the DevSkim job grantssecurity-events: writeandactions: readso the default read-onlyGITHUB_TOKENcan publish SARIF to the Security tab (the previous failure on push/schedule was “Resource not accessible by integration”).The upload action is bumped from
github/codeql-action/upload-sarif@v2to@v4, aligning with the repo’s CodeQL setup and avoiding deprecation hard-fails onv2.Reviewed by Cursor Bugbot for commit 75ec5b0. Bugbot is set up for automated code reviews on this repo. Configure here.