venkateshwaracholan opened a new issue, #4769:
URL: https://github.com/apache/polaris/issues/4769

   ### Describe the bug
   
   ## Problem
   
   The CLI currently handles `client_secret` values insecurely in profile 
management commands:
   
   * `profiles create` and `profiles update` read secrets using `input()`, 
causing the secret to be visible on-screen and potentially stored in terminal 
scrollback/history.
   * `profiles get` prints the complete profile configuration, including the 
raw `client_secret`.
   * The Polaris configuration file is written using default file permissions, 
which may allow unintended access by other users on the same system.
   
   Affected locations:
   
   * `client/python/apache_polaris/cli/command/profiles.py`
   
     * Lines 66–70
     * Lines 75–76
     * Lines 124–126
     * Lines 168–172
   
   ## Expected Behavior
   
   * Secret values should be entered without echoing to the terminal.
   * Displayed profile information should mask sensitive fields such as 
`client_secret`.
   * Configuration files containing secrets should be written with user-only 
permissions (0600).
   
   ## Proposed Solution
   
   1. Replace `input()` with `getpass.getpass()` when reading `client_secret`.
   2. Introduce a helper (e.g., `format_profile_for_display()`) that masks 
sensitive fields before printing profile information.
   3. Write `~/.polaris/.polaris.json` using an atomic write pattern:
   
      * Create a temporary file.
      * Set permissions to `0o600`.
      * Replace the existing file using `os.replace()`.
   
   ## Impact
   
   This change improves credential security while preserving the existing 
configuration schema and CLI behavior.
   
   ## Additional Context
   
   The issue affects local credential handling and may expose secrets through 
terminal output, logs, screen recordings, shared machines, or improperly 
permissioned configuration files.
   
   
   ### To Reproduce
   
   _No response_
   
   ### Actual Behavior
   
   _No response_
   
   ### Expected Behavior
   
   _No response_
   
   ### Additional context
   
   _No response_
   
   ### System information
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to