Skip to content
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

feat: support custom helm values file schemes #8535

Merged
merged 1 commit into from Feb 17, 2022

Conversation

alexmt
Copy link
Collaborator

@alexmt alexmt commented Feb 16, 2022

Signed-off-by: Alexander Matyushentsev AMatyushentsev@gmail.com

Closes #8397

It is not secure to allow any url scheme for a remote helm values file. The PR introduces are new setting in argocd-cm ConfigMap that allows user to configure allowed schemes:

  # Comma delimited list of additional custom remote values file schemes (http are https are allowed by default)
  helm.valuesFileSchemes: s3, git

@alexmt alexmt requested a review from jannfis February 16, 2022 20:39
@alexmt alexmt added this to the v2.3 milestone Feb 16, 2022
@codecov
Copy link

codecov bot commented Feb 16, 2022

Codecov Report

Merging #8535 (293131f) into master (1faa9b0) will increase coverage by 0.10%.
The diff coverage is 81.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8535      +/-   ##
==========================================
+ Coverage   42.33%   42.44%   +0.10%     
==========================================
  Files         176      176              
  Lines       22860    22889      +29     
==========================================
+ Hits         9678     9715      +37     
+ Misses      11799    11789      -10     
- Partials     1383     1385       +2     
Impacted Files Coverage Δ
pkg/apis/application/v1alpha1/types.go 55.08% <ø> (ø)
controller/state.go 73.90% <50.00%> (-0.27%) ⬇️
server/application/application.go 32.27% <66.66%> (+1.00%) ⬆️
util/settings/settings.go 48.14% <80.00%> (+0.60%) ⬆️
util/argo/argo.go 64.01% <88.23%> (+1.00%) ⬆️
reposerver/repository/repository.go 58.66% <100.00%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1faa9b0...293131f. Read the comment docs.

@jannfis
Copy link
Member

jannfis commented Feb 16, 2022

If we make this configurable, should we also allow to forbid http and https (e.g. when helm.valuesFileSchemes is set, do not automatically pull in http and https schemes)?

@jkroepke
Copy link
Contributor

I would agree with jannfis. Remove the hard-coded values. If http, https should allowed, they should be included in helm.valuesFileSchemes. The default value of helm.valuesFileSchemes could be http,https. But if helm.valuesFileSchemes= is defined (empty value), no remote protocols are allowed.

@alexmt
Copy link
Collaborator Author

alexmt commented Feb 16, 2022

@jannfis , @jkroepke I agree. Did not think about it. But http and https should be enabled by default, right?

@jannfis
Copy link
Member

jannfis commented Feb 16, 2022

Yeah, probably keep http and https as the defaults for now. I was also wondering (apart from this change), whether we should introduce an URL allow list for this feature.

@@ -216,6 +216,9 @@ data:
kustomize.version.v3.5.1: /custom-tools/kustomize_3_5_1
kustomize.version.v3.5.4: /custom-tools/kustomize_3_5_4

# Comma delimited list of additional custom remote values file schemes (http are https are allowed by default)
helm.valuesFileSchemes: s3, git
Copy link
Member

Choose a reason for hiding this comment

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

Would helm.valuesFileSchemesEnabled or helm.valuesFileSchemesAllowed be better?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For some reason, I like just helm.valuesFileSchemes. Boh enabled and allowed looks a little redundant to me because I cannot imagine any other option.

I might be wrong and don't have a strong opinion about it, to be honest. @terrytangyuan let me know please if you really think that some clarification is required and we should use helm.valuesFileSchemesEnabled/helm.valuesFileSchemesAllowed.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me. No need to change.

@alexmt
Copy link
Collaborator Author

alexmt commented Feb 17, 2022

@jannfis , @jkroepke implemented suggested change that allows disabling http/https.

Regarding URL allow list, I agree. This change is just to restore the ability to use value files and help plugins. In v2.4 or later we can enhance it and support configuring URLs

PTAL

Copy link
Member

@jessesuen jessesuen left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jkroepke jkroepke left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@jannfis jannfis left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
@alexmt alexmt merged commit 902b6aa into argoproj:master Feb 17, 2022
@alexmt alexmt deleted the 8397-helm-schemas branch February 17, 2022 19:51
@jkroepke
Copy link
Contributor

