-
Notifications
You must be signed in to change notification settings - Fork 30
fix: prevent MEK re-encryption from double-wrapping JWE config values #732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
c77a4e0
ad47c7b
222d2c7
46f557e
feabab4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -270,24 +270,31 @@ create_secrets() { | |
| $RUN_KUBECTL "delete secret redis-secret --namespace $OSMO_NAMESPACE --ignore-not-found=true" | ||
| $RUN_KUBECTL "create secret generic redis-secret --from-literal=redis-password=$REDIS_PASSWORD --namespace $OSMO_NAMESPACE" | ||
|
|
||
| # Generate and create MEK | ||
| log_info "Generating Master Encryption Key (MEK)..." | ||
| local random_key=$(openssl rand -base64 32 | tr -d '\n') | ||
| local jwk_json="{\"k\":\"$random_key\",\"kid\":\"key1\",\"kty\":\"oct\"}" | ||
| local encoded_jwk=$(echo -n "$jwk_json" | base64 | tr -d '\n') | ||
|
|
||
| local mek_manifest="apiVersion: v1 | ||
| # Generate and create MEK (skip if already exists to avoid key material mismatch) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Take a look at
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated both
See commit ebd427b. |
||
| if $RUN_KUBECTL "get configmap mek-config -n $OSMO_NAMESPACE" >/dev/null 2>&1; then | ||
| log_info "MEK ConfigMap already exists, skipping generation" | ||
| else | ||
| log_info "Generating Master Encryption Key (MEK)..." | ||
| local random_key=$(openssl rand -base64 32 | tr -d '\n') | ||
| # Use a unique kid per generation to make key material mismatches | ||
| # detectable. See https://github.com/NVIDIA/OSMO/issues/731 | ||
| local kid="key-$(openssl rand -hex 8)" | ||
| local jwk_json="{\"k\":\"$random_key\",\"kid\":\"$kid\",\"kty\":\"oct\"}" | ||
| local encoded_jwk=$(echo -n "$jwk_json" | base64 | tr -d '\n') | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| local mek_manifest="apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: mek-config | ||
| namespace: $OSMO_NAMESPACE | ||
| data: | ||
| mek.yaml: | | ||
| currentMek: key1 | ||
| currentMek: $kid | ||
| meks: | ||
| key1: $encoded_jwk" | ||
| $kid: $encoded_jwk" | ||
|
|
||
| $RUN_KUBECTL_APPLY_STDIN "$mek_manifest" | ||
| $RUN_KUBECTL_APPLY_STDIN "$mek_manifest" | ||
| fi | ||
|
|
||
| log_success "Secrets created" | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.