The Simplest Way to Make Bitbucket and SAML Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Bitbucket and SAML work together by linking your code host to your central login provider. This setup lets developers log in once and reach their repos with the right roles. Teams use this link to stop sharing passwords and to control who can read code. When a worker leaves the company, you cut their login in one single place. They lose their code permissions right away without extra manual work from your team. How bitbucket and saml handle user logins and roles The login flow starts when a

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Bitbucket and SAML work together by linking your code host to your central login provider. This setup lets developers log in once and reach their repos with the right roles.

Teams use this link to stop sharing passwords and to control who can read code. When a worker leaves the company, you cut their login in one single place. They lose their code permissions right away without extra manual work from your team.

How bitbucket and saml handle user logins and roles

The login flow starts when a user tries to open a code page. The code host sees the user is not logged in yet. It sends a login request to your central identity provider right away. The identity provider checks who the user is and checks their current group rules.

Once the check passes, the identity provider sends back a signed XML note. This note holds the user email, name, and group list for the session. The code host reads this signed note and trusts the identity provider key. It then opens the session and grants permissions based on those group claims.

Data flows between the two tools through the user browser during web logins. The identity provider never reads your source code or your commit logs. It only passes user facts to the code host at login time. Admin teams can map identity groups to specific project roles inside the code host.

This setup keeps role rules inside your main directory instead of scattered in many apps. When an engineer changes teams, you update their group in the identity tool. On their next login, the signed XML note carries the new group name. The code host updates their project permissions without a ticket to the admin team.

Common failure modes and how to scope permissions

Web logins work well with this setup, but command line git operations often bypass it. Developers create personal tokens or SSH keys so they can push code from laptops. These long-lived keys often stay active even after you turn off a SAML user. An old token can still pull private code if the system does not check it.

SAML 2.0 + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Shared service accounts cause another big risk for growing engineering teams. Build tools and scripts often use one master account with full admin rights. When multiple scripts share one broad token, you cannot tell who made a change. Your audit logs only show the shared bot name instead of a real person.

To fix this, admins must scope every role to the smallest needed task. Do not give full project write rights to every user in the main login group. Split your identity groups into clear read, write, and admin tiers for each team. Map each group to a tight role that only touches the right repos.

You also need strict rules for network paths and local git tokens. Set short end dates on all personal tokens and SSH keys across your team. Force users to log in through the identity provider again before they renew a key. Block direct password logins so every web session must pass the SAML check.

Keeping audit logs and automated workflows safe

Clear audit logs help you track every action across your code host and login tool. You should log every login attempt, group change, and token creation event. When an incident happens, your security team needs to match git pushes to real people. Good logs show when a user logged in and which repo they touched.

Automated pipelines also need tight scoping when they run tests or deploy code. Give each build job its own separate identity with read-only permissions by default. Only grant write permissions to the specific job that tags a release. If a build token leaks, the attacker can only read a single project.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Does SAML cover command line git pushes in Bitbucket?

No, SAML only handles web browser logins to your code host. Command line git tools use SSH keys or personal tokens that bypass the web flow.

What happens to active sessions when I remove a user in my identity tool?

Removing a user stops new web logins right away, but active sessions may keeps the session active. You must also revoke their active sessions and delete their personal git tokens.

How do I stop shared build accounts from having too much power?

Give each pipeline its own scoped token with read access to one repo. Rotate these tokens often and log every git pull or push they make.

The query runs. The emails stay hidden.