fix: harden shared agent source permissions - #2417
Merged
lyingbug merged 2 commits intoJul 30, 2026
Merged
Conversation
Reject invalid agent_source_tenant_id instead of silently falling back, fix a resolveAgent nil panic when a shared selector fails, and add regression tests for wiki write-tool filtering and agent resolution.
lyingbug
marked this pull request as ready for review
July 30, 2026 04:28
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.
Summary
Root cause
Shared-agent execution already switched several backend runtime resources to the source space, but adjacent paths used inconsistent authority:
Impact
Recipients can use the capabilities intentionally configured on a shared agent, including source-space web search and scoped knowledge resources, without receiving provider credentials. Shared-agent runs remain read-only for source-space Wiki content, and a client-supplied source selector cannot grant access without a matching verified share relation.
Validation
GOCACHE=/tmp/weknora-gocache-shared-agent-publish go test ./internal/application/repository ./internal/application/service ./internal/handler ./internal/handler/session ./internal/middleware ./internal/router ./internal/types ./internal/containernpx tsx --test src/utils/agentWebSearch.test.mjs src/components/Input-field.agent-switch.test.mjs(7/7)npm run build-only -- --mode developmentgit diff --cached --check