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

fix #6617 and #6659 #6661

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

fix #6617 and #6659 #6661

wants to merge 11 commits into from

Conversation

SamMHD
Copy link
Contributor

@SamMHD SamMHD commented Sep 8, 2024

closes #6617 and #6659


In order to fix #6617 I have changed how dagRoute.DisableAuth is caclulated.

Also, to fix #6659 I thought it is needed to change behavior when we are upgrading a request to HTTPS (when permitInsecure is not set and we are redirecting HTTP to HTTPS). Thereby, when dagRoute.AuthContext/dagRoute.AuthDisabled is configured it will affect redirection as well -- before these changes, redirection won't care about them.


Changes:

  • use dagRoute's AuthContext and AuthDisabled in HTTPS-Upgrade to fix 6659
  • Use globalExtAuth.AuthPolicy.Disabled to calculate dagRoute.AuthDisabled
  • Fix Tests

Changes:
- use dagRoute's AuthContext and AuthDisabled in HTTPS-Upgrade to fix 6659
- Use globalExtAuth.AuthPolicy.Disabled to calculate dagRoute.AuthDisabled
- Fix Tests

Signed-off-by: Saman Mahdanian <[email protected]>
@SamMHD SamMHD requested a review from a team as a code owner September 8, 2024 10:15
@SamMHD SamMHD requested review from skriss and sunjayBhatia and removed request for a team September 8, 2024 10:15
@sunjayBhatia sunjayBhatia requested review from a team, rajatvig and davinci26 and removed request for a team September 8, 2024 10:15
Signed-off-by: Saman Mahdanian <[email protected]>
Signed-off-by: Saman Mahdanian <[email protected]>
Signed-off-by: Saman Mahdanian <[email protected]>
Copy link

codecov bot commented Sep 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.03%. Comparing base (db432cc) to head (2827b9c).
Report is 48 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6661      +/-   ##
==========================================
- Coverage   81.76%   81.03%   -0.74%     
==========================================
  Files         133      133              
  Lines       15944    20016    +4072     
==========================================
+ Hits        13037    16220    +3183     
- Misses       2614     3503     +889     
  Partials      293      293              
Files with missing lines Coverage Δ
internal/dag/httpproxy_processor.go 91.00% <100.00%> (-0.41%) ⬇️
internal/envoy/v3/route.go 81.00% <100.00%> (+0.97%) ⬆️
internal/featuretests/v3/envoy.go 99.13% <100.00%> (-0.16%) ⬇️

... and 124 files with indirect coverage changes

@SamMHD
Copy link
Contributor Author

SamMHD commented Sep 10, 2024

@sunjayBhatia can you please add required labels to this one?
cc: @skriss @rajatvig @davinci26

@tsaarni tsaarni added the release-note/minor A minor change that needs about a paragraph of explanation in the release notes. label Sep 10, 2024
@SamMHD
Copy link
Contributor Author

SamMHD commented Sep 10, 2024

Thank you @tsaarni for the label.
When can we proceed to merge?

@tsaarni
Copy link
Member

tsaarni commented Sep 10, 2024

@SamMHD I will try to arrange time for myself to review ASAP today or tomorrow!

@SamMHD
Copy link
Contributor Author

SamMHD commented Sep 10, 2024

Thank you so much @tsaarni

Copy link
Member

@tsaarni tsaarni left a comment

Choose a reason for hiding this comment

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

Looks good!

Regarding testing the fix: Would it be possible to add a new test case in the e2e test suite that would have caught this bug. There are global ext auth tests here but they currently only cover disabled: false.

Also tagging @clayton-gonsalves for your input, as your review would be valuable since you originally implemented this functionality.

internal/envoy/v3/route.go Outdated Show resolved Hide resolved
@SamMHD
Copy link
Contributor Author

SamMHD commented Sep 13, 2024

Thank you for your feedback; I'll add the tests as suggested.

I previously attempted to write tests for this scenario but found the existing test functions a bit incompatible to implement disabled: true for GlobalAuth, which led me to initially omit them. Now that you've requested it, I'll revisit this and include the necessary tests.

@tsaarni
Copy link
Member

tsaarni commented Sep 15, 2024

I previously attempted to write tests for this scenario but found the existing test functions a bit incompatible to implement disabled: true for GlobalAuth, which led me to initially omit them. Now that you've requested it, I'll revisit this and include the necessary tests.

Exactly, the existing test functions make no sense for disabled: true. There could be a new one to test this behaviour specifically.

@SamMHD
Copy link
Contributor Author

SamMHD commented Sep 20, 2024

Exactly, the existing test functions make no sense for disabled: true. There could be a new one to test this behaviour specifically.

I think I have implemented a workaround to this by making the test function more flexible.
I'll push the changes now, hope you find time to review this, too.

Btw, Do you think we still need to add this to e2e tests?

@SamMHD
Copy link
Contributor Author

SamMHD commented Sep 22, 2024

@tsaarni Do have time to review the changes again?

@SamMHD
Copy link
Contributor Author

SamMHD commented Sep 29, 2024

@tsaarni @sunjayBhatia @skriss is there any update on this?

@SamMHD
Copy link
Contributor Author

SamMHD commented Oct 3, 2024

Why nobody answer us? :(((
@tsaarni @sunjayBhatia @skriss

@tsaarni
Copy link
Member

tsaarni commented Oct 3, 2024

Sorry @SamMHD I haven’t had a chance to review yet, I've been swamped 😅

@SamMHD
Copy link
Contributor Author

SamMHD commented Oct 5, 2024

thank you @tsaarni , when do you think you can give it a look?

@SamMHD
Copy link
Contributor Author

SamMHD commented Oct 12, 2024

Hello again, Is there any update on this PR? @tsaarni

@tsaarni
Copy link
Member

tsaarni commented Oct 16, 2024

Hi @SamMHD and apologies once more for the delays! I've now created an environment to test this PR. It works well, however it seems override can only be done at the route level and not at the virtual host level. This example does not work:

apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: echoserver
spec:
  virtualhost:
    fqdn: protected.127-0-0-101.nip.io
    tls:
      secretName: ingress
    authorization:
      authPolicy:
        disabled: false
  routes:
    - services:
        - name: echoserver
          port: 80

It seems that with this scenario we end up in this code branch where it will try use the uninitialized extension name from HTTPProxy.spec.virtualhost.authorization.extensionRef for the virtualhost and fail.

@SamMHD
Copy link
Contributor Author

SamMHD commented Oct 20, 2024

Very good point dear @tsaarni , I have visited that code branch and fixed it, other than this one more thing came to my attention, and it was that "If we disable global auth in vhost configuration then we can not enable it back again in a route" so I have fixed it in "else clause" of same code branch.

Can you give it a try or help me setup your test environment for myself? I think it should be fixed now.

@SamMHD SamMHD requested a review from tsaarni October 22, 2024 07:46
Copy link

github-actions bot commented Nov 6, 2024

The Contour project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 14d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the PR is closed

You can:

  • Ensure your PR is passing all CI checks. PRs that are fully green are more likely to be reviewed. If you are having trouble with CI checks, reach out to the #contour channel in the Kubernetes Slack workspace.
  • Mark this PR as fresh by commenting or pushing a commit
  • Close this PR
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 6, 2024
@SamMHD
Copy link
Contributor Author

SamMHD commented Nov 8, 2024

dear @tsaarni , do you have any update on this PR?

@github-actions github-actions bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/minor A minor change that needs about a paragraph of explanation in the release notes.
Projects
None yet
2 participants