-
Notifications
You must be signed in to change notification settings - Fork 2k
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
/v1/job/statuses doesn't filter by namespace when using a non management token #23370
Comments
Hi @jorgemarey! Strangely I wasn't able to confirm this behavior with Nomad 1.8.0 or the current tip of
I see the same behavior in the UI. Maybe there's some code path in the UI that's sending the wrong querystring. Can you capture the path and querystring being sent from the devtools? But that wouldn't explain what you're seeing in the API, so can you confirm the exact API path and querystring you're sending for that as well? |
Hi @tgross I just reproduced it myself just now. Did you export the token or are you using a management token to make the statuses request? Using a management token it works fine. Here is the history I just ran with nomad v1.8.0:
|
Just made a script that's able to reproduce it:
The output that I got is allways:
That final 2, should be a one. Hope this helps to find out where the problem is. Looking at the code, the problem could be arround here as allowableNamespaces is set to all namespaces the token has access and then thats used to filter. |
Ah, thanks @jorgemarey! Now I see what the difference in the two requests we were making, and I can confirm what you're seeing. You're sending the The |
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
Fix PR up here: #23456 |
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
Nomad version
nomad v1.8.0
Issue
When ACLs are enabled and using a non management token, the namespace filter doesn't work correctly in the UI nor the API v1/jobs/statuses directly.
Reproduction steps
namespace "*" {
policy = "read"
}
Try to filter using the UI or the API by namespace using the token created in step 8.
Expected Result
Actual Result
The text was updated successfully, but these errors were encountered: