Skip to content

Reject Turnstile responses that omit an expected action #9

Closed

Description

@LunaStev

Problem

TurnstileVerifier.Verify checks the returned action only when both result.Action and the caller's expected action are non-empty:

if result.Action != "" && action != "" && result.Action != action {
    return ErrChallengeFailed
}

When a caller requires an action such as login, a successful verification response with an empty action is therefore accepted instead of failing closed. The existing test covers a mismatched non-empty action but not an omitted one.

Completion criteria

  • When the caller supplies a non-empty expected action, require the verification response action to match it exactly, including rejecting an empty response action.
  • Preserve successful verification when the expected and returned actions match.
  • Preserve the current behavior for callers that intentionally pass an empty expected action.
  • Add focused tests for matching, mismatched, and omitted response actions.
  • Keep network, token, status-code, and disabled-verifier behavior unchanged.

Difficulty: easy.

Activity

  1. added
    bug
    good first issue
    help wanted
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions