You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: plain /approve in gateway grants session-wide approval instead of one-time approval #4697
In gateway/blocking approval mode, replying with plain /approve is documented as approving the oldest pending dangerous command once, but the implementation persists a session-wide approval for the matched danger pattern.
Steps to Reproduce
Start a gateway session with dangerous-command approvals enabled.
Trigger a dangerous command such as rm -rf /important.
Reply with /approve.
Trigger the same dangerous command again in the same session.
Expected Behavior
The second dangerous command should require a fresh approval, because plain /approve is a one-time approval.
Actual Behavior
The second dangerous command is auto-approved in the same session.
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp)
Tools (approval flow)
Messaging Platform
Any gateway platform using the blocking approval flow
Operating System
Containerized Linux environment
Python Version
3.11.15
Hermes Version
0.6.0 / current main at commit 924bc67e
Relevant Logs / Traceback
No traceback — behavior bug confirmed with regression test.
Root Cause Analysis
In tools/approval.py, the blocking gateway approval persistence logic currently treats choice == "once" the same as choice == "session" and calls approve_session(session_key, key) in both cases.
That makes plain /approve session-scoped instead of one-time.
Proposed Fix
Only persist session approval for choice == "session". Keep "once" non-persistent, matching the documented and CLI semantics.
This bug has been fixed on main — closing as implemented.
Commit ef3bd3b (security(approval): fix privilege escalation in gateway once-approval logic, merged 2026-04-03) directly addresses the root cause you identified:
Before:if choice in ("once", "session") — once-approval incorrectly called approve_session(), making it session-scoped.
After:if choice == "session" — only "session" and "always" persist; "once" is explicitly left non-persistent with an explanatory comment.
The fix is visible in tools/approval.py around line 821 in current main. Thank you for the detailed root-cause analysis — it made the fix straightforward.
Activity
fix(approval): plain /approve grants one-time approval, not session-w…
teknium1 commentedon Jun 10, 2026
This bug has been fixed on
main— closing as implemented.Commit
ef3bd3b(security(approval): fix privilege escalation in gateway once-approval logic, merged 2026-04-03) directly addresses the root cause you identified:if choice in ("once", "session")— once-approval incorrectly calledapprove_session(), making it session-scoped.if choice == "session"— only"session"and"always"persist;"once"is explicitly left non-persistent with an explanatory comment.The fix is visible in
tools/approval.pyaround line 821 in currentmain. Thank you for the detailed root-cause analysis — it made the fix straightforward.This is an automated hermes-sweeper review.