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

Update TokenVerifier to verify AuthZ too #8063

Merged

Conversation

creydr
Copy link
Member

@creydr creydr commented Jul 2, 2024

Updates the TokenVerifier to verify AuthZ too

@creydr creydr requested a review from pierDipi July 2, 2024 09:11
@knative-prow knative-prow bot requested a review from lionelvillard July 2, 2024 09:12
@knative-prow knative-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 2, 2024
Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 1.53846% with 64 lines in your changes missing coverage. Please review.

Project coverage is 67.76%. Comparing base (96c30bd) to head (80aca3b).
Report is 7 commits behind head on main.

Files Patch % Lines
pkg/auth/token_verifier.go 0.00% 64 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8063      +/-   ##
==========================================
- Coverage   67.92%   67.76%   -0.16%     
==========================================
  Files         366      366              
  Lines       17154    17192      +38     
==========================================
  Hits        11651    11651              
- Misses       4781     4819      +38     
  Partials      722      722              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@creydr
Copy link
Member Author

creydr commented Jul 2, 2024

@pierDipi could you check on this?

@creydr creydr force-pushed the update-tokenverifier-to-verify-authz-too branch from 1d0f605 to 7555093 Compare July 2, 2024 09:31
@creydr creydr force-pushed the update-tokenverifier-to-verify-authz-too branch from 3e408da to 80aca3b Compare July 2, 2024 10:19
Comment on lines +131 to +138
- apiGroups:
- eventing.knative.dev
resources:
- eventpolicies
verbs:
- get
- list
- watch
Copy link
Member Author

Choose a reason for hiding this comment

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

This can be a bit confusing. The webhook is not directly using the EventPolicyLister. But the SinkBinding uses the OIDCTokenProvider from the auth package. In this package we also have the OIDCTokenVerifier, which uses the EventPolicyLister (via eventpolicylister.Get()) and thus registers the informer in its init() method

@creydr
Copy link
Member Author

creydr commented Jul 2, 2024

/test reconciler-tests

- apiGroups:
- eventing.knative.dev
resources:
- eventtypes
Copy link
Member

Choose a reason for hiding this comment

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

is this related?

Copy link
Member Author

Choose a reason for hiding this comment

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

Before my PR, it was

  - apiGroups:
      - eventing.knative.dev
    resources:
      - eventtypes
    verbs:
      - create
      - get
      - list
      - watch

since we need the same (except for create) for the eventpolicies and they are in the same api group as eventtypes, I merged them and created one dedicated for eventtypes create: -->

  - apiGroups:
      - eventing.knative.dev
    resources:
      - eventtypes
      - eventpolicies
    verbs:
      - get
      - list
      - watch

  - apiGroups:
      - eventing.knative.dev
    resources:
      - eventtypes
    verbs:
      - create

Copy link
Member

@pierDipi pierDipi left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jul 4, 2024
Copy link

knative-prow bot commented Jul 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: creydr, pierDipi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot merged commit 332d974 into knative:main Jul 4, 2024
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants