-
Notifications
You must be signed in to change notification settings - Fork 56
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
fix keycloak secrets drift #507
Conversation
WalkthroughThe changes in this pull request primarily involve updates to the management of Kubernetes secrets and passwords within Keycloak configurations. The Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
packages/system/keycloak/templates/sts.yaml (2)
4-8
: Add validation for existing passwordWhile reusing existing passwords is good for preventing drift, consider adding validation to ensure the decoded password meets minimum security requirements (length, complexity).
{{- if $existingPassword }} {{- $password = index $existingPassword.data "password" | b64dec }} + {{- if not (regexMatch "^[A-Za-z0-9]{16,}$" $password) }} + {{- fail "Existing password does not meet minimum requirements (16+ alphanumeric characters)" }} + {{- end }} {{- end }}
Line range hint
67-68
: Use secretKeyRef for admin passwordThe admin password is currently exposed in the pod spec. Consider using
secretKeyRef
to reference the password from the secret, similar to how other sensitive environment variables are handled.- name: KEYCLOAK_ADMIN_PASSWORD - value: {{ $password }} + valueFrom: + secretKeyRef: + name: {{ .Release.Name }}-credentials + key: password🧰 Tools
🪛 yamllint (1.35.1)
[error] 1-1: syntax error: expected the node content, but found '-'
(syntax)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
packages/system/keycloak-configure/templates/configure-kk.yaml
(2 hunks)packages/system/keycloak/templates/sts.yaml
(1 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
packages/system/keycloak-configure/templates/configure-kk.yaml
[warning] 17-17: wrong indentation: expected 0 but found 2
(indentation)
[warning] 22-22: wrong indentation: expected 0 but found 2
(indentation)
🔇 Additional comments (3)
packages/system/keycloak-configure/templates/configure-kk.yaml (3)
6-18
: LGTM! Good secret management practices
The implementation correctly handles existing secrets while providing secure fallback for new deployments. The 32-character random strings provide good entropy.
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 17-17: wrong indentation: expected 0 but found 2
(indentation)
27-56
: LGTM! Well-structured secret definitions
The secret resources are properly defined with appropriate encoding and namespace placement.
205-205
: LGTM! Proper integration with auth proxy
The cookie secret is correctly integrated into the auth proxy configuration.
{{ $cookieSecret := randAlphaNum 16 }} | ||
{{- if $existingAuthConfig }} | ||
{{- $cookieSecret = index $existingAuthConfig.data "cookieSecret" | b64dec }} | ||
{{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Increase cookie secret length
For cookie signing, 16 characters might not provide sufficient entropy. Consider increasing the length to 32 characters to align with security best practices.
-{{ $cookieSecret := randAlphaNum 16 }}
+{{ $cookieSecret := randAlphaNum 32 }}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
{{ $cookieSecret := randAlphaNum 16 }} | |
{{- if $existingAuthConfig }} | |
{{- $cookieSecret = index $existingAuthConfig.data "cookieSecret" | b64dec }} | |
{{- end }} | |
{{ $cookieSecret := randAlphaNum 32 }} | |
{{- if $existingAuthConfig }} | |
{{- $cookieSecret = index $existingAuthConfig.data "cookieSecret" | b64dec }} | |
{{- end }} |
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 22-22: wrong indentation: expected 0 but found 2
(indentation)
closed in favor #508 |
Summary by CodeRabbit
New Features
Bug Fixes