Skip to content

fix(get-block): sanitize public error responses and return 404 for unarchived epochs - #109

Merged
augustin-cheron merged 1 commit into
mainfrom
fix/get-block-sanitize-errors
Dec 1, 2026
Merged

augustin-cheron merged 1 commit into
mainfrom
fix/get-block-sanitize-errors

Conversation

@augustin-cheron

Copy link
Copy Markdown
Collaborator

Summary

  • Sanitize all public error responses across GET /block/:slot.{json,bin}, GET /block-lite/:slot.json, and GET /block/:slot.resolution so internal storage backend details (S3 GET, R2 GET ... via <binding>, archive prefixes, .index / .marker object keys, and upstream internal error strings) are never leaked to clients, while retaining full diagnostics in internal Worker observability logs via console_error!.
  • Return uncached HTTP 404 for unarchived/future epochs instead of 502 or false result: null:
    • JSON routes return HTTP 404 (Cache-Control: no-store) with Solana JSON-RPC -32004 ("Block not available for slot <slot>").
    • Wincode .bin routes return HTTP 404 (Cache-Control: no-store) with {"ok": false, "error": {"code": "block_unavailable", ...}}.
    • Preserves 503 recent_unavailable when recent_archive_lookup is active (ARCHIVE_LOOKUP_REQUIRED) and still treats missing data blobs (.zstd, registries) within an existing epoch as 502 backend errors.

Verification

  • Unit tests (classifies_missing_primary_index_objects_without_matching_other_failures)
  • Full Miniflare workerd integration suite (scripts/test-worker.mjs) across sparse and dense index layouts verifying unarchived slot 404 (-32004 / block_unavailable) and zero path/backend leakage on 404 & 502 responses

@augustin-cheron
augustin-cheron merged commit f4d95dc into main Dec 1, 2026
6 checks passed
@augustin-cheron
augustin-cheron deleted the fix/get-block-sanitize-errors branch December 1, 2026 07:58
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.

1 participant