Align signature verification with Trusted Server v1.1#80
Align signature verification with Trusted Server v1.1#80ChristianPavilonis wants to merge 9 commits intomainfrom
Conversation
aram356
left a comment
There was a problem hiding this comment.
PR Review
The v1.1 signing protocol and SigningPayload canonicalization are solid structural improvements. The fixed-pricing simplification makes sense for a mock bidder. A few things need attention before merge — mostly around the trust model for signed fields and consistency across docs.
Summary
| Emoji | Count | Meaning |
|---|---|---|
| 🔧 | 4 | Needs change |
| ♻️ | 1 | Refactoring suggestion |
| 🌱 | 1 | Future consideration |
| 📌 | 1 | Out-of-scope follow-up |
| 💯 | 1 | Positive |
Non-inline notes
⛏ test_price_from_ext_and_iframe_bid_param (auction.rs:474) — the test name still implies we're verifying that ext.bid drives the price. It now tests the opposite. Rename to something like test_ext_bid_override_is_ignored.
⛏ log::info!("URI: {}", uri) at verification.rs:73 looks like a debug leftover from development. The line above already logs at debug level. Demote or remove.
📌 The request example in openrtb-auction.md (lines 52–55) still includes "ext": {"mocktioneer": {"bid": 2.5}} in the impression — contradicts the new Pricing section that says bid overrides are ignored. Remove it from the example to avoid confusion.
… with fixed pricing - Cross-check ext.trusted_server host/scheme against server-observed values - Enforce timestamp freshness window (±5 min) to prevent replay attacks - Add field-order warning comment on SigningPayload struct - Fix ts unit mismatch: align tests with docs (milliseconds) - Add positive-path Ed25519 round-trip test with deterministic keypair - Remove debug log leftover in fetch_jwks - Simplify APS size selection to area-based ranking (replaces CPM) - Remove CPM from /sizes endpoint response - Rename test to test_ext_bid_override_is_ignored - Docs sweep: remove bid override references across all doc pages
Review feedback addressed in 3bbbbc7🔧 Trust model for signed fields (verification.rs)
🌱 Field order comment on
|
Align remaining docs with fixed /bin/zsh.01 bidding and update Playwright /_/sizes assertions to match the cpm-free response, so review cleanups and CI checks reflect the current API behavior.
aram356
left a comment
There was a problem hiding this comment.
Review: Round 2
The follow-up commits addressed the first review well — host/scheme cross-checks, timestamp freshness, v1.1 canonical payload, E2E roundtrip test, docs sweep, and APS size selection are all in. Good work.
Remaining issues below, grouped by severity.
What's done well
- Check ordering — cheap validations (field extraction, host/scheme cross-check, timestamp freshness) all run before the expensive JWKS fetch + crypto. Good.
- Roundtrip crypto test —
verify_ed25519_roundtrip_with_known_keypairproves the full sign→verify pipeline and catches tampered payloads. Most valuable test in the file. - Creative sig param whitelist — sanitizes
sigquery param against known-safe values instead of trusting arbitrary input. Clean pattern. - Docs consistency — all references to dynamic pricing, price override, and
bidparam removed across 7 doc files. Thorough.
aram356
left a comment
There was a problem hiding this comment.
Review: Round 3
Prior rounds addressed host/scheme normalization, dead code removal (get_cpm, DEFAULT_CPM, MAX_AREA_BONUS), unused JS variable, and fragile test assertions. The branch is CI-clean (fmt, clippy, tests, WASM targets all pass).
One blocking item remains from round 2 that was partially addressed — the SIZE_MAP values were documented as legacy but not actually zeroed out.
CI Status
- fmt: PASS
- clippy: PASS
- tests: PASS (all workspace targets)
cargo check --features "fastly cloudflare": PASScargo check --target wasm32-unknown-unknown(Cloudflare): PASS
… with fixed pricing - Cross-check ext.trusted_server host/scheme against server-observed values - Enforce timestamp freshness window (±5 min) to prevent replay attacks - Add field-order warning comment on SigningPayload struct - Fix ts unit mismatch: align tests with docs (milliseconds) - Add positive-path Ed25519 round-trip test with deterministic keypair - Remove debug log leftover in fetch_jwks - Simplify APS size selection to area-based ranking (replaces CPM) - Remove CPM from /sizes endpoint response - Rename test to test_ext_bid_override_is_ignored - Docs sweep: remove bid override references across all doc pages
Align remaining docs with fixed /bin/zsh.01 bidding and update Playwright /_/sizes assertions to match the cpm-free response, so review cleanups and CI checks reflect the current API behavior.
- Normalize X-Forwarded-Proto: split on comma, trim, lowercase, fall back to request URI scheme before defaulting to https - Add canonicalize_host() to strip default ports (:443/:80) and lowercase both sides of host/scheme cross-checks in verification - Log deprecation warning when imp.ext.mocktioneer.bid is present but ignored - Remove dead pricing code: get_cpm(), DEFAULT_CPM, MAX_AREA_BONUS - Update CLAUDE.md key constants to reflect FIXED_BID_CPM - Remove unused JS variable 'b' in creative template - Strengthen timestamp test assertions with matches! on error variant
…calize_host tests
…ot bidder host The host cross-check was comparing ext.trusted_server.request_host (the publisher's domain) against the bidder's own ForwardedHost, which will never match in header bidding. Changed to compare against site.domain from the OpenRTB request instead. Also removed the redundant scheme cross-check since request_scheme is already verified cryptographically as part of the signed payload.
Remove the phf dependency entirely — SIZE_MAP values were zeroed out and only used for key membership checks. Replace with a sorted const array of (i64, i64) tuples. O(n) scan over 13 entries is trivially fast and eliminates the build-time codegen dependency.
Update all references from $0.01 to $0.20 across docs, CLAUDE.md, and inline code comments to match the actual constant value.
00c23d8 to
4766574
Compare
Summary
ext.trusted_serverfields (version,kid,request_host,request_scheme,ts) to prevent partial or ambiguous verification inputs.$0.01) for generated OpenRTB and APS responses, and remove request-level bid override behavior from generated ad markup.Changes
crates/mocktioneer-core/src/verification.rsversion,kid,host,scheme,id,ts), required v1.1 ext fields, enforced signing version1.1, and added payload/version tests.crates/mocktioneer-core/src/render.rscrates/mocktioneer-core/static/templates/creative.html.hbsverified/failed/not_present).crates/mocktioneer-core/src/auction.rs$0.01), removed request-supplied bid overrides from response generation, and updated related tests.docs/api/openrtb-auction.mdCloses
Closes #79
Closes #81
Test plan
cargo test --workspace --all-targetscargo clippy --workspace --all-targets --all-features -- -D warningscargo check --workspace --all-targets --features "fastly cloudflare"cargo run -p mocktioneer-adapter-axumcd tests/playwright && npm test)cargo fmt --all -- --check;cargo test -p mocktioneer-coreChecklist
mocktioneer-core, not in adapter cratesroutes.rsandedgezero.tomlrender.rs, not inlined in handlers#[cfg(test)]or intests/)