Secrets: deploy jobs need a database password, and it must not leak from MR pipelines.

IntermediateScenarioGitLab CI
Answer

Situation read → CI/CD variables scoping.

What I'd do →

  1. Add the variable as masked, hidden, and protected, scoped to environment production.
  2. Protected variables are only exposed to pipelines on protected branches/tags.
  3. Prefer external secrets: Vault via secrets: keyword with id_tokens (OIDC JWT) instead of storing the value.

Why → MR pipelines from unprotected branches cannot read protected variables.

Interview tip → Masking requires value rules (length, characters); mention that limitation.

All CI/CD questions Roadmap: GitLab CI/CD

More on GitLab CI