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

InMemoryChannel ingress: Reject unauthorized requests #7981

Closed
creydr opened this issue Jun 10, 2024 · 12 comments · Fixed by #8162
Closed

InMemoryChannel ingress: Reject unauthorized requests #7981

creydr opened this issue Jun 10, 2024 · 12 comments · Fixed by #8162
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. triage/accepted Issues which should be fixed (post-triage)

Comments

@creydr
Copy link
Member

creydr commented Jun 10, 2024

We need to verify in the channel receiver, that an request is authorized. Therefor we should do the following in the event receiver handler:

  • Get the OIDC identity of the sender
  • In case the InMemoryChannels .status.policies is set:
    • check, if the senders identity is subject of any of the linked EventPolicies (in their .status.from[]).
      • If it is present: continue with the request
      • If not: reject the request with a 403 status code
  • In case the InMemoryChannels .status.policies is empty:
    • Check the default-authorization-mode and do the following depending on its value:
      • allow-all: Continue with the request
      • deny-all: reject the request with a 403 status code
      • allow-same-namespace: check, if the senders identity is from the same namespace, as the Broker. If so, continue with the request, otherwise reject with a 403

We should also add an e2e test for the above scenarios

Prerequisites:

Additional context:

Additional hints for new contributors before starting with this issue:

  1. When the issue has the Draft status, the issue is subject to change and thus should not be started to be worked on
  2. Make sure you've read and understood the CONTRIBUTING.md guidelines
  3. Make sure you're able to run Knative Eventing locally and run at least the unit tests.
  4. Feel free to raise any questions you have either directly here in the issue, in the #knative-eventing Slack channel or join the Eventing Workgroup Meeting
  5. When you feel comfortable with this issue, feel free to assign it to you (e.g. by commenting /assign). Please be aware that we might unassign you, if we don't see any progress from your side to give other contributors also a chance to work on this issue.
@creydr creydr added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jun 10, 2024
@creydr creydr changed the title InMemoryChannel ingress: Check for authorized request InMemoryChannel ingress: Reject unauthorized requests Jun 10, 2024
@pratikkumar-mohite
Copy link

I would like to work on it, @creydr could you please assign it to me?

@creydr creydr added the triage/accepted Issues which should be fixed (post-triage) label Jun 13, 2024
@7h3-3mp7y-m4n
Copy link
Contributor

/assign

@Leo6Leo
Copy link
Member

Leo6Leo commented Jul 9, 2024

Hello @7h3-3mp7y-m4n , are there anything I can help you with regarding this issue?

@rahulii
Copy link
Contributor

rahulii commented Jul 12, 2024

hey @7h3-3mp7y-m4n , are you still planning to work on it ?

@Leo6Leo
Copy link
Member

Leo6Leo commented Jul 12, 2024

@7h3-3mp7y-m4n Thanks for picking up the issue. If you're still working on this issue, please let me know within the next 24 hours. We understand that plans and priorities can change, and if you're no longer able to continue with this task, that's completely okay!

In case I don't hear back from you in the next 24 hours, I'll reassign the issue to @rahulii to ensure our workflow continues smoothly.

@7h3-3mp7y-m4n
Copy link
Contributor

hey @Leo6Leo I'm sorry for creating a mess, I was caught up in my exams, but yeah I'll definitely work on this and get in touch on Slack. Sorry for not responding

@rahulii
Copy link
Contributor

rahulii commented Jul 17, 2024

Since there are no updates regarding this and we are really close to the deadline, I can take this up.
/Cc: @Leo6Leo

@Leo6Leo
Copy link
Member

Leo6Leo commented Jul 17, 2024

@rahulii: As we didn't see any progress on this, I think you can take this over if you want!
/unassign @7h3-3mp7y-m4n
/assign @rahulii

@knative-prow knative-prow bot assigned rahulii and unassigned 7h3-3mp7y-m4n Jul 17, 2024
@7h3-3mp7y-m4n
Copy link
Contributor

I was learning about code base and trying to implement the function as it was said, but it's okay if you don't find me a perfect fit to fix this
Thanks for giving me this opportunity and I'm sorry that I failed you ...
All the best @rahulii

@rahulii
Copy link
Contributor

rahulii commented Jul 17, 2024

@7h3-3mp7y-m4n it's not about being the perfect fit, you can open a draft PR and can ask for review. if you still feel you can pull this off abiding the timelines, please LMK, I will assign it to you.
Thanks!

@Leo6Leo
Copy link
Member

Leo6Leo commented Jul 17, 2024

Thanks for the PR @7h3-3mp7y-m4n , and @rahulii feel free to review the PR! Ping me if any of you have any questions.

@Leo6Leo
Copy link
Member

Leo6Leo commented Jul 31, 2024

/assign @7h3-3mp7y-m4n

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. triage/accepted Issues which should be fixed (post-triage)
Projects
Status: ✅ Done
5 participants