Do not list system-scope entities to unauthenticated callers (/x/api/v1/entities)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, openapi, php
- Domain
- authentication, backend-api-design
Research direction
Start with src/siteRoutes/v1/entities.js in haxcms-nodejs and system/backend/php/lib/siteRoutes/v1/entities.php in haxcms-php, then inspect the shared descriptor builder and each route’s auth checks. Add tests in both backends for unauthenticated, authenticated, JWT-only, and wrong-user-token requests, including the version surfaces from #3174. Update both site OpenAPI specs identically; done means both backends meet the acceptance criteria and the specs match.
Written by the indexing model from the issue text.
Description
Summary
GET /x/api/v1/entities is public by default (the site spec has global security: []) and returns entity descriptors merged across both site and system scopes. Unauthenticated callers can therefore list system-scope entities and their endpoints, and ?scope=system is honored with no auth check. This becomes a bigger fingerprinting surface once plugins contribute entities, since an unauthenticated plugin list would reveal the build.
Split out of https://github.com/haxtheweb/issues/issues/3174, whose version-exposure work landed in https://github.com/haxtheweb/haxcms-nodejs/pull/152 and https://github.com/haxtheweb/haxcms-php/pull/712.
Where it lives today
- haxcms-nodejs:
src/siteRoutes/v1/entities.js(buildEntityDescriptorsFromRegistry(registry, scope)readsreq.query.scopewith no auth check) - haxcms-php:
system/backend/php/lib/siteRoutes/v1/entities.php(reads$_GET['scope']the same way) /system/api/v1/entitiesshares the same descriptor builder
Proposed
- Unauthenticated
/x/api/v1/entitiesreturns only site-scope descriptors, regardless of?scope=. - Callers with both a valid JWT and
X-HAXCMS-User-Tokenkeep the current merged listing and?scope=filtering. - JWT only: existing "user token header is required" behavior. Wrong user token: existing "Invalid" behavior. No new error shapes.
- Identical behavior in both backends, with the site OpenAPI specs updated and kept identical.
Acceptance criteria
- Unauthenticated listing contains no system-scope descriptors, with or without
?scope=system(tests in both backends) - Authenticated listing unchanged (tests in both backends)
- JWT-only and wrong-user-token cases tested for this route
- Also add the JWT-only and wrong-user-token tests that #3174 asked for on the version surfaces, which were not part of the merged PRs
- Site OpenAPI specs updated in both backends and kept identical
- One PR per repo, cross-linked, not merged by the author
Generated by Claude Code
- Dominant language
- JavaScript
- Stars
- 12
- Forks
- 5
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from haxtheweb/issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
-
CLI: site:theme / site:rebuild fail rendering service-worker.js (Twig constant() not registered)Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
All issues in haxtheweb/issues
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
good first issue tests
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug role: dev-lead
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
briangwalker/TrussExplorer#424 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
eliasstravik/herdr-projects#1032 ·
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 90/100