Skip to content

[Fuzz] Add Fuzz testing for RegistryPreview #37607

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 22 commits into from
Mar 13, 2025

Conversation

chenmy77
Copy link
Contributor

@chenmy77 chenmy77 commented Feb 24, 2025

Summary of the Pull Request

Why we need add fuzz test?
This is a request from the SFI Wave 3, currently set as Priority 2.

In this PR:

  • Fuzz Tests Project:

Created for RegisrtyPreview using .NET 8 (Windows), focusing on testing CheckKeyLineForBrackets and StripFirstAndLast.

  • Code changes:

To facilitate fuzz testing of the registry file parsing process, decouple the utility functions CheckKeyLineForBrackets and StripFirstAndLast from the ParseRegistryFile function in RegistryPreviewMainPage.Utilities.cs. Move them to a new ParseHelper.cs and change their access modifiers from private to public.
Added the RegistryPreview.FuzzTests project to RegistryPreview.
Implemented CheckKeyLineForBrackets and FuzzStripFirstAndLast in the RegistryPreview.FuzzTests project.

  • Linking & Dependency Management:

Connected the ParseHelper.cs file to the FuzzTests project.

  • Testing Result:

The code is being tested using the OneFuzz pipeline.

  • The fuzz job result:

CheckKeyLineForBrackets
https://onefuzz-ui.microsoft.com/jobs/0e9d3878-3a76-4a73-b2d1-5d5a8b87ace3
image

StripFirstAndLast
https://onefuzz-ui.microsoft.com/jobs/ac805e56-28b4-45ca-b7bb-f757dab6303e
image

PR Checklist

  • Closes: #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@chenmy77 chenmy77 changed the title Dev/mengyuanchen/add onefuzz/registrypreview [Fuzz] Add Fuzz testing for RegistryPreview Feb 24, 2025
@chenmy77 chenmy77 marked this pull request as ready for review February 25, 2025 09:23

This comment has been minimized.

@chenmy77 chenmy77 requested a review from lei9444 March 11, 2025 02:40
@chenmy77 chenmy77 requested a review from zhaopy536 March 11, 2025 02:40
Copy link
Contributor

@lei9444 lei9444 left a comment

Choose a reason for hiding this comment

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

LGTM, Approved with a suggestion

Co-authored-by: leileizhang <leilzh@microsoft.com>
@chenmy77 chenmy77 merged commit a00f56e into main Mar 13, 2025
15 checks passed
colin-tso pushed a commit to colin-tso/PowerToys that referenced this pull request Apr 8, 2025
* Add fuzz test cases

* add fuzz tests framework in registrypreview

* add registrypreview fuzzing code

* add annotations and change net7.0--net8.0

* merge main into code

* add registry fuzz sln

* change fuzzing tests scope

* remove unuse annotations

* fix typos

* change public parser to internel and private

* fix linelower error and modify filenametext to registryContent

* Revert "fix linelower error and modify filenametext to registryContent"

This reverts commit e8269b8.

* add fuzz tests in sln

* modify typos

* clean code

Co-authored-by: leileizhang <leilzh@microsoft.com>

* add annotations

---------

Co-authored-by: leileizhang <leilzh@microsoft.com>
@crutkas crutkas deleted the dev/mengyuanchen/add_onefuzz/registrypreview branch April 10, 2025 05:25
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.

4 participants