зеркало из https://github.com/microsoft/BuildXL.git
a8410ec4f4
- Create initial onboarding documentation for Guardian - Create a sample project that incorporates the Guardian SDK. Related work items: #1829804 |
||
---|---|---|
.. | ||
.config/guardian | ||
.gdn | ||
sdk | ||
src | ||
.gitignore | ||
README.md | ||
build.ps1 | ||
config.dsc |
README.md
MS Guardian Sample
Introduction
This sample demonstrates how to use the Guardian SDK with BuildXL. See the Guardian documentation in the BuildXL wiki for more details on the Guardian SDK, or aka.ms/msguardian for more details on the Guardian tool.
Instructions
- Set the
BUILDXL_BIN
environment variable to the BuildXL deployment folder. - Copy the latest versions of the following directories from the BuildXL source code to the sdk directory on this sample:
BuildXLRepoRoot/Public/Sdk/Public/Tools/Guardian
andBuildXLRepoRoot/Public/Sdk/Public/Json
. - Open src/Program.cs and add a CredScan violation inside the Main function. This can be as simple as adding two string variables named Username and Password and setting them to any string.
- In powershell, run
.\build.ps1
. - This build will fail as it has a CredScan violation. To baseline the CredScan violation, uncomment the baselineFiles line within the GuardianArguments structure in GuardianSample.dsc.
- Now create a baseline file. Look at the error that is generated by BuildXL.
- From the error message in the console, look at the last line pointing to the stdout file.
- Example:
C:\path\to\BuildXL.Internal\Examples\MsGuardian\Out\Objects\1\e\98hj2aj7t0oy2cpptnyy4lvq\guardian.cmd.std_2\out.txt
- Example:
- Take root of the
guardian.cmd.std_2
directory and appendguardianOut\buildxl.gdnsettings
- Example:
C:\path\to\BuildXL.Internal\Examples\MsGuardian\Out\Objects\1\e\98hj2aj7t0oy2cpptnyy4lvq
->C:\path\to\BuildXL.Internal\Examples\MsGuardian\Out\Objects\1\e\98hj2aj7t0oy2cpptnyy4lvq\guardianOut\buildxl.gdnsettings
- Example:
- Then run the following command to create the baseline (ensure that a proper absolute paths are provided as Guardian will not accept relative paths)
guardian baseline --settings-file C:\path\to\BuildXL.Internal\Examples\MsGuardian\Out\Objects\1\e\98hj2aj7t0oy2cpptnyy4lvq\guardianOut\buildxl.gdnsettings -f C:\path\to\BuildXL.Internal\Examples\MsGuardian\.config\guardian\buildxl_baseline
- From the error message in the console, look at the last line pointing to the stdout file.
- Finally, run
.\build.ps1
again to get a passing build.