Skip to content

Enhanced request signing with domain verification (v1.1)#220

Open
jevansnyc wants to merge 1 commit intomainfrom
feature/enhanced-request-signing
Open

Enhanced request signing with domain verification (v1.1)#220
jevansnyc wants to merge 1 commit intomainfrom
feature/enhanced-request-signing

Conversation

@jevansnyc
Copy link
Collaborator

Summary

  • Implements cryptographic signing of OpenRTB requests that includes publisher domain verification and replay protection
  • The signed payload format is: kid:request_host:request_scheme:id:ts
  • Adds version ("1.1") and ts (Unix timestamp) fields to ext.trusted_server

This prevents request tampering and domain spoofing by ensuring the signature is cryptographically bound to the originating publisher domain.

Changes

  • openrtb.rs: Add version and ts fields to TrustedServerExt
  • signing.rs: Add SigningParams struct, SIGNING_VERSION constant, and sign_request() method
  • prebid.rs: Update both PrebidAuctionProvider and enhance_openrtb_request to use enhanced signing

Output Format

{
  "ext": {
    "trusted_server": {
      "version": "1.1",
      "kid": "ts-2026-01-A",
      "request_host": "publisher.com",
      "request_scheme": "https",
      "ts": 1738527600,
      "signature": "base64-encoded-ed25519-signature"
    }
  }
}

Test plan

  • Verify build passes (cargo build --release)
  • Verify clippy passes (cargo clippy)
  • Deploy to test environment and verify signature verification works on Mocktioneer
  • Test with different hosts to confirm signatures differ

Implements cryptographic signing of OpenRTB requests that includes publisher
domain verification and replay protection. The signed payload now includes:
- Key ID (kid)
- Request host
- Request scheme
- Request ID
- Unix timestamp

This prevents request tampering and domain spoofing by ensuring the signature
is bound to the originating publisher domain.

Changes:
- Add version and ts fields to TrustedServerExt
- Add SigningParams struct and sign_request() method
- Update PrebidAuctionProvider to use enhanced signing
- Add comprehensive tests for payload construction and signing
Copy link
Collaborator

@ChristianPavilonis ChristianPavilonis left a comment

Choose a reason for hiding this comment

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

pretty good, a couple nit picks.

Opening an issue on mocktioneer to verify new signature payload: stackpop/mocktioneer#30

deployed test site with this (verification broken until mocktioneer updated) but the TS side is working.

request_scheme,
timestamp: std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_secs())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should use milliseconds to stay in line with the rest of the openrtb spec.

let signature = signer.sign(id.as_bytes())?;
let params = SigningParams::new(
id.to_string(),
request_host.clone(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't have to clone here if you use params.request_host and params.request_scheme on lines 544-545

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants