Skip to content

test: expect encoded backslashes to be rejected on the HTTP path - #496

Merged
Tony133 merged 1 commit into
mainfrom
fix/encoded-backslash-tests
Nov 13, 2026
Merged

Tony133 merged 1 commit into
mainfrom
fix/encoded-backslash-tests

Conversation

@mcollina

Copy link
Copy Markdown
Member

@fastify/reply-from 12.8.1 rejects destinations whose decoded path contains a backslash, so three tests that expected /pub/foo%5Cbar to be proxied now fail on main with a fresh install: "HTTP paths cannot escape rewritePrefix", "reply.fromParameters cannot escape rewritePrefix" and "percent-encoded backslashes remain path data".

The HTTP and fromParameters tests now expect a 400 for the encoded backslash. In the WebSocket test, the upgrade still forwards /internal/foo%5C..bar unchanged because WebSocket traffic does not go through reply-from, so only the plain-HTTP half of that test now expects an error. The @fastify/reply-from range is raised to ^12.8.1 so the tested behaviour matches the minimum supported version.

@fastify/reply-from 12.8.1 rejects destinations whose decoded path
contains a backslash, so '/pub/foo%5Cbar' now gets a 400 on the HTTP
path instead of being forwarded. WebSocket upgrades do not go through
reply-from and still forward it unchanged.

Update the expectations accordingly and require @fastify/reply-from
^12.8.1 so the tested behaviour matches the minimum supported version.

@Tony133 Tony133 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@Tony133
Tony133 merged commit c32e69c into main Nov 13, 2026
20 checks passed
@Tony133
Tony133 deleted the fix/encoded-backslash-tests branch November 13, 2026 12:30
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.

2 participants