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

Bug auditing test_data/config.yaml with binary values #421

Closed
pablosnt opened this issue Mar 9, 2021 · 4 comments · Fixed by #422
Closed

Bug auditing test_data/config.yaml with binary values #421

pablosnt opened this issue Mar 9, 2021 · 4 comments · Fixed by #422

Comments

@pablosnt
Copy link
Contributor

pablosnt commented Mar 9, 2021

We found the following bug scanning detect-secrets project when the file test_data/config.yaml is audited:

bug_audit

We tried to solve this bug in #414, and we get it in the most cases, but this file includes the following line: low_entropy_binary_secret: !!binary MjNjcnh1IDJieXJpdXYyeXJpaTJidnl1MnI4OXkyb3UwMg==. We try to parse this file as YAML from python and we get the following behaviour:

bug_config_yaml

As can you see, the secret value changes when the file is parsed as YAML, so I think that this bug can be introduced by the YAML transformer. I'm not sure because I don't know how this transformer works exactly.

I also think that this bug is due to the specific value included in this file and it isn't a generic problem. I don't know how to fix it, so I open this issue to report it.

@domanchi
Copy link
Contributor

domanchi commented Mar 9, 2021

Hmm. I'm unable to reproduce this. Can you provide a minimal YAML file that causes this issue on master?

Cases I've tried:

  • low_entropy_binary_string in YAML file by itself
  • low_entropy_binary_string in YAML file, preceded by a new line
  • low_entropy_binary_string in YAML file, preceded by an arbitrary key pair
  • low_entropy_binary_string in YAML file, preceded by a secret
  • low_entropy_binary_string in YAML file, preceded by an arbitrary key pair + secret and a new line

They all have varying results (raising other issues), but none that raises this traceback that you provided.

@domanchi domanchi changed the title Bug auditing test_data/config.yaml Bug auditing test_data/config.yaml with unprocessable binary values Mar 9, 2021
@pablosnt
Copy link
Contributor Author

pablosnt commented Mar 9, 2021

Yes of course, the YAML file that causes this issue is this. Can you reproduce this?

@domanchi
Copy link
Contributor

domanchi commented Mar 9, 2021

Oh goodie. This means we have good test cases. But the fact we didn't catch it in our test cases means we're missing something lol.

I was able to reproduce with this file. I'll check it out.

@pablosnt
Copy link
Contributor Author

pablosnt commented Mar 9, 2021

Thank you very much @domanchi !!

@domanchi domanchi changed the title Bug auditing test_data/config.yaml with unprocessable binary values Bug auditing test_data/config.yaml with binary values Mar 9, 2021
killuazhu pushed a commit to IBM/detect-secrets that referenced this issue Mar 19, 2021
Co-authored-by: detect-secrets-updater <detect-secrets-updater@ibm.com>
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

Successfully merging a pull request may close this issue.

2 participants