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

'One-time downloads' not guaranteed #2652

Open
dillonstreator opened this issue Jan 15, 2025 · 0 comments
Open

'One-time downloads' not guaranteed #2652

dillonstreator opened this issue Jan 15, 2025 · 0 comments

Comments

@dillonstreator
Copy link

dillonstreator commented Jan 15, 2025

One-time downloads is not guaranteed. There is a race condition in the Redis database implementation.

func (r *Redis) Get(key string) (yopass.Secret, error) {
var s yopass.Secret
v, err := r.client.Get(key).Result()
if err != nil {
return s, err
}
if err := json.Unmarshal([]byte(v), &s); err != nil {
return s, err
}
if s.OneTime {
_, err := r.Delete(key)
if err != nil {
return s, err
}
}
return s, nil
}

There is no lock between the get and delete operation which means that multiple clients can retrieve the secret value. Additionally, the clients don't even need to know the password/key for retrieval and could brute force or just 'harvest now decrypt later' the secret (this is not trivial to solve but could store a hash of the decryption key on the server which puts the 'zero-knowledge' into a bit more of a gray-area). This is a bit more concerning if there is no rate limiting applied #8 due to brute forcing the id.

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

No branches or pull requests

1 participant