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

Exclude binary files from secrets scans #374

Closed
tdurk93 opened this issue Jan 18, 2024 · 1 comment
Closed

Exclude binary files from secrets scans #374

tdurk93 opened this issue Jan 18, 2024 · 1 comment
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@tdurk93
Copy link
Contributor

tdurk93 commented Jan 18, 2024

Binary (non-text) files aren't able to scanned properly, and that causes them to print exceptions to the terminal during a scan. It looks like this:

[seCureLI] [WARN] - An unknown error occurred loading the file from <file path>

Here are a couple examples of binary files that throw an exception when we attempt to read them with a utf-8 encoding (after I started logging the underlying exception):

tests/data/backends/test_backend-0.1-py2.py3-none-any.whl: 'utf-8' codec can't decode byte 0xd8 in position 17: invalid continuation byte
tests/data/packages3/dinner/Dinner-1.0.tar.gz: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

We should detect and exclude files that aren't utf-8.

@tdurk93 tdurk93 added the bug Something isn't working label Jan 18, 2024
@tdurk93 tdurk93 added this to seCureLI Jan 18, 2024
@github-project-automation github-project-automation bot moved this to Todo in seCureLI Jan 18, 2024
@dlolaogundipe
Copy link

Core epic

@kevin-orlando kevin-orlando added the good first issue Good for newcomers label Feb 2, 2024
@isaac-heist-slalom isaac-heist-slalom self-assigned this Feb 2, 2024
@isaac-heist-slalom isaac-heist-slalom moved this from Todo to In Progress in seCureLI Feb 5, 2024
@isaac-heist-slalom isaac-heist-slalom moved this from In Progress to PR Review in seCureLI Feb 7, 2024
isaac-heist-slalom added a commit that referenced this issue Feb 8, 2024
[secureli-374](#374)

<!-- Include general description here -->
Excludes binary files from scans.

## Changes
<!-- A detailed list of changes -->
* Added logic to skip binary files from scans
* Updated launch.json configs to avoid deprecated settings

## Testing
<!--
Mention updated tests and any manual testing performed.
Are aspects not yet tested or not easily testable?
Feel free to include screenshots if appropriate.
 -->
* All existing tests passing, some updating required
* Added unit tests to test detection of binary files to be excluded

## Clean Code Checklist
<!-- This is here to support you. Some/most checkboxes may not apply to
your change -->
- [x] Meets acceptance criteria for issue
- [ ] New logic is covered with automated tests
- [x] Appropriate exception handling added
- [ ] Thoughtful logging included
- [ ] Documentation is updated
- [ ] Follow-up work is documented in TODOs
- [ ] TODOs have a ticket associated with them
- [x] No commented-out code included


<!--
Github-flavored markdown reference:
https://docs.github.com/en/get-started/writing-on-github
-->
@github-project-automation github-project-automation bot moved this from PR Review to Done in seCureLI Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: Done
Development

No branches or pull requests

4 participants