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

Receiver reject requests for wrong audience #3675

Merged

Conversation

creydr
Copy link
Contributor

@creydr creydr commented Feb 6, 2024

Fixes #3577

Proposed Changes

  • 🎁 Receiver: Reject requests for wrong audience

Release Note

Reject requests for wrong OIDC audience

@knative-prow knative-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/data-plane labels Feb 6, 2024
Copy link

knative-prow bot commented Feb 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: creydr

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 added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 6, 2024
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

Attention: 24 lines in your changes are missing coverage. Please review.

Comparison is base (02be94e) 74.39% compared to head (9d223c5) 62.02%.
Report is 2 commits behind head on main.

Files Patch % Lines
...ting/kafka/broker/core/oidc/TokenVerifierImpl.java 20.00% 20 Missing ⚠️
...tive/eventing/kafka/broker/receiver/main/Main.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #3675       +/-   ##
=============================================
- Coverage     74.39%   62.02%   -12.38%     
- Complexity      845      856       +11     
=============================================
  Files            97      189       +92     
  Lines          3207    12831     +9624     
  Branches        273      275        +2     
=============================================
+ Hits           2386     7958     +5572     
- Misses          654     4243     +3589     
- Partials        167      630      +463     
Flag Coverage Δ
java-unittests 74.51% <65.21%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 6, 2024
@creydr creydr changed the title [WIP] Receiver reject requests for wrong audience Receiver reject requests for wrong audience Feb 6, 2024
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 6, 2024
@creydr
Copy link
Contributor Author

creydr commented Feb 6, 2024

@pierDipi could you check on this? I also added an e2e test for this in the channel-reconciler tests:

Running E2E Channel Reconciler Tests with OIDC authentication enabled
configmap/config-features configured
Running go test with args: -tags=e2e -count=1 -race -timeout=1h ./test/e2e_new_channel/... -run OIDC
PASS test/e2e_new_channel.TestKafkaChannelOIDC/Prerequisite/ChannelImpl_goes_ready./Prerequisite (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/Prerequisite/ChannelImpl_goes_ready./Setup/install_a_KafkaChannel_named_"kafka-channel-uskirfcw" (0.07s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/Prerequisite/ChannelImpl_goes_ready./Setup (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/Prerequisite/ChannelImpl_goes_ready./Requirement/KafkaChannel_is_ready (2.02s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/Prerequisite/ChannelImpl_goes_ready./Requirement (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/Prerequisite/ChannelImpl_goes_ready./Assert/ChannelImpl_be_addressable (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/Prerequisite/ChannelImpl_goes_ready./Assert (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/Prerequisite/ChannelImpl_goes_ready./Teardown (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/Prerequisite/ChannelImpl_goes_ready. (2.09s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/Prerequisite (2.09s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Prerequisite/should_not_run_when_Istio_is_enabled (0.03s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Prerequisite/transport_encryption_is_strict (0.03s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Prerequisite/OIDC_authentication_is_enabled (0.03s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Prerequisite (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Setup (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Requirement/KafkaChannel_is_addressable (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Requirement/KafkaChannel_is_ready (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Requirement/install_source (8.07s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Requirement (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Assert/KafkaChannel_event_sent (4.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Assert/KafkaChannel_get_401_on_response (4.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Assert (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience/Teardown (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_for_wrong_OIDC_audience (12.10s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Prerequisite/should_not_run_when_Istio_is_enabled (0.02s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Prerequisite/OIDC_authentication_is_enabled (0.02s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Prerequisite/transport_encryption_is_strict (0.03s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Prerequisite (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Setup (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Requirement/KafkaChannel_is_addressable (0.03s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Requirement/KafkaChannel_is_ready (0.04s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Requirement/install_source (3.44s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Requirement (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Assert/KafkaChannel_get_401_on_response (4.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Assert/KafkaChannel_event_sent (4.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Assert (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature/Teardown (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_corrupted_OIDC_token_signature (7.48s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Prerequisite/should_not_run_when_Istio_is_enabled (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Prerequisite/transport_encryption_is_strict (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Prerequisite/OIDC_authentication_is_enabled (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Prerequisite (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Setup (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Requirement/KafkaChannel_is_addressable (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Requirement/KafkaChannel_is_ready (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Requirement/install_source (3.45s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Requirement (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Assert/KafkaChannel_get_401_on_response (660.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Assert/KafkaChannel_event_sent (660.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Assert (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token/Teardown (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_reject_event_with_expired_OIDC_token (663.46s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Prerequisite/transport_encryption_is_strict (0.04s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Prerequisite/OIDC_authentication_is_enabled (0.05s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Prerequisite/should_not_run_when_Istio_is_enabled (0.05s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Prerequisite (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Setup (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Requirement/KafkaChannel_is_addressable (0.03s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Requirement/KafkaChannel_is_ready (0.03s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Requirement/install_source (5.49s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Requirement (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Assert/KafkaChannel_event_sent (4.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Assert/KafkaChannel_get_202_on_response (4.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Assert (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token/Teardown (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_handles_event_with_valid_OIDC_token (9.55s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_populates_its_.status.address.audience_correctly/Prerequisite/OIDC_authentication_is_enabled (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_populates_its_.status.address.audience_correctly/Prerequisite (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_populates_its_.status.address.audience_correctly/Setup (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_populates_its_.status.address.audience_correctly/Requirement/KafkaChannel_is_addressable (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_populates_its_.status.address.audience_correctly/Requirement/KafkaChannel_is_ready (0.01s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_populates_its_.status.address.audience_correctly/Requirement (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_populates_its_.status.address.audience_correctly/Assert/KafkaChannel_have_audience_set (0.02s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_populates_its_.status.address.audience_correctly/Assert (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_populates_its_.status.address.audience_correctly/Teardown (0.00s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC/KafkaChannel_handles_requests_with_OIDC_tokens_correctly/KafkaChannel_populates_its_.status.address.audience_correctly (0.04s)
PASS test/e2e_new_channel.TestKafkaChannelOIDC (708.72s)
PASS test/e2e_new_channel

DONE 77 tests in 712.438s

@creydr
Copy link
Contributor Author

creydr commented Feb 6, 2024

/retest-required

@Cali0707 Cali0707 removed the request for review from odacremolbap February 6, 2024 16:04
@creydr
Copy link
Contributor Author

creydr commented Feb 6, 2024

/test reconciler-tests-namespaced-broker

@creydr
Copy link
Contributor Author

creydr commented Feb 6, 2024

/cc @Cali0707

try {
JwtContext jwtContext = jwtConsumer.process(token);

promise.complete(jwtContext.getJwtClaims());
Copy link
Member

Choose a reason for hiding this comment

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

Does getting JWT claims from processing the token imply that the token had the correct audience?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. jwtConsumer.process(token) fails, when the JWT does not contain the audience which was set in line 48.

@creydr
Copy link
Contributor Author

creydr commented Feb 7, 2024

/retest-required

1 similar comment
@creydr
Copy link
Contributor Author

creydr commented Feb 8, 2024

/retest-required

@Leo6Leo
Copy link
Contributor

Leo6Leo commented Feb 8, 2024

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Feb 8, 2024
@knative-prow knative-prow bot merged commit 3655d6d into knative-extensions:main Feb 8, 2024
35 of 37 checks passed
@creydr creydr mentioned this pull request Feb 9, 2024
creydr added a commit to creydr/knative-eventing-kafka-broker that referenced this pull request Feb 21, 2024
* Receiver: reject request for wrong audience

* Switch to AuthenticationHandler

* Fix "Request has already been read" issue

* Change TokenVerifier to an interface

* Initialize TokenVerifier in main

* Add test for AuthenticationHandler

* Only initialize OIDC discovery config in main and create a TokenVerifier per verticle instance.

* Rerun hack/update-codegen.sh

* Move TokenVerifier setup into setup() to prevent null pointer exception when vertx is null

* Update KafkaChannel OIDC e2e tests, to run OIDC conformance tests so the receiver is tested too.

* Run OIDC e2e tests as part of the reconciler suite

* Fix KafkaChannelOIDC e2e test

* Fix lint issue

* Address review comments
creydr added a commit to creydr/knative-eventing-kafka-broker that referenced this pull request Mar 18, 2024
* Receiver: reject request for wrong audience

* Switch to AuthenticationHandler

* Fix "Request has already been read" issue

* Change TokenVerifier to an interface

* Initialize TokenVerifier in main

* Add test for AuthenticationHandler

* Only initialize OIDC discovery config in main and create a TokenVerifier per verticle instance.

* Rerun hack/update-codegen.sh

* Move TokenVerifier setup into setup() to prevent null pointer exception when vertx is null

* Update KafkaChannel OIDC e2e tests, to run OIDC conformance tests so the receiver is tested too.

* Run OIDC e2e tests as part of the reconciler suite

* Fix KafkaChannelOIDC e2e test

* Fix lint issue

* Address review comments
creydr added a commit to creydr/knative-eventing-kafka-broker that referenced this pull request Apr 2, 2024
* Receiver: reject request for wrong audience

* Switch to AuthenticationHandler

* Fix "Request has already been read" issue

* Change TokenVerifier to an interface

* Initialize TokenVerifier in main

* Add test for AuthenticationHandler

* Only initialize OIDC discovery config in main and create a TokenVerifier per verticle instance.

* Rerun hack/update-codegen.sh

* Move TokenVerifier setup into setup() to prevent null pointer exception when vertx is null

* Update KafkaChannel OIDC e2e tests, to run OIDC conformance tests so the receiver is tested too.

* Run OIDC e2e tests as part of the reconciler suite

* Fix KafkaChannelOIDC e2e test

* Fix lint issue

* Address review comments
openshift-merge-bot bot pushed a commit to openshift-knative/eventing-kafka-broker that referenced this pull request Apr 3, 2024
* Update contract with fields for OIDC information (knative-extensions#3632)

* Update contract to include OIDC information

* Run hack/update-codegen.sh

* Move OIDC SA to egress

* Expose OIDC audience of KafkaChannel in its status (knative-extensions#3622)

* Provision .status.address.audience and .status.addresses[*].audience in KafkaChannel

* Add kafka Channel e2e test to check if audience is provisioned

* Run goimport

* Update deps

* Auto generate Triggers OIDC identity service account and expose in its status (knative-extensions#3604)

* Support auto generation of Triggers identity service account and expose in AuthStatus

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* make ServiceAccountLister public

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* add oidc unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* integrate oidc unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* add some logic to reconcile triggers, if the features config map gets updated

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* revert vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/controller.go

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix Verify Deps and Codegen test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix unit test and reconcile triggers, in case of the features configmap changes

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

---------

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* Create KafkaSources OIDC service account and expose in its status (knative-extensions#3660)

* Create KafkaSources OIDC service account and expose in its status

* Run goimport

* Provision contract with OIDC information (knative-extensions#3646)

* Provision contract with OIDC information

* Add DLS audience in KafkaChannel CRD

* Update KafkaSource to expose its sinks audience in status

* Update Trigger test to include OIDC SA in contract

* Propagate KafkaSources OIDC serviceAccountName to consumer and consumergroup

* Propagate triggerv2s serviceAccountName to consumergroup

* Fix unit test

* [data-plane] Add the caching for OIDC JWT token to tokenprovider (knative-extensions#3663)

* Add the caching to tokenprovider

* Add the boiler

* Running the codegen

* Running the codegen

* Revert "Running the codegen"

This reverts commit 0ccf69c.

* Use constant, set buffer before token expire, remove unnecessary change

* Codegen changes

* Codegen changes

* Update data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/oidc/TokenProvider.java

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>

* Fix the review comments

* Run codegen

* Codegen changes

* Code gen again

---------

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>

* Receiver reject requests for wrong audience (knative-extensions#3675)

* Receiver: reject request for wrong audience

* Switch to AuthenticationHandler

* Fix "Request has already been read" issue

* Change TokenVerifier to an interface

* Initialize TokenVerifier in main

* Add test for AuthenticationHandler

* Only initialize OIDC discovery config in main and create a TokenVerifier per verticle instance.

* Rerun hack/update-codegen.sh

* Move TokenVerifier setup into setup() to prevent null pointer exception when vertx is null

* Update KafkaChannel OIDC e2e tests, to run OIDC conformance tests so the receiver is tested too.

* Run OIDC e2e tests as part of the reconciler suite

* Fix KafkaChannelOIDC e2e test

* Fix lint issue

* Address review comments

* Dispatcher authenticate requests (knative-extensions#3677)

* Change TokenProvider to return future to get a token

* Dispatcher add OIDC to token, when target has an audience set

* Add e2e test

* Support exposing the Audience of a Broker (knative-extensions#3600)

* Support exposing the Audience of a Broker

* fix formatting

* fix formatting

* test fixes

* Populate broker.status.addresses[*].audience field too

* Run goimports and gofmt

* Fix unit test

---------

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>

* Add broker OIDC e2e tests (knative-extensions#3685)

* Add broker OIDC e2e tests

* Fix broker template to allow TLS & OIDC configuration on dead letter sink

* Remove unneeded check when setting broker audience (knative-extensions#3708)

* Check status code of OIDC discovery response (knative-extensions#3707)

* Check status code of OIDC discovery endpoint

* Run update-codegen.sh

* Only allow 200 status code on OIDC discovery endpoint

* Run update-deps.sh

* Add OIDC tests to encryption/auth test suite

* run make generate-release

* TokenVerifier: execute blocking calls in parallel (knative-extensions#3728)

* TokenVerifier: execute blocking calls in parallel

* Revert "TokenVerifier: execute blocking calls in parallel"

This reverts commit f3dbde9.

* Revert: removed changes in contract.pb.go

* Cancel receiver pod start on invalid OIDC config only if authentication.oidc is enabled (knative-extensions#3761)

* Cancel pod start on invalid OIDC config only if authentication.oidc is enabled

* Update namespaced broker to copy features configmap too.

* Add unit test for FeaturesConfig class (knative-extensions#3771)

* Add unit test for FeaturesConfig class

* Update data-plane/core/src/test/java/dev/knative/eventing/kafka/broker/core/features/FeaturesConfigTest.java

Co-authored-by: Calum Murray <cmurray@redhat.com>

---------

Co-authored-by: Calum Murray <cmurray@redhat.com>

* Run make generate-release again

---------

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>
Co-authored-by: cola <45722758+xiangpingjiang@users.noreply.github.com>
Co-authored-by: Leo Li <leoli@redhat.com>
Co-authored-by: Gunish Matta <33680363+gunishmatta@users.noreply.github.com>
Co-authored-by: Partha Ghosh <112557191+parth721@users.noreply.github.com>
Co-authored-by: Calum Murray <cmurray@redhat.com>
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. area/data-plane area/test 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.

[data-plane]: Kafka channel receiver: reject requests for wrong audience
3 participants