Skip to content

Commit ee7dfe7

Browse files
authored
Merge pull request #79 from hdonnay/hack/container-schema
schema: add container metadata JSON Schema
2 parents 1480f97 + 2db5534 commit ee7dfe7

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://security.access.redhat.com/data/meta/v1/embedded_metadata.v1.schema.json",
4+
"type": "object",
5+
"name": "Red Hat Container Embedded metadata",
6+
"description": "This describes necessary metadata to make security determinations about a container image.",
7+
"properties": {
8+
"name": {
9+
"description": "This defines a canonical name for a container. This is likely to be displayed to an end-user.",
10+
"type": "string",
11+
"pattern": "[a-z0-9]+((\\.|_|__|-+)[a-z0-9]+)*(\\/[a-z0-9]+((\\.|_|__|-+)[a-z0-9]+)*)*",
12+
"$comment": "This regexp is the \"name\" regexp from the OCI Distribution spec."
13+
},
14+
"org.opencontainers.image.created": {
15+
"description": "This is the creation timestamp of the container.\n\nThis MUST be a complete RFC3339 timestamp",
16+
"type": "string",
17+
"format": "date-time"
18+
},
19+
"cpe": {
20+
"description": "This is the CPE Name identifying this container.\n\nAny version attributes SHOULD NOT be provided.\nContainers with distinct CPE Names MUST be considered distinct pieces of software with incomparible versions.",
21+
"type": "string",
22+
"oneOf": [
23+
{
24+
"description": "This is the CPE 2.2 regexp: https://cpe.mitre.org/specification/2.2/cpe-language_2.2.xsd",
25+
"type": "string",
26+
"pattern": "^[c][pP][eE]:/[AHOaho]?(:[A-Za-z0-9\\._\\-~%]*){0,6}$"
27+
},
28+
{
29+
"description": "This is the CPE 2.3 regexp: https://csrc.nist.gov/schema/cpe/2.3/cpe-naming_2.3.xsd",
30+
"type": "string",
31+
"pattern": "^cpe:2\\.3:[aho\\*\\-](:(((\\?*|\\*?)([a-zA-Z0-9\\-\\._]|(\\\\[\\\\\\*\\?!\"#$$%&'\\(\\)\\+,/:;<=>@\\[\\]\\^`\\{\\|}~]))+(\\?*|\\*?))|[\\*\\-])){5}(:(([a-zA-Z]{2,3}(-([a-zA-Z]{2}|[0-9]{3}))?)|[\\*\\-]))(:(((\\?*|\\*?)([a-zA-Z0-9\\-\\._]|(\\\\[\\\\\\*\\?!\"#$$%&'\\(\\)\\+,/:;<=>@\\[\\]\\^`\\{\\|}~]))+(\\?*|\\*?))|[\\*\\-])){4}$"
32+
}
33+
]
34+
},
35+
"architecture": {
36+
"description": "This is the intended architecture of the container.",
37+
"$comment": "This is modern(ish) architectures as their golang name.",
38+
"enum": [
39+
"amd64",
40+
"arm64",
41+
"mips64",
42+
"mips64le",
43+
"ppc64",
44+
"ppc64le",
45+
"riscv64",
46+
"s390x"
47+
]
48+
}
49+
},
50+
"required": [
51+
"name",
52+
"org.opencontainers.image.created",
53+
"cpe",
54+
"architecture"
55+
],
56+
"examples": [
57+
{
58+
"name": "openshift-gitops-1/gitops-rhel8-operator",
59+
"org.opencontainers.image.created": "2025-04-14T02:14:26Z",
60+
"cpe": "cpe:/a:redhat:openshift_gitops:::el8",
61+
"architecture": "amd64"
62+
}
63+
]
64+
}

0 commit comments

Comments
 (0)