Binary download is unauthenticated, so it hits the 60/hour anonymous rate limit and 403s
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- github-actions, javascript
- Domain
- ci-cd
Research direction
Start in src/index.js at downloadRelease(), then inspect how the authenticated client and github-token input are used around tc.downloadTool. Confirm the release asset download uses the existing token and that the action no longer fails with the reported anonymous-rate-limit 403 before scanning.
Written by the indexing model from the issue text.
Description
What happens
Intermittently, the action fails before scanning anything:
Downloading asset: docker-scout-action_linux_amd64 (179.2 MB)
##[error]Unexpected HTTP response: 403
No image is scanned and no finding is reported, so the job goes red for a reason unrelated to the code under test. A re-run usually clears it.
Why
In src/index.js, downloadRelease() builds an authenticated client and then does not use it for the download:
const octokit = github.getOctokit(core.getInput('github-token')) // authenticated
release = await octokit.rest.repos.getReleaseByTag({ ... }) // authenticated
await tc.downloadTool(asset.url, binary, undefined, { // <-- auth: undefined
accept: 'application/octet-stream',
})
The third parameter of @actions/tool-cache's downloadTool is auth. It is undefined, so the asset is fetched anonymously from api.github.com, which puts it on the 60-requests-per-hour-per-IP budget:
$ curl -sI -H "Accept: application/octet-stream" \
https://api.github.com/repos/docker/scout-action/releases/assets/493034676
HTTP/2 302
x-ratelimit-limit: 60
x-ratelimit-resource: core
Authenticated, that limit is 5,000/hour. GitHub-hosted runners come from a shared address pool, so the anonymous budget is spent collectively by everyone using this action — which is consistent with the failures being bursty and with a re-run (a different runner) succeeding.
It also means retrying inside the same job does not help: the retry runs from the same address against the same exhausted budget.
Suggested fix
Pass the token the action already accepts (github-token, default ${{ github.token }}):
const token = core.getInput('github-token')
await tc.downloadTool(asset.url, binary, `token ${token}`, {
accept: 'application/octet-stream',
})
Version
docker/scout-action@v1.24.0 (pinned by digest, 7c6b6c3f7844478ace1ffd4e7aef649053d1f87d), ubuntu-24.04 runners.
Happy to open a PR if that would be useful.
- Dominant language
- JavaScript
- Stars
- 141
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from docker/scout-action
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
docker/scout-action#91 · 1 comment ·
-
upstream
Difficulty 3/5 1-2 days Newbie friendliness 35/100
docker/scout-action#88 · 2 comments ·
-
upstream
Difficulty 3/5 1-2 days Newbie friendliness 46/100
docker/scout-action#87 ·
-
Running multiple commands causes failure in the middle and rest of the commands is not executed Opendocs
Difficulty 3/5 1-2 days Newbie friendliness 42/100
docker/scout-action#86 · 2 comments · 1 reaction ·
-
upstream
Difficulty 3/5 1-2 days Newbie friendliness 30/100
docker/scout-action#84 ·
All issues in docker/scout-action
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·
-
client-controller-update ta-bot-triage team-money-movement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MetaMask/metamask-mobile#36594 ·