Repository navigation
fix: keep the honeytoken secret when other deployments still mount it - #67
Merged
mariotrace merged 2 commits intoSep 4, 2026
Merged
Conversation
knQzx
force-pushed
the
fix/keep-shared-honeytoken-secret
branch
from
August 10, 2026 14:46
e04fb83 to
81f987a
Compare
mariotrace
requested changes
Sep 1, 2026
| // mounted by other deployments that match the trap. Kubernetes does not stop us from deleting | ||
| // a secret that is still in use, their pods would just fail to start on the next restart, | ||
| // so we have to check the remaining deployments ourselves. We also keep the secret when the | ||
| // update above failed, because then this deployment still mounts it. |
Member
There was a problem hiding this comment.
Just a nit to prefer a briefer comment to match the surrounding code style:
// Before deleting the secret, we should check for other mounters because the secret
// could be shared and in-use by other deployments with matching trap content.
Contributor
Author
There was a problem hiding this comment.
shortened to your version, thanks!
| // a secret that is still in use, their pods would just fail to start on the next restart, | ||
| // so we have to check the remaining deployments ourselves. We also keep the secret when the | ||
| // update above failed, because then this deployment still mounts it. | ||
| if secretName != "" && err == nil { |
Member
There was a problem hiding this comment.
[PRAISE] That is a solid function, thank you for finding this! 🥳
knQzx
force-pushed
the
fix/keep-shared-honeytoken-secret
branch
from
September 3, 2026 22:03
66beb59 to
03c883c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
removeDecoyWithVolumeMountdeletes the honeytoken secret unconditionally, and the comment explains it away with a guarantee that does not exist:the API server does not block deleting a secret that is still mounted, the pods simply fail to start the next time they are scheduled
that matters because the secret is not scoped to a policy or a workload.
generateSecretNamehashes onlyfilePath + ":" + fileContent, so every deployment in a namespace that matches the trap mounts the very same secret, and twoDeceptionPolicyobjects with identical path and content share it tooso narrowing one policy, or removing a trap from one deployment, deletes a secret that other deployments still reference. they keep running on the mounted copy until the first restart and then sit in
ContainerCreatingwithsecret not found, while their honeytoken quietly disappearsthis checks the remaining deployments in the namespace before deleting. the secret is also kept when the deployment update failed, because then this deployment still mounts it, and
volume.Secretis now guarded against nil. added tests for the sole-user, shared-user and failed-update cases