Skip to content

Handle invalid UTF-8 characters #678

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

Merged
merged 8 commits into from
Apr 4, 2025
Merged

Conversation

juli1
Copy link
Collaborator

@juli1 juli1 commented Apr 4, 2025

What problem are you trying to solve?

We want to be able to scan files with encoding different than UTF-8

What is your solution?

Change the functions to read files so that

  • we try to read UTF-8 first
  • if we fail, we fallback and convert the invalid UTF-8 characters into artifacts

Testing

Added integration tests with the sast-files-encoding repository that exposes data with different encodings.

@juli1 juli1 requested a review from a team as a code owner April 4, 2025 15:41
@juli1 juli1 requested a review from jasonforal April 4, 2025 15:41
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Apr 4, 2025

Datadog Summary

✅ Code Quality    ✅ Code Security    ✅ Dependencies

@juli1 juli1 requested a review from amaanq April 4, 2025 15:51
Copy link
Collaborator

@amaanq amaanq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's stacked off of #676, if so, for reviewing purposes can you please set the target branch to your other feature branch, until that PR is merged? I was very confused at first as to why a lot of the code was the same here.

Co-authored-by: Amaan Qureshi <[email protected]>
@juli1
Copy link
Collaborator Author

juli1 commented Apr 4, 2025

This looks like it's stacked off of #676, if so, for reviewing purposes can you please set the target branch to your other feature branch, until that PR is merged? I was very confused at first as to why a lot of the code was the same here.

Interesting since I use a different and clean branch. Will revert the other changes for sure.

@juli1 juli1 requested a review from amaanq April 4, 2025 19:45
Copy link
Collaborator

@amaanq amaanq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved but undo the seemingly accidental newline change to integration-test-secrets.sh

@juli1 juli1 merged commit 43ed438 into main Apr 4, 2025
74 of 75 checks passed
@juli1 juli1 deleted the julien/handle-different-encoding branch April 4, 2025 22:26
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 this pull request may close these issues.

2 participants