1a1ac3e4 Added query parameter filtering to local development and tests (#29888)
closes https://linear.app/ghost/issue/NY-1515/find-a-way-to-catch-stripped-query-parameter-issue-in-development
Local development and tests previously bypassed Ghost(Pro)'s query
parameter filtering, allowing new parameters to work locally but fail
after deployment. This makes Ghost the canonical source for the policy
and applies it before requests reach Ghost's route handlers, so missing
parameters are caught earlier. The production allowlist must still be
updated separately until infrastructure consumes Ghost's exported
policy.
## Summary
- add a canonical, machine-readable policy containing documented public
and Content API query parameters
- validate the policy with Zod, including its schema version, required
fields, valid names, and duplicate entries
- filter frontend and Content API requests against their respective
allowlists while preserving API and internal-route exemptions
- enable filtering in the root development environment, Ghost's
server-side test configurations, and Playwright test containers while
leaving it disabled by default
- preserve Express 4 and Express 5 query handling, repeated allowed
parameters, and warning logs for stripped parameters
- add a TypeScript exporter that validates and writes the policy
deterministically for future infrastructure integration
- cover policy validation, exporting, filtering, exemptions, and query
parsing behavior with tests
---------
Co-authored-by: Steve Larson <9larsons@gmail.com> 1a1ac3e4 Added query parameter filtering to local development and tests (#29888)
closes https://linear.app/ghost/issue/NY-1515/find-a-way-to-catch-stripped-query-parameter-issue-in-development
Local development and tests previously bypassed Ghost(Pro)'s query
parameter filtering, allowing new parameters to work locally but fail
after deployment. This makes Ghost the canonical source for the policy
and applies it before requests reach Ghost's route handlers, so missing
parameters are caught earlier. The production allowlist must still be
updated separately until infrastructure consumes Ghost's exported
policy.
## Summary
- add a canonical, machine-readable policy containing documented public
and Content API query parameters
- validate the policy with Zod, including its schema version, required
fields, valid names, and duplicate entries
- filter frontend and Content API requests against their respective
allowlists while preserving API and internal-route exemptions
- enable filtering in the root development environment, Ghost's
server-side test configurations, and Playwright test containers while
leaving it disabled by default
- preserve Express 4 and Express 5 query handling, repeated allowed
parameters, and warning logs for stripped parameters
- add a TypeScript exporter that validates and writes the policy
deterministically for future infrastructure integration
- cover policy validation, exporting, filtering, exemptions, and query
parsing behavior with tests
---------
Co-authored-by: Steve Larson <9larsons@gmail.com>