fix(auth): treat unconfigured-owner sessions as owner for ownerOnly tools#26331
Conversation
|
@greptile-apps please review |
9268ad5 to
61e05b3
Compare
|
@greptile-apps please review |
61e05b3 to
20c7859
Compare
Greptile SummaryFixed authentication logic to correctly treat users as owners in single-user setups (no
Confidence Score: 5/5
Last reviewed commit: 20c7859 |
20c7859 to
90300e5
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
90300e5 to
420786d
Compare
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🔴 Owner-only tool privilege escalation: any direct-chat sender treated as owner when owner allowlist unset
DescriptionThe new default-owner logic in
This enables privilege escalation in realistic deployments where direct messages are not single-user in the security sense:
Vulnerable code (introduced behavior): const senderIsOwner =
senderIsOwnerByIdentity ||
senderIsOwnerByScope ||
ownerAllowAll ||
(!ownerAllowlistConfigured && isDirectChat && Boolean(senderId));Security impact:
RecommendationDo not infer owner privileges from Safer options:
Example safer logic sketch: const allowSingleUserDmOwner = cfg.commands?.assumeSingleUserDirectChatOwner === true;
const senderIsOwner =
senderIsOwnerByIdentity ||
senderIsOwnerByScope ||
ownerAllowAll ||
(allowSingleUserDmOwner && commandAuthorized && isDirectChat && senderMatchesSoleConfiguredDmOwner);Also ensure the owner-only tool filtering uses Analyzed PR: #26331 at commit Last updated on: 2026-03-07T00:24:54Z |
…ools (openclaw#26319) When no commands.ownerAllowFrom is configured (single-user default), senderIsOwner was always false because matchedSender requires a non-empty ownerList. This caused ownerOnly tools (cron, gateway) to be silently filtered from the agent's tool list even for the sole authorized user. Now senderIsOwner defaults to true when no owner allowlist is configured, matching the expected single-user behavior. # Conflicts: # src/auto-reply/command-auth.ts
420786d to
1fbe1c7
Compare
|
Merged via squash. Thanks @widingmarcus-cyber! |
…ools (openclaw#26331) Merged via squash. Prepared head SHA: 1fbe1c7 Co-authored-by: widingmarcus-cyber <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ools (openclaw#26331) Merged via squash. Prepared head SHA: 1fbe1c7 Co-authored-by: widingmarcus-cyber <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ools (openclaw#26331) Merged via squash. Prepared head SHA: 1fbe1c7 Co-authored-by: widingmarcus-cyber <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ools (openclaw#26331) Merged via squash. Prepared head SHA: 1fbe1c7 Co-authored-by: widingmarcus-cyber <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ools (openclaw#26331) Merged via squash. Prepared head SHA: 1fbe1c7 Co-authored-by: widingmarcus-cyber <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ools (openclaw#26331) Merged via squash. Prepared head SHA: 1fbe1c7 Co-authored-by: widingmarcus-cyber <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ools (openclaw#26331) Merged via squash. Prepared head SHA: 1fbe1c7 Co-authored-by: widingmarcus-cyber <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman (cherry picked from commit 48b3c4a)
…ools (openclaw#26331) Merged via squash. Prepared head SHA: 1fbe1c7 Co-authored-by: widingmarcus-cyber <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman (cherry picked from commit 48b3c4a)
Closes #26319
Also fixes #26665
Problem
When no
commands.ownerAllowFromis configured (the common single-user setup),senderIsOwnerwas alwaysfalse. This happened becausematchedSenderrequires a non-emptyownerListto match against, and without explicit owner configuration the list is empty.As a result,
ownerOnlytools (cron,gateway,whatsapp_login) were silently filtered from the agent's tool list byapplyOwnerOnlyToolPolicy, even for the sole authorized user of the bot.openclaw sandbox explainshowedcronin the allow list (because it doesn't account forownerOnlyfiltering), creating a confusing mismatch.Root Cause
In
command-auth.ts, thesenderIsOwnerflag was computed as:When
ownerListis empty (noownerAllowFromconfigured),matchedSenderis alwaysundefined, sosenderIsOwneris alwaysfalse.Fix
When no owner allowlist is configured, default
senderIsOwnertotruefor any identified sender. This matches the expected single-user behavior: if you're authorized to talk to the bot and haven't configured multi-user ownership, you're the owner.When
ownerAllowFromIS configured, behavior is unchanged: only matched senders are owners.Testing
command-controltests passwhatsapp-login-gatingtests pass (also testssenderIsOwnerbehavior)Greptile Summary
Fixed
senderIsOwnerlogic to default totruefor single-user setups (nocommands.ownerAllowFromconfigured), ensuringownerOnlytools (cron,gateway,whatsapp_login) are available to authorized users.src/auto-reply/command-auth.ts:349-350to check if owner allowlist is unconfigured and sender is identifiedsrc/auto-reply/command-auth.owner-default.test.tscovering default, non-matching, matching, and wildcard scenariosConfidence Score: 5/5
senderIsOwnerwas incorrectlyfalsefor single-user setups. The new logic correctly evaluates all scenarios: wildcard, explicit owner lists, and the default no-config case. Four comprehensive tests cover all branches. All existing tests pass (24 command-control + 3 whatsapp-login-gating tests). The implementation follows project conventions with clear comments explaining the rationale. No security concerns or edge cases identified.Last reviewed commit: b92f3e3