docfast/src/__tests__
OpenClaw Agent 424a16ed8a
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 13m10s
fix: prevent error message information disclosure + standardize error handling (TDD)
Security & Consistency Fixes:
- Convert routes no longer leak internal error messages (err.message)
- Templates route no longer exposes error details via 'detail' field
- Admin cleanup endpoint no longer exposes error message
- Standardized QUEUE_FULL response: 429 → 503 (Service Unavailable)
- Added missing PDF_TIMEOUT handling: returns 504 Gateway Timeout
- Generic 500 errors now return 'PDF generation failed.' without internals

TDD Approach:
1. RED: Created error-responses.test.ts with 11 failing tests
2. GREEN: Fixed src/routes/convert.ts, templates.ts, and index.ts
3. Updated convert.test.ts to expect new correct status codes
4. All 541 tests pass

Before: 'PDF generation failed: Puppeteer crashed: SIGSEGV in Chrome'
After:  'PDF generation failed.' (internals logged, not exposed)

Closes security audit findings re: information disclosure
2026-03-07 17:05:54 +01:00
..
api.test.ts Fix OpenAPI PdfOptions schema: add missing format values, waitUntil field, and template size limits 2026-03-04 11:09:19 +01:00
app-routes.test.ts fix: OpenAPI spec accuracy — hide internal endpoints, mark signup/verify deprecated 2026-03-07 14:06:12 +01:00
auth.test.ts test: add auth, rate-limit, and keys service tests 2026-02-26 10:03:31 +00:00
billing.test.ts Fix BUG-099: Add TTL mechanism to provisionedSessions to prevent memory leak 2026-03-03 17:06:38 +01:00
body-limits.test.ts feat: add PDF render timing to convert and demo routes 2026-03-06 11:08:06 +01:00
browser-pool.test.ts fix: clear PDF_TIMEOUT timers after successful render, fix test unhandled rejections 2026-03-06 17:06:41 +01:00
browser-recycle.test.ts fix: clean up request interceptor in recyclePage to prevent pool contamination 2026-03-02 17:05:45 +01:00
convert-sanitized.test.ts feat: add PDF render timing to convert and demo routes 2026-03-06 11:08:06 +01:00
convert.test.ts fix: prevent error message information disclosure + standardize error handling (TDD) 2026-03-07 17:05:54 +01:00
db-utils.test.ts feat: unit tests for security/utility functions (isPrivateIP, isTransientError, markdown, escapeHtml) 2026-02-25 19:04:59 +00:00
db.test.ts test: add db retry and templates route tests 2026-02-27 10:05:34 +00:00
demo.test.ts feat: add PDF render timing to convert and demo routes 2026-03-06 11:08:06 +01:00
email-change.test.ts test: add missing email-change verify edge cases (expired, max_attempts) 2026-03-01 14:05:43 +01:00
email.test.ts add verification service and email service tests (13 new tests) 2026-02-26 07:04:39 +00:00
error-responses.test.ts fix: prevent error message information disclosure + standardize error handling (TDD) 2026-03-07 17:05:54 +01:00
errors.test.ts test: add comprehensive tests for isTransientError utility 2026-02-28 20:03:14 +01:00
examples-http-only.test.ts fix: replace stale Free Tier with Demo tier in Terms of Service 2026-03-05 14:05:34 +01:00
examples-url-to-pdf.test.ts feat: add URL-to-PDF examples to examples page 2026-03-05 17:03:23 +01:00
health.test.ts test: add route tests for signup, recover, health 2026-02-26 16:05:05 +00:00
html-utils.test.ts feat: unit tests for security/utility functions (isPrivateIP, isTransientError, markdown, escapeHtml) 2026-02-25 19:04:59 +00:00
html.test.ts fix: add .js extension to html test import (TypeScript moduleResolution) 2026-03-01 11:05:08 +01:00
keys-downgrade.test.ts fix(BUG-106): DB fallback for downgradeByCustomer and recover route 2026-03-06 20:06:04 +01:00
keys.test.ts test: add auth, rate-limit, and keys service tests 2026-02-26 10:03:31 +00:00
markdown.test.ts feat: unit tests for security/utility functions (isPrivateIP, isTransientError, markdown, escapeHtml) 2026-02-25 19:04:59 +00:00
network.test.ts feat: unit tests for security/utility functions (isPrivateIP, isTransientError, markdown, escapeHtml) 2026-02-25 19:04:59 +00:00
openapi-spec.test.ts fix: OpenAPI spec accuracy — hide internal endpoints, mark signup/verify deprecated 2026-03-07 14:06:12 +01:00
pdf-options.test.ts Add input validation for waitUntil and size limits for headerTemplate/footerTemplate 2026-03-04 11:04:46 +01:00
pdfRateLimit.test.ts test: add auth, rate-limit, and keys service tests 2026-02-26 10:03:31 +00:00
recover-db-fallback.test.ts fix(BUG-106): DB fallback for downgradeByCustomer and recover route 2026-03-06 20:06:04 +01:00
recover.test.ts test: add route tests for signup, recover, health 2026-02-26 16:05:05 +00:00
render-timing.test.ts feat: add PDF render timing to convert and demo routes 2026-03-06 11:08:06 +01:00
sanitize.test.ts refactor: deduplicate sanitizeFilename, add template+sanitize unit tests, fix esc single-quote 2026-02-25 16:04:22 +00:00
setup.ts feat: add GET /v1/usage/me endpoint for user-facing usage stats 2026-03-07 08:04:50 +01:00
signup.test.ts test: add route tests for signup, recover, health 2026-02-26 16:05:05 +00:00
templates-render-validation.test.ts feat: add PDF render timing to convert and demo routes 2026-03-06 11:08:06 +01:00
templates-route.test.ts feat: add PDF render timing to convert and demo routes 2026-03-06 11:08:06 +01:00
templates.test.ts test: add 14 comprehensive template service tests 2026-03-01 17:03:50 +01:00
terms-content.test.ts fix: replace stale Free Tier with Demo tier in Terms of Service (BUG-104) 2026-03-05 14:11:00 +01:00
usage-flush.test.ts fix: flush usage entries independently to prevent batch poisoning (BUG-100) 2026-03-04 14:04:53 +01:00
usage-me.test.ts feat: add GET /v1/usage/me endpoint for user-facing usage stats 2026-03-07 08:04:50 +01:00
usage-shutdown.test.ts fix: await flushDirtyEntries during shutdown to prevent usage data loss 2026-03-07 08:03:56 +01:00
usage.test.ts add unit tests for usage middleware (14 tests) 2026-02-26 13:04:15 +00:00
verification.test.ts add verification service and email service tests (13 new tests) 2026-02-26 07:04:39 +00:00