## Overview Add CLI support for the Secrets Management API, which manages secrets used in integrations and workflows. ## API Endpoints to Implement Based on analysis of https://docs.cortex.io/api, the following endpoints need CLI commands: ### Secrets - `POST /api/v1/secrets` - Create secret - `GET /api/v1/secrets` - List secrets (metadata only) - `GET /api/v1/secrets/{id}` - Get secret metadata - `PUT /api/v1/secrets/{id}` - Update secret - `DELETE /api/v1/secrets/{id}` - Delete secret **Note**: Secrets API returns metadata only (name, description, created date), not secret values, for security reasons. ## Proposed CLI Structure ```bash # Secrets Management cortex secrets create --name <name> --value <value> [--description <desc>] cortex secrets create -f <file> # For batch creation cortex secrets list cortex secrets get --id <id> cortex secrets get --name <name> cortex secrets update --id <id> --value <value> [--description <desc>] cortex secrets delete --id <id> cortex secrets delete --name <name> ``` ## Implementation Notes 1. Create new command module: `cortexapps_cli/commands/secrets.py` 2. Follow existing patterns from `api_keys.py` for sensitive data handling 3. **Security considerations**: - Never log or print secret values - Support reading values from stdin or file (not just CLI args) - Warn users about command history exposure when using `--value` flag - Recommend using `-f` with files or stdin for secret values 4. Support both interactive and file-based input 5. Add appropriate test coverage in `tests/test_secrets.py` 6. Consider adding `--force` flag for delete operations ## Security Best Practices ```bash # Recommended: Read from file cortex secrets create --name my-secret -f secret.txt # Recommended: Read from stdin echo "secret-value" | cortex secrets create --name my-secret -f- # Not recommended (appears in shell history) cortex secrets create --name my-secret --value "secret-value" ``` ## Priority **Medium-High** - Essential for workflow and integration management ## Business Impact Enables customers to manage secrets for: - Custom workflows - Integration configurations - CI/CD pipelines - Automation scripts Currently, users may need to manage secrets through the UI, which limits automation capabilities. ## References - API Documentation: https://docs.cortex.io/api/rest/secrets - Gap Analysis: Completed 2025-11-03
Activity