Skip to content

fix: security hardening for PAM import engine#1903

Open
jlima8900 wants to merge 15 commits intoKeeper-Security:masterfrom
jlima8900:fix/pam-import-security-hardening-pr1890
Open

fix: security hardening for PAM import engine#1903
jlima8900 wants to merge 15 commits intoKeeper-Security:masterfrom
jlima8900:fix/pam-import-security-hardening-pr1890

Conversation

@jlima8900
Copy link
Copy Markdown

Summary

  • Warn user that gateway token output contains sensitive credentials
  • Clear gateway token from memory after display
  • Add max iteration guard (1000) on folder name deduplication loop

Test plan

  • Tested on Python 3.7 and 3.12

ukumar-ks and others added 15 commits March 12, 2026 09:05
* commander KC - (1128, 1115, 1114) bug fix chnages

* File flag fix under "epm deployment download" in commander

* confirmation promp added  for kepm agent delete command without --force flag

* Kepm PR review changes
* Fixed double new lines on some terminals (Linux, MacOS)
* Improved handling of non-terminal protocols
* Update to keeper_pam_webrtc_rs>=2.1.5
Corrects logic in needs_security_audit: remove the erroneous "or None" that forced password mismatch to always be true, and determine alignment by comparing stored score and breach-watch revisions only when a current password exists. Adds retrieval of score_revision and sec_revision and updates needs_alignment accordingly. Includes new unit and integration tests (unit-tests/test_security_audit.py and tests/test_security_audit_refresh.py) to validate revision-based alignment, password removal, and other audit-refresh scenarios.
* Added "Connect As" options allowing for aditional records to provide credentials and host:port

* Added keeper webrtc version to SDP attribute a=keeper-webrtc:X.Y.Z
The execute_rest() function previously retried throttled (403) responses
every 10 seconds with no maximum retry count. This caused Commander to
hang indefinitely when throttled, and the 10-second retry interval
prevented the server's cooldown timer from expiring.

Changes:
- Add max retry count (3 attempts) before raising KeeperApiError
- Parse the server's "try again in X minutes/seconds" message
- Use exponential backoff (30s, 60s, 120s) capped at server's suggestion
- Cap server wait time at 300s to prevent excessive delays
- Log throttle attempts as warnings instead of debug
- After max retries, raise KeeperApiError so callers can handle it

The --fail-on-throttle flag continues to work as before (immediate error).

Unit tests (9 cases):
- Normal request unaffected by throttle logic
- Throttle twice then succeed (backoff 30s, 60s)
- KeeperApiError raised after 3 retries
- --fail-on-throttle skips retries entirely
- Parses "try again in X seconds" correctly
- Parses "try again in X minutes" correctly
- Caps server wait at 300s
- Exponential backoff progression (30s, 60s, 120s)
- Missing message defaults to 60s
…er-Security#1885)

- Make record argument optional; session-only probes run without it
  - Add Python-side network probes: DNS, HTTPS, WebSocket, TCP/UDP STUN,
    TURN Allocate, UDP port sweep across ephemeral range
  - Add PAM Configuration section (record required): DAG load, config
    linkage, gateway registered/online, connections/portForwards
  - Add --verbose flag for DAG allowedSettings table and record typed fields
- Warn user that gateway token output contains sensitive credentials
- Clear gateway token from memory after display
- Add max iteration guard (1000) on folder name deduplication loop
  to prevent infinite spin from pathological vault state
- Loop guard: terminates after MAX_ITERATIONS, finds name on 1st/3rd try
- Token clearing: tokens cleared from memory after display, res captures before clear
- Warning message: bootstrap token warning present in source
- Gateway data structure: all expected keys initialized
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.

8 participants