Skip to content

sec: add public key caching and strict keyId validation for arc-escrow - #35

Open
mertcano wants to merge 1 commit into
circlefin:masterfrom
mertcano:mertcano-patch-2
Open

sec: add public key caching and strict keyId validation for arc-escrow#35
mertcano wants to merge 1 commit into
circlefin:masterfrom
mertcano:mertcano-patch-2

Conversation

@mertcano

Copy link
Copy Markdown

This PR addresses a DoS/rate-limiting vulnerability and a path-injection risk in the arc-escrow webhook handler.

Currently, the endpoint fetches the Circle public key on every incoming POST request. Because this route is unauthenticated, an attacker can spam it with invalid signatures to exhaust the application's Circle API rate limits. Additionally, the keyId header is injected directly into the outbound URL without format validation.

This update hardens the implementation by:

Enforcing strict UUID regex validation on the keyId before any external fetch to prevent path-injection.

Implementing a process-level TTL cache for the public key to prevent redundant external API calls.

Adding proper try/catch error logging to verifyCircleSignature to prevent silent failures.

This PR addresses a DoS/rate-limiting vulnerability and a path-injection risk in the arc-escrow webhook handler.

Currently, the endpoint fetches the Circle public key on every incoming POST request. Because this route is unauthenticated, an attacker can spam it with invalid signatures to exhaust the application's Circle API rate limits. Additionally, the keyId header is injected directly into the outbound URL without format validation.

This update hardens the implementation by:

Enforcing strict UUID regex validation on the keyId before any external fetch to prevent path-injection.

Implementing a process-level TTL cache for the public key to prevent redundant external API calls.

Adding proper try/catch error logging to verifyCircleSignature to prevent silent failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant