Skip to content

feat(metrics): reject unknown query parameters - #416

Open
thlpkee20-wq wants to merge 2 commits into
Agentpay-Org:mainfrom
thlpkee20-wq:feature/metrics-02-validation
Open

feat(metrics): reject unknown query parameters#416
thlpkee20-wq wants to merge 2 commits into
Agentpay-Org:mainfrom
thlpkee20-wq:feature/metrics-02-validation

Conversation

@thlpkee20-wq

Copy link
Copy Markdown
Contributor

Closes #388

/api/v1/metrics and /api/v1/stats now reject any query parameter
with a structured 400 invalid_request, instead of silently ignoring
typos — neither route accepts any parameter today.

Test plan

  • npm run build
  • npm run lint
  • npm test — targeted run of metrics.test.js,
    lifetime-metrics.test.js, settlement-metrics.test.js,
    etag-events-stats.test.js, routes/operational.test.js: 20/20
    passing.

Note

Stacked on #415 (same fork-only caveat as noted on other PRs in this
series — I can't target a non-main base). The validation-specific
change is the two rejectUnknownQueryParams([]) calls in
src/routes/metrics.ts.

The health/deep checks handler inlined its own base64url cursor
encode/decode and page-slicing logic. Extracted it into a generic
paginateByCursor() in src/cursorPagination.ts (mirroring the offset
pagination helper already shared between the api-keys and webhooks list
endpoints) and refactored the health handler to use it. No behavior
change; this is the shared entry point subsequent metrics pagination
work will build on.
/api/v1/metrics and /api/v1/stats now reject any query parameter with a
structured 400 invalid_request; neither route accepts parameters today.
@mikewheeleer

Copy link
Copy Markdown
Contributor

polished work @thlpkee20-wq, merging it in 🚀

1 similar comment
@mikewheeleer

Copy link
Copy Markdown
Contributor

polished work @thlpkee20-wq, merging it in 🚀

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.

Validate and bound metrics request inputs against malformed payloads

2 participants