feat(helm): allow to set init containers#4745
Conversation
|
Hi @rclsilver ! can you also add this to Also, change our tests definition to include an init Container and see it passing :) |
|
As stated in Slack, my main concern is if someone can hijack a pipeline install where ESO is being installed from as a helm chart and they inject an initContainer with malicious code in it. I guess, they could do that with other deployments, but if there aren't any, ESO is providing another attack vector for that operation. Therefore, I'm on the fence with this modification. There are no guardrails around that unfortunately. Or rather, I don't know of any. :) |
6dbacfe to
241775e
Compare
|
|
I just fixed the Tell me if you want me to add the extraInitContainers for the other components. |
Yes, this is a valid concern. However, the best way to integrate a webhook provider today would be to make it available as a sidecar and make external-secrets do a connection via a unix socket to it. The best way to do that IMO is during installation time, right? If we look at other similar projects:
Which would mean we should probably remove this feature 🤔 Things we would need to remove thinking on securing the container on our own release:
IMO We should either support (and also, guide users how to install a in-pod-like webhook provider 😆 ) |
|
@gusfcarvalho I'm on the side of security hardening. Sorry @rclsilver. I can be overruled ofc. |
|
@Skarlso Quoting from your previous comment:
I fail to see how an init container would have any impact on the operator itself. The init containers runs independently from the main container, whether they have IMO, the Helm chart that you provide has little to do with security hardening of the operator itself, it's just a "template" to deploy the operator's image and related Kube resources.
I agree, it's either none or both, but as I said, the Helm chart itself is nothing else than a convenience for the community to deploy the operator. If you reject customization's values, the users will simply fork or write their own chart.
I haven't done any research to prove or disprove that any of these projects had a valid reason in the past to allow the customization of containers or init containers in their charts, but I could find other examples of charts from OSS projects that allow customization of containers/initContainers (fluent-bit for example). Perhaps to clarify the discussion, @Skarlso, are you more concerned about the ability to add others containers to the operator's pod, or the ability to query another container locally through the webhook provider ? |
|
Security wise, no one should use webhook providers, really :) they are on untrusted network bound perimeters. They are just an operational “must have” for a lot of use cases; but in any of those these use cases are sacrificing security for that (hopefully, in a conscious manner). those projects are all on the security space, and most of them drop this support, so this is why they were chosen as benchmark. I understand the positioning for security hardening and to be honest, we might really remove support for sidecars 🤔🤔. Re: how could this be used for evil: the external-secret service account would be available for the attacker to freely steal all your secrets 🥲🥲🥲 adding this to be discussed in the next community meeting. Please join them @rclsilver @wI2L 😃 |
if it were just a convenience, users would have no problem in forking it and maintaining their own. For me this is an argument to do breaking changes for the sake of what we think it’s a best convenient interface for users to start with 😂😂. We both know this isn’t really true and that people expect this helm chart deliverable as a part of the pipelines. |
initContainer can be used to load a compromised image that executes during load potentially injecting malicious code. It could cause dependency chain attacks, or exhaust resources, even prevent the main thing to run if it keeps crashing. Also, since it can share a mount it can include a backdoor script into the main application. |
|
@Skarlso Not saying that what you said is false per so, just far fetched. At this point, following your argument, the What you said is also true for non-init containers, yet the chart allows to add extra containers. My honest opinion on that matter is is that while those considerations are valid, this shouldn't be the chart's responsibility to prevent it, but a broader subject that involves CI/deploy workflows. Anyway, this doesn't represent a blocker, as we said, users could build their own Helm chart if they disagree with the stance that you take about this subject. However, we'd like to talk more about the Webhook provider (which is pretty handy in our case), in order to clarify what's you have in mind about this feature:
|
|
@gusfcarvalho @moolen Let's discuss this on next community meeting. I added it to the agenda ( 4th of June ). |
|
Reading through this leaves me a bit puzzled; |
|
@ItielOlenick The point here is to remove that option as well. :) |
|
👍 my 5ct: I think it's totally fine to make 🤡 I found myself populating the I'd be happy to trade usability with a slight increase in attack surface. It's not our responsibility to harden the deployment pipeline of our users. |
|
It's such a common practice in helm charts that seeing this as an issue is extremely odd IMO. |
If you check the thread - while it is a common practice in helm charts, almost none of the security-related tooling charts expose that 😄 |
But I guess that's the point. Having this as a well known, provided upstream option for ill-intended users vs. not having as an option so users that need this would do it anyways. I totally understand the point of exposing a very, very privileged service account to any other processes as a potential risk here, while for the use case that started this whole discussion (a webhook integration), there are other ways to bind it to external-secrets (like the good old socket + CSI). IMO we document ☝️ socket + CSI method, and stop supporting other methods which are way easier to abuse. |
|
I voiced my concerns. :) Other than that, I will follow whatever the maintainer majority is. :) |
|
Hi, If the webhook functionality were to be removed, what would be a realistic alternative for supporting similar integration use cases? The main advantage of this provider is that it allows us to integrate internal systems without needing to modify ESO’s code directly, which is critical for our workflow. Thanks in advance for your input. |
Its not disallowing webhooks - but disallowing them to be used with sidecar approach (favoring more secure modes, like mounting an unix socket). |
|
In our case, if the running component exposes a Unix socket, we would need a way to ensure that this socket exists (most likely by sharing it through an emptyDir) before starting ESO. This is something that naturally happens when using sidecars, as lifecycle dependencies are implicitly managed. I'm having a hard time understanding how exposing a Unix socket via emptyDir would be more secure than allowing sidecars. |
Unix Sockets can be mounted as a CSI volume mount, effectively removing the need for anything running as a sidecar to external-secrets. This is how SPIRE and SecretStore CSI work. For that to work, my guess is that we would need to provide some sort of |
4859213 to
b962a77
Compare
|
It should be OK with this version |
a030d16 to
6cfe3fb
Compare
Signed-off-by: Thomas Bétrancourt <thomas@betrancourt.net>
6cfe3fb to
a239467
Compare
|
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [external-secrets](https://github.com/external-secrets/external-secrets) | minor | `0.18.2` -> `0.19.0` | --- ### Release Notes <details> <summary>external-secrets/external-secrets (external-secrets)</summary> ### [`v0.19.0`](https://github.com/external-secrets/external-secrets/releases/tag/v0.19.0) [Compare Source](external-secrets/external-secrets@v0.18.2...v0.19.0) #### **BREAKING CHANGE** 🔴 🔴 BREAKING CHANGE 🔴 🔴 Please note that this a breaking change because our CRDs are now too big. Meaning a simple kubectl apply or Argo's default client side apply WILL NOT WORK! You have to add `--server-side` to kubectl apply and in argo add: ```yaml spec: project: default syncPolicy: automated: prune: true selfHeal: true syncOptions: - CreateNamespace=true - ServerSideApply=true ``` for it to correctly install the CRDs. Thank you. Image: `ghcr.io/external-secrets/external-secrets:v0.19.0` Image: `ghcr.io/external-secrets/external-secrets:v0.19.0-ubi` Image: `ghcr.io/external-secrets/external-secrets:v0.19.0-ubi-boringssl` #### What's Changed - chore: release helm chart for v0.18.2 by [@​Skarlso](https://github.com/Skarlso) in external-secrets/external-secrets#4985 - chore(deps): bump golang from `ee7ff13` to `10f549d` in /e2e by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#4997 - chore(deps): bump golang from `68932fa` to `68932fa` by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5000 - chore(deps): bump mkdocs-material from 9.6.14 to 9.6.15 in /hack/api-docs by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#4998 - chore(deps): bump anchore/sbom-action from 0.20.1 to 0.20.2 by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5001 - chore(deps): bump github/codeql-action from 3.29.1 to 3.29.2 by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5003 - chore(deps): bump aquasecurity/trivy-action from 0.31.0 to 0.32.0 by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5002 - fix: do not turn original value into string on value scope by [@​Skarlso](https://github.com/Skarlso) in external-secrets/external-secrets#5011 - fix: add uuid in edit and view clusterroles by [@​sylvainOL](https://github.com/sylvainOL) in external-secrets/external-secrets#5017 - chore: update dependencies by [@​eso-service-account-app](https://github.com/eso-service-account-app)\[bot] in external-secrets/external-secrets#4999 - fix: template data should not be the secret Data itself by [@​gusfcarvalho](https://github.com/gusfcarvalho) in external-secrets/external-secrets#5023 - Fix: Return appropriate error in ValidateStore by [@​prakash-218](https://github.com/prakash-218) in external-secrets/external-secrets#5019 - feat(helm): allow to set init containers by [@​rclsilver](https://github.com/rclsilver) in external-secrets/external-secrets#4745 - chore(deps): bump certifi from 2025.6.15 to 2025.7.14 in /hack/api-docs by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5032 - Fix: Remove root/buildinfo from ubi build files by [@​bainsy88](https://github.com/bainsy88) in external-secrets/external-secrets#5037 - chore(deps): bump ubi8/ubi from `19eae3d` to `c0b0729` by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5033 - chore(deps): bump golang from 1.24.4-bookworm to 1.24.5-bookworm in /e2e by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5029 - chore(deps): bump golang from 1.24.4 to 1.24.5 by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5034 - chore: update dependencies by [@​eso-service-account-app](https://github.com/eso-service-account-app)\[bot] in external-secrets/external-secrets#5031 - Add Red Hat OpenShift in Adopters by [@​KeenonLee](https://github.com/KeenonLee) in external-secrets/external-secrets#5039 - fix: remove authentication option with JWT token from STSSessionToken generator by [@​Skarlso](https://github.com/Skarlso) in external-secrets/external-secrets#5026 - fix: add validation constraints to ExternalSecretRewrite by [@​Aakkash-Suresh](https://github.com/Aakkash-Suresh) in external-secrets/external-secrets#5006 - fix: stability support matrix by [@​gusfcarvalho](https://github.com/gusfcarvalho) in external-secrets/external-secrets#5043 - docs(decoding-strategy): clarify base64 auto-detection limitations by [@​orymate](https://github.com/orymate) in external-secrets/external-secrets#5004 - feat(infisical): auth methods by [@​DanielHougaard](https://github.com/DanielHougaard) in external-secrets/external-secrets#5040 - chore(deps): bump alpine from 3.22.0 to 3.22.1 in /e2e by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5046 - chore(aws): parameterstore unit tests improvement by [@​ivankatliarchuk](https://github.com/ivankatliarchuk) in external-secrets/external-secrets#4986 - fix(helm): grafana dashboard: fix heatmaps to actually be heatmaps, not time series by [@​desaintmartin](https://github.com/desaintmartin) in external-secrets/external-secrets#5069 - chore(deps): bump sigstore/cosign-installer from 3.9.1 to 3.9.2 by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5047 - chore(deps): bump step-security/harden-runner from 2.12.2 to 2.13.0 by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5048 - chore(deps): bump golang from `ddf5200` to `daae04e` by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5049 - chore(deps): bump alpine from `8a1f59f` to `4bcff63` by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5051 - chore(deps): bump alpine from `8a1f59f` to `4bcff63` in /hack/api-docs by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5052 - chore(deps): bump mkdocs-material from 9.6.15 to 9.6.16 in /hack/api-docs by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5077 - Add SelfSubjectAccessReview as a fallback for failing SelfSubjectRulesReview by [@​alvin-rw](https://github.com/alvin-rw) in external-secrets/external-secrets#5025 - chore(deps): bump golang from `69adc37` to `ef8c5c7` in /e2e by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5076 - chore(deps): bump ubi8/ubi from `c0b0729` to `785d38c` by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5075 - chore(deps): bump github/codeql-action from 3.29.2 to 3.29.4 by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5072 - chore(deps): bump anchore/sbom-action from 0.20.2 to 0.20.4 by [@​dependabot](https://github.com/dependabot)\[bot] in external-secrets/external-secrets#5073 - SSHKey generator by [@​dex4er](https://github.com/dex4er) in external-secrets/external-secrets#5083 - fix: restore AWS credential chain resolution for ECRAuthorizationToken generator by [@​aditmeno](https://github.com/aditmeno) in external-secrets/external-secrets#5082 - fix(helm): grafana dashboard: add widget for sum of not ready secrets by [@​desaintmartin](https://github.com/desaintmartin) in external-secrets/external-secrets#5086 - feat(aws): secretsmanager to update/patch/delete tags by [@​ivankatliarchuk](https://github.com/ivankatliarchuk) in external-secrets/external-secrets#4984 - fix: update the e2e test with the new store status value by [@​Skarlso](https://github.com/Skarlso) in external-secrets/external-secrets#5089 - fix: correct usage of if in dlc and update for server side apply by [@​Skarlso](https://github.com/Skarlso) in external-secrets/external-secrets#5092 #### New Contributors - [@​sylvainOL](https://github.com/sylvainOL) made their first contribution in external-secrets/external-secrets#5017 - [@​prakash-218](https://github.com/prakash-218) made their first contribution in external-secrets/external-secrets#5019 - [@​rclsilver](https://github.com/rclsilver) made their first contribution in external-secrets/external-secrets#4745 - [@​bainsy88](https://github.com/bainsy88) made their first contribution in external-secrets/external-secrets#5037 - [@​KeenonLee](https://github.com/KeenonLee) made their first contribution in external-secrets/external-secrets#5039 - [@​orymate](https://github.com/orymate) made their first contribution in external-secrets/external-secrets#5004 - [@​desaintmartin](https://github.com/desaintmartin) made their first contribution in external-secrets/external-secrets#5069 - [@​alvin-rw](https://github.com/alvin-rw) made their first contribution in external-secrets/external-secrets#5025 - [@​dex4er](https://github.com/dex4er) made their first contribution in external-secrets/external-secrets#5083 - [@​aditmeno](https://github.com/aditmeno) made their first contribution in external-secrets/external-secrets#5082 **Full Changelog**: external-secrets/external-secrets@v0.18.2...v0.19.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xLjMiLCJ1cGRhdGVkSW5WZXIiOiI0MS4xLjMiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImNoYXJ0Il19--> Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/1114 Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net> Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>



Problem Statement
The project currently lacks built-in support for injecting sidecar containers as defined by the official Kubernetes documentation.
Sidecars are a critical pattern for building modular, scalable, and maintainable applications (e.g., for secret synchronization, proxying, logging, etc.).
Without proper sidecar management, users must manually patch Pod specifications, which increases complexity and operational risks.
Related Issue
No related issue
Proposed Changes
This pull request introduces two major improvements:
InitContainer Injection:
It is now possible to inject initContainers into Pod specifications, in addition to regular containers.
This allows initialization tasks (such as database migrations, cache preloading, or setup scripts) to benefit from secret injection and sidecar patterns.
Sidecar Injection:
Users can now define sidecar containers that are automatically appended to the Pod, following Kubernetes best practices.
Additionally, this PR enhances Helm chart flexibility:
Thanks to the use of the tpl function in the Helm templates, it is now possible to inject templated values inside initContainers or sidecars.
This enables dynamic configuration when this chart is used as a dependency of a parent chart, offering powerful customization without modifying the base chart.
These changes greatly improve the modularity and usability of the deployment options, making the system more flexible for real-world production use cases.
Checklist
git commit --signoffmake testmake reviewable