-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
Symlink loop detection incorrectly skips all symlinks for a given file location (except the first) #2402
Comments
Yes, I think the problem is that we should only record |
It seems to me that this is a relatively expensive case to try and detect algorithmically, so I took a peek at how GNU find detects such loops: apparently, it simply checks if the kernel syscall failed to resolve with a reported loop condition. The documentation for the linux approach to symlink chain resolution is here. Basically, they count the symlink depth and give up once depth exceeds
I think we should use the same approach at the application-level, with the extra wrinkle that we retain the current depth as the walk branches out:
|
@chaorace thanks for doing some digging here. We should definitely do 1. through 3. But I'm not sure if I got 4. and 5., yet. Any chance you could come up with a PR? |
Fixes gopasspw#2402 RELEASE_NOTES=[BUGFIX] Fix symlink deduplication. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Fixes gopasspw#2402 RELEASE_NOTES=[BUGFIX] Fix symlink deduplication. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Fixes gopasspw#2402 RELEASE_NOTES=[BUGFIX] Fix symlink deduplication. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Fixes #2402 RELEASE_NOTES=[BUGFIX] Fix symlink deduplication. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Summary
Starting with commit 5b82b99, gopass began to incorrectly skip symlinks if more than one symlink in the store resolves to the same file.
Steps To Reproduce
test-real.gpg
)test-link1.gpg
,test-link2.gpg
)gopass find test
Expected behavior
All resolvable symlinks should be considered when querying credentials and be included in the command output if appropriate
Environment
Linux chao-desktop 5.15.74-3-MANJARO #1 SMP PREEMPT Sat Oct 15 13:39:11 UTC 2022 x86_64 GNU/Linux
gopass 1.14.9 go1.19.1 linux amd64 <root> - gpg 2.2.39 - fs 0.0.0 Available Crypto Backends: age, gpgcli, plain Available Storage Backends: fossilfs, fs, gitfs
community/gopass
)Additional context
Demonstration (sensitive names replaced):
As you can see, only the real file (
C.example/foo.bar@example.com.gpg
) and one symlink (D.example/foo.bar@example.com
) were kept in the output forgopass find
, even though all of the symlinks resolve without producing a loop. I use symlinks extensively in my password store and I see the same behavior in every situation where I have two or more symlinks to the same credential.Log output (sensitive names replaced):
Note that there are 3 instances of the "Symlink loop detected" message, which corresponds to the number of missing symlinks from the expected output.
The text was updated successfully, but these errors were encountered: