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

feat: fuzz testing for GoModParser #3434

Merged
merged 3 commits into from
Oct 23, 2023
Merged

feat: fuzz testing for GoModParser #3434

merged 3 commits into from
Oct 23, 2023

Conversation

mastersans
Copy link
Contributor

fixes #3325

Added a fuzz testing for GoModParser(go.mod), made .proto file based on go.mod file reference ,
Although the GoParser (go.py) mainly parses for requirements('require'), but I included 'replace' and 'exclude' also.
I have tested the fuzzer in a container, also attached the screenshot below:

Screenshot 2023-10-18 233145

@terriko
Copy link
Contributor

terriko commented Oct 19, 2023

This looks really promising! I'm going to go ahead and approve the CI tests to run, and I'll be back for a more careful review after that's done.

@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2023

Codecov Report

Merging #3434 (bb29487) into main (9b23ea9) will increase coverage by 0.21%.
Report is 8 commits behind head on main.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #3434      +/-   ##
==========================================
+ Coverage   79.67%   79.88%   +0.21%     
==========================================
  Files         758      758              
  Lines       11596    11616      +20     
  Branches     1568     1571       +3     
==========================================
+ Hits         9239     9280      +41     
+ Misses       1932     1912      -20     
+ Partials      425      424       -1     
Flag Coverage Δ
longtests 74.81% <ø> (-0.02%) ⬇️
win-longtests 77.88% <ø> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 10 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@terriko terriko left a comment

Choose a reason for hiding this comment

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

Looks like we've got some linters failing, but thankfully those should be pretty easy to fix.

The contributor guide has some info on what the linters are used for and how to set them up:
https://github.com/intel/cve-bin-tool/blob/main/CONTRIBUTING.md#running-linters

The ones that are failing can probably be auto-fixed using the same tools. Once you've got them installed, try running

isort fuzz/fuzz_go.py

and those should fix the sorting issues, then something similar with black (which should also fix the flake8 issue) and pyupgrade. Update the pull request with the new files.

It does look like it's complaining about the generated file (which we should probably ahve those linters ignore) but go ahead and just run the fixes on it for now even though it says not to edit it. I'll open a separate issue to see if our config needs updating so stuff in fuzz/generated/ is ignored correctly in the future, but it's easier to just check in a slightly cleaned up file for this PR.

@mastersans
Copy link
Contributor Author

I ran the linters on the both fuzz_go.py and go_mod_pb2.py, both had some issues which are fixed also the pre-commit shows passed before commiting, I should have used it earlier.

Copy link
Contributor

@terriko terriko left a comment

Choose a reason for hiding this comment

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

Time to get this merged. Thank you again for working on this!

@terriko terriko merged commit c8b07ca into intel:main Oct 23, 2023
21 checks passed
@mastersans mastersans deleted the go-fuzzer branch October 24, 2023 17:15
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.

feat: Create fuzzer for go language parser
3 participants