carvel-dev / carvel-dev/vendir
Secrets with ``stringData`` fail silently
- Dominant language
- Go
- Stars
- 399
- Forks
- 73
- Avg merge
- 2h 53m
- Merged PRs (30d)
- 2
Description
**What steps did you take:**
Input a secret with ``stringData`` as ``helmChart.repository.secretRef.name``
```yaml
apiVersion: v1
kind: Secret
metadata:
name: auth
stringData:
username: admin
password: admin
---
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
- path: charts
contents:
- path: myChart
helmChart:
name: ...
version: "1.1.1"
repository:
url: https://registry.path/charts/
secretRef:
name: auth
```
Hook helm and run vendir
```sh
mv $(which helm) /tmp/helm
echo -e "#!/bin/sh\necho \$@ 1>2&\n/tmp/helm \$@" > /usr/bin/helm
chmod +x /usr/bin/helm
vendir sync -f auth.yaml
```
**What happened:**
vendir (helm) reports:
```
vendir: Error: Syncing directory 'charts':
Syncing directory 'myChart' with helm chart contents:
Add helm chart repository: exit status 1 (stderr: repo add vendir-unused https://registry.path/charts/
Error: looks like "https://registry.path/charts/" is not a valid chart repository or cannot be reached: failed to fetch "https://registry.path/charts/index.yaml" : 401 Unauthorized
```
The helm arguments ``repo add vendir-unused https://registry.path/charts/`` show that ``--username`` and ``--password`` weren't provided by vendir, thus resulting in a 401.
**What did you expect:**
vendir to either accept ``stringData`` or to fail showing that it can't parse the Secret.
**Anything else you would like to add:**
The [used parser](https://github.com/carvel-dev/vendir/blob/develop/pkg/vendir/config/config.go#L48) fails silently on keys existing in the yaml but not in the struct. While it is possible to make it fail on those, I believe that it would add other unwanted behavior.
**Environment:**
- vendir version: 0.46.0
- OS: Alpine Linux v3.24
---
Vote on this request
This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.
👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"
We are also happy to receive and review Pull Requests if you want to help working on this issue.
Contributor guide
Research direction
Start with the Secret parser referenced in pkg/vendir/config/config.go and reproduce the issue with the supplied auth.yaml and vendir sync command. Trace how stringData is handled for helmChart.repository.secretRef, then add coverage showing that credentials are accepted or that unsupported Secret fields produce an explicit error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, helm
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100