Skip to content

KC-1547: Prevent Service Mode command history disclosure - #2575

Merged
craiglurey merged 1 commit into
releasefrom
service-mode-history-fix-release
Nov 26, 2026
Merged

craiglurey merged 1 commit into
releasefrom
service-mode-history-fix-release

Conversation

@sshrushanth-ks

Copy link
Copy Markdown
Contributor

Summary

Prevent Service Mode API keys from accessing the interactive command history or adding raw commands to the process-global CLI history. Keep shell commands visible in normal CLI help while excluding them from Service Mode grants.

Changes

  • keepercommander/cli.py: Define shell/session commands and derive their aliases centrally. Block these commands in Service Mode and prevent Service Mode requests from entering global CLI history.
  • keepercommander/service/config/service_config.py: Exclude shell/session commands and aliases from Service Mode provisioning without changing normal CLI help output.
  • keepercommander/service/util/verified_command.py: Apply the shared command set at runtime, including for existing grants.
  • keepercommander/service/README.md: Document the restricted commands and upgrade considerations.
  • unit-tests/service/test_command.py: Verify the executor returns 403 for history, h, and server host --insecure.
  • unit-tests/service/test_service_config.py: Verify provisioning rejects shell/session commands and aliases.
  • unit-tests/service/test_verified_command.py: Verify runtime restrictions cover the shared command set and aliases.
  • unit-tests/test_cli.py: Verify shell commands remain listed in CLI help and Service Mode cannot use them or access global history.

* Prevent command history disclosure

Block history/h in Service Mode, exclude shell-only commands from provisioning,
and keep Service Mode requests out of the global CLI history.

Signed-off-by: sshrushanth-ks <sshrushanth@keepersecurity.com>

* align shell command restrictions

Keep shell commands visible in CLI help while excluding them from Service Mode
grants. Apply the shared command set and aliases at provisioning and runtime,
including server controls, and document the upgrade behavior.

Signed-off-by: sshrushanth-ks <sshrushanth@keepersecurity.com>

---------

Signed-off-by: sshrushanth-ks <sshrushanth@keepersecurity.com>
(cherry picked from commit 387150e)
@sshrushanth-ks sshrushanth-ks self-assigned this Nov 26, 2026
@sshrushanth-ks
sshrushanth-ks marked this pull request as ready for review November 26, 2026 10:12
@sshrushanth-ks sshrushanth-ks changed the title # KC-1547: Prevent Service Mode command history disclosure KC-1547: Prevent Service Mode command history disclosure Nov 26, 2026
@craiglurey
craiglurey merged commit 12824b9 into release Nov 26, 2026
4 checks passed
@sk-keeper
sk-keeper deleted the service-mode-history-fix-release branch November 26, 2026 17:46
ajaiswal-ks pushed a commit that referenced this pull request Nov 27, 2026
* Prevent command history disclosure

Block history/h in Service Mode, exclude shell-only commands from provisioning,
and keep Service Mode requests out of the global CLI history.



* align shell command restrictions

Keep shell commands visible in CLI help while excluding them from Service Mode
grants. Apply the shared command set and aliases at provisioning and runtime,
including server controls, and document the upgrade behavior.



---------


(cherry picked from commit 387150e)

Signed-off-by: sshrushanth-ks <sshrushanth@keepersecurity.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants