Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Cheat sheet: 10 Bitbucket security tips www.snyk.

io

1. Never store credentials as code/ 4. Add a SECURITY.md file 6. Get security tips as part of
config in Bitbucket. your workflow with code insights
You should include a SECURITY.md file that highlights
Some good practices: security -related information for your project. This should Perform scans on all your open PRs using Bitbucket Code Insights. The
contain: Snyk integration provides detailed in-line annotations about the new
vulnerabilities that each PR introduces.
• Block sensitive data being pushed to Bitbucket by Disclosure policy

adding git-secrets or a git pre-commit hook.
Define the procedure that describes what a reporter needs to
• Break the build using the same tools when necessary.
do in order to fully disclose a problem safely when a security
7. Add security testing to PRs
• Audit for slipped secrets with GitRob or truffleHog. issue is found, including who to contact and how. Consider
Use Bitbucket hooks to check that your PRs don’t introduce
HackerOne’s community edition or simply a ‘security@’
• Connect to secret managers like Vault using Adaptavist’s
email.
new vulnerabilities:
ScriptRunner.
• Snyk—dependency vuln testing
Security update policy
• SonarCloud—code quality testing
2. Removing sensitive data 
Define how you intend to update project users about new • CodeClimate—automated code reviews
security vulnerabilities as they are found. 
If sensitive data makes it to a repo:
Security-related configuration 8. Add security testing in your Bitbucket pipes
• Invalidate tokens and passwords.
Define the settings that your project users should configure
• Remove the info and clear the Git history (force push
that impact the security posture of deploying this project,
Add security-scanning pipes into your CI/CD flow to ensure your
rewrite history). automated pipelines do not contain security regressions:
such as HTTPS, authorization and many others.
• Assess impact of leaked private info. • Snyk—dependency vuln testing
Known security gaps & future enhancements
• SonarCloud—code quality testing
ScriptRunner make these integrations simple.
These are security improvements you haven’t gotten to yet.
9. Consider Bitbucket server
3. Tightly control access
5. Validate Bitbucket apps
If you don’t want anybody to have access to your code (even
Failures in security are often the results of humans making
Remember these apps are written by third-party developers, Atlassian), or if regulations require it, use the Bitbucket Server
poor decisions. Mandate the following practices for your contributors:
not Bitbucket. Validate: on-prem offering.

• Require two-factor authentication for all your



Bitbucket accounts. • The application access rights 10. Rotate SSH keys and personal access tokens
• Never let developers share Bitbucket accounts/passwords. • The author/organization credibility
 Bitbucket access is typically done using SSH keys or personal user
• Properly secure any laptops/devices with access to • How good the app’s security posture is—a breach tokens (in lieu of a password, because you enabled 2FA!). But what

your source code. gives attackers access to your code! happens if those tokens are stolen and you didn’t know?
Diligently revoke access from Bitbucket users who are
• Monitor changes in (2) and (3) over time, and keep on top of Be sure to refresh your keys and tokens periodically, mitigating any
no longer working with you.
administering your applications. damage caused by keys that leaked out.

Manage team access to data. Give contributors only access to


what they need to do their work.

You might also like