Skip to content

security(appraisal-api): add basic rate limits to appraisal quote creation - #583

Open
umpireboulianne-design wants to merge 1 commit into
Sub-Rosa-Issue:mainfrom
umpireboulianne-design:fix/issue-539
Open

umpireboulianne-design wants to merge 1 commit into
Sub-Rosa-Issue:mainfrom
umpireboulianne-design:fix/issue-539

Conversation

@umpireboulianne-design

Copy link
Copy Markdown

Summary

  • Add InMemoryQuoteRateLimiter (bounded by maxKeys with expired/oldest eviction and injectable nowMs clock) and the AppraisalQuoteRateLimiter production adapter interface in services/appraisal-api/src/rate-limit.ts.
  • Wire quote rate limiting into buildAppraisalServer on unpaid POST /appraise quote creation requests, returning 429 Too Many Requests ({ "error": "rate_limit_exceeded", "retryAfterSeconds": ... }) and Retry-After / X-RateLimit-* headers when exceeded.
  • Add deterministic unit and HTTP integration tests in services/appraisal-api/src/body-limit.test.ts and document the production adapter boundary in services/appraisal-api/README.md.

Supply-chain review

  • No package scripts or dependencies changed. If changed, explain why below.
  • No .vscode/, workflow, or other editor/config file changes. If changed, list them below.
  • No lockfile changes. If changed, explain the update below.
  • No binary or font asset changes. If changed, list and justify them below.
  • I confirm no automatic task (such as preinstall/postinstall) was added.
  • I confirm no hidden executable payload (encoded blob, obfuscated command, or unexpected binary) was added.
  • Any changed executable or binary was reviewed by a maintainer.

Testing

  • node --import tsx/esm --test services/appraisal-api/src/body-limit.test.ts services/appraisal-api/src/appraisal.test.ts services/appraisal-api/src/appraisal-fixtures.test.ts services/appraisal-api/src/config.test.ts

Closes #539
Fixes #539

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.

security(high/easy): add basic rate limits to appraisal quote creation

1 participant