Skip to content

Tornado adapter diverges from the engine request/response flow used by fastapi-guard #38

Closed

Description

@rennf93

Summary

I audited the Tornado adapter against fastapi-guard, the reference adapter, and found it diverges from the engine request and response flow.

  • _check_bypass reimplements passthrough. A request with no client address is fully bypassed instead of getting the engine fail_secure 403, and an excluded path is fully bypassed instead of being scoped by the engine.
  • The route all-checks bypass is reimplemented without calling the real handler through the engine bypass handler.
  • The response pass runs from on_finish, after the response has already been sent. The result is discarded, so custom_response_modifier and return-rule header changes never reach the client, the body is read from an already-flushed _write_buffer so body-based return rules see nothing, and global behavior return rules are never passed.
  • Every request (blocked, excluded, bypassed) emits request metrics.
  • Security headers and CORS are reimplemented before the handler instead of coming from the engine response pass.
  • A Redis failure during initialization is a 500 instead of the 503 with Retry-After that fastapi-guard returns.

Expected

Route through the engine exactly where fastapi-guard does, and run the engine response pass on the outgoing response before it is flushed.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions