Skip to content

Conversation

@vdinica-mdsol
Copy link

@vdinica-mdsol vdinica-mdsol commented Nov 12, 2025

Using exact path matching for exempt paths does not provide a flexible way of specifying which request paths should be exempt from mauth checks.

Added an optional substring based check.

Copilot AI review requested due to automatic review settings November 12, 2025 11:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds optional substring/prefix matching functionality for exempt paths in the MAuth middleware. When exempt_prefix_match=True is enabled, paths that start with exempt prefixes (e.g., /health matching /health/live) will bypass authentication, while preventing false matches (e.g., /api not matching /api-admin).

Key changes:

  • Added is_exempt_request_path() utility function for prefix-based path matching
  • Updated WSGI and ASGI middlewares to support exempt_prefix_match parameter
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mauth_client/utils.py Added is_exempt_request_path() function to handle prefix matching with path separator validation
mauth_client/middlewares/wsgi.py Added exempt_prefix_match parameter and integrated prefix matching logic
mauth_client/middlewares/asgi.py Added exempt_prefix_match parameter and integrated prefix matching logic
tests/utils_test.py Added comprehensive test suite for is_exempt_request_path() covering edge cases
tests/middlewares/wsgi_test.py Added integration tests for WSGI middleware with prefix matching enabled
tests/middlewares/asgi_test.py Added integration tests for ASGI middleware with prefix matching enabled
pyproject.toml Bumped version from 1.6.6 to 1.6.7
CHANGELOG.md Documented the new feature in version 1.6.7

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vdinica-mdsol
Copy link
Author

PR opened for discussions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants