Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
76b1cc8
Add unit tests for DwarfAttributeValue and related DWARF types
Sasinkas Apr 9, 2026
cb5a384
Add unit tests for DwarfCommonInformationEntry to validate parsing be…
Sasinkas Apr 13, 2026
237fd1e
Add unit tests for DwarfFrameDescriptionEntry to validate constructor…
Sasinkas Apr 13, 2026
208b939
Add unit tests for DwarfLineNumberProgram to validate constructor and…
Sasinkas Apr 13, 2026
db52ee5
Add unit tests for DwarfSymbol to validate name and full name behavior
Sasinkas Apr 13, 2026
d57aba5
Add unit tests for DwarfSymbolProvider to validate parsing and comman…
Sasinkas Apr 13, 2026
f112129
Merge branch 'main' into dev/sraroseck/draft/UpdateTests/UnitTests/Dw…
Sasinkas Apr 21, 2026
36ec1d4
Update active context and learnings with guardian integration test de…
Sasinkas Apr 22, 2026
531e04a
Add integration tests for BinSkim with BinSkimRunner helper class
Sasinkas Apr 24, 2026
9d2e225
Add integration tests for new Dwarf commands and enhance existing tests
Sasinkas Apr 24, 2026
5b8b769
acitve context
Sasinkas Apr 30, 2026
71f30c1
Merge branch 'main' into dev/sraroseck/draft/UpdateTests/UnitTests/Dw…
Sasinkas May 27, 2026
2db23b0
Fix directory index boundary check and update Strp offset in unit tests
Sasinkas May 28, 2026
20ce7d5
Add unit tests for ElfBinary class to validate loading and error hand…
Sasinkas May 28, 2026
c6719c7
Add unit tests for ELF binary analysis in AnalyzeCommandIntegrationTests
Sasinkas May 28, 2026
93c6842
Add Pester integration tests for BinSkim CLI functionality
Sasinkas May 28, 2026
16fe746
Add PDB file for BA2004.EnableSecureSourceCodeHashing functional test…
Sasinkas Jun 4, 2026
ec9a810
Add portable executable and PDB files for .NET Core and .NET Standard
Sasinkas Jun 4, 2026
a780397
Merge branch 'main' into dev/sraroseck/draft/UpdateTests/UnitTests/Dw…
Sasinkas Jun 4, 2026
d053d62
Refactor LEB128 encoding helpers into DwarfTestHelpers for code reuse…
Sasinkas Jun 4, 2026
4379ef3
Refactor integration tests: remove redundant tests, add repository ro…
Sasinkas Jun 8, 2026
07b5447
Fix applicability condition for EnableShadowStack in RuleTests
Sasinkas Jun 8, 2026
19bc249
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 8, 2026
de65664
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 8, 2026
3ba606a
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 8, 2026
7f9b15b
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 8, 2026
faf29ea
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 8, 2026
3ebe1f7
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 8, 2026
225a360
Merge branch 'main' into dev/sraroseck/draft/UpdateTests/UnitTests/Dw…
Sasinkas Jun 8, 2026
b84a211
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 8, 2026
d2eb70f
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 8, 2026
bbc3d5d
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 9, 2026
8db7b49
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 9, 2026
bee3aa2
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 9, 2026
8649118
Refactor variable declarations for clarity in Dwarf-related unit tests
Sasinkas Jun 9, 2026
8d1522b
Merge branch 'dev/sraroseck/draft/UpdateTests/UnitTests/DwarfAttribut…
Sasinkas Jun 9, 2026
d0b9b5e
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 9, 2026
a0ff8f1
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 9, 2026
87205ec
Potential fix for pull request finding 'CodeQL / Call to 'System.IO.P…
Sasinkas Jun 9, 2026
15f676c
Remove outdated documentation and notes from the memory bank
Sasinkas Jun 9, 2026
855f1f5
Merge branch 'main' into dev/sraroseck/draft/UpdateTests/UnitTests/Dw…
Sasinkas Jun 12, 2026
1335ba7
Add blank lines for improved readability in feature instructions
Sasinkas Jun 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/03-feature.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ applyTo: "**"

