-
-
Notifications
You must be signed in to change notification settings - Fork 6
Content: Password Management for #8 #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JosephTLucas
wants to merge
11
commits into
main
Choose a base branch
from
passwords
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ae893b1
Content: Password Management for #8
JosephTLucas 56a5811
Update bestpractices/content/passwords.md
JosephTLucas 56e2a60
Update bestpractices/content/passwords.md
JosephTLucas 9d729ba
Update bestpractices/content/passwords.md
JosephTLucas 618751f
Update bestpractices/content/passwords.md
JosephTLucas a7fe20b
Update bestpractices/content/passwords.md
JosephTLucas adb9295
Update bestpractices/content/passwords.md
JosephTLucas f33a5c7
Update bestpractices/content/passwords.md
JosephTLucas b25515a
Update bestpractices/content/passwords.md
JosephTLucas 9cdf750
Fix a typo, fix spelling notation of "TruffleHog"
agriyakhetarpal bcb1bfd
Add a reference to SPEC 6 – "Keys to the Castle"
agriyakhetarpal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,66 @@ | ||||||||||
# Password Management | ||||||||||
|
||||||||||
Maintaining open source software often means juggling a variety of responsibilities—from ensuring code quality to building a thriving community of contributors. Projects often find themselves juggling accounts on a variety of platforms like code repositories domain providers, and container repositories, all while trying to control access to the right set of individuals. This is often messy and a source of vulnerability. | ||||||||||
|
||||||||||
This post aims to help open source maintainers understand: | ||||||||||
|
||||||||||
1. The value of using a password manager for both personal and project credentials. | ||||||||||
2. How to scan for accidentally committed secrets using open source tools like [TruffleHog](https://github.com/trufflesecurity/trufflehog). | ||||||||||
3. Techniques for setting up pre-commit hooks and CI scans to ensure secrets do not leak into your repositories. | ||||||||||
|
||||||||||
--- | ||||||||||
|
||||||||||
## Risks of Insecure Password Management | ||||||||||
|
||||||||||
Hardcoded passwords, API keys, and other secrets in your repository can expose your project to risks like: | ||||||||||
|
||||||||||
- **Account Takeover**: Exposed credentials can allow unauthorized access to critical services (e.g., package registries, CI/CD systems, or infrastructure). | ||||||||||
- **Reputation Damage**: A security breach can harm your project's reputation, deterring potential collaborators or users. | ||||||||||
- **User Supply Chain Risk**: With unauthorized access, attackers can push harmful content to your users. Most often, this is simply defacement or malicious binaries (like cryptojackers), but can sometimes be more insidious. | ||||||||||
|
||||||||||
Ensuring that passwords and other sensitive credentials remain secure is essential for any project that wants to maintain trust and protect both its developers and users. | ||||||||||
|
||||||||||
--- | ||||||||||
|
||||||||||
## Best Practices for Secret Handling | ||||||||||
|
||||||||||
1. **Never store passwords or tokens directly in your repository.** Use something like GitHub Secrets to manage your secrets during CI/CD. | ||||||||||
2. **Limit Credential Scope**: Give each service or token the least privileges possible. Avoid reusing passwords across multiple services. | ||||||||||
3. **Rotate Credentials Regularly**: If you accidentally expose a secret, be prepared to revoke or rotate it immediately. | ||||||||||
4. **Educate Contributors**: Let your community know about these security measures. Provide clear guidelines for how they should handle secrets. | ||||||||||
|
||||||||||
--- | ||||||||||
|
||||||||||
## Using a Password Manager | ||||||||||
|
||||||||||
One of the easiest ways to ensure secrets stay secure is to use a password manager. Password managers offer: | ||||||||||
|
||||||||||
- **Encrypted Storage**: Passwords are stored in an encrypted vault, reducing the risk of accidental exposure. | ||||||||||
- **Secure Sharing**: Share credentials safely among project maintainers without resorting to email or plaintext messages. | ||||||||||
Comment on lines
+38
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
- **Strong, Unique Passwords**: Automatically generate strong passwords for each service to minimize the damage if one account is compromised. | ||||||||||
|
||||||||||
If you’re looking for a managed solution, [1Password](https://github.com/1Password/for-open-source) provides a **free Teams account for Open Source Projects**. An open source alternative is [Bitwarden](https://github.com/bitwarden/). | ||||||||||
|
||||||||||
--- | ||||||||||
|
||||||||||
## Scanning for Secrets | ||||||||||
|
||||||||||
Even with a password manager, mistakes can happen. You or a contributor might accidentally commit a password, API key, or other credentials to the repository. Fortunately, tools like [TruffleHog](https://github.com/trufflesecurity/trufflehog) can help detect these secrets before they make their way into production or public repositories. | ||||||||||
|
||||||||||
For usage details, see the official [Trufflehog documentation](https://github.com/trufflesecurity/trufflehog). | ||||||||||
|
||||||||||
When evaluating a secret scanning tool, there are several key features to look for: | ||||||||||
|
||||||||||
1. **Relevance**: The relevance to the secrets your project uses. Most of these tools use regular expressions to identify the service associated with the credential. Some also test the credential to determine if it's still active, which helps reduce false positives. Review their documentation to make sure that the services you use are monitored. | ||||||||||
2. **Pre-commit hooks**: The best time to catch a mistake is before it happens. If you can configure the tool into [pre-commit hooks](https://pre-commit.com/), you can detect the secrets _before you can commit them locally and subsequently push changes to the remote repository_. | ||||||||||
3. **CI/CD**: We work in distributed teams and building checks into our automated processes will help protect everyone. | ||||||||||
|
||||||||||
The Security Committee has found that TruffleHog fits nicely because it is open source, supports a wide range of detectors, and has convenient pre-commit hooks and CI integrations. | ||||||||||
|
||||||||||
--- | ||||||||||
|
||||||||||
## Conclusion | ||||||||||
|
||||||||||
Password management is a foundational security practice for any open source project, including those under NumFOCUS. By leveraging password managers such as [1Password](https://github.com/1Password/for-open-source) (with its free Teams account for eligible OSS projects) and incorporating secret scanning tools like [TruffleHog](https://github.com/trufflesecurity/trufflehog) into your workflow, you can significantly reduce the risk of accidental credential leaks and protect your maintainers and users. | ||||||||||
|
||||||||||
For additional reading on security best practices beyond password management and around project-specific recommendations, please refer to [Scientific Python - SPEC 6 — "Keys to the Castle"](https://scientific-python.org/specs/spec-0006/). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"GitHub Secrets" makes me feel as if it's an official product/service offered by GitHub to manage secrets, and it doesn't show up as such on search engines, so it could be misleading – I'm curious to hear your thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I can clarify with "secrets in GitHub Actions"