git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #113201 from talyz/gitlab-db-key-base-patch

gitlab: Add patch for db_key_base length bug, fix descriptions

commite50164a7ce00019cba2b07b5ec0fc85f22ec72c0 authorKim Lindberger <kim.lindberger@gmail.com> dateTue 27 Apr 2021, 19:25 (6 years ago) parent8e1f3bc1215bd4
3 files changed+16−7
nixos/modules/services/misc/gitlab.nix+3−3 nixos/tests/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
nixos/tests/gitlab.nix+3−3
@@ -57,9 +57,9 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : with lib; {
5757 };
5858 };
5959 secrets = {
60− secretFile = pkgs.writeText "secret" "r8X9keSKynU7p4aKlh4GO1Bo77g5a7vj";
61− otpFile = pkgs.writeText "otpsecret" "Zu5hGx3YvQx40DvI8WoZJQpX2paSDOlG";
62− dbFile = pkgs.writeText "dbsecret" "lsGltKWTejOf6JxCVa7nLDenzkO9wPLR";
60+ secretFile = pkgs.writeText "secret" "Aig5zaic";
61+ otpFile = pkgs.writeText "otpsecret" "Riew9mue";
62+ dbFile = pkgs.writeText "dbsecret" "we2quaeZ";
6363 jwsFile = pkgs.runCommand "oidcKeyBase" {} "${pkgs.openssl}/bin/openssl genrsa 2048 > $out";
6464 };
6565 };
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 = ''