Robot Upgrade: prometheus-node-exporter chart upgrade from 4.6.0 to 4.51.1#3898
Robot Upgrade: prometheus-node-exporter chart upgrade from 4.6.0 to 4.51.1#3898weizhoublue wants to merge 1 commit intomainfrom
Conversation
Summary of ChangesHello @weizhoublue, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request orchestrates a substantial upgrade of the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request upgrades the prometheus-node-exporter Helm chart from version 4.6.0 to 4.51.1, bringing numerous features, enhanced security by removing deprecated PodSecurityPolicy resources, and improved configuration flexibility. A security audit, however, identified potential template injection vulnerabilities due to the use of the tpl function on user-provided values in labels and extra manifests. The RBAC permissions for kube-rbac-proxy are also significant, increasing the potential impact of a pod compromise. It is recommended to review the use of tpl and ensure RBAC permissions adhere to the principle of least privilege. Minor issues also include a markdown formatting error in README files and an inconsistency in the kube-rbac-proxy sidecar image configuration, where sha is used instead of digest.
| labels: | ||
| {{- include "prometheus-node-exporter.labels" . | nindent 8 }} | ||
| {{- with .Values.podLabels }} | ||
| {{- tpl (toYaml .) $ | nindent 8 }} |
There was a problem hiding this comment.
The use of the tpl function on user-provided values like podLabels can lead to template injection. In environments where the Helm chart is deployed by a service with high privileges (e.g., ArgoCD or Flux), a user who can modify values.yaml could use the lookup function within these templates to access sensitive information, such as Secrets, from any namespace in the cluster. It is recommended to avoid using tpl on values that are intended to be plain strings or maps provided by the user.
{{- toYaml . | nindent 8 }}| {{- with .Values.podLabels }} | ||
| {{ toYaml . }} | ||
| {{- with .Values.commonLabels }} | ||
| {{ tpl (toYaml .) $ }} |
There was a problem hiding this comment.
The use of the tpl function on commonLabels allows for potential template injection. Similar to podLabels, this can be exploited to leak sensitive information from the cluster using the lookup function if the deployment process has sufficient permissions. Consider using toYaml without tpl for user-provided labels.
{{ toYaml . }}
| @@ -0,0 +1,4 @@ | |||
| {{ range .Values.extraManifests }} | |||
| --- | |||
| {{ tpl . $ }} | |||
There was a problem hiding this comment.
Processing extraManifests through the tpl function allows users to inject arbitrary Helm template logic into the deployed manifests. This significantly increases the risk of template injection and unauthorized access to cluster resources via functions like lookup. If this feature is necessary, the security implications should be clearly documented.
{{ . }}| - apiGroups: [ "authentication.k8s.io" ] | ||
| resources: | ||
| - tokenreviews | ||
| verbs: [ "create" ] | ||
| - apiGroups: [ "authorization.k8s.io" ] | ||
| resources: | ||
| - subjectaccessreviews | ||
| verbs: [ "create" ] |
There was a problem hiding this comment.
The ClusterRole created for kube-rbac-proxy grants create permissions on tokenreviews and subjectaccessreviews. These are sensitive cluster-wide permissions. Since this role is bound to the service account used by the node-exporter DaemonSet (which runs on every node and has extensive host access), a compromise of any node-exporter pod could allow an attacker to perform authentication and authorization checks across the entire cluster, facilitating reconnaissance and lateral movement.
| - Helm Repository: `https://prometheus-community.github.io/helm-charts` with chart `prometheus-node-exporter` | ||
|
|
||
| _See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._ | ||
| The installation instructions use the OCI registry. Refer to the [`helm repo`]([`helm repo`](https://helm.sh/docs/helm/helm_repo/)) command documentation for information on installing charts via the traditional repository. |
There was a problem hiding this comment.
The markdown for the link to the helm repo documentation is nested, which makes it invalid. This should be corrected to a single, valid link.
| The installation instructions use the OCI registry. Refer to the [`helm repo`]([`helm repo`](https://helm.sh/docs/helm/helm_repo/)) command documentation for information on installing charts via the traditional repository. | |
| The installation instructions use the OCI registry. Refer to the [`helm repo`](https://helm.sh/docs/helm/helm_repo/) command documentation for information on installing charts via the traditional repository. |
| - Helm Repository: `https://prometheus-community.github.io/helm-charts` with chart `prometheus-node-exporter` | ||
|
|
||
| _See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._ | ||
| The installation instructions use the OCI registry. Refer to the [`helm repo`]([`helm repo`](https://helm.sh/docs/helm/helm_repo/)) command documentation for information on installing charts via the traditional repository. |
There was a problem hiding this comment.
The markdown for the link to the helm repo documentation is nested, which makes it invalid. This should be corrected to a single, valid link.
| The installation instructions use the OCI registry. Refer to the [`helm repo`]([`helm repo`](https://helm.sh/docs/helm/helm_repo/)) command documentation for information on installing charts via the traditional repository. | |
| The installation instructions use the OCI registry. Refer to the [`helm repo`](https://helm.sh/docs/helm/helm_repo/) command documentation for information on installing charts via the traditional repository. |
| {{- if .Values.kubeRBACProxy.image.sha }} | ||
| image: "{{ .Values.global.imageRegistry | default .Values.kubeRBACProxy.image.registry}}/{{ .Values.kubeRBACProxy.image.repository }}:{{ .Values.kubeRBACProxy.image.tag }}@sha256:{{ .Values.kubeRBACProxy.image.sha }}" | ||
| {{- else }} | ||
| image: "{{ .Values.global.imageRegistry | default .Values.kubeRBACProxy.image.registry}}/{{ .Values.kubeRBACProxy.image.repository }}:{{ .Values.kubeRBACProxy.image.tag }}" | ||
| {{- end }} |
There was a problem hiding this comment.
For consistency with the main application image, which now uses image.digest, the kube-rbac-proxy image configuration should also be updated to use digest instead of sha. Additionally, hardcoding the sha256: prefix is less flexible; the digest value should ideally include the algorithm.
{{- if .Values.kubeRBACProxy.image.digest }}
image: "{{ .Values.global.imageRegistry | default .Values.kubeRBACProxy.image.registry}}/{{ .Values.kubeRBACProxy.image.repository }}:{{ .Values.kubeRBACProxy.image.tag }}@{{ .Values.kubeRBACProxy.image.digest }}"
{{- else }}
image: "{{ .Values.global.imageRegistry | default .Values.kubeRBACProxy.image.registry}}/{{ .Values.kubeRBACProxy.image.repository }}:{{ .Values.kubeRBACProxy.image.tag }}"
{{- end }}| registry: quay.io | ||
| repository: brancz/kube-rbac-proxy | ||
| tag: v0.20.2 | ||
| sha: "" |
There was a problem hiding this comment.
ab942ed to
edae3f7
Compare
a5a0080 to
6cc58d8
Compare
fe28347 to
87d7d61
Compare
…4.51.1 Signed-off-by: robot <robot@example.com>
87d7d61 to
2e44871
Compare
I am robot, upgrade: project prometheus-node-exporter chart upgrade from 4.6.0 to 4.51.1