git.iko.soy/typeable/nixpkgs
on master help sign in
gitlab: Add patch for db_key_base length bug, fix descriptions

The upstream recommended minimum length for db_key_base is 30 bytes, which our option descriptions repeated. Recently, however, upstream has, in many places, moved to using aes-256-gcm, which requires a key of exactly 32 bytes. To allow for shorter keys, the upstream code pads the key in some places. However, in many others, it just truncates the key if it's too long, leaving it too short if it was to begin with. This adds a patch that fixes this and updates the descriptions to recommend a key of at least 32 characters. See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53602

commit7a67a2d1a890eb1b3d98a4c98ce9283be2fe4e10 authortalyz <kim.lindberger@gmail.com> dateWed 10 Feb 2021, 18:42 (6 years ago) parentba6f0e8
2 files changed+13−4
nixos/modules/services/misc/gitlab.nix+3−3 pkgs/applications/version-management/gitlab/default.nix+10−1
nixos/modules/services/misc/gitlab.nix+3−3
@@ -588,7 +588,7 @@ in {
588588 the DB. If you change or lose this key you will be unable to
589589 access variables stored in database.
590590
591− Make sure the secret is at least 30 characters and all random,
591+ Make sure the secret is at least 32 characters and all random,
592592 no regular words or you'll be exposed to dictionary attacks.
593593
594594 This should be a string, not a nix path, since nix paths are
@@ -604,7 +604,7 @@ in {
604604 the DB. If you change or lose this key you will be unable to
605605 access variables stored in database.
606606
607− Make sure the secret is at least 30 characters and all random,
607+ Make sure the secret is at least 32 characters and all random,
608608 no regular words or you'll be exposed to dictionary attacks.
609609
610610 This should be a string, not a nix path, since nix paths are
@@ -620,7 +620,7 @@ in {
620620 tokens. If you change or lose this key, users which have 2FA
621621 enabled for login won't be able to login anymore.
622622
623− Make sure the secret is at least 30 characters and all random,
623+ Make sure the secret is at least 32 characters and all random,
624624 no regular words or you'll be exposed to dictionary attacks.
625625
626626 This should be a string, not a nix path, since nix paths are
pkgs/applications/version-management/gitlab/default.nix+10−1
@@ -1,4 +1,4 @@
1−{ stdenv, lib, fetchurl, fetchFromGitLab, bundlerEnv
1+{ stdenv, lib, fetchurl, fetchpatch, fetchFromGitLab, bundlerEnv
22, ruby, tzdata, git, nettools, nixosTests, nodejs, openssl
33, gitlabEnterprise ? false, callPackage, yarn
44, fixup_yarn_lock, replace, file
@@ -125,6 +125,15 @@ stdenv.mkDerivation {
125125 patches = [
126126 # Change hardcoded paths to the NixOS equivalent
127127 ./remove-hardcoded-locations.patch
128+
129+ # Use the exactly 32 byte long version of db_key_base with
130+ # aes-256-gcm, see
131+ # https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53602
132+ (fetchpatch {
133+ name = "secrets_db_key_base_length.patch";
134+ url = "https://gitlab.com/gitlab-org/gitlab/-/commit/dea620633d446ca0f53a75674454ff0dd4bd8f99.patch";
135+ sha256 = "19m4z4np3sai9kqqqgabl44xv7p8lkcyqr6s5471axfxmf9m2023";
136+ })
128137 ];
129138
130139 postPatch = ''