Skip to content

[haxcms-nodejs] Fix app-store auth regression + standardize system API path - #21

Merged
btopro merged 2 commits into
mainfrom
conformance/v1-normalization
Aug 6, 2026
Merged

[haxcms-nodejs] Fix app-store auth regression + standardize system API path#21
btopro merged 2 commits into
mainfrom
conformance/v1-normalization

Conversation

@btopro

@btopro btopro commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to merged PR #20. Two regression fixes noticed during post-merge testing of the app-store endpoint.

Changes

Standardize system API path in connection-settings (parity with PHP)

  • connectionSettings.js: the system API base path is now always absolute (/{basePath}system/api/), mirroring PHP (HAXCMS.php appJWTConnectionSettings forces a leading slash). Previously Node emitted a relative systemRequestBase which the browser resolved site-scoped (/_sites/<name>/system/api/v1/...) when called from a site context. That worked on Node (which registers site-scoped system routes) but diverged from PHP and was not standardized.

Restore app-store site-token-only auth stance (fix regression)

  • app.js normalizeSiteApiSecurityPolicy: now distinguishes siteTokenHeader-only (site-token-only) from bearerAuth + siteTokenHeader (authenticated-site). The app-store GET declares siteTokenHeader alone, so it maps to site-token-only — the handler (generateAppStore.js) validates the site token against the server-side active user, no bearer JWT required.
  • The conformance work in [haxcms-nodejs] v1 API conformance normalization (canonical spec + Node fixes) #20 mapped siteTokenHeaderauthenticated-site unconditionally, which required a bearer-derived userName at the router (enforceSystemApiSiteTokenPolicy). The front-end appStore fetch sends the site token but not a bearer JWT, so the call was rejected (403).
  • provider-search (bearerAuth + siteTokenHeader) stays authenticated-site and is unaffected. No site-spec routes declare siteTokenHeader-only, so the site API is unaffected.

Validation

  • node --check on both changed files → OK
  • Surgical: app-store GET is the only route in either spec declaring siteTokenHeader without bearerAuth

Related

Co-Authored-By: Oz oz-agent@warp.dev

btopro and others added 2 commits August 6, 2026 14:30
The system API base path is now always absolute (/{basePath}system/api/)
mirroring PHP (HAXCMS.php appJWTConnectionSettings forces a leading slash).
Previously Node emitted a relative systemRequestBase which resolved against
the current page URL, producing a site-scoped system endpoint
(/_sites/<name>/system/api/v1/...) when called from a site context. That
worked on Node (which registers site-scoped system routes) but diverged from
PHP and was not standardized.

Regression noticed during post-merge testing: the appStore URL generated by
connection-settings resolved site-scoped on Node vs root-level on PHP.

Co-Authored-By: Oz <oz-agent@warp.dev>
normalizeSiteApiSecurityPolicy now distinguishes siteTokenHeader-only
('site-token-only') from bearerAuth+siteTokenHeader ('authenticated-site').
The app-store GET declares siteTokenHeader alone, so it maps to
'site-token-only' — the handler (generateAppStore.js) validates the site
token against the server-side active user, no bearer JWT required.

Previously the conformance work mapped siteTokenHeader to 'authenticated-site'
unconditionally, which required a bearer-derived userName at the router
(enforceSystemApiSiteTokenPolicy). The front-end appStore fetch sends the
site token but not a bearer JWT, so both backends rejected the call
(Node 403, PHP 401). This restores the original handler-validated behavior.

provider-search (bearerAuth+siteTokenHeader) stays 'authenticated-site' and
is unaffected. No site-spec routes declare siteTokenHeader-only, so the
site API is unaffected.

Co-Authored-By: Oz <oz-agent@warp.dev>
Copilot AI lite review requested due to automatic review settings August 6, 2026 18:45
@codesandbox

codesandbox Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@btopro
btopro merged commit f20ad2f into main Aug 6, 2026
1 check passed
@btopro
btopro removed the request for review from Copilot August 6, 2026 19:18
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