## Feature Instructions


Add unit tests to binskim class:
DwarfAttributeValue
DwarfCommonInformationEntry
DwarfCompilationUnit
DwarfFrameDescriptionEntry
DwarfLineNumberProgram
DwarfMemoryReader
DwarfSymbol
DwarfProvider
ElfBinary
Nice to have
guardian integration tests
guardian pipeline - run guardian with binskim on 1ESPT
Binskim Integration tests
pester tests (powershell)
Get rid of Verify Methods

## Testing Configuration
50 changes: 50 additions & 0 deletions .memory-bank/activeContext.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Active Context

## Current Work Focus
BinSkim Integration Tests - Tracks 1-2 complete, Tracks 3-4 ready.

## Recent Changes
- ✅ Track 1: Project scaffolding, BinSkimRunner helper, 5 initial tests
- ✅ Track 2: Core integration tests - 8 new tests (analyze verbs, dump, export-rules, export-config, error handling)
- Build: 0 warnings, 0 errors; Tests: 13/13 passing

## Active Decisions
- Invocation: dotnet BinSkim.dll for cross-platform (Linux + Windows)
- BinSkim.Driver referenced with ReferenceOutputAssembly=false (build-order dependency only)
- Path resolution: navigate from test assembly up to bld/bin/BinSkim.Driver/release/BinSkim.dll
- Self-scan pattern: BinSkim analyzing its own DLL (PDB co-located)
- CommandLineParser writes help/version to stderr, tests check combined output
- BinSkim exits 0 even when rules fire errors. Exit code reflects tool health, not rule results
- Verb names: analyze, dump, export-rules, export-config (NOT export-rules-metadata/export-configuration)
- export-rules/export-config take positional output path arg (not --output)

## Files Created/Modified
- NEW: src/Test.IntegrationTests.BinSkim.Driver/Test.IntegrationTests.BinSkim.Driver.csproj
- NEW: src/Test.IntegrationTests.BinSkim.Driver/BinSkimRunner.cs
- NEW: src/Test.IntegrationTests.BinSkim.Driver/AnalyzeCommandIntegrationTests.cs
- MOD: src/BinSkim.sln (added project + build configs)

## Test Inventory (13 tests, all passing)
### Track 1 (original)
1. Analyze_SelfScan_ExitsWithZero
2. Analyze_SelfScan_ProducesValidSarif
3. Analyze_NoValidTargets_ExitsWithNonZero
4. Analyze_HelpFlag_ExitsCleanly
5. Analyze_VersionFlag_ExitsCleanly

### Track 2 (new)
6. Analyze_KnownFailBinary_ProducesErrorResults - BA2016 fires error on ManagedFail.dll
7. Analyze_RunOnlyRules_FiltersToSpecifiedRule - --run-only-rules BA2016 filters results
8. Analyze_InvalidArgument_ExitsWithNonZero - --bogus-flag gives non-zero
9. Analyze_InvalidVerb_ExitsWithNonZero - unrecognized verb gives non-zero
10. Dump_SelfScan_ProducesMetadataOutput - dump outputs binary metadata
11. Dump_Verbose_ProducesMoreDetailedOutput - --verbose produces >= normal output
12. ExportRules_ProducesValidSarifOutput - export-rules creates .sarif with rule BA2016
13. ExportConfig_ProducesValidJsonOutput - export-config creates .json config

## Next Steps (Tracks 3-4 from plan)
1. ☐ Track 3: CLI Behavior Tests - response files, --recurse, config files, error handling
2. ☐ Track 4: SARIF Validation Tests - schema compliance, determinism, data insertion/removal

## Current State
Tracks 1-2 complete. 13 integration tests all green. Ready for Tracks 3-4.
20 changes: 20 additions & 0 deletions .memory-bank/learnings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Learnings

