Skip to content

[enhancement] Improved NTSD test datasets for massive coverage#40

Merged
p0dalirius merged 5 commits intomainfrom
better-test-datasets-for-ntsd-coverage
Mar 13, 2026
Merged

[enhancement] Improved NTSD test datasets for massive coverage#40
p0dalirius merged 5 commits intomainfrom
better-test-datasets-for-ntsd-coverage

Conversation

@p0dalirius
Copy link
Collaborator

No description provided.

@p0dalirius p0dalirius self-assigned this Feb 7, 2026
@p0dalirius p0dalirius added the enhancement New feature or request label Feb 7, 2026
@p0dalirius p0dalirius requested a review from Copilot March 13, 2026 11:38
@p0dalirius p0dalirius merged commit d083860 into main Mar 13, 2026
7 checks passed
@p0dalirius p0dalirius deleted the better-test-datasets-for-ntsd-coverage branch March 13, 2026 11:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds dataset-generation scripts and updates the NT security descriptor involution test to consume embedded JSON datasets, aiming to greatly expand real-world coverage.

Changes:

  • Added PowerShell scripts to dump AD SIDs, AD security descriptors, and local filesystem ACL security descriptors into JSON.
  • Embedded securitydescriptor/tests/datasets and updated TestNtSecurityDescriptor_Involution to iterate over all dataset JSON entries.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

File Description
sid/tests/scripts/Dump-ActiveDirectorySids.ps1 New script to enumerate AD objectSid values into JSON.
securitydescriptor/tests/scripts/Dump-LocalFileSystemAcls.ps1 New script to recurse filesystem and dump security descriptors into JSON.
securitydescriptor/tests/scripts/Dump-ActiveDirectoryAcls.ps1 New script to dump AD nTSecurityDescriptor into JSON.
securitydescriptor/NtSecurityDescriptor_test.go Updated involution test to read embedded datasets and run roundtrip checks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

OSVersionString = $os.VersionString
}
}
ActiveDirectory = @()
Comment on lines +34 to +41
$roots = @("C:\")

foreach ($root in $roots) {
Get-ChildItem -Path $root -Recurse -Force -ErrorAction SilentlyContinue |
ForEach-Object {
try {
Write-Host $_.FullName
$acl = Get-Acl -LiteralPath $_.FullName
Comment on lines +50 to +58
# Full SD (Owner, Group, DACL, SACL)
$searcher.SecurityMasks =
[System.DirectoryServices.SecurityMasks]::Owner `
-bor [System.DirectoryServices.SecurityMasks]::Group `
-bor [System.DirectoryServices.SecurityMasks]::Dacl `
-bor [System.DirectoryServices.SecurityMasks]::Sacl

foreach ($res in $searcher.FindAll()) {

Comment on lines +76 to +82
for _, v := range raw {
var candidate []descriptorEntry
if err := json.Unmarshal(v, &candidate); err == nil && len(candidate) > 0 {
descriptors = candidate
break
}
}
}
}
if descriptors == nil {
continue
Comment on lines +87 to +90
for _, tt := range descriptors {
tt := tt
t.Run(datasetName+"/"+componentName+"/"+tt.Name, func(t *testing.T) {
hexdata := tt.Hexdata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants