Repository navigation
Submit the dependency snapshot without a third-party binary holding the write token (#655) - #656
Merged
Merged
Conversation
…he write token (#655) Split dependency-submission.yml into a read-only detect job that builds the snapshot from obj/project.assets.json with a repo script, and a write-token submit job that only downloads the artifact and posts it with gh api. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MrD9SGvLFx4kJaeGZyXG9
erikdarlingdata
marked this pull request as ready for review
October 15, 2026 00:13
|
Reviewed the workflow and script. I found no correctness or injection problems, and I did not run the workflow.
|
- Restore PlanShare in its own step. - Restore SSMS projects under bash so the first failing restore fails the step. - Script fails when an assets file logs a restore Error; add #Requires -Version 7.0. - submit rewrites sha, ref and job id from the run, fails unless result is SUCCESS or ACCEPTED, and prints the response body on an HTTP error. - Concurrency group per ref so the latest commit's graph is submitted last. - Correct the correlator comment (the old action's snapshot is not replaced) and the scope comment. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MrD9SGvLFx4kJaeGZyXG9
|
Reviewed the workflow split and
🤖 Generated with Claude Code |
Cosmetic: the two multi-line commands had been flattened into single lines with runs of spaces. Same commands, same behavior. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MrD9SGvLFx4kJaeGZyXG9
|
Reviewed the workflow and
Two non-blocking points:
I'm not proposing any change to the workflow itself. |
This was referenced Oct 15, 2026
Merged
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.
Claude posting for Erik Darling.
Reworks
.github/workflows/dependency-submission.ymlso no third-party binary runs while a write token is present. The component-detection action (which downloaded the latest microsoft/component-detection release at run time) is gone.Changes
.github/workflows/dependency-submission.ymldetectjob:contents: read, windows-latest, checkout withpersist-credentials: false, setup-dotnet, wasm-tools workload, and the restores unchanged (solution, the two installer projects, the SSMS project via MSBuild, all-p:NuGetAudit=falsewith the original comment). Then runs the new script and uploadssnapshot.jsonas artifactdependency-snapshot(actions/upload-artifactat the pin release.yml uses, v7.0.2).submitjob:needs: detect,contents: write, ubuntu-latest, no checkout.actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1(v8.0.2 is 7 days old, so v8.0.1 from 2026-03-11 is the newest release at least two weeks old), then onegh api --method POST ... dependency-graph/snapshots --input snapshot.jsonstep that printsresultandmessageand exits 1 onINVALID.permissions: {}; each job sets its own. Push triggers (main, dev) andworkflow_dispatchkept. Header comment rewritten: why two jobs, dev snapshots feed no alerts and the dev trigger exists to exercise the workflow; the downloaded-binary sentence is dropped.github.sha,refandrun_idreach the script through env vars, not spliced into the script text (a branch name can contain a quote)..github/scripts/New-DependencySnapshot.ps1(new): reads everyobj/project.assets.json(skipping.claude/,tmp-*/,bin/), writes the snapshot. Throws when it finds no assets file or zero resolved packages (replaces the oldfail-on-empty).Decisions
submit, notDependency submission_submit. At the old action's commit a02aeda,dist/index.jshasgetInput("correlator")?.trim() || github_context.job, andgithub.context.jobis the job idsubmit. The correlator therefore stayssubmit, but this does not make the new snapshot replace the old action's (corrected in round 1): GitHub keys snapshots on correlator plus detector name, and the detector name differs (Component Detectionthere,performancestudio-assets-snapshothere). The old action's snapshot exists only on dev and is left beside this one; main never received one.resolvedkeys are the package URLs themselves,dependencieslist package URLs (all present in the same manifest),scopeisdevelopmentfortests/**andruntimeotherwise.tfm/rid, e.g.net472/win-x86,.NETFramework,Version=v4.7.2/win-x64,net10.0/browser-wasm) repeat the plain target's packages; the script keeps only the plain target per framework. Every project here has exactly one framework, so manifests are named by csproj path with no(tfm)suffix. (My first run emitted 16 manifests including the RID copies; fixed before committing.)Local verification
PlanViewer.sln, both installer projects (dotnet restore) andPlanViewer.Ssms.csproj(MSBuild 2022 BuildTools-t:Restore -p:Configuration=Release), all-p:NuGetAudit=false: 9 assets files.refs/heads/fix/655-dependency-snapshot, run id 999999: valid JSON, 9 manifests, 533 resolved packages.System.Security.Cryptography.Pkcs@10.0.13: direct in Core; indirect in App, Cli and Core.Tests.MessagePack@2.5.307: direct in PlanViewer.Ssms (7 dependencies listed).dependenciesentry (all manifests) exists as a key in the sameresolvedmap: 0 dangling.yaml ok.dotnet build PlanViewer.sln -c Debug: 0 warnings, 0 errors (noNUwarnings). No tests run; nothing touches code or tests.Real submission
Generated a snapshot for the pushed head (
shaa98c6c7, refrefs/heads/fix/655-dependency-snapshot, correlatorsubmit) and posted it with the samegh apicommand the workflow uses, under the local gh login. Response, verbatim:result:ACCEPTEDmessage:The snapshot was accepted, but it is not for the default branch. It will not update dependency results for the repository.Nothing was submitted for dev or main.
Not verified
pwshon windows-latest (the script was run under local PowerShell 7), andgh/jqin the ubuntu job. The first run on dev after merge exercises all three.main(the dependency graph showingSystem.Security.Cryptography.PkcsandMessagePack) can only be checked after the next dev-to-main merge.devfrom the push trigger; the brief keeps it, so it stays until the first dev run is green.Review round 1
Applied in commit 74d552c. Items are from the round-1 security review.
dotnet restore server/PlanShare/PlanShare.csproj -p:NuGetAudit=false) after "Restore solution". Finding while verifying:tests/PlanViewer.Core.Testshas a project reference to PlanShare, so the solution restore already restores it (I deletedserver/PlanShare/obj, ran only the solution restore, and the assets file came back). The CI snapshot therefore already had 9 manifests; the explicit step keeps PlanShare covered if that reference ever goes away.shell: bash, so the first failing command fails the step. (b) The script throws after reading an assets file whoselogshas an entry withlevelError, naming the file and the first code.submitrunsjq --arg sha "$GITHUB_SHA" --arg ref "$GITHUB_REF" --arg id "$GITHUB_RUN_ID" '.sha = $sha | .ref = $ref | .job.id = $id' snapshot.json > body.jsonand postsbody.json.detectstill writes the fields, so a local script run produces a complete file.resultisSUCCESSorACCEPTED(a missing result fails too), and on an HTTP error it printsresponse.jsonfirst (if ! gh api ... > response.json; then cat response.json; exit 1; fi). Result and message are still printed.concurrency: group: dependency-submission-${{ github.ref }},cancel-in-progress: true.developmentis for tests/ projects only and that build-time packages in product projects (ILLink, the WASM DevServer, VSSDK.BuildTools) are listed asruntime, which only affects alert triage.#Requires -Version 7.0is now line 1 of the script.Not done: the review's optional suggestions (a coverage check over every csproj, rebuilding the whole envelope in
submit, a branch-head check insubmit); the rulings for this round were narrower.Local proofs (round 1)
dotnet restore PlanViewer.sln,server/PlanShare/PlanShare.csproj, both installer projects, and the SSMS project with MSBuild 2022 BuildTools, all-p:NuGetAudit=false, all exit 0.server/PlanShare/objwas deleted first. Note: the vswhere recipe in the brief returns nothing here because only Build Tools are installed; it needs-products *.refs/heads/main, run id 123,-Correlator submit: 9 manifests, 533 resolved packages from 9 assets files. Per manifest (resolved, direct/indirect): PlanShare 7 (2/5), App 82 (16/66), Cli 69 (3/66), Core 40 (5/35), Ssms.Installer 2 (1/1), Ssms 127 (4/123), Web 31 (5/26), Core.Tests 143 (7/136), Ssms.Installer.Tests 32 (4/28).project.restore.projectPathinside the tree, andlogs: [{code: NU1101, level: Error}]. The script threw...\proj\obj\project.assets.json: restore logged 1 error(s), first NU1101. The snapshot would be incomplete.and wrote no output. Control with aWarninglog: succeeded. Temp tree deleted.aaaa.../refs/heads/main/123todeadbeef/refs/heads/dev/999; manifests unchanged (9).{"result":"INVALID"}fails,{"result":"ACCEPTED","message":"x"}passes,{}fails,{"result":"SUCCESS"}passes. A failing command that writes{"message":"Not Found"}to stdout and exits 1: the body is printed and the step fails.yaml ok.Closes #655
🤖 Generated with Claude Code
https://claude.ai/code/session_018MrD9SGvLFx4kJaeGZyXG9