Skip to content

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

Merged
sshrushanth-ks merged 2 commits into
service-mode-history-fixfrom
service-mode-history-fix-int
Nov 26, 2026
Merged

sshrushanth-ks merged 2 commits into
service-mode-history-fixfrom
service-mode-history-fix-int

Conversation

@sshrushanth-ks

@sshrushanth-ks sshrushanth-ks commented Nov 20, 2026 •

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.

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>
@sshrushanth-ks sshrushanth-ks self-assigned this Nov 20, 2026
@sshrushanth-ks
sshrushanth-ks marked this pull request as ready for review November 20, 2026 05:11
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>
@sshrushanth-ks
sshrushanth-ks merged commit 387150e into service-mode-history-fix Nov 26, 2026
4 checks passed
craiglurey pushed a commit that referenced this pull request Nov 26, 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>
@sshrushanth-ks
sshrushanth-ks deleted the service-mode-history-fix-int branch November 27, 2026 07:52
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.

4 participants