Habr•November 25, 2026•🇷🇺Translated from Russian

Securing Secrets in GitLab CI/CD Against Merge Request Leaks and Unsafe Pipelines

GitLab pipelines execute with elevated privileges, granting every job access to project variables and the CI_JOB_TOKEN. When configuration is incorrect, these credentials become available from untrusted branches and pipelines triggered from forks.

Common leakage scenarios include debug commands such as echo $SECRET left in .gitlab-ci.yml or an overly broad CI_JOB_TOKEN that permits access to neighboring projects. The key distinction is that masked does not equal protected: masking hides values in job logs but does not restrict access, whereas protected variables are delivered only to pipelines running on protected branches and tags.

Variable Hygiene and Scope

Variables can be defined at instance, group, or project level. Higher levels affect more projects, increasing the risk of silent overrides. Teams should adopt naming conventions with prefixes and regularly audit group-level variables to remove outdated entries.

Secrets should always be configured as both protected and masked, with an additional environment scope such as environment: production. This ensures the secret is available only in jobs linked to the intended environment even on protected branches.

Restricting CI_JOB_TOKEN

Administrators can limit CI_JOB_TOKEN scope in Settings → CI/CD → Token Access by explicitly listing only the projects that require access. This change converts an all-powerful token into one with precisely the required permissions and should be applied to legacy projects whose defaults may date from earlier GitLab versions.

External Secret Management with HashiCorp Vault

For highly sensitive data such as production database credentials or cloud access keys, GitLab recommends external secret stores. HashiCorp Vault integration uses JWT/OIDC authentication: GitLab issues a signed JWT, Vault validates the signature and claims including project_id, ref_protected, and ref_type, then releases the secret only when all conditions match.

The declarative secrets: block is preferred for readability, while manual id_tokens login offers greater flexibility. Vault roles must be tightly bound to specific projects and protected tags to prevent tokens from feature branches or forks from obtaining production secrets.

OIDC Federation for Cloud Access

GitLab can issue signed JWTs via the id_tokens keyword, enabling passwordless authentication to cloud providers. In Yandex Cloud, a federation is created with the GitLab issuer URL and audience set to the project path. Subject constraints are limited to concrete protected branches using stable identifiers such as project_id rather than mutable paths.

The resulting short-lived IAM token is passed between jobs through artifacts:reports:dotenv. This approach eliminates static cloud credentials entirely and automatically rotates tokens on every pipeline run.

Pipeline and Runner Hardening

Configuration files included from other repositories must be referenced by commit SHA rather than branch name. Runners should be tagged by trust level so that builds from forks never execute on privileged runners holding production secrets. Tools such as Buildah or Kaniko are preferred over Docker-in-Docker, and container images should be pinned by SHA digest.

These layered controls—proper variable configuration, external secret storage, OIDC federation, and pipeline hardening—collectively reduce the attack surface of GitLab CI/CD environments.

Related articles

Habr•Supply Chain & Open Source

SAP Investigates GitHub Breach After Attackers Steal Employee Tokens to Modify Source Code

SAP has confirmed an ongoing investigation into a security incident in which attackers obtained employee authentication tokens and used them to access, copy, and modify source code on the company's GitHub infrastructure. The company stated that there is currently no evidence of unauthorized access to customer data. German outlet Der Spiegel reported that the incident was internally codenamed Project Granite, with employees instructed to maintain confidentiality. Attackers are believed to have leveraged AI-based tools during the operation, though SAP has not officially confirmed this detail. As a precaution, SAP restricted GitHub access, halted automated development processes, and replaced digital signing keys. The incident follows a separate compromise of official SAP npm packages earlier this year that targeted developer credentials.

AntiMalware•Supply Chain & Open Source

Pre-installed Android Malware Surges as Triada and Keenadu Trojans Infect Devices Through Supply Chain

The number of Android devices carrying pre-installed malware has more than doubled over the past year, with compromised firmware reaching consumers directly from manufacturers. According to Kaspersky Lab research covering the first ten months of 2026, 88 percent of detected cases involved the Triada and Keenadu trojan families, with Keenadu alone appearing on over 220,000 devices. Infections occur at multiple points in the production pipeline, including deliberate insertion by makers of low-cost and counterfeit hardware, compromised firmware builds supplied by contractors, and tainted open-source components. Triada operates with system-level privileges to inject malicious modules into application memory, intercept SMS and calls, and steal credentials, while Keenadu employs a delayed-activation mechanism that can remain dormant for roughly 2.5 months after initial contact with its command server. Similar threats have been identified beyond smartphones, including Dwphon on children's smartwatches and Vo1d on television set-top boxes. Kaspersky Lab's Denis Parinov warned that such devices can serve as entry points into corporate networks, sources of data leaks, and participants in DDoS attacks, recommending firmware verification and Zero Trust policies for mobile infrastructure.

安全客•Supply Chain & Open Source

Barracuda Cloud Breach: Unrevoked Key to Third-Party AI Provider Allowed AI Agent Deployment

Barracuda suffered a cloud intrusion after an access key issued to a third-party AI service provider was never revoked following the end of their collaboration. Attackers used the valid credential to access multiple cloud environments, including those managing the company's XDR security products. They then deployed the ARTEX AI penetration testing framework, which autonomously enumerated permissions, moved laterally, and searched for cryptocurrency wallet data such as mnemonic phrases and private keys stored in Kubernetes Secrets and environment variables. The incident remained undetected by internal monitoring for nearly two days until the AI provider and an engineer reported anomalies. Barracuda has since advised affected customers to reissue credentials, highlighting persistent risks in third-party access management and long-lived cloud keys. The case underscores how AI tools can accelerate post-compromise execution while the root cause remains classic credential hygiene failures.

Habr•Supply Chain & Open Source

Scandal in Bohemia: How MaDaDev Hid OpenRails Code in TME Using .NET Native AOT While Leaving Clear Evidence

A Russian developer and long-time OpenRails contributor has published a detailed analysis showing that the commercial Train Multiplayer Experience (TME) product from MaDaDev RTS contains large portions of code copied from the GPL-licensed OpenRails simulator. Despite attempts to obfuscate the origins through renaming, recompilation with .NET Native AOT, and addition of new modules such as a paid subscription system, decompilation with dnSpy revealed near-identical class structures, method signatures, and even leftover OpenRails directory paths. The TME distribution still shipped the original GNU GPL v3 license file along with unmodified Readme and Prerequisites documents from OpenRails. The researcher filed Launchpad ticket #2174769 documenting dozens of modified and newly added files that implement authorization, DirectX 12 rendering, and physics changes on top of the stolen base. The case highlights ongoing challenges in enforcing copyleft licenses when commercial teams attempt to close and monetize open-source railway simulation code.