Distinguish redirect loop and redirect chain timeout errors#114
Draft
heydemoura wants to merge 1 commit into
Draft
Distinguish redirect loop and redirect chain timeout errors#114heydemoura wants to merge 1 commit into
heydemoura wants to merge 1 commit into
Conversation
Implement detection for two distinct redirect failure modes: - ErrorRedirectLoop (9): when a redirect chain visits the same URL twice - ErrorRedirectTimeout (10): when following redirects exceeds the site timeout Both use the same timeout limit as regular checks (NET_COMMS_TIMEOUT or per-site TimeoutSeconds) to prevent veriflier from getting stuck on exploitable long-redirect-chain attacks that would consume excessive CPU time. The redirect chain timeout is identified separately from ErrorTimeout to distinguish between regular connection timeouts and redirect-induced timeouts, improving observability and incident diagnosis. New metrics: scheduler.page.check.redirect_timeout.count Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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
Add detection for two distinct redirect failure modes that were previously conflated:
Redirect Loop (
ErrorRedirectLoop = 9): Detects when a redirect chain visits the same URL twice via URL deduplication. Maps to"redirect"status type.Redirect Chain Timeout (
ErrorRedirectTimeout = 10): Detects when following a redirect chain exceeds the site's timeout limit (same as regular check timeout). Maps to"intermittent"status type.Rationale
Long-running redirect chains present an exploitable attack surface for Jetmon's veriflier:
Implementation Details
New Error Constants
ErrorRedirectLoop = 9— redirect chain cycle detectedErrorRedirectTimeout = 10— redirect chain exceeded timeoutDetection Mechanism
seenURLsmap in theCheckRedirecthookcheckStart := time.Now())errRedirectLoop,errRedirectChainTimeout) that survive*url.ErrorwrappingError Classification
Checks for sentinel errors via
errors.Is()before generic checks:Time Limit
Uses the same timeout as regular checks —
NET_COMMS_TIMEOUTor per-siteTimeoutSeconds. No new config key required.Test Coverage
TestCheckRedirectLoop: Verifies A→B→A cycle detectionTestCheckRedirectChainTimeout: Verifies slow redirects timeout correctlyTestResultStatusType: Updated to test both new error codesMetrics
New StatsD counter:
scheduler.page.check.redirect_timeout.countBoth loop and timeout cases are tracked separately in orchestrator for debugging.
Files Changed
internal/checker/checker.go— error constants, sentinel errors, detection logic, error classificationinternal/orchestrator/orchestrator.go— tracking, metrics, logginginternal/checker/checker_test.go— new test cases🤖 Generated with Claude Code