> For clean Markdown of this page, append .md to its URL. For the complete documentation index, see https://www.superagent.sh/llms.txt.


Connect Bitbucket Cloud repositories for PR security scans, supply chain checks, repository red teaming, and findings review.

# Connect Bitbucket

Connect Bitbucket Cloud from [Integrations](https://www.superagent.sh/app/integrations). An organization
owner links a native Superagent Security app installation to their organization.
A Bitbucket workspace administrator installs the app using Bitbucket's native
permissions screen. Repository access belongs to the app installation.

## Connect repositories

1. Open **Integrations → Bitbucket Cloud → Connect** and install Superagent
   Security into the appropriate Bitbucket workspace.
2. In Bitbucket, open **Workspace settings → Forge Apps → Superagent Security**
   and select **Connect to Superagent**.
3. Choose your Superagent organization and confirm. Accessible repositories in
   the installed workspace synchronize automatically. Repeat for another
   workspace if needed.
4. Open [Repositories](https://www.superagent.sh/app/repository) to configure PR scans, supply chain
   checks, contributor history review, environment variables, and red teaming.

New and updated pull requests trigger the enabled checks. Results appear as
Bitbucket commit statuses and PR comments, with full history and findings in
Superagent. Comment `@superagent review` to request another review; repository
permissions and the configured allowed review actors still apply.

Repository configuration can also be stored in `.superagent.yml` at the
repository root. Organization-managed settings override the file.

## Repository red teaming

Start manual scans, choose daily, weekly, or monthly schedules, or run on new
tags. Tag-triggered scans use the tag's pinned commit. Findings, remediation
diffs, focused triage, report history, desktop streams, and repository environment
variables use the same workflows as GitHub repositories.

## Provider differences

- Contributor review assesses accessible previous PRs in the selected Bitbucket
  repository. It does not assign a GitHub reputation score or claim global
  identity verification. Missing history produces an inconclusive result.
- GitHub Security Advisory ingestion and publication are unavailable. Repository
  findings and focused triage remain available in Superagent.
- Dependency Validation supports Renovate and owner-approved dependency bots.
  Enable it in the repository's **Dependency validation** tab and add the bot's
  immutable Bitbucket account UUIDs, without braces. Hosted Renovate pushes as
  the workspace and commits as a separate Renovate account; approve both UUIDs.
  A workspace UUID trusts all apps acting through that workspace identity.
  Superagent verifies every
  introduced commit against signed Forge push events from that account before
  loading repository variables. Bot names, PR titles, and Git author emails
  alone do not authorize execution. Missing or truncated push evidence prevents
  execution; retry after Forge delivery. Fork PRs and merged commit ranges are
  not eligible. The destination must be the default branch or an owner-selected
  base branch, and its commit must be an ancestor of the bot update. If the
  destination advances or diverges, update the bot branch before retrying.
  These checks run again before provisioning. The native Forge connection is required.
- Bitbucket dependency advisories come from OSV using the pinned base package
  versions. Superagent tests the vulnerable base and proposed update through the
  same Dependency Validation runtime. Missing advisory coverage stays inconclusive.
  Results publish as Bitbucket PR comments and commit statuses; GitHub outcome
  labels are not available on Bitbucket.
  Eligible vulnerable dependency updates run Dependency Validation exclusively,
  without parallel PR security, supply chain, or contributor checks. Routine
  version updates without known advisories retain the regular checks.
- Use tags or schedules for automatic red teaming; GitHub release events have
  no equivalent in this connection.
- Patch PR creation and Open CLA are outside this Bitbucket integration.
- Public repositories can publish security badges. Private repository statistics
  are never exposed by the public badge endpoint.

## Disconnect

**Disconnect** stops repository access and new scans through Superagent for a
workspace. Uninstall **Superagent Security** from Bitbucket's **Workspace settings
→ Installed apps** to revoke the app installation. Native uninstall handling
deactivates the workspace's repository connections and clears stored app tokens.
Existing reports and findings are retained.

## Server configuration

The operator deploys the native Forge app in `integrations/bitbucket-forge`.
Set `BITBUCKET_FORGE_APP_ID`, `BITBUCKET_FORGE_ENVIRONMENT`, and
`BITBUCKET_FORGE_INSTALL_URL` on the Superagent server. The installation URL comes
from the Forge developer console's distribution settings. Set
`BITBUCKET_FORGE_REMOTE_URL` to the public HTTPS backend origin when deploying
Forge, and `BITBUCKET_FORGE_APP_URL` to the user-facing Superagent origin
(`http://localhost:3000` for local development).

Build the Forge settings UI with `node scripts/build-bitbucket-forge.mjs`.
Run Forge commands through `scripts/bitbucket-forge-cli.mjs` with dotenvx to
load the configured remote URL. Apply both Bitbucket database migrations before
deploying Superagent. `--app development` and `--app production` select the
separate registered applications recorded in `app-ids.json`. Both applications
use their Forge production environment so each has a native distribution link;
the development application points to the developer tunnel. The production
application uses `https://www.superagent.sh`, or the explicit
`BITBUCKET_FORGE_PRODUCTION_REMOTE_URL` override. Match each server's app ID,
environment (`PRODUCTION`), and installation link to its application.

Forge authenticates native events and remote calls using signed invocation
tokens. App tokens are encrypted at rest, refreshed by native scheduled
invocations, and cleared when the installation is removed. Sandbox checkouts
use read-only Git access scoped to their report or scan; app credentials stay
on the server. Customers install the shared app and do not register their own
application. This integration supports Bitbucket Cloud.

---
Source: https://www.superagent.sh/docs/connect/bitbucket
Index: https://www.superagent.sh/llms.txt
