-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support content-type annotation #511
Conversation
3f3bec0
to
8dae52f
Compare
8dae52f
to
b1eed30
Compare
sValue, err = base64.StdEncoding.DecodeString(string(sValue)) | ||
if err != nil { | ||
err = fmt.Errorf("failed to decode secret. Error: %v", err) | ||
return nil, err |
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.
In the K8s secrets implementation we are logging the decoding error as a warning here, but then still providing the original secret value. I think this makes it a bit more resilient if there is a change in the secret value to plaintext where it won't immediately break here.
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.
ok, will change.
t.ContentType = v | ||
} else { | ||
count = count + 1 | ||
if count > 1 { |
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.
I don't think any unit tests trigger this condition (too many mapping entries)
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.
The test TestNewSecretSpecs/secret_spec_map_with_multiple_keys triggers this condition.
if content == "text" || content == "base64" { | ||
return nil | ||
} else { | ||
return fmt.Errorf("secret group %s: the content-type of %s is invalid", |
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.
Somewhat similar to the other comment - in the K8s secrets implementation, if a user provides an invalid content-type we log a warning and assume it should be treated as text
so that it doesn't fail
Happy to discuss which outcome is more intuitive for the user, but either way we should aim to be consistent
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.
I agree it should be consistent. I'll change it to a warning and leave in the base code and UT so we can
switch back in the future if we want to.
b1eed30
to
3f6f4f5
Compare
3f6f4f5
to
bf6d37c
Compare
Code Climate has analyzed commit bf6d37c and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 89.3% (50% is the threshold). This pull request will bring the total coverage in the repository to 89.2% (0.0% change). View more on Code Climate. |
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.
LGTM
Desired Outcome
Update push to file to support content-type annotation to decode base 64.
Implemented Changes
Added the new content-type annotations.
Connected Issue/Story
CyberArk internal issue ID: CNJR-813
Definition of Done
At least 1 todo must be completed in the sections below for the PR to be
merged.
Changelog
CHANGELOG update
Test coverage
changes, or
Documentation
README
s) were updated in this PRBehavior
Security