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

Vendir allows self-destructing configuration #348

Closed
Zebradil opened this issue Jan 2, 2024 · 4 comments · Fixed by #341
Closed

Vendir allows self-destructing configuration #348

Zebradil opened this issue Jan 2, 2024 · 4 comments · Fixed by #341
Labels
bug This issue describes a defect or unexpected behavior carvel-accepted This issue should be considered for future work and that the triage process has been completed

Comments

@Zebradil
Copy link
Member

Zebradil commented Jan 2, 2024

What steps did you take:

Try to run vendir sync with a config that contains a directory path with .., like this (the charts directory must exist beforehand):

apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: charts/..
    contents:
      - path: foo
        inline:
          paths:
            test.txt: hello world

What happened:

All files from the current directory are gone.

❯ vendir sync
Fetching: charts/.. + foo (inline)

vendir: Error: Syncing directory 'charts/..':
  Deleting dir charts/..: unlinkat charts/..: directory not empty

❯ ls -la | wc -l
0

What did you expect:

I expect vendir to complain about the faulty configuration, like it does for the . path:

❯ cat <<EOF | vendir sync -f-
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: .
    contents:
      - path: foo
        inline:
          paths:
            test.txt: hello world
EOF
vendir: Error: Parsing resource config '-':
  Unmarshaling config:
    Validating config:
      Validating directory '.' (0):
        Expected path to not be one of '/', '.', '..', ''

Environment:

  • vendir version: 0.38.0
  • OS: latest Arch Linux x86_64

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.

@Zebradil Zebradil added bug This issue describes a defect or unexpected behavior carvel-triage This issue has not yet been reviewed for validity labels Jan 2, 2024
@carvel-bot carvel-bot added this to Carvel Jan 2, 2024
@kumaritanushree
Copy link
Contributor

@Zebradil thank you for raising this issue and adding changes to fix it in PR #341

@kumaritanushree
Copy link
Contributor

@Zebradil I am getting different than error what you have added for the 1st case.

$ mkdir charts

$ ./vendir sync 
Fetching: . + foo (inline)

vendir: Error: Syncing directory '.':
  Deleting dir .:
    RemoveAll .: invalid argument 

$ cat vendir.yml 
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: charts/..
    contents:
      - path: foo
        inline:
          paths:
            test.txt: hello world

Can you please check on this or am I doing anything wrong?

@Zebradil
Copy link
Member Author

Zebradil commented Jan 4, 2024

@kumaritanushree which vendir version are you using? With 0.38.0 I have the following output:

$ mkdir charts
$ cat <<EOF | vendir sync -f-
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: charts/..
    contents:
      - path: foo
        inline:
          paths:
            test.txt: hello world
EOF
Fetching: charts/.. + foo (inline)

vendir: Error: Syncing directory 'charts/..':
  Deleting dir charts/..: unlinkat charts/..: directory not empty

Notice the Fetching: line. In your case, it references the . dir that is not presented in the configuration. It looks concerning.

@kumaritanushree
Copy link
Contributor

@Zebradil My bad yes without your changes getting same what I have pasted above but with your change I am getting this error:

Fetching: . + foo (inline)

vendir: Error: Syncing directory '.':
  Deleting dir .:
    RemoveAll .: invalid argument

What I expect is this should show error something like charts/.. is invalid config, it will delete all content of your current directory(can try to think something better).

Although it is not deleting now the content of current directory but error message I feel we can try to make better.

@renuy renuy moved this to To Triage in Carvel Jan 9, 2024
@renuy renuy added carvel-accepted This issue should be considered for future work and that the triage process has been completed and removed carvel-triage This issue has not yet been reviewed for validity labels Jan 9, 2024
@renuy renuy moved this from To Triage to Prioritized Backlog in Carvel Jan 9, 2024
@github-project-automation github-project-automation bot moved this from Prioritized Backlog to Closed in Carvel Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect or unexpected behavior carvel-accepted This issue should be considered for future work and that the triage process has been completed
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants