Skip to content

Commit 2bc167e

Browse files
authored
Merge branch 'main' into feature/edgezero-pr2-platform-traits
2 parents f4c4b57 + 18b5c16 commit 2bc167e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3105
-892
lines changed

.claude/agents/pr-creator.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Using the `.github/pull_request_template.md` structure, draft:
4949
- **Changes table**: list each file modified and what changed.
5050
- **Closes**: `Closes #<issue-number>` to auto-close the linked issue.
5151
- **Test plan**: check off which verification steps were run.
52+
- **Hardening note**: when config-derived regex or pattern compilation is touched, state how invalid enabled config fails startup and which regression tests cover that path.
5253
- **Checklist**: verify each item applies.
5354

5455
### 5. Create the PR
@@ -172,6 +173,7 @@ Do **not** use labels as a substitute for types.
172173
- Use sentence case for the title.
173174
- Use imperative mood (e.g., "Add caching to proxy" not "Added caching").
174175
- The summary should focus on _why_, not just _what_.
176+
- Do not describe config-derived regex/pattern compilation as safe unless invalid enabled config is handled without `panic!`, `unwrap()`, or `expect()`.
175177
- Always base PRs against `main` unless told otherwise.
176178
- Always assign the PR to the current user (`--assignee @me`).
177179
- Never force-push or rebase without explicit user approval.

.claude/agents/pr-reviewer.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ For each changed file, evaluate:
7878
- `expect("should ...")` instead of `unwrap()` in production code
7979
- `error-stack` (`Report<E>`) with `derive_more::Display` for errors (not thiserror/anyhow)
8080
- `log` macros (not `println!`)
81+
- Config-derived regex/pattern compilation must not use panic-prone `expect()`/`unwrap()`; invalid enabled config should surface as startup/config errors
82+
- Invalid enabled integrations/providers must not be silently logged-and-disabled during startup or registration
8183
- `vi.hoisted()` for mock definitions in JS tests
8284
- Integration IDs match JS directory names
8385
- Colocated tests with `#[cfg(test)]`
@@ -105,6 +107,7 @@ For each changed file, evaluate:
105107

106108
- Are new code paths tested?
107109
- Are edge cases covered (empty input, max values, error paths)?
110+
- If config-derived regex/pattern compilation changed: are invalid enabled-config startup failures and explicit `enabled = false` bypass cases both covered?
108111
- Rust tests: `cargo test --workspace`
109112
- JS tests: `npx vitest run` in `crates/js/lib/`
110113

.claude/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
"Bash(git status:*)",
2626
"mcp__plugin_chrome-devtools-mcp_chrome-devtools__new_page",
2727
"mcp__plugin_chrome-devtools-mcp_chrome-devtools__performance_stop_trace",
28-
"mcp__plugin_chrome-devtools-mcp_chrome-devtools__evaluate_script"
28+
"mcp__plugin_chrome-devtools-mcp_chrome-devtools__evaluate_script",
2929
]
30+
},
31+
"enabledPlugins": {
32+
"chrome-devtools@claude-plugins-official": true,
33+
"superpowers@claude-plugins-official": true
3034
}
3135
}

.env.dev

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ TRUSTED_SERVER__SYNTHETIC__OPID_STORE=opid_store
88
# [proxy]
99
# Disable TLS certificate verification for local dev with self-signed certs
1010
# TRUSTED_SERVER__PROXY__CERTIFICATE_CHECK=false
11+
#
12+
# Restrict first-party proxy redirect targets to an allowlist (JSON array or indexed form).
13+
# Leave unset in local dev; configure in production to prevent SSRF via redirect chains
14+
# initiated by signed first-party proxy URLs.
15+
# TRUSTED_SERVER__PROXY__ALLOWED_DOMAINS='["*.doubleclick.net","*.googlesyndication.com"]'
16+
# Or using indexed form:
17+
# TRUSTED_SERVER__PROXY__ALLOWED_DOMAINS__0='*.doubleclick.net'
18+
# TRUSTED_SERVER__PROXY__ALLOWED_DOMAINS__1='*.googlesyndication.com'

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Security
11+
12+
- 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
13+
1014
### Added
1115

1216
- Implemented basic authentication for configurable endpoint paths (#73)

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ jose-jwk = "0.1.2"
7474
log = "0.4.29"
7575
log-fastly = "0.11.12"
7676
lol_html = "2.7.2"
77-
once_cell = "1.21"
7877
matchit = "0.9"
7978
pin-project-lite = "0.2"
8079
rand = "0.8"

crates/trusted-server-adapter-fastly/src/main.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ fn main(req: Request) -> Result<Response, Error> {
5353
log::debug!("Settings {settings:?}");
5454

5555
// Build the auction orchestrator once at startup
56-
let orchestrator = build_orchestrator(&settings);
56+
let orchestrator = match build_orchestrator(&settings) {
57+
Ok(orchestrator) => orchestrator,
58+
Err(e) => {
59+
log::error!("Failed to build auction orchestrator: {:?}", e);
60+
return Ok(to_error_response(&e));
61+
}
62+
};
5763

5864
let integration_registry = match IntegrationRegistry::new(&settings) {
5965
Ok(r) => r,
@@ -111,9 +117,21 @@ async fn route_request(
111117
None
112118
});
113119

114-
if let Some(mut response) = enforce_basic_auth(settings, &req) {
115-
finalize_response(settings, geo_info.as_ref(), &mut response);
116-
return Ok(response);
120+
// `get_settings()` should already have rejected invalid handler regexes.
121+
// Keep this fallback so manually-constructed or otherwise unprepared
122+
// settings still become an error response instead of panicking.
123+
match enforce_basic_auth(settings, &req) {
124+
Ok(Some(mut response)) => {
125+
finalize_response(settings, geo_info.as_ref(), &mut response);
126+
return Ok(response);
127+
}
128+
Ok(None) => {}
129+
Err(e) => {
130+
log::error!("Failed to evaluate basic auth: {:?}", e);
131+
let mut response = to_error_response(&e);
132+
finalize_response(settings, geo_info.as_ref(), &mut response);
133+
return Ok(response);
134+
}
117135
}
118136

119137
// Get path and method for routing

crates/trusted-server-core/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ uuid = { workspace = true }
5252
validator = { workspace = true }
5353
ed25519-dalek = { workspace = true }
5454
edgezero-core = { workspace = true }
55-
once_cell = { workspace = true }
5655

5756
[build-dependencies]
5857
config = { workspace = true }

crates/trusted-server-core/build.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ fn main() {
3838

3939
// Merge base TOML with environment variable overrides and write output.
4040
// Panics if admin endpoints are not covered by a handler.
41-
// Note: placeholder secret rejection is intentionally NOT done here.
42-
// The base trusted-server.toml ships with placeholder secrets that
43-
// production deployments override via TRUSTED_SERVER__* env vars at
44-
// build time. Runtime startup (get_settings) rejects any remaining
45-
// placeholders so a misconfigured deployment fails fast.
4641
let settings = settings::Settings::from_toml_and_env(&toml_content)
4742
.expect("Failed to parse settings at build time");
4843

0 commit comments

Comments
 (0)