Merged
Conversation
Operations initiated by the system namespace must act on behalf of the workload's owning namespace. The client now publishes on the owning namespace's NATS control subjects (masquerading at the subject layer while authenticated as system) and discovers the target namespace via ListWorkloads when the system user stops a workload by id. The node mints workload credentials against the request body's namespace so log permissions line up with where the workload actually lives. handleCloneWorkload also gains a guard that prevents non-system callers from reading workload definitions belonging to other namespaces. - client.StartWorkload now takes a *models.StartWorkloadRequest so the caller controls the target namespace directly; Auction takes an explicit namespace argument - client.StopWorkload detects system callers and resolves the owning namespace via ListWorkloads before publishing the stop; errors out clearly when the namespace cannot be determined, suggesting the --namespace flag as the operator escape hatch - client.CloneWorkload uses cloneResp.Namespace for both the auction and the deploy, so clones land in the owning namespace instead of being re-homed into system - handlers.go handleAuctionDeploy mints WorkloadCred with req.Namespace so \$NEX.FEED.<ns>.logs.> permission lines up with the workload's actual namespace - handlers.go handleCloneWorkload silently drops responses whose workload namespace does not match the caller (unless caller is system), closing a pre-existing cross-namespace info disclosure - nex workload copy --stop prints clone success and stop failure as distinct lines so partial failures are not silent - Error messages on the system-user stop discovery path do not echo the resolved namespace names, to avoid leaking namespace inventory through NATS micro response headers and logs - Tests: cross-namespace clone, cross-namespace clone+stop, system-user stop discovery, not-found, and a WorkloadClaims unit test locking in the log-subject scope invariant Signed-off-by: Jordan Rash <jordan@synadia.com>
- StartWorkload shallow-copies the incoming request before defaulting Tags so call sites that pass a struct they still hold (notably CloneWorkload passing cloneResp verbatim) do not see silent mutation - CloneWorkload fails fast with a clear error when cloneResp.Namespace is empty, instead of publishing on a malformed auction subject and surfacing as a misleading "no nodes available for placement" - TestNexClient_CloneWorkload_CrossNamespace replaces a trivially-true subtraction assertion with explicit count checks against both the user and system clients Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
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.
fix: honor owning namespace on clone, stop, and credential mint
Operations initiated by the system namespace must act on behalf of the workload's owning namespace. The client now publishes on the owning namespace's NATS control subjects (masquerading at the subject layer while authenticated as system) and discovers the target namespace via ListWorkloads when the system user stops a workload by id. The node mints workload credentials against the request body's namespace so log
permissions line up with where the workload actually lives. handleCloneWorkload also gains a guard that prevents non-system callers from reading workload definitions belonging to other namespaces.