Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d8c8429
feat(github): add remaining direct CIS GitHub v1.2.0 checks
thetechgy Oct 24, 2026
e362ce4
fix(github): honor rate limits and redact sensitive configuration
thetechgy Oct 24, 2026
7812f2b
fix(github): preserve indeterminate empty-check freshness
thetechgy Oct 24, 2026
7d29cb6
chore(github): reconcile direct checks with deletion fixes
thetechgy Oct 30, 2026
c202382
chore(github): reconcile current upstream catalogs
thetechgy Oct 30, 2026
12ba87a
chore(github): carry reviewed fixture fix into direct checks
thetechgy Oct 30, 2026
d0cbaf1
chore(github): resolve PR 2540 conflicts with upstream main
thetechgy Oct 31, 2026
6f44e09
feat(report): prepare scoped redacted result exports
thetechgy Oct 31, 2026
517fec2
Merge branch 'feat/github-evidence-transport' into feat/github-deleti…
thetechgy Oct 31, 2026
b354ff1
Merge branch 'feat/scoped-redacted-result-exports' into feat/github-d…
thetechgy Oct 31, 2026
ce0ce80
feat(github): assess deletion access with configured approvals
thetechgy Oct 31, 2026
82eab44
test(github): distinguish imported and in-memory redaction
thetechgy Oct 31, 2026
88f9231
test(github): retire replaced deletion rendering assertions
thetechgy Oct 31, 2026
35c1d0f
Merge branch 'main' into feat/github-cis-direct-checks
thetechgy Oct 31, 2026
2a51154
merge: combine reviewed GitHub CIS foundations
thetechgy Nov 1, 2026
907ac9a
merge: reconcile direct GitHub CIS checks with reviewed foundations
thetechgy Nov 1, 2026
4f82e71
fix(github): share MFA audit and clarify required-check evidence
thetechgy Nov 1, 2026
74938c0
fix(github): align branch evidence helper and cache guidance
thetechgy Nov 1, 2026
4c86102
refactor(github): separate CIS enterprise assessment from retrieval
thetechgy Nov 1, 2026
39aca19
test(report): cover CSV XML and XLSX redaction exports
thetechgy Nov 1, 2026
06d2d50
fix(github): align CIS guidance and notification impact
thetechgy Nov 2, 2026
e70990f
fix(github): rate commit signing setup impact as medium
thetechgy Nov 2, 2026
b9eabfd
Merge branch 'main' into feat/scoped-redacted-result-exports
thetechgy Nov 2, 2026
35ce359
fix(report): preserve release versions in redacted Markdown
thetechgy Nov 2, 2026
80f3d44
Merge branch 'main' into feat/github-deletion-approvals
thetechgy Nov 2, 2026
30ddd2c
Merge branch 'main' into feat/github-cis-direct-checks
thetechgy Nov 2, 2026
a04e6ba
fix(report): retain failure messages in redacted Markdown
thetechgy Nov 2, 2026
d3d3d21
Merge remote-tracking branch 'refs/remotes/review/pr2633' into fix/pr…
thetechgy Nov 2, 2026
43ba097
Merge remote-tracking branch 'refs/remotes/review/pr2634' into fix/pr…
thetechgy Nov 2, 2026
4da091b
fix(github): retain partial inventory on deletion errors
thetechgy Nov 2, 2026
6890e96
docs(github): clarify fresh evidence after deletion remediation
thetechgy Nov 2, 2026
429f05d
fix(github): reconcile reviewed prerequisite corrections
thetechgy Nov 3, 2026
8852b73
Merge branch 'main' into feat/github-cis-direct-checks
merill Nov 4, 2026
76535f5
Regenerate the golden selection fixture after merging main
merill Nov 4, 2026
e45e24f
Merge branch 'main' into feat/github-cis-direct-checks
merill Nov 4, 2026
9fa56dd
Regenerate the golden selection fixture after merging main
merill Nov 4, 2026
00069d4
fix(github): preserve literal identifiers in branch result tables
thetechgy Nov 10, 2026
c5921d6
fix(github): reconcile CIS checks with upstream main
thetechgy Nov 10, 2026
a296939
fix(github): contextualize absent status-check protection
thetechgy Nov 10, 2026
e2a90cb
fix(github): declare the supported GitHub account models
thetechgy Nov 18, 2026
c597d2c
fix(github): verify ambiguous status checks on the matching ref
thetechgy Nov 18, 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
1 change: 1 addition & 0 deletions powershell/Maester.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ $__MtSession = @{
DataverseResourceUrl = $null # Dataverse resource URL for token acquisition (e.g. https://org123.crm.dynamics.com)
DataverseEnvironmentId = $null # Environment identifier for display (e.g. org123.crm.dynamics.com)
SpoCache = @{} # Cache for SharePoint Online tenant settings retrieved via PnP
GitHubRateLimits = $null # Connection/host cooldowns; preserved across Invoke-Maester runs
FabricCache = @{} # Fabric admin API data cached for the current test run
GitHubCache = @{} # Per-session REST response cache; cleared each Invoke-Maester run
ADCache = @{} # Active Directory data cache
Expand Down
4 changes: 4 additions & 0 deletions powershell/assets/MaesterSettings.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
AzureDevOpsOrganization = @{ Type = 'string'; Default = ''; Sensitive = $false; Description = 'Azure DevOps organization that Connect-Maester -Service AzureDevOps connects to.' }
GitHubOrganization = @{ Type = 'string'; Default = ''; Sensitive = $false; Description = 'GitHub organization that the GitHub checks read.' }
GitHubApiBaseUri = @{ Type = 'string'; Default = 'https://api.github.com'; Sensitive = $false; Description = 'Base URI of the GitHub REST API.' }
GitHubDeletionPolicy = @{ Type = 'object'; Default = @{}; Sensitive = $true; Description = 'Host and organization-bound approved owner and repository administrator IDs for GitHub deletion assessments.' }
GitHubApiVersion = @{ Type = 'string'; Default = '2022-11-28'; Sensitive = $false; Description = 'GitHub REST API version.' }
GitHubAccountModel = @{ Type = 'string'; AllowedValues = @('Unknown', 'PersonalAccounts', 'EnterpriseManagedUsers'); Default = 'Unknown'; Sensitive = $false; Description = 'GitHub identity model: Unknown, PersonalAccounts, or EnterpriseManagedUsers.' }
GitHubEnterprise = @{ Type = 'string'; Default = ''; Sensitive = $true; Description = 'Explicit enterprise slug for GitHub CIS enterprise-dependent assessments.' }
GitHubCisRepositoryScope = @{ Type = 'object'; Default = @{}; Sensitive = $true; Description = 'Complete organization repository applicability inventory and control-specific branch declarations for GitHub CIS checks.' }
}
}
2 changes: 2 additions & 0 deletions powershell/assets/MaesterTaxonomy.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@
Aliases = @('GitHub')
Features = @(
@{ Key = 'organization-settings'; Name = 'Organization settings' }
@{ Key = 'branch-protection'; Name = 'Branch protection' }
@{ Key = 'enterprise-settings'; Name = 'Enterprise settings' }
)
}
@{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
function Get-MtCisGitHubDeletionPolicyGap {
<#
.SYNOPSIS
Internal: Checks for restrictive repository policies before failing an administrator baseline.
#>
[CmdletBinding()]
[OutputType([string])]
param(
[Parameter(Mandatory)] [string] $Organization,
[Parameter(Mandatory)] [string] $Repository,
[Parameter(Mandatory)] [string] $RepositoryId
)
$query = @'
query DeletionPolicies($org:String!,$repo:String!,$after:String){
repository(owner:$org,name:$repo){databaseId rulesets(first:100,after:$after,includeParents:true,targets:[REPOSITORY]){
totalCount pageInfo{hasNextPage endCursor} nodes{
id target enforcement
}
}}
}
'@
$cursor = $null
$seenCursors = [System.Collections.Generic.HashSet[string]]::new()
$count = 0
$seenPolicies = [System.Collections.Generic.HashSet[string]]::new()
$expected = $null
for ($page = 0; $page -lt 100; $page++) {
try {
$response = Invoke-MtGitHubGraphQLRequest -Query $query -OperationName DeletionPolicies -Variables @{ org = $Organization; repo = $Repository; after = $cursor }
} catch {
if ($_.Exception.Data['GitHubRateLimit']) { throw }
if ((Get-MtGitHubErrorStatusCode -ErrorRecord $_) -in 403, 404) { return 'Applicable repository-policy evidence is not visible; a restrictive alternative cannot be ruled out.' }
throw
}
$connection = $response.Data.repository.rulesets
$databaseId = $response.Data.repository.databaseId
if ($response.Errors.Count -gt 0 -or ($databaseId -isnot [int] -and $databaseId -isnot [long] -and $databaseId -isnot [bigint]) -or $databaseId -le 0 -or [string]$databaseId -cne $RepositoryId -or $null -eq $connection -or $connection.nodes -isnot [array] -or $connection.pageInfo.hasNextPage -isnot [bool] -or ($connection.totalCount -isnot [int] -and $connection.totalCount -isnot [long]) -or $connection.totalCount -lt 0) { return 'Applicable repository-policy evidence is unavailable or incomplete; a restrictive alternative cannot be ruled out.' }
if ($null -eq $expected) { $expected = $connection.totalCount }
if ($expected -ne $connection.totalCount) { return 'Applicable repository-policy population changed during collection.' }
foreach ($policy in $connection.nodes) {
if ($policy.id -isnot [string] -or [string]::IsNullOrWhiteSpace($policy.id) -or -not $seenPolicies.Add($policy.id) -or $policy.target -cne 'REPOSITORY') { return 'Applicable repository-policy identity or target is unusable.' }
if ($policy.enforcement -cnotin 'ACTIVE', 'DISABLED', 'EVALUATE') { return 'Applicable repository-policy enforcement is unavailable or unknown.' }
if ($policy.enforcement -cne 'ACTIVE') { continue }
return 'An active repository-target policy may restrict deletion; its effective restrictions, bypass membership and stronger-policy equivalence need review.'
}
$count += $connection.nodes.Count
if (-not $connection.pageInfo.hasNextPage) {
if ($count -ne $expected) { return 'Applicable repository-policy total does not match collected items.' }
return $null
}
$cursor = $connection.pageInfo.endCursor
if ($cursor -isnot [string] -or [string]::IsNullOrWhiteSpace($cursor) -or -not $seenCursors.Add($cursor)) { return 'Applicable repository-policy pagination cursor is unusable.' }
}
return 'Applicable repository-policy pagination reached the page cap.'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
function Get-MtCisGitHubDeletionResult {
<#
.SYNOPSIS
Internal: Renders raw or pseudonymized deletion results from the same evidence.
#>
[CmdletBinding()]
[OutputType([string])]
param(
[Parameter(Mandatory)] [System.Collections.IDictionary] $Evidence,
[switch] $RedactUserIdentity
)

$userId = {
param($Id)
if ($RedactUserIdentity) {
# User database IDs are host-scoped. Normalize the API authority, including a
# non-default port, without adding numeric IDs to the global replacement map.
$authority = ([uri]$Evidence.ApiAuthority).GetLeftPart([UriPartial]::Authority).ToLowerInvariant()
Get-MtAffectedObjectUniqueId -System 'GitHub' -Type 'User' -Id "$authority/users/$Id"
} else { [string]$Id }
}
$result = $Evidence.Message + "`n`nOrganization setting ``$($Evidence.Field)``: ``$($Evidence.Setting)``.`n`n"
if ($Evidence.OwnerBranch) {
$rows = [System.Collections.Generic.List[string]]::new()
$unapproved = 0
foreach ($owner in $Evidence.Owners) {
$id = & $userId $owner.id
$login = if ($RedactUserIdentity) { $id } elseif ($owner.login -is [string] -and -not [string]::IsNullOrWhiteSpace($owner.login)) { Get-MtSafeMarkdown $owner.login } else { 'Unavailable' }
$approval = if (-not $Evidence.ApprovalsConfigured) { 'Not configured' } elseif ([string]$owner.id -cin $Evidence.ApprovedOwnerIds) { 'Approved' } else { 'Not approved' }
if ($approval -eq 'Not approved') { $unapproved++ }
$rows.Add("| $login | $id | $approval |")
}
$coverage = if ($Evidence.OwnerComplete) { 'Complete' } else { 'Incomplete / partial; total owner count unknown; observed count is a lower bound' }
$unapprovedCount = if ($Evidence.ApprovalsConfigured) { [string]$unapproved } else { 'Not configured' }
$result += "Organization ID: ``$($Evidence.OrganizationId)``.`n`n| Observed owners | Maximum | Unapproved owners | Evidence |`n| --- | --- | --- | --- |`n| $($rows.Count) | $($Evidence.MaximumOrganizationOwners) | $unapprovedCount | $coverage |`n`n| Owner login | User ID | Approval |`n| --- | --- | --- |`n" + ($rows -join "`n")
if ($rows.Count -eq 0) { $result += "`nNo validated owner rows were available. This does not establish that the organization has no owners." }
$result += "`n`nThe maximum is a Maester policy choice (default 3, configurable as a positive integer); CIS does not define a numeric value for 'few'. Unassigned approval entries do not affect the live count."
} else {
$rows = foreach ($repository in $Evidence.Repositories) {
$ids = @($repository.UnapprovedIds | ForEach-Object { & $userId $_ }) -join ', '
$notAssessed = $repository.Assessment -eq 'Not assessed'
$unapprovedCount = if (-not $repository.ApprovalsConfigured) { 'Not configured' } elseif ($notAssessed) { 'Not assessed' } else { [string]@($repository.UnapprovedIds).Count }
$administratorCount = if ($notAssessed) { 'Not assessed' } else { [string]$repository.AdministratorCount }
$coverage = if ($notAssessed) { 'Not collected' } elseif ($repository.Complete) { 'Complete' } else { 'Incomplete / partial; observed count is a lower bound' }
"| $(Get-MtSafeMarkdown $repository.Name) | $administratorCount | $unapprovedCount | $ids | $($repository.Assessment) | $coverage |"
}
$result += "| Repository | Effective administrators | Unapproved | Unapproved observed user IDs | Assessment | Evidence |`n| --- | --- | --- | --- | --- | --- |`n" + ($rows -join "`n")
$result += "`n`nEffective administrator permissions include inherited grants. This assessment uses the configured approvals; it does not independently determine a person's trust or qualifications. No issue was deleted or sampled."
}
if ($Evidence.Gaps.Count) { $result += "`n`n" + ($Evidence.Gaps -join "`n`n") }
return $result
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
function Get-MtCisGitHubDeletionRoleGap {
<#
.SYNOPSIS
Internal: Qualifies whether custom role definitions extend issue deletion beyond administrators.
#>
[CmdletBinding()]
[OutputType([string])]
param([Parameter(Mandatory)] [string] $Organization)

$encoded = [uri]::EscapeDataString($Organization)
foreach ($catalog in @(@{ Path = 'custom-repository-roles'; Key = 'custom_roles' }, @{ Path = 'organization-roles'; Key = 'roles' })) {
try {
$evidence = Invoke-MtGitHubRequest -RelativeUri "/orgs/$encoded/$($catalog.Path)" -IncludeMetadata -ApiVersion '2026-03-10'
} catch {
if ($_.Exception.Data['GitHubRateLimit']) { throw }
if ((Get-MtGitHubErrorStatusCode -ErrorRecord $_) -in 403, 404) { return 'Issue-deletion custom-role catalog is not visible to the connected account.' }
throw
}
$data = $evidence.Data
$roles = $data.($catalog.Key)
if (-not $evidence.CollectionIntegrityValid -or $evidence.ContentKind -ne 'Object' -or $roles -isnot [array] -or ($data.total_count -isnot [int] -and $data.total_count -isnot [long]) -or $data.total_count -ne $roles.Count) {
return 'Issue-deletion custom-role catalog is incomplete or has an unexpected API shape.'
}
$seen = [System.Collections.Generic.HashSet[string]]::new()
foreach ($role in $roles) {
if ($role -isnot [pscustomobject] -or ($role.id -isnot [int] -and $role.id -isnot [long] -and $role.id -isnot [bigint]) -or $role.id -le 0 -or -not $seen.Add([string]$role.id) -or $role.permissions -isnot [array] -or @($role.permissions | Where-Object { $_ -isnot [string] -or [string]::IsNullOrWhiteSpace($_) }).Count) { return 'Issue-deletion custom-role permissions or identities are unavailable or malformed.' }
if ($catalog.Key -eq 'custom_roles') {
if ($role.base_role -isnot [string] -or $role.base_role -cnotin 'read', 'triage', 'write', 'maintain') { return 'Issue-deletion custom repository role has an unavailable or unknown base role.' }
} elseif ($null -ne $role.base_role -and ($role.base_role -isnot [string] -or $role.base_role -cnotin 'none', 'read', 'triage', 'write', 'maintain', 'admin')) {
return 'Issue-deletion organization role has an unknown base role.'
}
# Additional issue-deletion grants require assignment evidence beyond the administrator population.
if (@($role.permissions | Where-Object { $_ -match '(?i)(delete.*issue|issue.*delete)' }).Count) { return 'A custom role can grant issue deletion; its effective assignments and policy restrictions need review.' }
}
}
return $null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
function Resolve-MtCisGitHubRepositoryScope {
<#
.SYNOPSIS
Internal: Reconciles explicit CIS applicability with the complete readable organization inventory.
.DESCRIPTION
Validates only classifications the selected control needs. The declaration is not proof of permission completeness.
#>
[CmdletBinding()]
param([Parameter(Mandatory)] [string] $Control)
$provided = $__MtSession.MaesterConfig.GlobalSettings.PSObject.Properties['GitHubCisRepositoryScope']
if ($provided -and $null -ne $provided.Value -and $provided.Value.GetType() -ne [System.Management.Automation.PSCustomObject]) { throw 'GitHubCisRepositoryScope must be a configuration object.' }
$scope = Get-MtSetting -Name GitHubCisRepositoryScope -Verbose:$false
$issues = [System.Collections.Generic.List[string]]::new()
$repositories = [System.Collections.Generic.List[object]]::new()
if ($null -eq $scope -or ($scope -is [System.Collections.IDictionary] -and $scope.Count -eq 0) -or ($scope -is [pscustomobject] -and @($scope.PSObject.Properties).Count -eq 0)) {
return [pscustomobject]@{ Repositories = @(); Issues = @('Configure a complete GitHubCisRepositoryScope applicability declaration.'); ExcludedCount = 0; Exclusions = @(); StartedUtc = $null; CompletedUtc = $null }
}
if (($null -eq $scope -or $scope.GetType() -ne [System.Management.Automation.PSCustomObject])) { throw 'GitHubCisRepositoryScope must be a configuration object.' }
$organization = $__MtSession.GitHubConnection.Organization
if ($scope.Organization -isnot [string] -or $scope.Organization -ne $organization) { throw 'GitHubCisRepositoryScope.Organization must match the connected organization.' }
if ($scope.Complete -isnot [bool]) { throw 'GitHubCisRepositoryScope.Complete must be Boolean.' }
if (-not $scope.Complete) { $issues.Add('The assessor has not declared this repository scope complete.') }
if ($scope.Repositories -isnot [array]) { throw 'GitHubCisRepositoryScope.Repositories must be an array.' }
$inventory = Get-MtGitHubRepositoryInventory
foreach ($issue in $inventory.Issues) { $issues.Add($issue) }
$byId = @{}
foreach ($item in $inventory.Repositories) { $byId[[string]$item.id] = $item }
$seen = [System.Collections.Generic.HashSet[string]]::new()
$excluded = 0
$exclusions = [System.Collections.Generic.List[object]]::new()
foreach ($entry in $scope.Repositories) {
if (($null -eq $entry -or $entry.GetType() -ne [System.Management.Automation.PSCustomObject]) -or ($entry.Id -isnot [int] -and $entry.Id -isnot [long] -and $entry.Id -isnot [bigint]) -or $entry.Id -le 0 -or $entry.InUse -isnot [bool]) { throw 'Every scope repository needs a numeric positive Id and Boolean InUse.' }
$id = [string]$entry.Id
if (-not $seen.Add($id)) { throw 'GitHubCisRepositoryScope contains a duplicate repository Id.' }
if (-not $byId.ContainsKey($id)) { $issues.Add('A declared repository is missing or inaccessible in the live inventory.'); continue }
if (-not $entry.InUse) {
if ($entry.ExclusionReason -isnot [string] -or [string]::IsNullOrWhiteSpace($entry.ExclusionReason)) { throw 'Every excluded repository needs an ExclusionReason.' }
$exclusions.Add([pscustomobject]@{ Repository = $byId[$id].full_name; Reason = $entry.ExclusionReason })
$excluded++; continue
}
$branches = [System.Collections.Generic.List[string]]::new()
foreach ($field in @($(if ($Control -ne '1.1.12') { 'MainBranches' }), $(if ($Control -eq '1.1.16') { 'LongStandingBranches' }))) {
if (-not $field) { continue }
if (-not (Test-MtGitHubObjectProperty -InputObject $entry -PropertyName $field)) { $issues.Add("A required $field declaration is missing."); continue }
if ($entry.$field -isnot [array]) { throw "GitHubCisRepositoryScope.$field must be an array." }
if ($field -eq 'MainBranches' -and $entry.$field.Count -eq 0) { $issues.Add('An in-use repository has no main-branch classification.') }
foreach ($branch in $entry.$field) {
if ($branch -isnot [string] -or [string]::IsNullOrWhiteSpace($branch)) { throw "GitHubCisRepositoryScope.$field must contain nonempty branch-name strings." }
if (-not $branches.Contains($branch)) { $branches.Add($branch) }
}
}
$repositories.Add([pscustomobject]@{ Repository = $byId[$id]; Branches = $branches.ToArray() })
}
foreach ($id in $byId.Keys) { if (-not $seen.Contains($id)) { $issues.Add('A live repository has no applicability classification.') } }
if ($inventory.Repositories.Count -eq 0) { $issues.Add('Empty repository inventory does not establish complete visibility or non-applicability.') }
return [pscustomobject]@{ Repositories = $repositories.ToArray(); Issues = $issues.ToArray(); ExcludedCount = $excluded; Exclusions = $exclusions.ToArray(); StartedUtc = $inventory.StartedUtc; CompletedUtc = $inventory.CompletedUtc }
}
Loading
Loading