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

job statuses: fix filtering for namespace parameter #23456

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

tgross
Copy link
Member

@tgross tgross commented Jun 27, 2024

The job statuses endpoint does not filter jobs by the namespace query parameter unless the user passes a management token. The RPC handler creates a filter based on all the allowed namespaces but improperly conditions reducing this down to only the requested set on there being a management token. Note this does not give the user access to jobs they shouldn't have, only ignores the parameter.

Remove the RPC handler's extra condition that prevents using the requested namespace. This is safe because we specifically check the ACL for that namespace earlier in the handler.

Fixes: #23370

The job statuses endpoint does not filter jobs by the namespace query parameter
unless the user passes a management token. The RPC handler creates a filter
based on all the allowed namespaces but improperly conditions reducing this down
to only the requested set on there being a management token. Note this does not
give the user access to jobs they shouldn't have, only ignores the parameter.

Remove the RPC handler's extra condition that prevents using the requested
namespace. This is safe because we specifically check the ACL for that namespace
earlier in the handler.

Fixes: #23370
Copy link
Contributor

@philrenaud philrenaud left a comment

Choose a reason for hiding this comment

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

neat! Related: we've gotten a request to change the namespace dropdown (which only appears if you have any non-default namespaces, re: issue comment) from single-select radios to multi-select checkboxes, and was planning on using filter expressions to do so. Sounds like this makes that possible for non-mgmt, so thank you!

@tgross
Copy link
Member Author

tgross commented Jun 27, 2024

and was planning on using filter expressions to do so. Sounds like this makes that possible for non-mgmt, so thank you!

As it turns out, filter expressions already worked. It was only the namespace query parameter which was broken. Which was very confusing to me in the issue! 😁

Copy link
Member

@gulducat gulducat left a comment

Choose a reason for hiding this comment

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

lgtm!

@tgross tgross added the backport/1.8.x backport to 1.8.x release line label Jun 27, 2024
@tgross tgross merged commit 7d3ce7e into main Jun 27, 2024
28 checks passed
@tgross tgross deleted the b-job-statuses-namespace-param branch June 27, 2024 20:19
Copy link

github-actions bot commented Jan 2, 2025

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/1.8.x backport to 1.8.x release line theme/ui type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/v1/job/statuses doesn't filter by namespace when using a non management token
3 participants