Title: bug: buildResourceUrl strips port — ACL matching fails on non-standard ports · Issue #250 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
Open Graph Title: bug: buildResourceUrl strips port — ACL matching fails on non-standard ports · Issue #250 · JavaScriptSolidServer/JavaScriptSolidServer
X Title: bug: buildResourceUrl strips port — ACL matching fails on non-standard ports · Issue #250 · JavaScriptSolidServer/JavaScriptSolidServer
Description: Summary buildResourceUrl in src/auth/middleware.js uses request.hostname which in Fastify returns the hostname without port (e.g. localhost). But ACLs reference full URLs with port (e.g. http://localhost:4443/alice/public/premium.json). ...
Open Graph Description: Summary buildResourceUrl in src/auth/middleware.js uses request.hostname which in Fastify returns the hostname without port (e.g. localhost). But ACLs reference full URLs with port (e.g. http://loc...
X Description: Summary buildResourceUrl in src/auth/middleware.js uses request.hostname which in Fastify returns the hostname without port (e.g. localhost). But ACLs reference full URLs with port (e.g. http://loc...
Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/250
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: buildResourceUrl strips port — ACL matching fails on non-standard ports","articleBody":"## Summary\n\n`buildResourceUrl` in `src/auth/middleware.js` uses `request.hostname` which in Fastify returns the hostname without port (e.g. `localhost`). But ACLs reference full URLs with port (e.g. `http://localhost:4443/alice/public/premium.json`).\n\nThe constructed resourceUrl `http://localhost/alice/...` never matches the ACL's `accessTo` of `http://localhost:4443/alice/...`, so conditional authorizations (like PaymentCondition) fail even when they should pass.\n\n## Reproduction\n\n1. `jss start --pay` (runs on port 4443)\n2. Create resource and ACL with `accessTo: http://localhost:4443/alice/public/premium.json`\n3. PaymentCondition with amount 0, deposit sats, try to access\n4. Gets 402 even though balance exists — because URL doesn't match\n\n## Fix\n\nUse `request.headers.host` (includes port) instead of `request.hostname` (strips port) in `buildResourceUrl`.\n\n## Impact\n\nAffects all ACL matching on non-standard ports. Default port 4443 is always affected. Only port 80/443 would accidentally work since browsers omit those from Host headers.","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-04-03T00:54:16Z","url":"https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/250"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fd1f1036-1f73-a8f8-d1b1-d7b60042ee9a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E6DC:24E38:1366DA:197BAD:6B039763 |
| html-safe-nonce | 1ca514ba84cd63f1cd5dccf7956fb4e0e9014ef3a07374e120e1da577e12d80b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkRDOjI0RTM4OjEzNjZEQToxOTdCQUQ6NkIwMzk3NjMiLCJ2aXNpdG9yX2lkIjoiNzQ4MDIyNDUwMTc1MDUzNjAzNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6d3c6678980b54a1608f9c91cdf0e75481a48ecea67ef303f75f7fc0c92bd31c |
| hovercard-subject-tag | issue:4197660318 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/JavaScriptSolidServer/250/issue_layout |
| twitter:image | https://opengraph.githubassets.com/445d190b105a2adc1ab896e5ff26e432cddc28b9a3c331435efb6f9850af6451/JavaScriptSolidServer/JavaScriptSolidServer/issues/250 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/445d190b105a2adc1ab896e5ff26e432cddc28b9a3c331435efb6f9850af6451/JavaScriptSolidServer/JavaScriptSolidServer/issues/250 |
| og:image:alt | Summary buildResourceUrl in src/auth/middleware.js uses request.hostname which in Fastify returns the hostname without port (e.g. localhost). But ACLs reference full URLs with port (e.g. http://loc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melvincarvalho |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 958025407 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 958025407 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width