Link Search Menu Expand Document

Sensitive Information Disclosure in CI/CD

Play SecureFlag Play CI/CD Labs on this vulnerability with SecureFlag!

GitLab

Sensitive information management is a critical aspect of security in GitLab. “Secrets” refer to sensitive data like passwords, API keys, SSH keys, and tokens, which are often needed during CI/CD pipeline execution. Properly managing these secrets helps protect the system and its associated applications from unauthorized access and potential breaches.

CI/CD Variables

GitLab provides built-in support for securely managing secrets through CI/CD variables. These variables allow users to store sensitive information securely, ensuring that it is available for pipeline jobs without being exposed in logs or visible to unauthorized users.

CI/CD variables can store various types of data, such as API tokens, environment-specific configuration values, and passwords. They are encrypted at rest and are injected into pipeline jobs as environment variables during runtime.

Scoping

Secrets in GitLab can be defined at different scopes:

  • Project-level: Secrets are only available to the jobs running within a particular project.
  • Group-level: Secrets can be shared across multiple projects that belong to a specific group, ensuring consistency and ease of management.
  • Instance-level: Administrators can define instance-wide secrets, typically used for configurations applicable across multiple projects and groups.

This hierarchical scoping ensures that secrets are limited to where they are needed, minimizing the risk of exposure.

Job Access

Once defined, secrets can be referenced securely in GitLab CI/CD jobs without exposing their actual values. They are masked in job logs and injected as environment variables only when the pipeline is executed, ensuring that sensitive data is handled securely.

Integration with External Secret Management Tools

GitLab also supports integration with external secrets management tools like HashiCorp Vault or AWS Secrets Manager. These tools can be used in combination with GitLab CI/CD pipelines to fetch secrets dynamically, ensuring a consistent and secure approach to managing sensitive information across the entire development and deployment process.

Jenkins

Sensitive information management is an essential aspect of security in Jenkins. “Secrets” refer to sensitive data like passwords, API keys, SSH keys, and tokens, among others. Properly managing these secrets is vital to safeguard the system and its associated applications from unauthorized access and potential breaches.

Credentials Plugin

The Credentials plugin integrated with Jenkins serves as the primary mechanism for storing and managing secrets.

The plugin allows storing username and password pairs, SSH keys, certificates, files, and generic strings that can be used as generic authentication material.

It also encrypts secrets, ensuring they are not stored in clear text. This helps to achieve compliance.

Scoping

Secrets can be defined at varying scopes - globally, for specific domains, or for particular projects. This granularity ensures that secrets are only available where they’re needed, reducing the risk of accidental exposure.

Jobs

Once stored, secrets can be easily referenced in Jenkins jobs without exposing their actual content. They are injected into jobs as environment variables, ensuring that the raw secrets are never exposed in logs or output.

Plugins to Integrate with External Secrets Management Tools

While the Jenkins Credentials Plugin provides solid foundational capabilities for secrets management, larger organizations may already utilize dedicated secrets management tools, like HashiCorp Vault or AWS Secrets Manager. Jenkins can integrate with these systems, allowing a consistent secrets management approach across the CI/CD components.

References

Jenkins - Storing Secrets

GitLab - CI/CD Variables