Skip to content

fix: identify Virtool to NCBI and GitHub to avoid blocked requests - #1393

Merged
igboyes merged 1 commit into
mainfrom
igboyes/vir-2971-identify-outbound-requests-to-ncbi-genbank-and-github-with-a
Aug 14, 2026
Merged

fix: identify Virtool to NCBI and GitHub to avoid blocked requests#1393
igboyes merged 1 commit into
mainfrom
igboyes/vir-2971-identify-outbound-requests-to-ncbi-genbank-and-github-with-a

Conversation

@igboyes

@igboyes igboyes commented Aug 14, 2026

Copy link
Copy Markdown
Member

Summary

  • Every outbound request went out anonymous. NCBI throttles or blocks unidentified callers and BLAST polling is our highest-volume outbound path; GitHub refuses a request carrying no User-Agent at all. A single USER_AGENT constant in @virtool/data/userAgent now travels with all four third-party call sites — NCBI BLAST (submit, poll, result fetch), the GenBank efetch call, the virtool.ca HMM manifest, and the GitHub-hosted release archive apps/tasks downloads.
  • No shared HTTP client, per VIR-2971. Each call site already takes its own AbortSignal.timeout, and a singleton would be exactly the module-scope construction packages/data avoids everywhere else. request() in blast/ncbi.ts narrows its init to Omit<RequestInit, "headers" | "signal"> so a caller cannot silently drop either.
  • The token carries no version, which was the one open call the issue left. Python sent virtool/{version} from one shared aiohttp session, but packages/data has no build-time global to read one from — apps/web has __APP_VERSION__ and apps/tasks a JSON import of its own manifest, neither visible from there — so matching it meant threading a string through nine signatures and ~45 test call sites. Stamping only the sites that can reach a version would leave install_hmms sending virtool/1.2.3 while sweep_blast sends virtool, which reads as a bug in a log. Easy to reverse if you'd rather have it.

apps/site's build-time api.github.com fetch is deliberately untouched — separate deploy, separate gates, and not in the issue's scope.

Closes VIR-2971.

Every outbound request went out anonymous. NCBI throttles or blocks
unidentified callers and BLAST polling is the highest-volume outbound
path here; GitHub refuses a request carrying no User-Agent at all.

Adds a single USER_AGENT constant in @virtool/data/userAgent and sends
it from the four third-party call sites: NCBI BLAST (submit, poll and
result fetch), the GenBank efetch call, the virtool.ca HMM manifest, and
the GitHub-hosted release archive apps/tasks downloads.

No shared HTTP client: each call site already takes its own
AbortSignal.timeout, and a singleton client would be the module-scope
construction packages/data avoids everywhere else.

The token carries no version. Python sent virtool/{version} from one
shared aiohttp session, but packages/data has no build-time global to
read one from -- apps/web has __APP_VERSION__ and apps/tasks a JSON
import of its own manifest, neither visible from there -- so matching it
would mean threading a string through nine signatures. One token every
call site agrees on beats a version on the subset that could reach one.

request() in blast/ncbi.ts now takes Omit<RequestInit, "headers" |
"signal"> so a caller cannot silently drop either.
@linear-code

linear-code Bot commented Aug 14, 2026

Copy link
Copy Markdown

VIR-2971

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@igboyes
igboyes merged commit e422793 into main Aug 14, 2026
23 checks passed
@igboyes
igboyes deleted the igboyes/vir-2971-identify-outbound-requests-to-ncbi-genbank-and-github-with-a branch August 14, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant