Skip to content

fix(security): comprehensive fix for /relay/ping impersonation and nonce replay#126

Closed
AdnanMehr8 wants to merge 10 commits intoScottcjn:mainfrom
AdnanMehr8:security/issue-48-final-fix
Closed

fix(security): comprehensive fix for /relay/ping impersonation and nonce replay#126
AdnanMehr8 wants to merge 10 commits intoScottcjn:mainfrom
AdnanMehr8:security/issue-48-final-fix

Conversation

@AdnanMehr8
Copy link
Contributor

This PR addresses Issue #48 by implementing:

  1. Identity Binding: Derives agent_id from pubkey_hex on the registration path to prevent agents from claiming a bcn_* ID they don't own.
  2. Replay Protection: Enforces unique nonces within the sliding window for both registration and heartbeats on /relay/ping.
  3. Authentication: Ensures existing agents provide a valid relay_token to update their heartbeat.

Verified with local tests.

@AdnanMehr8
Copy link
Contributor Author

This PR addresses Issue #48 by implementing:

  1. Identity Binding: Derives from on the registration path to prevent agents from claiming a ID they don't own.
  2. Replay Protection: Enforces unique nonces within the sliding window for both registration and heartbeats on .
  3. Authentication: Ensures existing agents provide a valid to update their heartbeat.

Verified with local tests.

@AdnanMehr8
Copy link
Contributor Author

Synced with upstream main and forced push. The security fix is now applied on top of the latest codebase, including the new rate limiter and security guide.

Summary of changes in this PR:

  1. Derive agent_id from pubkey: Ensures that an agent cannot register with a ID they don't own by spoofing the field.
  2. Nonce Replay Protection: Extends the existing nonce window logic to the endpoint for both registration and heartbeats.
  3. Heartbeat Authentication: Enforces validation for existing agents attempting to update their heartbeat on the ping path.

Verified against latest main.

@AdnanMehr8
Copy link
Contributor Author

Superseded by PR #127 which is synced with latest upstream main.

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

Labels

size/XL PR: 500+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant