Skip to content

fix: address OWASP security review findings for v2 API endpoints#30

Open
mukama wants to merge 10 commits intotetherto:developfrom
mukama:fix/v2-api-asana-reviews
Open

fix: address OWASP security review findings for v2 API endpoints#30
mukama wants to merge 10 commits intotetherto:developfrom
mukama:fix/v2-api-asana-reviews

Conversation

@mukama
Copy link
Contributor

@mukama mukama commented Mar 10, 2026

Summary

Addresses OWASP security review findings flagged by Roberto for 5 API v2 endpoints:

  • GET /auth/metrics/power-mode/timeline — Implement limit query parameter (default 10080, max 50000) to cap result size. Previously limit was in the cache key but unused in the handler (OWASP 4)
  • Timestamp validation — Add minimum: 0 to all start/end schema properties across metrics and pools schemas to reject negative timestamps (OWASP 4, 8)
  • Error message sanitization — Add SAFE_ERROR_MESSAGES allowlist; unknown errors now return generic "Bad Request" instead of leaking internal details (OWASP 8)
  • Security response headers — Add X-Content-Type-Options: nosniff and Cache-Control: no-store via onSend hook (OWASP 8)

Endpoints addressed

Endpoint OWASP Issues
GET /auth/site/status/live 8, 10
GET /auth/pools 3, 4, 8, 10
GET /auth/metrics/hashrate 8, 9
GET /auth/metrics/efficiency 8, 9
GET /auth/metrics/power-mode/timeline 4, 8, 9, 10

mukama added 5 commits March 9, 2026 14:16
The limit param was in the cache key but unused in the handler.
Now reads limit from query (default 10080) and truncates results.
Adds schema validation with min/max bounds.
Prevents negative timestamps from passing schema validation
on balanceHistory and poolStatsAggregate endpoints.
Adds SAFE_ERROR_MESSAGES allowlist to prevent leaking internal
error details. Adds X-Content-Type-Options and Cache-Control
security headers via onSend hook.
@mukama mukama changed the base branch from main to develop March 10, 2026 10:52
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.

2 participants