Document actual debug routes and fix rate limiter IP resolution#60
Open
GsCommand wants to merge 1 commit into
Open
Document actual debug routes and fix rate limiter IP resolution#60GsCommand wants to merge 1 commit into
GsCommand wants to merge 1 commit into
Conversation
…smoke test dead endpoint - src/middleware/rateLimit.mjs: use req.ip (Express trust-proxy-resolved) instead of reading X-Forwarded-For directly. The previous code allowed any caller to inject an arbitrary IP via the X-Forwarded-For header and bypass per-IP rate limiting entirely. With trust proxy: 1 set in server.mjs, req.ip is already correctly resolved by Express to the first untrusted hop. - README.md: correct the debug routes section. The documented routes (/debug/env, /debug/enskey, /debug/validators, POST /debug/prewarm) do not exist in server.mjs. The actual implemented routes are /debug/signer, /debug/ens, and /debug/schema/:verb. Updated to match implementation. - tests/smoke.mjs: remove reference to non-existent /debug/env endpoint in the error-branch debug path. Replace with /debug/signer which is the implemented equivalent. The dead reference would have produced a 404 JSON body in debug output, obscuring the actual signer error. AUDIT: remaining CRITICAL issues (no auth on verb routes, no 422 responses) require architectural decisions and are flagged for engineering review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR corrects documentation to match the actual implemented debug API surface and fixes a security issue in the rate limiter's IP resolution logic.
Key Changes
Documentation updates (README.md):
/executeendpoint to the documented API surface/debug/env,/debug/enskey,/debug/validators,/debug/prewarm) with the actually implemented routes:GET /debug/signer— active signer state, kid, fingerprint, and boot errorsGET /debug/ens— ENS resolution result with optional query parametersGET /debug/schema/:verb— schema compilation status for a given verb/debug/schema/:verbinstead of the non-existent/debug/prewarmand/debug/validators/debug/schemafetchroute (no longer relevant)Rate limiter security fix (src/middleware/rateLimit.mjs):
X-Forwarded-Forheader directly to using Express'sreq.ip(which respects the trust proxy setting)Test updates (tests/smoke.mjs):
/debug/signerendpoint instead of the non-existent/debug/envContract Impact
No hard contracts broken. Documentation now accurately reflects the implemented runtime API surface. Rate limiter behavior is more secure and aligns with Express best practices for proxy trust.
https://claude.ai/code/session_016igMwkFir2FkLQCHL6a34z