Skip to content
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
9 changes: 9 additions & 0 deletions crates/edgecookie/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Edge Cookie providers

Vendor Edge Cookie provider crates live here, one per vendor, for example
`crates/edgecookie/<vendor>`. Each implements the `EdgeCookieProvider` trait
from `trusted-server-core` and is wired in by an adapter.

The built-in default provider (HMAC over the client IP) ships in
`trusted-server-core` (`ec::provider`), so no crate is needed for it. This
directory is a placeholder until a vendor provider is added.
3 changes: 3 additions & 0 deletions crates/trusted-server-adapter-axum/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ mod tests {
proxy_secret = "unit-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"
"#,
)
Expand Down
3 changes: 3 additions & 0 deletions crates/trusted-server-adapter-axum/tests/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ fn test_router() -> edgezero_core::router::RouterService {
proxy_secret = "integration-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"
"#,
)
Expand Down
3 changes: 3 additions & 0 deletions crates/trusted-server-adapter-cloudflare/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ mod tests {
proxy_secret = "unit-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"
"#,
)
Expand Down
6 changes: 6 additions & 0 deletions crates/trusted-server-adapter-cloudflare/tests/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ fn test_router() -> RouterService {
proxy_secret = "route-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"
"#,
)
Expand Down Expand Up @@ -85,6 +88,9 @@ fn make_router() -> RouterService {
proxy_secret = "integration-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"
"#,
)
Expand Down
15 changes: 15 additions & 0 deletions crates/trusted-server-adapter-fastly/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,9 @@ mod tests {
allowed_domains = ["*.example", "*.example.com"]

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-passphrase-at-least-32-bytes!!"

[request_signing]
Expand Down Expand Up @@ -1353,6 +1356,9 @@ mod tests {
allowed_domains = ["*.example", "*.example.com"]

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"

[request_signing]
Expand Down Expand Up @@ -1717,6 +1723,9 @@ mod tests {
proxy_secret = "unit-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"
"#,
)
Expand Down Expand Up @@ -2172,6 +2181,9 @@ mod tests {
proxy_secret = "unit-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"

[request_signing]
Expand Down Expand Up @@ -2297,6 +2309,9 @@ mod tests {
proxy_secret = "unit-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"

[request_signing]
Expand Down
3 changes: 3 additions & 0 deletions crates/trusted-server-adapter-fastly/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@ mod tests {
proxy_secret = "unit-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"

[request_signing]
Expand Down
3 changes: 3 additions & 0 deletions crates/trusted-server-adapter-fastly/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ mod tests {
proxy_secret = "unit-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"

[request_signing]
Expand Down
3 changes: 3 additions & 0 deletions crates/trusted-server-adapter-spin/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ mod tests {
proxy_secret = "unit-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"
"#,
)
Expand Down
3 changes: 3 additions & 0 deletions crates/trusted-server-adapter-spin/tests/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ fn test_router() -> RouterService {
proxy_secret = "route-test-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "test-secret-key-32-bytes-minimum"
"#,
)
Expand Down
3 changes: 3 additions & 0 deletions crates/trusted-server-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ origin_url = "https://origin.example.com"
proxy_secret = "change-me-proxy-secret"

[ec]
provider = "hmac"

[ec.providers.hmac]
passphrase = "production-secret-key-32-bytes-min"

[[handlers]]
Expand Down
22 changes: 19 additions & 3 deletions crates/trusted-server-core/src/config_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ mod tests {
fn strings_that_look_like_json_scalars_round_trip_as_strings() {
let mut original = test_settings();
original.publisher.proxy_secret = Redacted::new("1234567890".to_string());
original.ec.passphrase = Redacted::new("12345678901234567890123456789012".to_string());
original.ec.providers.hmac = Some(crate::settings::HmacProviderConfig {
passphrase: Redacted::new("12345678901234567890123456789012".to_string()),
});
original.handlers[0].password = Redacted::new("true".to_string());

let reconstructed = settings_from_config_blob(&envelope_json(&original))
Expand All @@ -166,8 +168,22 @@ mod tests {
"numeric-looking proxy secret should remain a string"
);
assert_eq!(
reconstructed.ec.passphrase.expose(),
original.ec.passphrase.expose(),
reconstructed
.ec
.providers
.hmac
.as_ref()
.expect("should reconstruct the hmac provider")
.passphrase
.expose(),
original
.ec
.providers
.hmac
.as_ref()
.expect("should keep the hmac provider")
.passphrase
.expose(),
"numeric-looking passphrase should remain a string"
);
assert_eq!(
Expand Down
Loading
Loading