-
Notifications
You must be signed in to change notification settings - Fork 4
MLE-21295: Enforce automountServiceAccountToken=false #96
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ type statefulSetParameters struct { | |
ImagePullSecrets []corev1.LocalObjectReference | ||
AdditionalVolumeClaimTemplates *[]corev1.PersistentVolumeClaim | ||
ServiceAccountName string | ||
AutomountServiceAccountToken *bool | ||
} | ||
|
||
type containerParameters struct { | ||
|
@@ -238,6 +239,9 @@ func generateStatefulSetsDef(stsMeta metav1.ObjectMeta, params statefulSetParame | |
if params.ServiceAccountName != "" { | ||
statefulSet.Spec.Template.Spec.ServiceAccountName = params.ServiceAccountName | ||
} | ||
if params.AutomountServiceAccountToken != nil { | ||
statefulSet.Spec.Template.Spec.AutomountServiceAccountToken = params.AutomountServiceAccountToken | ||
} | ||
if containerParams.Tls != nil && containerParams.Tls.EnableOnDefaultAppServers { | ||
copyCertsVM := []corev1.VolumeMount{ | ||
{ | ||
|
@@ -349,10 +353,14 @@ func generateContainerDef(name string, containerParams containerParameters) []co | |
} | ||
|
||
func generateStatefulSetsParams(cr *marklogicv1.MarklogicGroup) statefulSetParameters { | ||
// Always enforce automountServiceAccountToken to false for security | ||
falseValue := false | ||
|
||
params := statefulSetParameters{ | ||
Comment on lines
+356
to
359
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. [nitpick] Consider using a package-level constant for the false value instead of declaring it locally in each function. This would improve consistency and make the security requirement more explicit. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
Replicas: cr.Spec.Replicas, | ||
Name: cr.Spec.Name, | ||
ServiceAccountName: cr.Spec.ServiceAccountName, | ||
AutomountServiceAccountToken: &falseValue, // Always false for security | ||
TerminationGracePeriodSeconds: cr.Spec.TerminationGracePeriodSeconds, | ||
UpdateStrategy: cr.Spec.UpdateStrategy, | ||
NodeSelector: cr.Spec.NodeSelector, | ||
|
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.
[nitpick] Consider using a package-level constant for the false value instead of declaring it locally in each function. This would improve consistency and make the security requirement more explicit.
Copilot uses AI. Check for mistakes.