Merge pull request #528 from github/suppress-secret-scanning-encrypted-secrets-warning

Only backup secret scanning secrets on GHES versions 3.8.0+
This commit is contained in:
Chuck Pathanjali 2023-08-24 10:57:39 -04:00 коммит произвёл GitHub
Родитель b9042e3e7d 09bd75b9f3
Коммит a8ef76a059
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 39 добавлений и 6 удалений

Просмотреть файл

@ -86,10 +86,13 @@ if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.7.0)" ]; then
cat "$GHE_SNAPSHOT_DIR/encrypted-column-encryption-keying-material" | sed 's:.*;::' > "$GHE_SNAPSHOT_DIR/encrypted-column-current-encryption-key"
fi
backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key"
backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys"
backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key"
backup-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys"
# secret scanning encrypted secrets keys were added in GHES 3.8.0
if [ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" ]; then
backup-secret "secret scanning encrypted secrets current storage key" "secret-scanning-encrypted-secrets-current-storage-key" "secrets.secret-scanning.encrypted-secrets-current-storage-key"
backup-secret "secret scanning encrypted secrets delimited storage keys" "secret-scanning-encrypted-secrets-delimited-storage-keys" "secrets.secret-scanning.encrypted-secrets-delimited-storage-keys"
backup-secret "secret scanning encrypted secrets current shared transit key" "secret-scanning-encrypted-secrets-current-shared-transit-key" "secrets.secret-scanning.encrypted-secrets-current-shared-transit-key"
backup-secret "secret scanning encrypted secrets delimited shared transit keys" "secret-scanning-encrypted-secrets-delimited-shared-transit-keys" "secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys"
fi
# Backup argon secrets for multiuser from ghes version 3.8 onwards
if [[ "$(version $GHE_REMOTE_VERSION)" -ge "$(version 3.8.0)" && "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.2)" ]]; then

Просмотреть файл

@ -772,7 +772,7 @@ begin_test "ghe-backup takes backup of encrypted column encryption keying materi
)
end_test
begin_test "ghe-backup takes backup of secret scanning encrypted secrets encryption keys"
begin_test "ghe-backup does not take backups of secret scanning encrypted secrets encryption keys on versions below 3.8.0"
(
set -e
@ -787,7 +787,37 @@ begin_test "ghe-backup takes backup of secret scanning encrypted secrets encrypt
ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo"
done
ghe-backup
GHE_REMOTE_VERSION=3.7.0 ghe-backup -v | grep -q "secret scanning encrypted secrets" && exit 1
required_files=(
"secret-scanning-encrypted-secrets-current-storage-key"
"secret-scanning-encrypted-secrets-delimited-storage-keys"
"secret-scanning-encrypted-secrets-current-shared-transit-key"
"secret-scanning-encrypted-secrets-delimited-shared-transit-keys"
)
for file in "${required_files[@]}"; do
[ "$(cat "$GHE_DATA_DIR/current/$file")" = "" ]
done
)
end_test
begin_test "ghe-backup takes backup of secret scanning encrypted secrets encryption keys on versions 3.8.0+"
(
set -e
required_secrets=(
"secrets.secret-scanning.encrypted-secrets-current-storage-key"
"secrets.secret-scanning.encrypted-secrets-delimited-storage-keys"
"secrets.secret-scanning.encrypted-secrets-current-shared-transit-key"
"secrets.secret-scanning.encrypted-secrets-delimited-shared-transit-keys"
)
for secret in "${required_secrets[@]}"; do
ghe-ssh "$GHE_HOSTNAME" -- ghe-config "$secret" "foo"
done
GHE_REMOTE_VERSION=3.8.0 ghe-backup
required_files=(
"secret-scanning-encrypted-secrets-current-storage-key"