Security teams should embed scanning as an automated pipeline control, not a separate after-the-fact review. Configure rules to surface high-risk findings, then block only the issues that violate policy or create unacceptable exposure. Use repository-level tuning so each project can apply the right thresholds, while keeping developers, security analysts, and managers aligned on shared risk ownership.
Why This Matters for Security Teams
Code scanning in Bitbucket Cloud only helps if it becomes part of the delivery path, not a separate gate that developers learn to route around. For most teams, the real risk is not the scanner itself but the mismatch between policy and pipeline behavior: too many findings cause alert fatigue, while too few let critical defects and exposed secrets move forward. NIST Cybersecurity Framework 2.0 remains useful here because it frames security as an operational capability, not a late review step, and that is the right mental model for modern CI/CD.
This is especially important where code, build secrets, and deployment credentials live in the same workflow. NHIMG research on Guide to the Secret Sprawl Challenge shows how quickly credentials accumulate across delivery systems, and why scanning must be paired with secret handling discipline. If the pipeline can reveal high-risk issues early, teams can block only what truly violates policy and let lower-risk work continue with visibility intact. In practice, many security teams discover their “fast” pipelines are already slow because remediation happens after merge, after release, or after an incident.
How It Works in Practice
The most effective pattern is to treat scanning as an automated control with severity-based enforcement. In Bitbucket Cloud pipelines, that usually means running code scanning on pull requests and mainline branches, then tuning the policy so only clearly unacceptable conditions fail the build. Current guidance suggests separating informational findings from enforcement findings, because a single undifferentiated gate tends to create friction without improving outcomes.
A practical setup usually includes three layers:
- Run fast checks on every pull request so developers get immediate feedback before merge.
- Reserve hard blocking for policy violations such as critical vulnerabilities, hard-coded secrets, or forbidden dependency risks.
- Use repository-level thresholds so a high-risk service can be stricter than a low-risk internal tool without forcing one global rule.
That approach works best when security, engineering, and platform owners agree on what is “block,” “warn,” and “accept with exception.” It also helps to pair scanner output with remediation guidance, because a build that only says “fail” often drives work into manual triage queues. NHIMG’s CI/CD pipeline exploitation case study is a useful reminder that attackers target delivery systems precisely because they can turn a single pipeline weakness into broad downstream impact. For broader operational context, the NIST Cybersecurity Framework 2.0 supports the same idea: detect and respond continuously rather than waiting for a final approval checkpoint.
Teams that keep scans lightweight, scoped, and policy-driven usually preserve developer velocity while improving coverage. These controls tend to break down when every repository shares one rigid rule set because build noise rises faster than the team can triage it.
Common Variations and Edge Cases
Tighter scanning often increases triage overhead, requiring organisations to balance delivery speed against the cost of reviewing findings. That tradeoff becomes visible in monorepos, legacy services, and heavily shared pipelines, where one scanner can produce a large volume of inherited issues unrelated to the current change set.
Best practice is evolving around partial enforcement and contextual exceptions. For example, teams may choose to block only newly introduced critical findings while allowing known legacy issues to remain visible in the backlog. That keeps delivery moving without hiding risk. Some environments also need different treatment for third-party code, generated code, and infrastructure-as-code files, because a single scanning policy rarely fits all three well. Where secret exposure is the main concern, pairing code scanning with secret detection is essential, since source-level checks alone do not catch every leak. NHIMG’s Reviewdog GitHub Action supply chain attack illustrates how pipeline trust can become the real attack surface when automation is granted broad execution rights.
The cleanest implementation is one that can be tuned per repository, reviewed regularly, and measured against false-positive rate and mean time to remediate. Without that discipline, even a well-designed scanner can become a drag on delivery instead of a guardrail.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10, OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST CSF 2.0 and NIST AI RMF set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-04 | Pipeline-scoped secrets and NHI misuse are directly relevant to scan enforcement. |
| OWASP Agentic AI Top 10 | A-06 | Automated pipeline actions need policy-bound execution, like other agentic workloads. |
| CSA MAESTRO | GOV-02 | Repository-level policy tuning fits MAESTRO governance for automated delivery controls. |
| NIST CSF 2.0 | PR.DS-6 | Code scanning supports protecting data in transit and at rest within CI/CD. |
| NIST AI RMF | GOVERN | Policy ownership and accountability are needed for automated security decisions. |
Constrain automation with least privilege and task-scoped approvals before code reaches deploy stages.
Related resources from NHI Mgmt Group
- How should security teams integrate Java source scanning into CI pipelines without slowing developers down?
- How should security teams integrate container scanning into CI/CD without slowing delivery?
- How should security teams limit cloud access without slowing delivery?
- How should security teams unify cloud security and AppSec without slowing delivery?