Skip to content

fix: use a custom helper for path traversal tests#377

Open
BlankParticle wants to merge 1 commit into
honojs:mainfrom
BlankParticle:fix/path-traversal-tests
Open

fix: use a custom helper for path traversal tests#377
BlankParticle wants to merge 1 commit into
honojs:mainfrom
BlankParticle:fix/path-traversal-tests

Conversation

@BlankParticle

Copy link
Copy Markdown
Contributor

The test that were testing path traversal using supertest were not testing the proper behaviour. supertest uses superagent under the hood which automatically normalizes the path and there is no way to turn this behaviour off. This means hono was receiving normalized /secret.txt instead of /static/../secret.txt

superagent is full of some of these footguns, like in #368 superagent suddenly started doing brotli decompression in the major version without anyway to opt out, but it doesn't do zst compression. Now the test suite fixtures are testing against are 2 different types, one real brotli fixture and one fake zst fixture.

https://e18e.dev is trying to get the ecosystem to migrate away from superagent e18e/ecosystem-issues#257, so probably migrating away from supertest also makes sense

This PR introduces a small requestServer util that has similar interface to fetch built on node:http, this interface can replace like 90% of supertest usage in here, for the remaining we will need to add some specialized functions for things like testing HTTP/2 and TLS.

I am only replacing the affected path tests in this PR and introducing this new helper to the codebase as a cataleyist for the future migration

@BlankParticle BlankParticle force-pushed the fix/path-traversal-tests branch from fb6dcdb to 3d5a0e2 Compare July 16, 2026 07:28
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