-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix multiple issues with the TSS lookup plugin when using fetch_attachments #6720
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! I've a first comment on the changelog fragment, the plugin maintainers might have more/other comments.
Co-authored-by: Felix Fontein <felix@fontein.de>
This reverts commit a9fb96e.
Backport to stable-6: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 6bff57e on top of patchback/backports/stable-6/6bff57ee6e85a450540ddd9151b9814cd24d294f/pr-6720 Backporting merged PR #6720 into main
🤖 @patchback |
Backport to stable-7: 💚 backport PR created✅ Backport PR branch: Backported as #6751 🤖 @patchback |
@laszlojau thanks for fixing this! |
…hments (#6720) * Treat files as binary when downloading attachments * Raise a warning when the attachment can't be read * Set the 'itemValue' for files, even when they can't be read * Always return the original secret content * Add changelog * Fix changelog * Update changelog Co-authored-by: Felix Fontein <felix@fontein.de> * Revert "Always return the original secret content" This reverts commit a9fb96e. --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 6bff57e)
…SS lookup plugin when using fetch_attachments (#6751) Fix multiple issues with the TSS lookup plugin when using fetch_attachments (#6720) * Treat files as binary when downloading attachments * Raise a warning when the attachment can't be read * Set the 'itemValue' for files, even when they can't be read * Always return the original secret content * Add changelog * Fix changelog * Update changelog Co-authored-by: Felix Fontein <felix@fontein.de> * Revert "Always return the original secret content" This reverts commit a9fb96e. --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 6bff57e) Co-authored-by: laszlojau <49835454+laszlojau@users.noreply.github.com>
SUMMARY
There are multiple issues present in the TSS lookup plugin when the recently added
fetch_attachments
is set toTrue
:AttributeError
is raised ('str' object has no attribute 'text'
) when some attachments are missing from a secret. This is an issue, as some attachments may be optional (e.g. a secret can hold both a PFX and PEM format certificate in separate fields)ISSUE TYPE
COMPONENT NAME
tss
ADDITIONAL INFORMATION
An
AttributeError
is raised when attachments are missing:Before this PR (files get created for missing attachments and the whole task errors out):
After this PR (files won't be created for missing attachments and the task will raise warnings instead of erroring out):
Downloaded files are corrupted when using PFX attachments
Before this PR: PFX files get corrupted when downloading them with the current lookup plugin, which uses the
text
field for loading the content of the attachment - i.e. they can't be read withopenssl pkcs12 -in my-cert.pfx -clcerts -nokeys -noout -text
.After this PR: Using the
content
field and writing the file as binary works for PFX files. It also works for PEM format certificates and RSA keys.3. The return values are different when usingfetch_attachments
and they cannot be printedI've reverted the relevant commit as this was an issue on our end, masked by the above the 2 issues. I was receiving errors as our secret template did not have a
private-key
field.