Skip to content

Commit

Permalink
Relax the SLSA Provenance schema validation
Browse files Browse the repository at this point in the history
Chains is not populating the `invocation.configSource.uri` attribute
correctly, due to tektoncd/chains#934

This change relaxes the schema validation until the issue in Chains is
fixed and widely adopted.

Ref: RHTAPBUGS-857

Signed-off-by: Luiz Carvalho <[email protected]>
  • Loading branch information
lcarva committed Oct 4, 2023
1 parent 8753956 commit 14d1f31
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
10 changes: 0 additions & 10 deletions pkg/schema/__snapshots__/slsa_provenance_v0.2_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,11 @@

[TestPredicateInvocationConfigSourceUri/case_1 - 1]
[]jsonschema.KeyError{
{
PropertyPath: "/predicate/invocation/configSource/uri",
InvalidValue: "",
Message: "invalid uri: uri missing scheme prefix",
},
}
---

[TestPredicateInvocationConfigSourceUri/case_2 - 1]
[]jsonschema.KeyError{
{
PropertyPath: "/predicate/invocation/configSource/uri",
InvalidValue: "not_uri",
Message: "invalid uri: uri missing scheme prefix",
},
}
---

Expand Down
3 changes: 1 addition & 2 deletions pkg/schema/slsa_provenance_v0.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@
"type": "object",
"properties": {
"uri": {
"type": "string",
"format": "uri"
"type": "string"
},
"digest": {
"$ref": "#/$defs/DigestSet"
Expand Down
1 change: 1 addition & 0 deletions pkg/schema/slsa_provenance_v0.2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func TestPredicateBuilderType(t *testing.T) {
func TestPredicateInvocationConfigSourceUri(t *testing.T) {
check(t,
`{"predicate": {"invocation": {"configSource": {"uri": null}}}}`, // is optional, so `null` is allowed
// Values without a scheme are currently allowed due to https://github.com/tektoncd/chains/issues/934.
`{"predicate": {"invocation": {"configSource": {"uri": ""}}}}`,
`{"predicate": {"invocation": {"configSource": {"uri": "not_uri"}}}}`,
`{"predicate": {"invocation": {"configSource": {"uri": "scheme:authority"}}}}`,
Expand Down

0 comments on commit 14d1f31

Please sign in to comment.