A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.gitlab.com/ci/pipeline_security/ below:

Pipeline security | GitLab Docs

Secrets Management

Secrets management is the systems that developers use to securely store sensitive data in a secure environment with strict access controls. A secret is a sensitive credential that should be kept confidential. Examples of a secret include:

Secrets storage Secrets management providers

Secrets that are the most sensitive and under the strictest policies should be stored in a secrets manager. When using a secrets manager solution, secrets are stored outside of the GitLab instance. There are a number of providers in this space, including HashiCorp’s Vault, Azure Key Vault, and Google Cloud Secret Manager.

You can use the GitLab native integrations for certain external secret management providers to retrieve those secrets in CI/CD pipelines when they are needed.

CI/CD variables

CI/CD Variables are a convenient way to store and reuse data in a CI/CD pipeline, but variables are less secure than secrets management providers. Variable values:

Information suitable for storage in a variable should be data that can be exposed without risk of exploitation (non-sensitive).

Sensitive data should be stored in a secrets management solution. If you don’t have a secrets management solution and want to store sensitive data in a CI/CD variable, be sure to always:

Pass parameters to CI/CD pipelines

For passing parameters to CI/CD pipelines, use CI/CD inputs instead of pipeline variables.

Inputs provide:

Consider disabling pipeline variables when implementing inputs to prevent security vulnerabilities, because pipeline variables:

Pipeline Integrity

The key security principles of ensuring pipeline integrity include:

Docker images

Always use SHA digests for Docker images to ensure client-side integrity verification. For example:

You can find the SHA digest of an image with a specific tag using:

docker pull node:18.17.1
docker images --digests node:18.17.1

Prefer to pull from container registries that protect image integrity:

When possible, avoid using variables in container references as they can be modified to point to malicious images. For example:

Package dependencies

You should lock down package dependencies in your jobs. Use exact versions, defined in lock files:

For example, in a CI/CD job:

javascript-job:
  script:
    - npm ci
Shell commands and scripts

When installing tools in a job, always specify and verify exact versions. For example, in a Terraform job:

terraform_job:
  script:
    # Download specific version
    - |
      wget https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_amd64.zip
      # IMPORTANT: Always verify checksums
      echo "c0ed7bc32ee52ae255af9982c8c88a7a4c610485cf1d55feeb037eab75fa082c terraform_1.5.7_linux_amd64.zip" | sha256sum -c
      unzip terraform_1.5.7_linux_amd64.zip
      mv terraform /usr/local/bin/
    # Use the installed version
    - terraform init
    - terraform plan
Version management tools

Use version managers when possible:

node_build:
  script:
    # Use nvm to install and use a specific Node version
    - |
      nvm install 16.15.1
      nvm use 16.15.1
    - node --version  # Verify version
    - npm ci
    - npm run build
Included configurations

When using the include keyword to add configuration or CI/CD components to your pipeline, use a specific ref when possible. For example:

include:
  - project: 'my-group/my-project'
    ref: 8b0c8b318857c8211c15c6643b0894345a238c4e  # Pin to a specific commit
    file: '/templates/build.yml'
  - project: 'my-group/security'
    ref: v2.1.0                                    # Pin to a protected tag
    file: '/templates/scan.yml'
  - component: 'my-group/security-scans'           # Pin to a specific version
    version: '1.2.3'

Avoid versionless includes:

include:
  - project: 'my-group/my-project'                   # Unsafe
    file: '/templates/build.yml'
  - component: 'my-group/security-scans'             # Unsafe
  - remote: 'https://example.com/security-scan.yml'  # Unsafe

Instead of including remote files, download the file and save it in your repository. Then you can include the local copy:

include:
  - local: '/ci/security-scan.yml'  # Verified and stored in the repository
  1. CIS Docker Benchmarks
  2. Google Cloud: Design secure deployment pipelines

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4