Hi, is there a chance to backport this into the 2.2.x branch? In case if not, is there any release of ArgoCD 2.3 planned?

gdsoumya pushed a commit to gdsoumya/argo-cd that referenced this pull request Feb 23, 2022
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
alexmt added a commit that referenced this pull request Feb 25, 2022
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
@stephaneetje
Copy link

Hello, is it resolved ? i see a merge but i added helm.valuesFileSchemes: s3, git, secrets to my argocd-cm but i still get rpc error: code = Unknown desc = Manifest generation error (cached): the URL scheme 'secrets' is not allowed.
Am i doing something wrong ? I could not find documentation

@stephaneetje
Copy link

Anyone that successfully added the option ?

alexmt added a commit that referenced this pull request Mar 3, 2022
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
alexmt added a commit that referenced this pull request Mar 4, 2022
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
@jmclean-starburst
Copy link

Hello, is it resolved ? i see a merge but i added helm.valuesFileSchemes: s3, git, secrets to my argocd-cm but i still get rpc error: code = Unknown desc = Manifest generation error (cached): the URL scheme 'secrets' is not allowed. Am i doing something wrong ? I could not find documentation

Im still having this issue, using v2.3.0-rc5; i have verified my argocd-cm contains the below

> kgcm argocd-cm -o yaml | grep valuesFileSchemes | grep -v apiVersion
  helm.valuesFileSchemes: http, https, secrets

@jkroepke - I have followed your guidance in https://github.com/jkroepke/helm-secrets/blob/88609fb95f79720f64268c317ef079dac90f75f3/docs/ArgoCD%20Integration.md

@jmclean-starburst
Copy link

silly me, i noticed helm.valuesFileSchemes is not in https://github.com/argoproj/argo-cd/blob/v2.3.0-rc5/docs/operator-manual/argocd-cm.yaml

@petr4
Copy link

petr4 commented Mar 23, 2022

Hey there. is it merged? the schema options still does not work for 2.3.2.

@rgeraskin
Copy link

@petr4 did you try to hard refresh your app? looks like it's cached error
image

@petr4
Copy link

petr4 commented Mar 28, 2022

@rgeraskin Hy there, it works as well. In my case the issue was in wrong argocd service to apply configs. And yes - refresh apps definitely helps with correct works

@amohamedhey
Copy link

@rgeraskin @petr4
I have tried this
helm.valuesFileSchemes: http, https
but it didn't work. should I restart any pod after update the configmap?

@petr4
Copy link

petr4 commented Apr 20, 2022

@amohamedhey Hey! Any changes should be reread from cm to pod, i guess restart can help, in my case i just have added helm {{ data }} (please, read helm templates functions) to annotation

wojtekidd pushed a commit to wojtekidd/argo-cd that referenced this pull request Apr 25, 2022
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Signed-off-by: wojtekidd <wojtek.cichon@protonmail.com>
@MeNsaaH
Copy link
Contributor

MeNsaaH commented May 30, 2022

@alexmt

I have upgraded. However, I noticed all my argocd app diffs command are broken with the same error

the URL scheme 'secrets' is not allowed

Is there something, I'm missing? does the argocd app diff ignore the argocd-cm?

#9200

@arthurk
Copy link
Contributor

arthurk commented Jun 29, 2022

This PR has introduced a bug with the argocd app diff command when the --local flag is passed. The settings will not be read and the diff command will show the URL scheme 'secrets' is not allowed errors

@myrondev
Copy link

Hi. Did anyone solve this issue?

@myrondev
Copy link

@rgeraskin @petr4 I have tried this helm.valuesFileSchemes: http, https but it didn't work. should I restart any pod after update the configmap?

It's a good idea to restart pods.

@myrondev
Copy link

@rgeraskin Hy there, it works as well. In my case the issue was in wrong argocd service to apply configs. And yes - refresh apps definitely helps with correct works

Did you fix it with this? helm.valuesFileSchemes: http, https, secrets

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.

CVE-2022-24348 fix broke Helm downloader plugins interface