Compare commits

..

4 Commits

Author SHA1 Message Date
dependabot[bot]
91264757e1 build(deps): bump the codeql-actions group across 1 directory with 2 updates
Bumps the codeql-actions group with 2 updates in the / directory: [github/codeql-action/init](https://github.com/github/codeql-action) and [github/codeql-action/analyze](https://github.com/github/codeql-action).


Updates `github/codeql-action/init` from 4.37.2 to 4.37.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e0647621c2...e4fba868fa)

Updates `github/codeql-action/analyze` from 4.37.2 to 4.37.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e0647621c2...e4fba868fa)

---
updated-dependencies:
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: codeql-actions
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: codeql-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-28 05:54:42 +00:00
CrazyMax
371161bbe7 Merge pull request #1058 from crazy-max/fix-dockerhub-oidc-error-handling
surface Docker Hub OIDC error responses
2026-07-27 18:30:08 +02:00
CrazyMax
5dc73df38e chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-07-27 17:15:04 +02:00
CrazyMax
2aa1edee0b surface Docker Hub OIDC error responses
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-07-27 17:14:54 +02:00
8 changed files with 142 additions and 153 deletions

View File

@@ -35,12 +35,12 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
-
name: Initialize CodeQL
uses: github/codeql-action/init@e0647621c2984b5ed2f768cb892365bf2a616ad1 # v4.37.2
uses: github/codeql-action/init@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
with:
languages: javascript-typescript
build-mode: none
-
name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@e0647621c2984b5ed2f768cb892365bf2a616ad1 # v4.37.2
uses: github/codeql-action/analyze@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
with:
category: "/language:javascript-typescript"

View File

@@ -126,8 +126,14 @@ describe('getOIDCToken', () => {
expect(core.info).toHaveBeenCalledWith('Docker Hub OIDC token request rate limited, retrying in 0ms (attempt 1/5)');
});
test('throws Docker Hub API errors', async () => {
postSpy.mockResolvedValue(httpResponse(400, JSON.stringify({description: 'bad connection'})));
await expect(dockerhub.getOIDCToken('docker.io', 'dbowie')).rejects.toThrow('Docker Hub API: bad status code 400: bad connection');
test('throws Docker Hub OIDC error responses', async () => {
postSpy.mockResolvedValue(httpResponse(400, JSON.stringify({error: 'invalid_request', error_description: 'bad connection', error_uri: 'https://docs.docker.com'})));
await expect(dockerhub.getOIDCToken('docker.io', 'dbowie')).rejects.toThrow('Docker Hub API: bad status code 400: {"error":"invalid_request","error_description":"bad connection","error_uri":"https://docs.docker.com"}');
});
test('throws rate limited Docker Hub OIDC error response after retries', async () => {
postSpy.mockResolvedValue(httpResponse(429, JSON.stringify({error: 'rate_limited', error_description: 'slow down'}), {'retry-after': '0'}));
await expect(dockerhub.getOIDCToken('docker.io', 'dbowie')).rejects.toThrow('Docker Hub API: bad status code 429: {"error":"rate_limited","error_description":"slow down"}');
expect(postSpy).toHaveBeenCalledTimes(6);
});
});

226
dist/index.cjs generated vendored

File diff suppressed because one or more lines are too long

6
dist/index.cjs.map generated vendored

File diff suppressed because one or more lines are too long

5
dist/licenses.txt generated vendored
View File

@@ -2396,12 +2396,11 @@ SOFTWARE.
-----------
The following npm packages may be included in this product:
The following npm package may be included in this product:
- js-yaml@5.2.1
- js-yaml@5.2.2
These packages each contain the following license:
This package contains the following license:
(The MIT License)

View File

@@ -30,7 +30,7 @@
"@docker/actions-toolkit": "^0.94.0",
"http-proxy-agent": "^9.1.0",
"https-proxy-agent": "^9.1.0",
"js-yaml": "^5.2.2",
"js-yaml": "^5.2.1",
"uuid": "^14.0.1"
},
"devDependencies": {

View File

@@ -108,24 +108,19 @@ const handleResponse = async (resp: httpm.HttpClientResponse): Promise<string> =
};
const parseError = (statusCode: number, body: string): Error => {
if (body) {
let errResp: unknown;
try {
errResp = JSON.parse(body);
} catch {
errResp = undefined;
}
if (errResp !== undefined) {
throw new Error(`Docker Hub API: bad status code ${statusCode}: ${JSON.stringify(errResp)}`);
}
}
if (statusCode === 401) {
throw new Error(`Docker Hub API: operation not permitted`);
}
if (body) {
const errResp = parseErrorBody(body);
for (const k of ['description', 'message', 'detail', 'error']) {
if (errResp[k]) {
throw new Error(`Docker Hub API: bad status code ${statusCode}: ${errResp[k]}`);
}
}
}
throw new Error(`Docker Hub API: bad status code ${statusCode}`);
};
const parseErrorBody = (body: string): Record<string, string> => {
try {
return <Record<string, string>>JSON.parse(body);
} catch {
return {};
}
};

View File

@@ -3174,7 +3174,7 @@ __metadata:
globals: "npm:^17.3.0"
http-proxy-agent: "npm:^9.1.0"
https-proxy-agent: "npm:^9.1.0"
js-yaml: "npm:^5.2.2"
js-yaml: "npm:^5.2.1"
prettier: "npm:^3.8.1"
typescript: "npm:^5.9.3"
uuid: "npm:^14.0.1"
@@ -4357,17 +4357,6 @@ __metadata:
languageName: node
linkType: hard
"js-yaml@npm:^5.2.2":
version: 5.2.2
resolution: "js-yaml@npm:5.2.2"
dependencies:
argparse: "npm:^2.0.1"
bin:
js-yaml: bin/js-yaml.mjs
checksum: 10/2b4c2933af12c97e1c4894a4f27fe9b06dab70a64a96bb50624b4429bef6bf11008bde20d868bce52a36784473314efc30078ba6025b58cf7537961e23b1ae9c
languageName: node
linkType: hard
"jsbn@npm:1.1.0":
version: 1.1.0
resolution: "jsbn@npm:1.1.0"