- Initialized learnings file; no project-specific learnings recorded yet.
- DwarfAttributeValue represents DWARF attribute values with a Type enum (DwarfAttributeValueType) and a boxed Value, plus an optional Offset used for deferred resolution.
- Equality in DwarfAttributeValue is type-sensitive and uses special handling for some enum values (Address, Constant, Reference, SecOffset, Block, ExpressionLocation, Flag, String); other enum values currently fall through to a default “equal” path regardless of Value, which is important to keep in mind when adding tests.
- DwarfCompilationUnit maps DWARF4 forms (Data*, Address, Block*, String/Strp, Flag*, Ref*, ExpressionLocation, SecOffset, etc.) and DWARF5/extended forms (LineStrp, StrpSup, Strx*/GNUStrIndex, Addrx*/GNUAddrIndex, Rnglistx, Loclistx, RefSup*, RefSig8) into DwarfAttributeValue instances by setting Type, Value, and/or Offset according to the DWARF spec and LLVM’s DWARFFormValue behavior.
## Guardian / 1ES Infrastructure
- "Guardian" in this repo refers to Microsoft 1ES SDL infrastructure agent pools (guardian-build-infra-windows-x64, guardian-build-infra-linux-x64), NOT a separate tool or NuGet package.
- 1ESPT (1 Engineering System Perf and Test) is the compliance scanning pool (pool-1espt-mseng).
- Pipeline templates come from 1ESPipelineTemplates/1ESPipelineTemplates repo (refs/tags/release): Official template for build, Unofficial for compliance.
- Compliance pipeline runs BinSkim@4 (v4.3.1), CodeQL, CredScan@2, SPMI on net9.0 release outputs.
- Build pipeline uses custom NuGet feed (BinSkim.Build on mseng/1ES), validates release PRs are merged, triggers internal BinSkimInternal pipeline (ID 21327).
- No .gdnconfig/.gdn guardian config files exist; all config is in pipeline YAML.

## Test Infrastructure
- Functional tests use xUnit + FluentAssertions on .NET 9 (netcoreapp9.0).
- Test.FunctionalTests.BinSkim.Driver uses baseline SARIF comparison (Expected/ vs NonWindowsExpected/ folders).
- Test.FunctionalTests.BinSkim.Rules uses Pass/Fail binary folders per rule (BAXXX.RuleFriendlyName pattern).
- Test assets include PE (exe/dll), ELF, Mach-O binaries from various compilers.
- UpdateBaselines.ps1 / .sh scripts regenerate expected SARIF outputs.
6 changes: 6 additions & 0 deletions src/BinSkim.sln
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.UnitTests.BinSkim.Rule
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.UnitTests.BinSkim.Driver", "Test.UnitTests.BinSkim.Driver\Test.UnitTests.BinSkim.Driver.csproj", "{B64DBE60-C7E6-48C1-BB7F-B12129DF98B2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.IntegrationTests.BinSkim.Driver", "Test.IntegrationTests.BinSkim.Driver\Test.IntegrationTests.BinSkim.Driver.csproj", "{2E4F8A1B-3C5D-4E6F-9A0B-1C2D3E4F5A6B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -84,6 +86,10 @@ Global
{B64DBE60-C7E6-48C1-BB7F-B12129DF98B2}.Debug|Any CPU.Build.0 = Debug|AnyCPU
{B64DBE60-C7E6-48C1-BB7F-B12129DF98B2}.Release|Any CPU.ActiveCfg = Release|AnyCPU
{B64DBE60-C7E6-48C1-BB7F-B12129DF98B2}.Release|Any CPU.Build.0 = Release|AnyCPU
{2E4F8A1B-3C5D-4E6F-9A0B-1C2D3E4F5A6B}.Debug|Any CPU.ActiveCfg = Debug|AnyCPU
{2E4F8A1B-3C5D-4E6F-9A0B-1C2D3E4F5A6B}.Debug|Any CPU.Build.0 = Debug|AnyCPU
{2E4F8A1B-3C5D-4E6F-9A0B-1C2D3E4F5A6B}.Release|Any CPU.ActiveCfg = Release|AnyCPU
{2E4F8A1B-3C5D-4E6F-9A0B-1C2D3E4F5A6B}.Release|Any CPU.Build.0 = Release|AnyCPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading
Loading