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

--up is broken: open secrets.yml: no such file or directory #254

Open
1 of 3 tasks
SpectreVert opened this issue Dec 11, 2024 · 3 comments · May be fixed by #255
Open
1 of 3 tasks

--up is broken: open secrets.yml: no such file or directory #254

SpectreVert opened this issue Dec 11, 2024 · 3 comments · May be fixed by #255
Labels

Comments

@SpectreVert
Copy link

SpectreVert commented Dec 11, 2024

Summary

Using --up should find a secrets.yml file up the directory hierarchy. In v0.10.0 and v0.10.1 the flag is broken when running summon from any subdirectory.

Steps to Reproduce

  1. Inside a directory (some-repo) setup a secrets.yml and a subdirectory.
some-repo/
├── secrets.yml
└── subdirectory

1 directory, 1 file
  1. The contents of secret.yml could be as follows:

secrets.yml

BIG_SECRET: !var SomeStore/MyBigSecret
  1. Store placeholder secret in your store: (go)pass insert SomeStore/MyBigSecret

  2. Navigate to some-repo/subdirectory

  3. Run summon --up -- sh -c 'echo $BIG_SECRET'

Expected Results

In the previous summon v0.9.6 the example above works and displays the secret.

Actual Results

Starting with v0.10.0 the example above fails with :

open secrets.yml: no such file or directory

Reproducible

  • Always
  • Sometimes
  • Non-Reproducible

Version/Tag number

All binaries downloaded from https://github.com/cyberark/summon/releases summon-linux-amd64.tar.gz
Correct: v0.9.6-8de0e79
Offending: v0.10.0-129fb57, v0.10.1-29ebeaa

Environment setup

Linux 6.8.9-49-generic
Ubuntu 22.04.5 LTS 64-bit

Additional Information

Add any other context about the problem here.

@SpectreVert
Copy link
Author

FYI @marco-m

@marco-m
Copy link
Contributor

marco-m commented Dec 15, 2024

I had a look at the code. I believe that the bug has been introduced in ef71de5. The --up feature has been introduced in #144, in function findInParentTree, which was called by function runAction.

It turns out that function runAction has been renamed to RunSubprocess and moved to file pkg/summon/summon.go. In the process, this snippet has been deleted by mistake:

	if ac.RecurseUp {
		currentDir, err := os.Getwd()
		ac.Filepath, err = findInParentTree(ac.Filepath, currentDir)
		if err != nil {
			return err
		}
	}

Ironically, this has not been detected by the tests, because the tests exercise function findInParentTree, which still exists in the source code, although it is now not called by anything except the tests...

@marco-m marco-m linked a pull request Dec 16, 2024 that will close this issue
13 tasks
@marco-m
Copy link
Contributor

marco-m commented Dec 16, 2024

@SpectreVert could you please check #255 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants