<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Azidin Shairi</title>
    <description>The latest articles on DEV Community by Azidin Shairi (@azidin).</description>
    <link>https://dev.to/azidin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1179499%2F49ba9bd9-eb00-4e78-a626-77dc035974c0.png</url>
      <title>DEV Community: Azidin Shairi</title>
      <link>https://dev.to/azidin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/azidin"/>
    <language>en</language>
    <item>
      <title>Zero Trust CI/CD: Keyless Bitbucket Deployment on Google Cloud</title>
      <dc:creator>Azidin Shairi</dc:creator>
      <pubDate>Thu, 29 Oct 2026 20:41:19 +0000</pubDate>
      <link>https://dev.to/gde/zero-trust-cicd-keyless-bitbucket-deployment-on-google-cloud-1ka1</link>
      <guid>https://dev.to/gde/zero-trust-cicd-keyless-bitbucket-deployment-on-google-cloud-1ka1</guid>
      <description>&lt;p&gt;Using static Service Account (SA) keys in CI/CD pipelines has long been a common method for authenticating to Google Cloud Platform (GCP). However, storing long-lived credentials inside external pipeline environment variables introduces severe security vulnerabilities and ongoing operational friction.&lt;/p&gt;

&lt;p&gt;Google Mandiant demonstrated in a threat intelligence blog post (&lt;a href="https://cloud.google.com/blog/topics/threat-intelligence/bitbucket-pipeline-leaking-secrets" rel="noopener noreferrer"&gt;Holes in Your Bitbucket: Why Your CI/CD Pipeline Is Leaking Secrets&lt;/a&gt;) that secret variables in Bitbucket pipelines can easily be extracted from environment variables during runtime. Moving away from static JSON keys toward Google Cloud Workload Identity Federation (WIF) provides a modern, keyless authentication mechanism that leverages OpenID Connect (OIDC) to exchange short-lived tokens, eliminating the risks associated with static credential management.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Service Account Keys Are a Bad Security&amp;nbsp;Practice
&lt;/h2&gt;

&lt;p&gt;While Atlassian Bitbucket documentation describes &lt;a href="https://support.atlassian.com/bitbucket-cloud/docs/deploy-to-google-cloud/" rel="noopener noreferrer"&gt;deployment to Google Cloud using Service Account keys&lt;/a&gt;, relying on traditional static JSON key files introduces two fundamental security and operational flaws:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High Security Risk &amp;amp; Lack of Traceability&lt;/strong&gt;: Service account keys do not expire automatically and carry persistent security exposure. They lack strict origin traceability and can easily be copied, downloaded, or exfiltrated to execute commands anywhere outside Bitbucket without network restrictions or audit context. If a key is compromised, malicious actors gain unrestricted access until it is manually identified and revoked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Management &amp;amp; Operational Overhead&lt;/strong&gt;: Even if key expiration limits are configured, security compliance mandates continuous key lifecycle management, including periodic rotation and distribution across multiple repositories and workspaces. This creates substantial administrative overhead for platform engineering teams and risks pipeline failures when keys expire or are revoked prematurely.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F85obpqnk0wzbaj0d3umj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F85obpqnk0wzbaj0d3umj.png" alt=" " width="800" height="308"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing Workload Identity Federation (WIF)
&lt;/h2&gt;

&lt;p&gt;Workload Identity Federation establishes direct federated trust between Atlassian Bitbucket, acting as the Identity Provider and Google Cloud using OpenID Connect (OIDC) over the OAuth 2.0 framework. While OAuth 2.0 handles authorization, deciding what resources can be accessed, OIDC adds authentication verifying identity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F87yx6u0qwfo18idvbhak.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F87yx6u0qwfo18idvbhak.png" alt=" " width="799" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Key benefits of WIF include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Short-Lived Token Exchange&lt;/strong&gt;: Bitbucket generates a temporary OIDC identity token for each pipeline step. Workload Identity Federation validates this token and exchanges it for a short-lived access token to Google Cloud, valid strictly for the duration of the job.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fine-Grained Scope Control&lt;/strong&gt;: Access permissions can be tightly scoped per Bitbucket workspace, project, repository, or down to a specific deployment environment pipeline (e.g., staging vs. production).&lt;/p&gt;




&lt;h2&gt;
  
  
  Migrating Bitbucket Pipelines from using Service Account Keys to Google Cloud Workload Identity Federation
&lt;/h2&gt;

&lt;p&gt;Before configuring Workload Identity Federation, gather your Bitbucket workspace OIDC configurations from your repository admin setting page.&lt;br&gt;
You will need the following details from Bitbucket Workspace&amp;nbsp;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identity Provider URL: &lt;code&gt;https://api.bitbucket.org/2.0/workspaces/WORKSPACE_ID/pipelines-config/identity/oidc&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Audience: &lt;code&gt;ari:cloud:bitbucket::workspace/WORKSPACE_UUID&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bitbucket issues an OIDC token claim payload during pipeline execution structured as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"sub"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{REPOSITORY_UUID}:{stepUuid}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"aud"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ari:cloud:bitbucket::workspace/WORKSPACE_UUID"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"stepUuid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"iss"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.bitbucket.org/2.0/workspaces/WORKSPACE_ID/pipelines-config/identity/oidc"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"repositoryUuid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{REPOSITORY_UUID}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"branchName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"xxxxxxxxx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"exp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"xxxxxxxxxx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"iat"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"xxxxxxxxxx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"pipelineUuid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxx}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"workspaceUuid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{WORKSPACE_UUID}"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bitbucket OpenID Connect settings page looks like this: &lt;a href="https://bitbucket.org/WORKSPACE_ID/REPO_ID/admin/pipelines/openid-connect" rel="noopener noreferrer"&gt;https://bitbucket.org/WORKSPACE_ID/REPO_ID/admin/pipelines/openid-connect&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5cupz4qrhp5bf4rr3b5y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5cupz4qrhp5bf4rr3b5y.png" alt=" " width="800" height="909"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Enable and Set Up WIF in Target GCP&amp;nbsp;Projects
&lt;/h3&gt;

&lt;p&gt;To establish federated authentication between Bitbucket Pipelines and GCP, create a Workload Identity Pool and Provider in your target GCP project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.1 Create a Workload Identity Pool&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Create a global Workload Identity Pool dedicated to Bitbucket:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud iam workload-identity-pools create bitbucket &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"global"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Bitbucket Workload Identity Pool"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--display-name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Bitbucket"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1.2 Create the Workload Identity Provider&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Configure an OIDC provider that trusts Bitbucket's issuer URL and maps claims (such as workspace UUID, repository UUID, and deployment environment) to Google attributes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud iam workload-identity-pools providers create-oidc bitbucket &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"global"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--display-name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Bitbucket"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Bitbucket Identity Provider"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--workload-identity-pool&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"bitbucket"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--issuer-uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://api.bitbucket.org/2.0/workspaces/WORKSPACE_ID/pipelines-config/identity/oidc"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--allowed-audiences&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ari:cloud:bitbucket::workspace/WORKSPACE_UUID"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--attribute-mapping&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"google.subject=assertion.sub,attribute.workspace_uuid=assertion.workspaceUuid,attribute.repository_uuid=assertion.repositoryUuid,attribute.deployment_env_uuid=assertion.deploymentEnvironmentUuid"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz1dixcpl2kqvw4bql638.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz1dixcpl2kqvw4bql638.png" alt=" " width="800" height="764"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.3 Map Bitbucket Identity to the GCP Service Account&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Grant your Bitbucket Workspace permission to impersonate the target GCP existing Service Account by binding the &lt;code&gt;roles/iam.workloadIdentityUser&lt;/code&gt; role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud iam service-accounts add-iam-policy-binding bitbucket-pipelines@PROJECT_ID.iam.gserviceaccount.com &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;roles/iam.workloadIdentityUser &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--member&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/bitbucket/attribute.workspace_uuid/{WORKSPACE_UUID}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fonw7goktt9l94ddpywfs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fonw7goktt9l94ddpywfs.png" alt=" " width="800" height="303"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Update Bitbucket Pipelines to Use OIDC Authentication
&lt;/h3&gt;

&lt;p&gt;Once Workload Identity Federation and the Identity Pool are configured, update your &lt;code&gt;bitbucket-pipelines.yml&lt;/code&gt; configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Legacy Pipeline Configuration (Using Static SA Keys):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;pipelines&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;default&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;step&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deployment Step&lt;/span&gt;
        &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;gcloud auth activate-service-account --key-file &amp;lt;(echo "${GCLOUD_DEPLOYER_KEYFILE}" | base64 --decode --ignore-garbage)&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;gcloud config set project $GCLOUD_PROJECT&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To migrate your pipeline to OIDC authentication, first update each pipeline step requiring Google Cloud access by enabling &lt;code&gt;oidc: true&lt;/code&gt;. This allows Bitbucket to generate an OIDC token during execution, which you then export from the &lt;code&gt;$BITBUCKET_STEP_OIDC_TOKEN&lt;/code&gt; environment variable to a temporary file for gcloud usage.&lt;/p&gt;

&lt;p&gt;Next, update your authentication commands by switching&lt;br&gt;
from &lt;code&gt;gcloud auth activate-service-account --key-file=file.json&lt;/code&gt;&lt;br&gt;
to &lt;code&gt;gcloud auth login --cred-file=file.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, update your workspace variables to replace the legacy key variable (&lt;code&gt;GCLOUD_DEPLOYER_KEYFILE&lt;/code&gt;) with a reference pointing to your credential configuration file (&lt;code&gt;GCLOUD_DEPLOYER_CREDFILE&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Migrated Pipeline Configuration (Using Keyless WIF via OIDC):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;pipelines&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;default&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;step&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deployment Step with OIDC&lt;/span&gt;
        &lt;span class="na"&gt;oidc&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
        &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;echo $BITBUCKET_STEP_OIDC_TOKEN &amp;gt; /tmp/bitbucket-step-oidc-token.txt&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;gcloud auth login --cred-file &amp;lt;(echo "$GCLOUD_DEPLOYER_CREDFILE")&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;gcloud config set project $GCLOUD_PROJECT&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Remove Bitbucket Workspace Level GCP SA&amp;nbsp;Keys
&lt;/h3&gt;

&lt;p&gt;After validating that the updated pipeline runs and authenticates successfully using Workload Identity Federation, navigate to your Bitbucket Workspace or Repository Settings to permanently delete the legacy Service Account key variables, such as &lt;code&gt;GCLOUD_DEPLOYER_KEYFILE&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, navigate to the Google Cloud Console or run &lt;code&gt;gcloud iam service-accounts keys delete&lt;/code&gt; to revoke and delete the corresponding static Service Account JSON keys from GCP.&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary &amp;amp; Best Practices
&lt;/h2&gt;

&lt;p&gt;Migrating from static Service Account keys to Workload Identity Federation aligns your CI/CD workflows with Zero Trust security principles. By enforcing keyless authentication with short-lived OIDC tokens, you eliminate secret leakage risks, remove rotation management overhead, and gain fine-grained control over your Google Cloud deployments.&lt;/p&gt;

&lt;p&gt;To maximize your security posture during and after migration:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apply Least Privilege&lt;/strong&gt;: Restrict IAM role permissions on target GCP Service Accounts to only the explicit roles required for deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Leverage Fine-Grained Attribute Mappings&lt;/strong&gt;: Use WIF attribute conditions to strictly isolate non-production environments from production infrastructure based on repository UUIDs, branch names, or deployment environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Audit Organization Workflows&lt;/strong&gt;: Review active pipelines across your repositories to ensure all legacy gcloud auth activate-service-account commands and static key variables are fully removed.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Reference links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://cloud.google.com/blog/topics/threat-intelligence/bitbucket-pipeline-leaking-secrets" rel="noopener noreferrer"&gt;Google Mandiant: Bitbucket Pipeline Leaking Secrets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloud.google.com/iam/docs/workload-identity-federation" rel="noopener noreferrer"&gt;Managing Workload Identity Federation in GCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://support.atlassian.com/bitbucket-cloud/docs/integrate-pipelines-with-resource-servers-using-oidc/" rel="noopener noreferrer"&gt;Atlassian Support: Integrate Bitbucket Pipelines with Resource Servers Using OIDC&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devops</category>
      <category>cicd</category>
      <category>security</category>
      <category>googlecloud</category>
    </item>
  </channel>
</rss>
