Repository navigation
Conversation
The request gate read only the Host header. Under HTTP/2, which the Angular dev server uses with --ssl, browsers send :authority and no Host. With allowedHosts: true the gate then refused a same-origin page, and the Host check against DNS rebinding was skipped. Fall back to :authority when Host is missing.
…wedOrigins The dev-server builder started the hub with its defaults, so a page opened on a custom hostname that points to this machine got 403 on the panel's SSE POST, even with the name in allowedHosts. initPangularHub() takes an allowedHosts option, read like Vite's server.allowedHosts, in its request gate and in the origin check of its transports. The builder forwards the dev server's allowedHosts, its host when it is a name, and a new allowedOrigins option, which it keeps from the Angular dev server's own options.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@guiomesch thank you! i will have a look ASAP! |
|
Thanks a lot @erkamyaman ! I find Pangular Inspector amazing, it has become part of my daily Angular workflow. I ran into an issue with the host part: with the dev-server builder, opening the app on a custom hostname (with --ssl) left the panel blank because the hub refused the requests, so I put this fix together. Thanks again for the tool, and I'm looking forward to your feedback! |
What and why
With
@pangular-inspector/devtools:dev-server, an app opened on a custom hostname that resolves to 127.0.0.1 (for examplehttps://myapp.dev.example.test:4200with--ssl) gets a blank panel.POST /__devframes/__ssereturns 403, andng serveprints:The builder started the hub with
initPangularHub({ ws: false }), so neither the dev server'sallowedHostsnor any origin reached the hub's gate. TheGETrequests pass because they carry noOrigin. ThePOSTis refused.Changes:
initPangularHub()takesallowedHosts(string[] | true), read like Vite'sserver.allowedHosts. It applies in the request gate and in the origin check of the hub's transports. devframe's SSE transport checksOriginon its own, so the gate alone wasn't enough. It gets the same gated registry the Vite plugin uses. It shows in the Dashboard's security status, andtrueprints the same warning as in Vite.dev-serverbuilder passes the dev server'sallowedHosts, itshostwhen that is a name (not loopback or a wildcard), and a newallowedOriginsoption. It keepsallowedOriginsout of the options it hands to the Angular dev server, since Angular's schema doesn't know it.:authorityunder HTTP/2. With--sslthe dev server speaks HTTP/2 and browsers send noHost. WithallowedHosts: truethe gate then refused same-origin pages, and theHostcheck against DNS rebinding was skipped.allowedHostsin the Express hub options, and the security page.How it was verified
pnpm commit:check(commit messages follow the guidelines)pnpm format:checkpnpm typecheck(includes thengctemplate checks)pnpm test:devtools: all pass exceptsource-file-index.test.ts > rescans a component once its missing templateUrl file appears, which fails the same way onmainon my machinepnpm skills:check(when.claude/changed): not neededapps/docsupdated andpnpm docs:buildpassespnpm extension:buildandextension/uicommitted (whenapp/changed): not neededNew tests:
hub-express-gate.test.ts: a request withOrigin: https://myapp.dev.example.test:4200gets through, and the SSEPOSTgets past the 403, withallowedHostsorallowedOriginsset. Without them it gets 403. Without the transport registry thePOSTassertion fails, which confirms devframe's own check.hub-gate.test.ts: an HTTP/2-style request (:authority, noHost).dev-server-builder.test.ts: the hub options built fromangular.json, run through the real@angular/builddev server schema.Notes for reviewers
sslandportdon't matter.allowedHosts: truewarnings still name Vite'sserver.allowedHosts. Rewording them for the builder and the hub can come in a follow-up.Summary by CodeRabbit
allowedHosts: trueremains available for broader access.:authorityare now checked using the same host rules as requests usingHost.