Skip to content

fix(UPM-81611): Use URL-safe base64 for Fernet key generation#7104

Merged
josh-heyer merged 1 commit intodevelopfrom
UPM-81611-fix-fernet-key-generation
Mar 10, 2026
Merged

fix(UPM-81611): Use URL-safe base64 for Fernet key generation#7104
josh-heyer merged 1 commit intodevelopfrom
UPM-81611-fix-fernet-key-generation

Conversation

@jesswolfedb
Copy link
Contributor

What Changed?

Fixed Fernet key generation commands across all Hybrid Manager doc versions (1.2, 1.3, preview) to produce URL-safe base64 output per the Fernet specification.

Problem

The existing command:

FERNET_KEY=$(dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64)

produces standard base64 which may contain + and / characters. The Fernet spec requires URL-safe base64 (RFC 4648 Section 5), which uses - and _ instead. Python's cryptography.fernet.Fernet.generate_key() also produces URL-safe base64.

Keys generated with the old command are non-compliant with the Fernet spec and will be rejected by edbctl setup validation approximately 50% of the time (whenever + or / appear in the output).

Fix

Added | tr '+/' '-_' to convert standard base64 to URL-safe base64:

FERNET_KEY=$(dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64 | tr '+/' '-_')

This same pattern was already used in the migration portal secrets docs for password generation.

Files changed (10)

1.2:

  • ai-factory/enabling.mdx
  • install/customization/genai_secret.mdx
  • install/eks/installing/assets-helm/eks-install-secrets.sh
  • install/eks/installing/assets-op/eks-install-secrets.sh
  • install/gcp/prerequisites/gcpcluster.mdx

1.3:

  • ai-factory/how-to-enable-ai-factory.mdx
  • install/configuration/genai_secret.mdx

preview:

  • ai-factory/how-to-enable-ai-factory.mdx
  • install/configuration/genai_secret.mdx
  • using_hybrid_manager/upgrading_hm/2025.11_to_2025.12.mdx

🤖 Generated with Claude Code

The Fernet specification (https://github.com/fernet/spec/) requires
URL-safe base64 encoding (RFC 4648 Section 5), which uses `-` and `_`
instead of `+` and `/`. The existing `dd | base64` command produces
standard base64 which may contain `+` and `/` characters, making
the generated key non-compliant with the Fernet spec.

Add `| tr '+/' '-_'` to all Fernet key generation commands across
all doc versions (1.2, 1.3, preview).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jesswolfedb jesswolfedb requested a review from a team as a code owner March 6, 2026 20:06
Copy link
Contributor

@josh-heyer josh-heyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@josh-heyer josh-heyer merged commit 71f71c6 into develop Mar 10, 2026
8 checks passed
@josh-heyer josh-heyer deleted the UPM-81611-fix-fernet-key-generation branch March 10, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants