gitbutlerapp / gitbutler

The GitButler version control client, backed by Git, powered by Tauri/Rust/Svelte
https://gitbutler.com
Other
11.48k stars 467 forks source link

migrate plain-text secrets to keystore #4165

Open Byron opened 6 days ago

Byron commented 6 days ago

Remove plain-text secrets from various configuration files and put them into the keystore instead.

This is a similar move as the one done by the gh command-line tool recently, which now also stores its secrets (like the GitHub authentication token) in the keystore.

Tasks

Platform Notes

Notes for the Reviewer

Byron commented 2 days ago

I declare it ready for review despite the Frontend-based CI failures. @mtsgrd offered help in turning the naive current implementation into something maintainable much faster and better than I could do it. Thus, I will stop force-pushing here and will at most push fixes on top if @krlvi finds issues during testing.

gitguardian[bot] commented 21 minutes ago

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | | | -------------- | ------------------ | ------------------------------ | ---------------- | --------------- | -------------------- | | [-](https://dashboard.gitguardian.com/workspace/495881/incidents/secrets) | | Generic High Entropy Secret | b0ababbabf1164b8e83b923c3d124b2780d743cf | app/src/lib/ai/service.test.ts | [View secret](https://github.com/gitbutlerapp/gitbutler/commit/b0ababbabf1164b8e83b923c3d124b2780d743cf#diff-806b07fa44fb9bbaf589ff8acacfb1e2f53a8091b7ae716b7e0100e0c72a4a5aL186) |
🛠 Guidelines to remediate hardcoded secrets
1. Understand the implications of revoking this secret by investigating where it is used in your code. 2. Replace and store your secret safely. [Learn here](https://blog.gitguardian.com/secrets-api-management?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) the best practices. 3. Revoke and [rotate this secret](https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/generics/generic_high_entropy_secret#revoke-the-secret?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment). 4. If possible, [rewrite git history](https://blog.gitguardian.com/rewriting-git-history-cheatsheet?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment). Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data. To avoid such incidents in the future consider - following these [best practices](https://blog.gitguardian.com/secrets-api-management/?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) for managing and storing secrets including API keys and other credentials - install [secret detection on pre-commit](https://docs.gitguardian.com/ggshield-docs/integrations/git-hooks/pre-commit?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) to catch secret before it leaves your machine and ease remediation.

🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

mtsgrd commented 13 minutes ago

@Byron thanks, I've pushed a commit splitting out a separate service for the secrets. Could you have a look and make sure things still work as expected?