Repository navigation
fix(core): accept only exact loopback origins and hosts on the stream server - #889
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
@evlog/cli
evlog
@evlog/nuxthub
@evlog/signals
@evlog/telemetry
commit: |
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 7
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 17, 2026
This branch was successfully deployed
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.
Without a
token, the local stream server (startStreamServer,stream: truein Nuxt and Next.js) is meant to serve only this machine. It had two gaps:Originhost withstartsWith('localhost'), so a page onhttps://localhost.example.comorhttps://127.0.0.1.example.compassed.Host. A page whose domain is rebound to127.0.0.1sends noOriginon a same-origin GET, so it passed too.Either way the page reads every wide event as it is emitted, plus the replay buffer. Redaction is off by default in dev, so those events carry real request data. The Nuxt discovery route
/api/_evlog/stream-infoanswered withAccess-Control-Allow-Origin: *, so any site could also learn the ephemeral port.Fix
Hosthostname is exactlylocalhost,127.0.0.1or[::1], and itsOrigin, if sent, is one of those exactly. The check lives insrc/shared/loopback.ts(internal, not exported)./api/_evlog/stream-infoechoesAccess-Control-Allow-Originonly for loopback origins, withVary: Origin. A dev tool on another local port still works; the docs only describe same-origin use.Host, as the docs require forhost: '0.0.0.0'.Before and after
Requests to a running stream server with no token:
mainOrigin: http://localhost:3000Origin: https://evil.comOrigin: https://localhost.evil.comOrigin: https://127.0.0.1.evil.comOrigin,Host: rebind.evil.comThe new tests on
main:All pass on this branch. The docs table in
6.extend/1.stream.mddescribes the new rule.Checks
pnpm run lint: passpnpm run typecheck --filter='!evlog-telemetry'(the CI filter): passpnpm test:coverage: 112 files, 2,223 tests pass. Coverage 92.32 / 86.08 / 95.56 / 94.32 (statements / branches / functions / lines)pnpm content:linton the changeset and the stream docs page: 100ELI5
The live log viewer runs a small server on your computer and is only supposed to talk to your computer. It checked "does the address start with localhost?", so a website named
localhost.something.comcould listen to your app's logs. It now checks that the address is exactly your computer.