-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from kubewarden/fix-broken-e2e-tests
fix broken e2e tests
- Loading branch information
Showing
11 changed files
with
321 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,6 +178,10 @@ | |
} | ||
|
||
@test "Certificate verification with Rekor enabled" { | ||
# This is a test that verifies an image that was signed with the | ||
# key associated with a certificate. The signature was then registered | ||
# inside of Rekor's transparency log. | ||
# | ||
# Need to run the command inside of `bash -c` because of a bats | ||
# limitation: https://bats-core.readthedocs.io/en/stable/gotchas.html?highlight=pipe#my-piped-command-does-not-work-under-run | ||
|
||
|
@@ -207,3 +211,34 @@ | |
[ $(expr "$output" : '.*Certificate not trusted: Certificate is not trusted by the provided cert chain.*') -ne 0 ] | ||
} | ||
|
||
@test "Keyless verification" { | ||
# Need to run the command inside of `bash -c` because of a bats | ||
# limitation: https://bats-core.readthedocs.io/en/stable/gotchas.html?highlight=pipe#my-piped-command-does-not-work-under-run | ||
|
||
run bash -c 'kwctl run \ | ||
--request-path test_data/pod_creation_signed_with_keyless_mode.json \ | ||
--settings-path test_data/settings-keyless-signing.yaml \ | ||
annotated-policy.wasm | jq -r ".patch | @base64d"' | ||
|
||
# this prints the output when one the checks below fails | ||
echo "output = ${output}" | ||
|
||
[ "$status" -eq 0 ] | ||
[ $(expr "$output" : '.*ghcr.io/kubewarden/tests/pod-privileged:v0.2.1@sha256:db48aecd83c2826eba154a84c4fbabe0977f96b3360b4c6098578eae5c2d2882.*') -ne 0 ] | ||
} | ||
|
||
@test "Keyless verification with wrong subject" { | ||
run kwctl run \ | ||
--request-path test_data/pod_creation_signed_with_keyless_mode.json \ | ||
--settings-path test_data/settings-keyless-signing-wrong-subject.yaml \ | ||
annotated-policy.wasm | ||
|
||
# this prints the output when one the checks below fails | ||
echo "output = ${output}" | ||
|
||
[ "$status" -eq 0 ] | ||
[ $(expr "$output" : '.*"allowed":false.*') -ne 0 ] | ||
[ $(expr "$output" : '.*is not accepted.*subject: !equal [email protected].*') -ne 0 ] | ||
[ $(expr "$output" : '.*subject: !equal [email protected].*') -ne 0 ] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"CN": "sunlight.127.0.0.1.sslip.io", | ||
"key": { | ||
"algo": "ecdsa" | ||
}, | ||
"names": [ | ||
{ | ||
"C": "DE", | ||
"L": "Nuremberg", | ||
"O": "Kubewarden", | ||
"ST": "Bavaria", | ||
"OU": "sunlight" | ||
} | ||
], | ||
"hosts": [ | ||
"sunlight.127.0.0.1.sslip.io" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,31 @@ | |
"algo": "ecdsa" | ||
}, | ||
"names": [ | ||
{ | ||
"C": "DE", | ||
"L": "Nuremberg", | ||
"O": "Kubewarden", | ||
"ST": "Bavaria", | ||
"OU": "Kubewarden User" | ||
} | ||
{ | ||
"C": "DE", | ||
"L": "Nuremberg", | ||
"O": "Kubewarden", | ||
"ST": "Bavaria", | ||
"OU": "Kubewarden User" | ||
} | ||
], | ||
"hosts": [ | ||
"[email protected]" | ||
], | ||
"extensions": [ | ||
{ | ||
"id": [ | ||
1, | ||
3, | ||
6, | ||
1, | ||
4, | ||
1, | ||
57264, | ||
1, | ||
1 | ||
], | ||
"value": "a3ctb3duLWluZnJh" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"uid": "1299d386-525b-4032-98ae-1949f69f9cfc", | ||
"kind": { | ||
"group": "", | ||
"kind": "Pod", | ||
"version": "v1" | ||
}, | ||
"resource": { | ||
"group": "", | ||
"version": "v1", | ||
"resource": "pods" | ||
}, | ||
"object": { | ||
"metadata": { | ||
"name": "nginx" | ||
}, | ||
"spec": { | ||
"containers": [ | ||
{ | ||
"image": "ghcr.io/kubewarden/tests/pod-privileged:v0.2.1", | ||
"name": "test-verify-image-signatures" | ||
} | ||
] | ||
} | ||
}, | ||
"operation": "CREATE", | ||
"requestKind": { | ||
"group": "", | ||
"version": "v1", | ||
"kind": "Pod" | ||
}, | ||
"userInfo": { | ||
"username": "alice", | ||
"uid": "alice-uid", | ||
"groups": [ | ||
"system:authenticated" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
modifyImagesWithDigest: true | ||
signatures: | ||
- image: "ghcr.io/kubewarden/tests/pod-privileged:v0.2.1" | ||
keyless: | ||
- issuer: "https://github.com/login/oauth" | ||
subject: "[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
modifyImagesWithDigest: true | ||
signatures: | ||
- image: "ghcr.io/kubewarden/tests/pod-privileged:v0.2.1" | ||
keyless: | ||
- issuer: "https://github.com/login/oauth" | ||
subject: "[email protected]" |
Oops, something went wrong.