Skip to content

fix(extension): route passthrough, bypass and response pass through the engine like fastapi-guard - #40

Merged
rennf93 merged 1 commit into
masterfrom
fix/engine-parity
Oct 15, 2026
Merged

rennf93 merged 1 commit into
masterfrom
fix/engine-parity

Conversation

@rennf93

@rennf93 rennf93 commented Oct 15, 2026

Copy link
Copy Markdown
Member

Summary

Aligns the Flask adapter with fastapi-guard's engine routing.

  • Passthrough goes through the engine BypassHandler.handle_passthrough: a request with no client address gets the fail_secure 403, and excluded paths stay scoped (checks still run) instead of being skipped.
  • The route all-checks bypass goes through BypassHandler.handle_security_bypass, calling the real view and applying the response modifier. Its response, like blocked and preflight responses, skips the response pass.
  • _after_request only runs the engine response pass for responses that came out of the view, so blocked, preflight and bypass responses emit no request metrics.
  • global_behavior_rules are passed to the engine response pass.

The test that asserted the old no-client-address pass-through now asserts the 403.

Tests

New tests/test_engine_parity.py uses the Flask test client against the real engine handlers. Full suite with --cov-fail-under=100 and pre-commit run --all-files pass.

Closes #39

…he engine like fastapi-guard

Use the engine BypassHandler for passthrough (fail_secure 403 without a client address) and for the route all-checks bypass, which now calls the real view. Run the response pass only for responses produced by the view, so blocked, preflight and bypass responses emit no request metrics. Pass global behavior return rules to the engine response pass.
@rennf93 rennf93 self-assigned this Oct 15, 2026
@github-actions github-actions Bot added area: extension Touches flaskapi_guard/extension.py (Flask extension hook) tests Test suite changes labels Oct 15, 2026
@rennf93
rennf93 merged commit a8695ec into master Oct 15, 2026
13 checks passed
@rennf93
rennf93 deleted the fix/engine-parity branch October 15, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: extension Touches flaskapi_guard/extension.py (Flask extension hook) tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flask adapter diverges from the engine request/response flow used by fastapi-guard

1 participant