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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Security

- Validate synthetic ID format on inbound values from the `x-synthetic-id` header and `synthetic_id` cookie; values that do not match the expected format (`64-hex-hmac.6-alphanumeric-suffix`) are discarded and a fresh ID is generated rather than forwarded to response headers, cookies, or third-party APIs

### Added

- Implemented basic authentication for configurable endpoint paths (#73)
Expand Down
11 changes: 9 additions & 2 deletions crates/common/src/integrations/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1310,8 +1310,15 @@ mod tests {
let registry = IntegrationRegistry::from_routes(routes);

let mut req = Request::get("https://test.example.com/integrations/test/synthetic");
// Pre-existing cookie
req.set_header(header::COOKIE, "synthetic_id=existing_id_12345");
// Pre-existing cookie with a valid-format synthetic ID
req.set_header(
header::COOKIE,
format!(
"{}={}",
crate::constants::COOKIE_SYNTHETIC_ID,
crate::test_support::tests::VALID_SYNTHETIC_ID
),
);

let result = futures::executor::block_on(registry.handle_proxy(
&Method::GET,
Expand Down
5 changes: 3 additions & 2 deletions crates/common/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,8 @@ mod tests {
sig
),
);
req.set_header(crate::constants::HEADER_X_SYNTHETIC_ID, "synthetic-123");
let valid_synthetic_id = crate::test_support::tests::VALID_SYNTHETIC_ID;
req.set_header(crate::constants::HEADER_X_SYNTHETIC_ID, valid_synthetic_id);

let resp = handle_first_party_click(&settings, req)
.await
Expand All @@ -1309,7 +1310,7 @@ mod tests {
assert_eq!(pairs.remove("foo").as_deref(), Some("1"));
assert_eq!(
pairs.remove("synthetic_id").as_deref(),
Some("synthetic-123")
Some(valid_synthetic_id)
);
assert!(pairs.is_empty());
}
Expand Down
Loading
Loading