Skip to content

Commit ba78a13

Browse files
authored
feat: support OCI images without platform tags (#738)
- Upgrade @snyk/docker-registry-v2-client from 2.23.0 to 2.24.0 - Add test for snykgoof/oci-goof:ociNoPlatformTag
1 parent 135810e commit ba78a13

3 files changed

Lines changed: 36 additions & 8 deletions

File tree

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"dependencies": {
3131
"@snyk/composer-lockfile-parser": "^1.4.1",
3232
"@snyk/dep-graph": "^2.10.0",
33-
"@snyk/docker-registry-v2-client": "^2.23.0",
33+
"@snyk/docker-registry-v2-client": "^2.24.0",
3434
"@snyk/rpm-parser": "^3.4.0",
3535
"@snyk/snyk-docker-pull": "^3.15.0",
3636
"@swimlane/docker-reference": "^2.0.1",

test/system/image-type/identifier.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { scan } from "../../../lib/index";
2+
import { execute } from "../../../lib/sub-process";
23

34
describe("handles bad input being provided", () => {
45
it("should reject when provided with a non-existent image and tag", async () => {
@@ -9,3 +10,30 @@ describe("handles bad input being provided", () => {
910
).rejects.toEqual(Error("authentication required"));
1011
});
1112
});
13+
14+
describe("OCI images without platform tags", () => {
15+
afterAll(async () => {
16+
await execute("docker", [
17+
"image",
18+
"rm",
19+
"snykgoof/oci-goof:ociNoPlatformTag",
20+
]).catch(() => {
21+
console.error(`tests teardown failed to remove docker image`);
22+
});
23+
});
24+
25+
it("should correctly scan an OCI image without platform information in the tag", async () => {
26+
const image = "snykgoof/oci-goof:ociNoPlatformTag";
27+
28+
const pluginResult = await scan({
29+
path: image,
30+
username: process.env.DOCKER_HUB_USERNAME,
31+
password: process.env.DOCKER_HUB_PASSWORD,
32+
});
33+
34+
expect(pluginResult.scanResults).toBeDefined();
35+
expect(pluginResult.scanResults.length).toBeGreaterThan(0);
36+
expect(pluginResult.scanResults[0].facts).toBeDefined();
37+
expect(pluginResult.scanResults[0].facts.length).toBeGreaterThan(0);
38+
});
39+
});

0 commit comments

Comments
 (0)