-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
252 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
pr: none | ||
trigger: none | ||
|
||
schedules: | ||
- cron: "0 0 * * *" | ||
displayName: Daily fuzzing submission | ||
branches: | ||
include: | ||
- main | ||
always: true | ||
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) | ||
|
||
parameters: | ||
- name: platform | ||
type: string | ||
default: x64 # for fuzzing, we only use x64 for now | ||
- name: enableMsBuildCaching | ||
type: boolean | ||
displayName: "Enable MSBuild Caching" | ||
default: false | ||
- name: useVSPreview | ||
type: boolean | ||
displayName: "Build Using Visual Studio Preview" | ||
default: false | ||
|
||
stages: | ||
- stage: Build_${{ parameters.platform }} | ||
displayName: Build ${{ parameters.platform }} | ||
jobs: | ||
- template: templates/job-build-project.yml | ||
parameters: | ||
pool: | ||
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}: | ||
name: SHINE-INT-L | ||
${{ else }}: | ||
name: SHINE-OSS-L | ||
${{ if eq(parameters.useVSPreview, true) }}: | ||
demands: ImageOverride -equals SHINE-VS17-Preview | ||
buildPlatforms: | ||
- ${{ parameters.platform }} | ||
buildConfigurations: [Release] | ||
enablePackageCaching: true | ||
enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }} | ||
runTests: true | ||
useVSPreview: ${{ parameters.useVSPreview }} | ||
|
||
- stage: OneFuzz | ||
displayName: Fuzz ${{ parameters.platform }} | ||
dependsOn: | ||
- Build_${{parameters.platform}} | ||
jobs: | ||
- template: templates/job-fuzz.yml | ||
parameters: | ||
platform: ${{ parameters.platform }} | ||
configuration: Release | ||
inputArtifactStem: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
parameters: | ||
- name: configuration | ||
type: string | ||
default: "Release" | ||
- name: platform | ||
type: string | ||
default: "" | ||
- name: inputArtifactStem | ||
type: string | ||
default: "" | ||
|
||
jobs: | ||
- job: OneFuzz | ||
pool: | ||
vmImage: windows-2022 | ||
|
||
steps: | ||
- checkout: self | ||
submodules: false | ||
clean: true | ||
fetchDepth: 1 | ||
fetchTags: false | ||
|
||
- download: current | ||
displayName: Download artifacts | ||
artifact: build-${{ parameters.platform }}-${{ parameters.configuration }}${{ parameters.inputArtifactStem }} | ||
patterns: |- | ||
**/tests/*.FuzzTests/** | ||
- task: onefuzz-task@0 | ||
inputs: | ||
onefuzzOSes: Windows | ||
env: | ||
onefuzzDropDirectory: $(Pipeline.Workspace)\build-${{ parameters.platform }}-${{ parameters.configuration }}${{ parameters.inputArtifactStem }}\x64\Release\x64\Release\tests | ||
SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/AdvancedPaste.FuzzTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework> | ||
<LangVersion>latest</LangVersion> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\tests\AdvancedPaste.FuzzTests\</OutputPath> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="..\AdvancedPaste\Helpers\JsonHelper.cs" Link="JsonHelper.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="MSTest" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="OneFuzzConfig.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
</Project> |
21 changes: 21 additions & 0 deletions
21
src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/FuzzTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using AdvancedPaste.Helpers; | ||
using Windows.ApplicationModel.DataTransfer; | ||
|
||
// OneFuzz currently does not support .NET 9 code testing, so this is a temporary solution. | ||
// Create a .NET 8 project and use a file link to include the code for testing first. | ||
namespace AdvancedPaste.FuzzTests | ||
{ | ||
public class FuzzTests | ||
{ | ||
public static void FuzzToJsonFromXmlOrCsv(ReadOnlySpan<byte> input) | ||
{ | ||
var dataPackage = new DataPackage(); | ||
dataPackage.SetText(input.ToString()); | ||
_ = Task.Run(async () => await JsonHelper.ToJsonFromXmlOrCsvAsync(dataPackage.GetView())).Result; | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/Logger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
// This is used for fuzz testing and ensures that the project links only to JsonHelper, | ||
// avoiding unnecessary connections to additional files | ||
namespace ManagedCommon | ||
{ | ||
public static class Logger | ||
{ | ||
// An empty method to simulate logging information | ||
public static void LogTrace() | ||
{ | ||
// Do nothing | ||
} | ||
|
||
// An empty method to simulate logging information | ||
public static void LogInfo(string message) | ||
{ | ||
// Do nothing | ||
} | ||
|
||
// An empty method to simulate logging warnings | ||
public static void LogWarning(string message) | ||
{ | ||
// Do nothing | ||
} | ||
|
||
// An empty method to simulate logging errors | ||
public static void LogError(string message, Exception? ex = null) | ||
{ | ||
// Do nothing | ||
} | ||
|
||
public static void LogDebug(string message, Exception? ex = null) | ||
{ | ||
// Do nothing | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/MSTestSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] |
47 changes: 47 additions & 0 deletions
47
src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/OneFuzzConfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"configVersion": 3, | ||
"entries": [ | ||
{ | ||
"fuzzer": { | ||
"$type": "libfuzzerDotNet", | ||
"dll": "AdvancedPaste.FuzzTests.dll", | ||
"class": "AdvancedPaste.FuzzTests.FuzzTests", | ||
"method": "FuzzToJsonFromXmlOrCsv", | ||
"FuzzingTargetBinaries": [ | ||
"PowerToys.AdvancedPaste.dll" | ||
] | ||
}, | ||
"adoTemplate": { | ||
// supply the values appropriate to your | ||
// project, where bugs will be filed | ||
"org": "microsoft", | ||
"project": "OS", | ||
"AssignedTo": "[email protected]", | ||
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DEEP-Developer Experience, Ecosystem and Partnerships\\SHINE\\PowerToys", | ||
"IterationPath": "OS\\Future" | ||
}, | ||
"jobNotificationEmail": "[email protected]", | ||
"skip": false, | ||
"rebootAfterSetup": false, | ||
"oneFuzzJobs": [ | ||
// at least one job is required | ||
{ | ||
"projectName": "AdvancedPaste", | ||
"targetName": "AdvancedPaste-dotnet-fuzzer" | ||
} | ||
], | ||
"jobDependencies": [ | ||
// this should contain, at minimum, | ||
// the DLL and PDB files | ||
// you will need to add any other files required | ||
// (globs are supported) | ||
"AdvancedPaste.FuzzTests.dll", | ||
"AdvancedPaste.FuzzTests.pdb", | ||
"Microsoft.Windows.SDK.NET.dll", | ||
"Newtonsoft.Json.dll", | ||
"WinRT.Runtime.dll" | ||
], | ||
"SdlWorkItemId": 49911822 | ||
} | ||
] | ||
} |
8e13bd7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@check-spelling-bot Report
🔴 Please review
See the 📜action log or 📝 job summary for details.
Unrecognized words (2)
leilzh
onefuzz
These words are not needed and should be removed
accctrl aclapi appdata Appium appmodel atlbase atlcom atlfile atlstr bootstrapper caniuse ceq cguid Cmds cne codicon comdef commandline commctrl commdlg comutil consts cppwinrt CRSEL crx dcommon dcomp DCs desktopwindowxamlsource devpkey dxgidebug dxgiformat emmintrin Emoji endpointvolume evntrace exdisp Functiondiscoverykeys guiddef hinstance hstring Intelli junja Knownfolders lmcons LONGLONG lpt LTRB mfapi mfidl mfobjects mftransform Minimatch mmdeviceapi mmsystem msedge msiquery newdev nodoc notlike Objbase objidl pathcch Pnp Preinstalled processthreadsapi propkey propvarutil redistributable Renamer reparse restrictederrorinfo roadmap ruleset runtimes shellapi shellscalingapi shldisp shlobj stl strsafe strutil subquery SWC tailwindcss tapp thumbcache tlhelp Toolset touchpad Tsd uninstantiated uniquifier Unknwn unregistering urlmon USERDATA Uxtheme verrsrc wcautil wincodec Wincodecsdk windef windowsapp windowsx winerror winevt winsdkver winternl wsl wtsapiTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:microsoft/PowerToys.git repository
on the
leilzh/add_onefuzz
branch (ℹ️ how do I use this?):If the flagged items are 🤯 false positives
If items relate to a ...
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txt
file matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^
refers to the file's path from the root of the repository, so^README\.md$
would exclude README.md (on whichever branch you're using).well-formed pattern.
If you can write a pattern that would match it,
try adding it to the
patterns.txt
file.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.