Repository navigation
Desktop release: run the VirusTotal scan after publishing, in its own job - #8194
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78b3d37795
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # full length while being unable to block one. | ||
| virustotal-scan: | ||
| name: VirusTotal post-publish scan | ||
| needs: [publish-release] |
There was a problem hiding this comment.
Run the scan after partial publish failures
Because a job guarded only by needs is skipped when its dependency fails, this scan never runs if publish-release fails after creating the release. For example, the release assets may already be public when Publish versioned updater metadata, its validation, or the desktop-latest update fails, leaving the published bundles unscanned. Use an always() condition or split out the step that establishes successful asset publication so the scan also covers these partial-publish failures.
Useful? React with 👍 / 👎.
| virustotal-scan: | ||
| name: VirusTotal post-publish scan | ||
| needs: [publish-release] |
There was a problem hiding this comment.
Update the workflow ordering regression tests
Moving the scan into this new job leaves tests/python/test_virustotal_scan.py::TestWorkflowOrdering looking for VirusTotal pre-flight scan and Check out the scan script inside publish-release; with PyYAML installed, four tests now raise ValueError because those steps no longer exist there. Update those tests to assert the new job dependency and post-publish ordering so the explicit VirusTotal test suite remains usable.
Useful? React with 👍 / 👎.
|
Validated on real CI in a harness modelling the release job graph, at danielhanchen/release-graph-test. Ordering holds (run 31268015946): The release is created and finished before the scan job starts, so the scan no longer sits on the release path. The artifacts are still reachable from the later job: the scan downloaded the same The scan cannot affect a release that failed (run 31268196463, one build leg made to fail): Job-level |
78b3d37 to
fba4c7d
Compare
|
Rebased onto main now that #8191 and #8193 have landed. The conflict was in Verified after the rebase by parsing the workflow and diffing it structurally against main:
The harness runs linked above already exercised this exact combination, since they modelled the waiter and the post-publish scan job together in one graph. |
…ld pre-flight one (#8240) The desktop release workflow no longer runs a VirusTotal step inside publish-release. #8194 moved it into its own virustotal-scan job that runs after the release is published, and #8193 replaced publish-release's `needs: build` with a "Wait for the build matrix" step so the job can queue for its runner during the build. Five tests still encoded the old shape and fail on main for every PR: TestWorkflowOrdering::test_scan_runs_after_the_release_is_validated TestWorkflowOrdering::test_release_creation_is_deferred_until_after_the_scan TestWorkflowOrdering::test_scan_runs_before_the_assets_are_published TestWorkflowOrdering::test_the_scan_script_is_checked_out_first test_build_matrix_hands_off_assets_without_release_credentials Rewrite them against the current layout rather than dropping the assertions. The scan is a post-publish sweep and is advisory by design, so what is worth pinning is that it cannot be quietly lost: - virustotal-scan exists and `needs: [publish-release]`, so deleting the job or the dependency is red, - the job carries no `if:`, and no step does either except the summary, which is `if: always()` so the verdict survives a failed scan, - the sparse checkout of scripts/virustotal_scan.py is asserted by mechanism rather than by step name, along with the guard that exits 1 when the script is absent, - the scan step does not swallow the script's exit status: no continue-on-error, no `|| true`, no `exit 0`, and no `--fail-threshold` pinned to a value the script treats as never-fail, - continue-on-error appears on exactly one job and on no step of any job that handles a bundle, - the downloaded artifact pattern matches what the build matrix uploads, - publish-release does not re-inline the scan. For the permissions test, the build-to-publish handoff is now gated by the waiter, so assert that instead of `needs: build`: it covers every matrix leg by name, refuses to publish a leg that did not succeed, and refuses to publish a leg whose job record never appeared. Add a check that the new scan job holds no release credentials, since it handles the bundles and uploads them off-box. Docstrings say plainly that this is a post-publish sweep, so a future reader does not go looking for a pre-publish gate that is not there. Co-authored-by: danielhanchen <[email protected]>
Summary
Moves the VirusTotal scan out of
publish-releaseinto its ownvirustotal-scanjob that runs after it. The release publishes as soon as the bundles are ready; the advisory scan then runs and posts its summary.Why
Measured on the
v0.1.526-betarun,publish-releasewas almost entirely this one step:So roughly nine and a half minutes of release latency, of which the scan is about nine. The step is
continue-on-error: trueand the workflow already states "The step never fails the job: a missing secret, a VirusTotal outage or a quota exhaustion must not be able to block a release." It could never gate a release, so running it ahead of publication only delayed it.Why not parallelise the scan instead
The scan is rate-limit bound, not compute bound. VirusTotal's public API allows 4 requests/minute and 500/day, and
scripts/virustotal_scan.pyalready paces itself to match atDEFAULT_REQUEST_INTERVAL = 20.0, whose comment reads "The public API allows 4 requests/minute... A premium key can drop this to ~1s via--request-interval."That budget is per API key, not per connection. The four bundles cost a hash lookup each, an upload for anything VirusTotal has not seen, then analysis polls, and scanning them concurrently issues the same requests against the same cap in bursts. The result is 429s handed to the script's exponential backoff, which is slower than pacing. Concurrency only becomes useful on a premium key, and would then need a rate limiter shared across threads rather than the current per-instance
_last_request_at.Notes
continue-on-error: trueso a missing secret, an outage or quota exhaustion cannot fail a release that already published. That preserves the old step-level behaviour.Create versioned releasewas previously "Deferred until immediately before upload so public releases are not left empty during the VirusTotal scan". With the scan gone from that job the gap it was working around no longer exists. The deferral and its absence re-checks are kept as they are, since reserving the tag atomically immediately before upload is correct regardless; only the comment is updated.SKIPPED_SUFFIXES = (".sig",)filtering signatures.Test plan
publish-releaseinto the new job;build,prepare-versionandfree-capacityare byte identical.run:block in the new job shell-parsed clean.Note
Independent of #8191 and #8193. #8191 shortens the build phase, #8193 removes the publish job's queue wait, this removes the scan from the release path.