Commit graph

26 commits

Author SHA1 Message Date
Hidde Beydals
e21c9cf7e2
repo: detect JSON and unmarshal efficiently
When an index is in a JSON format, the `sigs.k8s.io/yaml` package uses
an inefficient approach to unmarshaling the data, as it does an
unnecessary roundtrip on the data to transform the YAML to valid JSON.

To prevent this from happening, detect if the bytes which we attempt
to load contain valid JSON, and unmarshal them directly using
`json.Unmarshal` instead.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-21 00:23:43 +02:00
Adam Reese
657ce552cb
fix(*): Validate metadata semver and printable characters
ref: https://github.com/helm/helm/security/advisories/GHSA-c38g-469g-cmgx

* Skip invalid chart versions when reading the repository index file or
  when programmatically adding a chart version.
* Adds semver validation and strips non-printable characters and
  normalizes spaces for string fields in Metadata.Validate()
* Fixes a unit test that was pulling a remote repo.  Now uses a local
  repo.
* Fixes ignored error in repo update command

Signed-off-by: Adam Reese <adam@reese.io>
2021-02-04 12:52:24 -08:00
Matt Butcher
fe2d7f7792
this rewrites a whole bunch of old repo URLs to the new repo URL (#8902)
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-10-19 14:38:32 -06:00
Matt Farina
4c121c3085 Adding annotation to index.yaml file
Chart.yaml files have an annotation field that allow a chart to
have custom information similar to the way Kubernetes annotations
work.

In an index.yaml file each chart version can have annotations in
a similar manner to the Chart.yaml file. It is derived from the
same underlying struct.

These enable extension points where people can add their own info.

One thing missing is the ability to extend the top level of an
index file. This change adds annotations to the top level of an
index.yaml file. This would provide top level support for vendors
to extent index.yaml files.

Closes #8767

Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-09-23 14:00:19 -04:00
Matthew Fisher
f19acbdc94
fix: allow serverInfo field on index files
A recent change merged into Helm fixes a number of security issues related to parsing malformed index files. Unfortunately, it also broke the ability for users to load index files from chartmuseum, which adds a "server info" field to add additional metadata.

This commit adds that field so that index files from chartmuseum can be validated. Since Helm does not use this field for anything, the information is discarded and unused.

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2020-09-17 15:00:28 -07:00
Marc Khouzam
d3a8cc4713 feat(chore): Remove unused code
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-01-11 23:58:17 -05:00
Adam Reese
e458a67f0c
ref(pkg/chart): add validation method to chart
Consolidate validation of Chart.yaml.

Signed-off-by: Adam Reese <adam@reese.io>
2019-04-05 13:40:06 -07:00
Adam Reese
28d8c7b277
ref(*): remove references to chart 'engine'
Signed-off-by: Adam Reese <adam@reese.io>
2019-02-04 16:08:14 -08:00
Amanda Cameron
415e52bf55 Add support for sub-directory scanning as in issue #1401 2017-09-08 09:33:44 -04:00
Sushil Kumar
dce9d88c25 Added tests for --repo flag for helm fetch command
- [ ] Added tests for --repo flag on `helm fetch` command
- [ ] Also added tests for (pkg/repo).FindChartInRepoURL
2017-05-02 16:57:05 -07:00
John Welsh
f4486d4858 fix(helm): Don't assume index.yaml is sorted
This change sorts the helm index file after downloading from a repo.

Closes #2186
2017-03-25 01:57:25 -07:00
Matt Farina
da73150ce9
fix(tls): download helm and charts over https
Downloading of charts and helm itself happened over http. This
change moves to use https as that is available with valid certs.
2016-11-14 19:06:53 -05:00
Matt Farina
7a79661f0e
feat(charts): Move bucket to domain from path
A bucket name in the path can be migrated to a custom k8s domain
name. This is in preperation for that.
2016-11-14 13:55:33 -05:00
Matt Butcher
737d3c745f Merge pull request #1406 from technosophos/fix/1397-fix-index
fix(helm): finish repo index.html
2016-10-20 12:23:44 -06:00
Adnan Abdulhussein
ee7fe7c728 fix(repo): ensure index generates in the right order 2016-10-19 10:56:04 -07:00
Matt Butcher
abf1ddc324 fix(helm): finish repo index.html
Previous versions of Helm had placeholder text in the index.yaml file.
This generates an HTML index for 'helm serve'. It also has a
refactoring of the server so that the server can be tested.

Closes #1397
2016-10-18 17:12:18 -06:00
Matt Butcher
ea0e665f84 fix(repo): auto-update index file formats
This performs a relatively weak in-memory translation of index file
data. It does not, in most cases, write the corrected data to disk, and
it emits a warning directly to STDERR each time it loads a deprecated
index.

Known limitations:

- It cannot recover certain bogus records that earlier alpha releases
  generated (notably, where all chartfile data is missing)
- In some cases, it has to parse a filename to get version info. This is
  lossy.
- Because it takes three passes through the YAML and JSON unmarshal, it
  is not performant.

This feature is transitional and should be removed during the Beta
cycle, prior to the release of 2.0.0.

Closes #1265
2016-10-04 23:20:25 -06:00
Matt Butcher
4f09b05613 feat(helm): implement new index format
This implements a new index file format for repository indices. It also
implements a new format for requirements.yaml.

Breaking change: This will break all previous versions of Helm, and will
impact helm search, repo, serve, and fetch functions.

Closes #1197
2016-10-04 13:54:14 -06:00
Matt Butcher
5a2174231b fix(helm): fix repo package to use chartutil 2016-06-06 21:40:20 -06:00
Michelle Noorali
4bb36c89ab feat(helm): generate index file for repository 2016-05-20 14:34:03 -04:00
Michelle Noorali
9b732da719 ref(helm): rename cache file to index file
* also change additional references to cache to index
* see issue #665
2016-05-10 17:16:09 -04:00
vaikas-google
d50e22c707 Add search support 2016-05-09 11:40:10 -07:00
Matt Butcher
d58cfc46fd reset 2016-04-27 21:29:54 -06:00
jackgr
edcf783f65 Make pkg/repo use testdata from pkg/chart 2016-04-05 20:23:21 -07:00
jackgr
eb3385be58 Add file based credential provider 2016-03-20 19:30:27 -07:00
jackgr
33ca00f893 Add GetChart method 2016-03-17 22:53:04 -07:00