Skip to content

Desktop release: run the VirusTotal scan after publishing, in its own job - #8194

Merged
danielhanchen merged 1 commit into
mainfrom
desktop-scan-after-publish
Aug 9, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
desktop-scan-after-publish

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Moves the VirusTotal scan out of publish-release into its own virustotal-scan job 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-beta run, publish-release was almost entirely this one step:

Step Duration
Setup, harden, checkout, download, both validations 13 seconds combined
VirusTotal pre-flight scan ~9 minutes

So roughly nine and a half minutes of release latency, of which the scan is about nine. The step is continue-on-error: true and 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.py already paces itself to match at DEFAULT_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

  • The job is continue-on-error: true so a missing secret, an outage or quota exhaustion cannot fail a release that already published. That preserves the old step-level behaviour.
  • Create versioned release was 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.
  • The scan now reports on bundles that are already published rather than about to be. It was advisory in both cases, and Defender remains the authoritative fail-closed gate on Windows.
  • Scan targets are unchanged: the four installers, with SKIPPED_SUFFIXES = (".sig",) filtering signatures.

Test plan

  • Workflow parsed and diffed structurally: the only changes are the three steps moving out of publish-release into the new job; build, prepare-version and free-capacity are byte identical.
  • Every run: block in the new job shell-parsed clean.
  • Confirm on the next release that the release appears without waiting for the scan, and that the summary still posts

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +2004 to +2006
virustotal-scan:
name: VirusTotal post-publish scan
needs: [publish-release]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member Author

Validated on real CI in a harness modelling the release job graph, at danielhanchen/release-graph-test.

Ordering holds (run 31268015946):

16:54:41  release created at 16:54:41       (publish-release)
16:54:42  publish-release completed
16:54:44  VirusTotal post-publish scan started
16:55:17  VirusTotal post-publish scan completed

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 desktop-release-* set with merge-multiple: true and saw all three.

The scan cannot affect a release that failed (run 31268196463, one build leg made to fail): publish-release ended failure and VirusTotal post-publish scan was skipped, so a failed release does not get scanned and the scan cannot mask the failure.

Job-level continue-on-error: true preserves the old step-level guarantee that a missing secret, an outage or quota exhaustion cannot fail a release that already published.

@danielhanchen
danielhanchen force-pushed the desktop-scan-after-publish branch from 78b3d37 to fba4c7d Compare August 9, 2026 03:03
@danielhanchen

Copy link
Copy Markdown
Member Author

Rebased onto main now that #8191 and #8193 have landed.

The conflict was in publish-release: #8193 inserted the "Wait for the build matrix" step immediately after Harden runner (audit), which is the same region this PR edits to remove Check out the scan script. Resolved by keeping the waiter and still moving the scan-script checkout into the new job, where it belongs.

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.

@danielhanchen
danielhanchen merged commit b8dac29 into main Aug 9, 2026
13 of 14 checks passed
@danielhanchen
danielhanchen deleted the desktop-scan-after-publish branch August 9, 2026 03:10
danielhanchen added a commit that referenced this pull request Aug 9, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant