Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup integration tests #619

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 79 additions & 56 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ members = [
"rvps",
"tools/kbs-client",
"deps/verifier",
"integration-tests",
]
resolver = "2"

Expand Down Expand Up @@ -37,6 +38,7 @@ kbs-types = "0.7.0"
kms = { git = "https://github.com/confidential-containers/guest-components.git", rev = "e6999a3c0fd877dae9e68ea78b8b483062db32b8", default-features = false }
jsonwebtoken = { version = "9", default-features = false }
log = "0.4.17"
openssl = "0.10.55"
prost = "0.13"
regorus = { version = "0.2.6", default-features = false, features = [
"regex",
Expand All @@ -51,7 +53,7 @@ rstest = "0.18.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.132"
serde_with = { version = "1.11.0", features = ["base64", "hex"] }
serial_test = "0.9.0"
serial_test = { version = "3.2.0", features = ["async"] }
sha2 = "0.10"
shadow-rs = "0.19.0"
strum = { version = "0.25", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion attestation-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jsonwebtoken.workspace = true
kbs-types.workspace = true
lazy_static = "1.4.0"
log.workspace = true
openssl = "0.10.55"
openssl.workspace = true
prost = { workspace = true, optional = true }
rand = "0.8.5"
reference-value-provider-service.path = "../rvps"
Expand Down
19 changes: 10 additions & 9 deletions attestation-service/src/token/simple_default_policy.rego
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
package policy

import future.keywords.every
import future.keywords.if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's going on here? was if not in the original simple-default-policy and should have been (so you added it)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our CI does a formatting check of the default policy using the OPA package. We don't pin the version of the package so sometimes it wants new things. Recently it has started complaining about not having if before blocks.

The versioning of OPA is a little squirrely but it hasn't been too big of an issue so far.


default allow = false
default allow := false

allow {
allow if {
every k, v in input {
# `judge_field`: Traverse each key value pair in the input and make policy judgments on it.
#
Expand All @@ -44,7 +45,7 @@ allow {
}
}

judge_field(input_key, input_value) {
judge_field(input_key, input_value) if {
has_key(data.reference, input_key)
reference_value := data.reference[input_key]

Expand All @@ -57,16 +58,16 @@ judge_field(input_key, input_value) {
match_value(reference_value, input_value)
}

judge_field(input_key, input_value) {
judge_field(input_key, input_value) if {
not has_key(data.reference, input_key)
}

match_value(reference_value, input_value) {
match_value(reference_value, input_value) if {
not is_array(reference_value)
input_value == reference_value
}

match_value(reference_value, input_value) {
match_value(reference_value, input_value) if {
is_array(reference_value)

# `array_include`: judge the input value with the values in the array.
Expand All @@ -78,16 +79,16 @@ match_value(reference_value, input_value) {
array_include(reference_value, input_value)
}

array_include(reference_value_array, input_value) {
array_include(reference_value_array, input_value) if {
reference_value_array == []
}

array_include(reference_value_array, input_value) {
array_include(reference_value_array, input_value) if {
reference_value_array != []
some i
reference_value_array[i] == input_value
}

has_key(m, k) {
has_key(m, k) if {
_ = m[k]
}
24 changes: 24 additions & 0 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "integration-tests"
version.workspace = true
authors.workspace = true
description.workspace = true
documentation.workspace = true
edition.workspace = true

[dependencies]
kbs = { path = "../kbs" }
attestation-service = { path = "../attestation-service" }
kbs-client = { path = "../tools/kbs-client" }

actix-web.workspace = true
actix-rt = "2.10.0"
anyhow.workspace = true
env_logger.workspace = true
log.workspace = true
openssl.workspace = true
rstest.workspace = true
serde_json.workspace = true
serial_test.workspace = true
tempfile.workspace = true
tokio.workspace = true
Loading
Loading