Skip to content
Draft
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
5 changes: 4 additions & 1 deletion .cargo/audit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ignore = [
"RUSTSEC-2025-0057",
# RUSTSEC-2025-0134: rustls-pemfile unmaintained - dev-only via bollard/testcontainers
# Waiting for upstream bollard fix
"RUSTSEC-2025-0134"
"RUSTSEC-2025-0134",
# RUSTSEC-2026-0066: astral-tokio-tar PAX extension vulnerability - dev-only via testcontainers
# Upstream testcontainers has not updated their bollard dependency
"RUSTSEC-2026-0066"
]
# Warn about unmaintained crates but don't fail
informational_warnings = ["unmaintained"]
14 changes: 7 additions & 7 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions crates/app-http/src/middleware/cors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ pub async fn cors_middleware(
{
if let Ok(header_value) = HeaderValue::from_str(&origin) {
response.headers_mut().insert(header::ACCESS_CONTROL_ALLOW_ORIGIN, header_value);
response.headers_mut().append(header::VARY, HeaderValue::from_static("origin"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-high high

The Vary: Origin header should be added to all responses where the Origin header is inspected, including those where the origin is rejected. If a 'denied' response is cached without this header, it may be served to subsequent requests from allowed origins, causing CORS failures. Since the middleware dynamically determines the Access-Control-Allow-Origin header, Vary: Origin is essential for all cacheable responses. Consider moving this logic outside the conditional block to ensure it's always applied when the middleware is active. Also, using the canonical casing "Origin" is recommended. Finally, ensure that integration tests are updated to verify the presence of this header.

Suggested change
response.headers_mut().append(header::VARY, HeaderValue::from_static("origin"));
response.headers_mut().append(header::VARY, HeaderValue::from_static("Origin"));

}

if state.cors_config.allow_credentials {
Expand Down Expand Up @@ -300,6 +301,7 @@ fn handle_preflight(
// Set allowed origin
if let Ok(header_value) = HeaderValue::from_str(&origin) {
response.headers_mut().insert(header::ACCESS_CONTROL_ALLOW_ORIGIN, header_value);
response.headers_mut().append(header::VARY, HeaderValue::from_static("origin"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Use the canonical casing "Origin" for the Vary header value.

Suggested change
response.headers_mut().append(header::VARY, HeaderValue::from_static("origin"));
response.headers_mut().append(header::VARY, HeaderValue::from_static("Origin"));

}

// Set allowed methods
Expand Down
2 changes: 2 additions & 0 deletions crates/http-middleware/src/cors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pub async fn cors_middleware(config: CorsConfig, request: Request, next: Next) -
{
if let Ok(header_value) = HeaderValue::from_str(&origin) {
response.headers_mut().insert(header::ACCESS_CONTROL_ALLOW_ORIGIN, header_value);
response.headers_mut().append(header::VARY, HeaderValue::from_static("origin"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-high high

The Vary: Origin header should be added to all responses (including rejections) to prevent cache poisoning where a CORS-less response is served to an allowed origin. Also, using the canonical "Origin" casing is recommended.

Suggested change
response.headers_mut().append(header::VARY, HeaderValue::from_static("origin"));
response.headers_mut().append(header::VARY, HeaderValue::from_static("Origin"));

}

if config.allow_credentials {
Expand Down Expand Up @@ -194,6 +195,7 @@ fn handle_preflight(
// Set allowed origin
if let Ok(header_value) = HeaderValue::from_str(&origin) {
response.headers_mut().insert(header::ACCESS_CONTROL_ALLOW_ORIGIN, header_value);
response.headers_mut().append(header::VARY, HeaderValue::from_static("origin"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Use the canonical casing "Origin" for the Vary header value.

Suggested change
response.headers_mut().append(header::VARY, HeaderValue::from_static("origin"));
response.headers_mut().append(header::VARY, HeaderValue::from_static("Origin"));

}

// Set allowed methods
Expand Down
7 changes: 6 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ ignore = [
# - Next review: 2026-03-18 (quarterly)
# - Action: Monitor upstream bollard crate for fix
# - Tracking: https://github.com/testcontainers/testcontainers-rs/issues
"RUSTSEC-2025-0134"
"RUSTSEC-2025-0134",
# RUSTSEC-2026-0066 (astral-tokio-tar)
# - Path: astral-tokio-tar -> testcontainers -> adapters-db-sqlx
# - Risk: Low severity, parser differential.
# - Mitigation: Cannot be updated directly via `cargo update` due to upstream testcontainers locking the version.
"RUSTSEC-2026-0066"
]
yanked = "deny"

Expand Down
Loading