Skip to content

fix: set file permissions on AWS credentials, remove sensitive data from SSH logs#1907

Closed
jlima8900 wants to merge 0 commit intoKeeper-Security:releasefrom
jlima8900:fix/security-audit-findings-pr1873
Closed

fix: set file permissions on AWS credentials, remove sensitive data from SSH logs#1907
jlima8900 wants to merge 0 commit intoKeeper-Security:releasefrom
jlima8900:fix/security-audit-findings-pr1873

Conversation

@jlima8900
Copy link
Copy Markdown
Contributor

@jlima8900 jlima8900 commented Mar 28, 2026

Summary

Two validated findings from a security audit of the Commander codebase (445 Python files, 10 categories, 3-pass validation).

KC-2026-001: AWS credentials file permissions

The awskey rotation plugin writes credentials to ~/.aws/credentials without restricting file permissions, leaving them world-readable by default.

Fix: Use os.open() with O_WRONLY | O_CREAT | O_TRUNC and mode 0o600 to atomically create the file with restricted permissions, preventing TOCTOU race conditions.

KC-2026-002: SSH connection logging

SSH connection handler logs contain sensitive session data that should be redacted.

Fix: Sanitize log output to remove sensitive connection details. Also removed truncated input data from error logs to resolve CodeQL clear-text logging alerts.

Tests

  • 19 unit tests in test_security_hardening.py
  • CI: pytest 3.7 + 3.12 passing

CodeQL

All clear-text logging alerts resolved in this single squashed commit.

Comment thread keepercommander/commands/pam_import/base.py Fixed
Comment thread keepercommander/commands/pam_import/base.py Fixed
Comment thread keepercommander/commands/pam_import/base.py Fixed
Comment thread keepercommander/commands/pam_import/base.py Fixed
Comment thread keepercommander/commands/pam_import/base.py Fixed
Comment thread keepercommander/commands/pam_import/base.py Fixed
Comment thread keepercommander/commands/pam_import/base.py Fixed
Comment thread keepercommander/commands/pam_import/base.py Fixed
Comment thread keepercommander/commands/pam_import/base.py Fixed
Comment thread keepercommander/commands/pam_import/base.py Fixed
@jlima8900 jlima8900 changed the base branch from master to release March 30, 2026 13:33
@jlima8900 jlima8900 force-pushed the fix/security-audit-findings-pr1873 branch 3 times, most recently from b7707ef to 445d3a4 Compare April 2, 2026 08:23
@jlima8900
Copy link
Copy Markdown
Contributor Author

@aaunario — ready for review. Squashed to single commit, all CodeQL alerts resolved, 19 unit tests passing.

@jlima8900 jlima8900 closed this Apr 2, 2026
@jlima8900 jlima8900 force-pushed the fix/security-audit-findings-pr1873 branch from dcbc112 to d610fb9 Compare April 2, 2026 22:07
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