{{ message }}
Repository navigation
fix: reject dot segments in request paths - #1139
Merged
felipefreitag merged 1 commit intoOct 15, 2026
Merged
Conversation
felipefreitag
approved these changes
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

follow up to #1113, split out as suggested in this comment. this only blocks
.and..path segments, no encoding changes.what's happening
url paths work like folders, and
..means "go up one level".fetchresolves that before sending, so an id of.or..(or one containing../) takes the request to a different endpoint:emails.cancel('..')sendsPOST /canceldomains.remove('../api-keys/KEY_ID')sendsDELETE /api-keys/KEY_ID, which is the delete api key endpointif an app passes user input as an id, that lets a call escape its own endpoint.
the fix
fetchRequestnow checks the path and returns aninvalid_parametererror without sending anything if any segment is.or... it also catches the encoded forms like%2E%2E, since url parsing treats those as dot segments too. it returns the error instead of throwing, same as the other input checks in the sdk.nothing that works today changes. a dot segment always ended up on the wrong endpoint, and ids are still sent exactly as passed, so values that are already encoded keep working. ids that just contain dots (
...,john.doe@example.com) go through as normal.tests
has-dot-segment.spec.ts: detects./..and the encoded forms, ignores the query string and fragment, allows...and dotted emailsresend.spec.ts:.,..and../api-keys/key-idreturninvalid_parameterand no request is made,...still goes throughverified
built the sdk from the current release and from this pr, pointed both at a local http server via
baseUrl, and logged the request that actually arrived:emails.get('..')GET /invalid_parameteremails.cancel('..')POST /cancelinvalid_parameterdomains.remove('.')DELETE /domains/invalid_parameterdomains.remove('../api-keys/KEY_ID')DELETE /api-keys/KEY_IDinvalid_parameteremails.get('...')GET /emails/...contacts.get({ email: 'team@resend.com' })GET /contacts/team@resend.comcontacts.get({ email: encodeURIComponent('team@resend.com') })GET /contacts/team%40resend.comSummary by cubic
Rejects request paths containing
.or..segments so user-supplied IDs can no longer redirect a request to another endpoint.fetchresolves dot segments before sending, soemails.cancel('..')was hittingPOST /cancelanddomains.remove('../api-keys/KEY_ID')was hitting the delete API key endpoint.fetchRequestnow returns aninvalid_parametererror without sending anything when any path segment is.or.., including percent-encoded forms like%2E%2E. IDs that merely contain dots (...,john.doe@example.com) are unchanged.Written for commit 2fef573. Summary will update on new commits.