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

noop authenticator doesn't skip id_token mutator #669

Closed
lcsanchez opened this issue Mar 18, 2021 · 5 comments
Closed

noop authenticator doesn't skip id_token mutator #669

lcsanchez opened this issue Mar 18, 2021 · 5 comments
Labels
stale Feedback from one or more authors is required to proceed.

Comments

@lcsanchez
Copy link

lcsanchez commented Mar 18, 2021

Describe the bug

Using the noop authenticator doesn't behave as describe by the authn pipeline docs.

The noop handler tells ORY Oathkeeper to bypass authentication, authorization, and mutation

When I make a request that matches the rule below, the id_token mutator being invoked and a JWT token with sub: "" is injected into the Authorization header.

Reproducing the bug

Steps to reproduce the behavior:

Server configuration

access_rules:
  repositories:
    - file://config/access-rules.json

authorizers:
  allow:
    enabled: true
  deny:
    enabled: true

authenticators:
  noop:
    enabled: true
  oauth2_introspection:
    enabled: true
    config:
      introspection_url: https://hydra-admin.local/oauth2/introspect

mutators:
  noop:
    enabled: true
  id_token:
    enabled: true
    config:
      issuer_url: http://oathkeeper.local/
      jwks_url: file://config/secret.jwks
[{
  ...
  "authenticators": [
    {
      "handler": "oauth2_introspection",
      "config": {
        "required_scope": []
      }
    },
    { 
      "handler": "noop" 
    }
  ],
  "authorizer": { "handler": "allow" },
  "mutators": [{ "handler": "id_token" }],
  "errors": [{ "handler": "json" }]
}]

Expected behavior

I would expect that when a request is made that matches the rule and no Authorization header is specified, the request is forwarded with no Authorization header value present.

Environment

  • Version: v0.38.9-beta.1
  • Environment: OS X, Docker

Additional context

I've been able to reproduce locally and debug the code a bit, here's what I found:

  1. The request handler initializes the empty subject
  2. noop authenticator is found and request gets flagged as being able to proceed (found = true).
  3. id_token mutator gets invoked with the empty subject and the JWT gets assigned to the Authorization header.

Trying to get some clarification on whether the docs are simply out of date and the behavior was changed at some point. Or if this is a bug. Thanks!

@lcsanchez
Copy link
Author

Happy to contribute a fix if I can get some guidance on what the actual behavior should be. Seems like pipeline docs do not match the current behavior.

@aeneasr
Copy link
Member

aeneasr commented Apr 14, 2021

Thank you! This is intended behaviour as the upstream service still needs to be able to verify the request. We should update the documentation here!

@github-actions
Copy link

Hello contributors!

I am marking this issue as stale as it has not received any engagement from the community or maintainers a year. That does not imply that the issue has no merit! If you feel strongly about this issue

  • open a PR referencing and resolving the issue;
  • leave a comment on it and discuss ideas how you could contribute towards resolving it;
  • leave a comment and describe in detail why this issue is critical for your use case;
  • open a new issue with updated details and a plan on resolving the issue.

Throughout its lifetime, Ory has received over 10.000 issues and PRs. To sustain that growth, we need to prioritize and focus on issues that are important to the community. A good indication of importance, and thus priority, is activity on a topic.

Unfortunately, burnout has become a topic of concern amongst open-source projects.

It can lead to severe personal and health issues as well as opening catastrophic attack vectors.

The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone.

If this issue was marked as stale erroneous you can exempt it by adding the backlog label, assigning someone, or setting a milestone for it.

Thank you for your understanding and to anyone who participated in the conversation! And as written above, please do participate in the conversation if this topic is important to you!

Thank you 🙏✌️

@github-actions github-actions bot added the stale Feedback from one or more authors is required to proceed. label Apr 15, 2022
@mmellison
Copy link

mmellison commented Aug 25, 2022

We recently ran across this, and it's making migrating a legacy app to use Oathkeeper a bit complicated.

Our legacy system uses HTTP basic authentication which is validated using some custom business logic. We were looking to use Oathkeeper during a deprecation period where users could use their legacy credentials, or if they've updated to our new environment, they would use oauth2_introspection with an id_token mutator.

The problem is, even when we use a noop authenticator in order to pass through the legacy credentials, the id_token mutator clobbers the Authorization header with a "blank" token (empty string for "sub" claim).

Using this handler is basically an allow-all configuration. It makes sense when the upstream handles access control itself or doesn't need any type of access control.

Unfortunately, based on the docs we thought the noop authenticator was a true short-circuit, and now we're having to look into a much more complex solution (routing the request based on header to bypass Oathkeeper, for example).

@yunier-sc
Copy link

Same example here. My team had to implement risky solutions in Gloo routing just to accommodate the cases that could have been easily handled by having a fallback mechanism like noop. It is unclear why it was decided to change the behaviour in #97 and 6f8ab4f : No description, no comments, nothing.

yunier-rojas added a commit to yunier-rojas/oathkeeper that referenced this issue Mar 2, 2024
## Problem Summary

This merge request addresses issue !669 surrounding the behavior
of the "noop" authentication method, which underwent changes in commit
6f8ab4f. Reverting these changes to restore the previous behavior is
challenging due to the potential for breaking existing systems. To mitigate
this risk, we propose implementing a new authenticator named "delegate" to
replicate the original behavior of the "noop" method.

## Ideal Solution

To address this issue, our proposed solution is to implement a new
authenticator named "delegate" that replicates the original behavior of the
"noop" method. This approach ensures that existing systems in production
remain stable and unaffected by changes, while also providing users who
prefer the old behavior with an option to utilize it. By introducing the
"delegate" authenticator, we mitigate the risk of breaking changes while
offering flexibility to users who require the previous behavior.

## Changes Proposed

1. **New Authenticator Module**: This MR adds a new authenticator module
named "delegate" to replicate the original behavior of the "noop" method.

3. **Integration Tests**: Integration tests will be added to validate the
functionality of the "delegate" authenticator, ensuring compatibility and
reliability.

4. **Documentation Updates**: Documentation will be updated to include
details about the new "delegate" authenticator, its configuration options,
and usage examples.

## Related Issues

ory#1152
ory#669

closes 1152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Feedback from one or more authors is required to proceed.
Projects
None yet
Development

No branches or pull requests

4 participants