Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor authentication middleware to include project_id in request tracing #12

Merged
merged 2 commits into from
Jul 25, 2023

Commits on Jul 25, 2023

  1. A couple of debugging experience fixes

    1. Allow passing --project-id to any subcommand instead of only admin commands.
    2. A stricter secret api key matching using regex. Only matching with the prefix was too aggressive matching stuff like "_task_something".
    3. Add IP addresses to request tracing
    MohamedBassem committed Jul 25, 2023
    Configuration menu
    Copy the full SHA
    1bcdfa1 View commit details
    Browse the repository at this point in the history
  2. Refactor authentication middleware to include project_id in request t…

    …racing
    
    Change the main authentication middleware to be a top level middleware that
    injects the authentication status into the request extensions. The per route
    middleware can then just read the AuthenticationStatus and take decisions based
    on it. This change allows us to capture the project id in the request tracing
    which wasn't possible before because it get invoked just before the request handlers
    (due to how middleware ordering works).
    
    
    The main change in behavior here is that the middleware will be invoked regardless of
    whether the route requires authentication or not. This is ok, unless the customer passes
    malformed auth headers in which case the request would currently fail with `BadRequest`
    while it would have succeeded before. Note, that we currently don't have any unauthenticated
    endpoints, so no "real" change in behavior here.
    MohamedBassem committed Jul 25, 2023
    Configuration menu
    Copy the full SHA
    abcc1b8 View commit details
    Browse the repository at this point in the history