-
Notifications
You must be signed in to change notification settings - Fork 10
fix: Skip azure authentication on /api resources #2702
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,9 +129,28 @@ func AllowBypassingAzureAuth(allowedPaths []string, requestUrlPath string, reque | |
| } | ||
|
|
||
| // Skip azure authentication with ID for `/` (POST: createEnv), `/release`, `/releasetrain` and `/locks` endpoints. The requests will be validated with pgp signature | ||
| // Also requests to the `/api` endpoints do the same. | ||
| // usage in requests from outside the cluster (e.g. by GitHub Actions and the publish.sh script). | ||
| group, tail := xpath.Shift(requestUrlPath) | ||
|
|
||
| if group == "api" { | ||
| subgroup, tail := xpath.Shift(tail) | ||
| if subgroup == "environments" || subgroup == "environment-groups" { | ||
| envName, tail := xpath.Shift(tail) | ||
| if envName != "" { // We shouldn't receive an empty env, added just as a second layer of validation | ||
| function, tail := xpath.Shift(tail) | ||
| switch function { | ||
| case "lock", "releasetrain", "applications", "cluster": | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "applications" and "cluster" are not returning true for the non-api case, it seems. Why should they for /api-API?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| return true | ||
| case "": // create environment | ||
| if tail == "/" && (requestMethod == http.MethodPost || requestMethod == http.MethodDelete) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MethodDelete is not returning true for the non-api case, it seems. Why should it for /api-API?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also stubled about this. My best idea is that this simply a bug that we haven't found yet because we rarely delete environments. |
||
| return true | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if group == "environments" || group == "environment-groups" { | ||
| envName, tail := xpath.Shift(tail) | ||
| if envName != "" { // We shouldn't receive an empty env, added just as a second layer of validation | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of adding this feature to
/api, we should add the required endpoint to the old api.The new
/apiis essentially our migration path to get away from "azureauth".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not picky. I just need one way to access it.