Quote the root password in gitlab.rb as a Ruby literal

What

The small-VM tuning block in bootstrap-gitlab-omnibus.sh wrote SIM_ROOT_PASSWORD into /etc/gitlab/gitlab.rb inside double quotes. gitlab.rb is Ruby that omnibus reconfigure evaluates, so a password containing ", \ or #{...} either broke the file or ran its own Ruby during reconfigure.

Change

  • The block writes gitlab_rails['initial_root_password'] as the base64 literal ('...'.unpack1('m0').force_encoding('UTF-8')) that the root-user runner script in the same file already uses. The literal is built once near the top of the script and both sites read it.
  • Every other gitlab.rb write in the repo was checked: the Geo block, the Praefect blocks, the staging-subscription line and the private-CA edit carry generated, constant or validated values (the CA host and registry port are matched against a character class before use). Nothing else takes a caller value.

This is a single quoting step, so there is no diagram.

Test

bootstrap-omnibus-selftest.sh renders the gitlab.rb line for four passwords (double quote with interpolation and backslash, interpolation that writes a canary file, a literal backslash-n, and a quote with $ and backticks). For each it runs ruby -c on the line, evaluates it, and compares the value byte for byte.

On origin/main the self-test reports 11 failures. On this branch it passes.

Merge request reports

Loading
Loading