Repository navigation
allow workloads access to wildcard namespace service queries - #28534
Merged
Merged
Conversation
tgross
force-pushed
the
nmd920-service-registration-wildcard-wi
branch
from
September 9, 2026 20:09
282565e to
b14ec94
Compare
While testing work in `consul-template` to support cross-namespace queries of Nomad native services, I discovered that the List endpoint restricts querying using the wildcard namespace to ACL tokens with the `read-job` capability. This excludes the default Workload Identity policy. But the default policy can already read any _specific_ namespace's service registrations, so this is just an oversight and not an intentional security control. Update the code path we use for wildcard namespace queries to use the exact same check we have in the non-wildcard path. This changeset also heavily refactors the tests for the List endpoint, which had a lot of redundant setup code that made it hard to follow what was actually under test. I've broken the test into ACLs and non-ACLs tests and then reduced the setup code to be shared, which will also reduce the time it takes to run the tests because we only wait for the keyring to be ready twice. Ref: https://hashicorp.atlassian.net/browse/NMD-920 Ref: hashicorp/consul-template#2182
tgross
force-pushed
the
nmd920-service-registration-wildcard-wi
branch
from
September 9, 2026 20:13
b14ec94 to
be51c62
Compare
tgross
marked this pull request as ready for review
September 9, 2026 20:59
tehut
approved these changes
Sep 9, 2026
tehut
left a comment
Contributor
There was a problem hiding this comment.
LGTM! A lot more readable.
|
|
||
| // allowFunc checks whether the caller has the read-job capability on the | ||
| // passed namespace. | ||
| isWorkload := args.GetIdentity().Claims != nil |
Contributor
There was a problem hiding this comment.
I've never seen this syntax before and had to make a dumb playground example to make myself believe it.
This is cool!!!
Merged
5 of 8 tasks
schmichael
pushed a commit
to vercel/nomad
that referenced
this pull request
Sep 25, 2026
…rp#28534) While testing work in `consul-template` to support cross-namespace queries of Nomad native services, I discovered that the List endpoint restricts querying using the wildcard namespace to ACL tokens with the `read-job` capability. This excludes the default Workload Identity policy. But the default policy can already read any _specific_ namespace's service registrations, so this is just an oversight and not an intentional security control. Update the code path we use for wildcard namespace queries to use the exact same check we have in the non-wildcard path. This changeset also heavily refactors the tests for the List endpoint, which had a lot of redundant setup code that made it hard to follow what was actually under test. I've broken the test into ACLs and non-ACLs tests and then reduced the setup code to be shared, which will also reduce the time it takes to run the tests because we only wait for the keyring to be ready twice. Ref: https://hashicorp.atlassian.net/browse/NMD-920 Ref: hashicorp/consul-template#2182
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While testing work in
consul-templateto support cross-namespace queries of Nomad native services, I discovered that the List endpoint restricts querying using the wildcard namespace to ACL tokens with theread-jobcapability. This excludes the default Workload Identity policy. But the default policy can already read any specific namespace's service registrations, so this is just an oversight and not an intentional security control.Update the code path we use for wildcard namespace queries to use the exact same check we have in the non-wildcard path.
This changeset also heavily refactors the tests for the List endpoint, which had a lot of redundant setup code that made it hard to follow what was actually under test. I've broken the test into ACLs and non-ACLs tests and then reduced the setup code to be shared, which will also reduce the time it takes to run the tests because we only wait for the keyring to be ready twice. (Ex. ~3s down to ~0.3s in local testing)
Ref: https://hashicorp.atlassian.net/browse/NMD-920
Ref: hashicorp/consul-template#2182
Testing & Reproduction steps
With a
replacestatement in thego.modpointing to hashicorp/consul-template#2182, you can deploy the following job to multiple namespaces (one of which should be named"prod") and see the cross-query listing work.example.nomad.hcl
Contributor Checklist
changelog entry using the
make clcommand.Reviewer Checklist
backporting document.
in the majority of situations. The main exceptions are long-lived feature branches or merges where
history should be preserved.
within the public repository.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.