Skip to content

Commit f869ae6

Browse files
committed
Repo audit cleanup, dead code removal, doc fixes (v0.4.5)
- Remove dead code: Get-ProcessParentId, Get-ProcessCommandLine, unused $maxPenalty, unused $Color param in CI Write-SummaryLine - Remove unreachable whitelist guard in Check-Processes.ps1 - Add TrustedAppDirs and Suppressions defaults to Get-DefaultConfig - Track fix-bom.ps1 (was gitignored but referenced by docs/pre-commit) - Update fix-bom.ps1 to use $PSScriptRoot instead of hardcoded path - Fix README CI JSON example: add suppressed key, correct version - Add 0.4.x to SECURITY.md supported versions Made-with: Cursor
1 parent 73ebaa7 commit f869ae6

9 files changed

Lines changed: 34 additions & 36 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ desktop.ini
1717
.claude/
1818
*.swp
1919
*.swo
20-
fix-bom.ps1

AmIHacked.ps1

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ if ($script:NonInteractive) {
8080
$script:RedactMap = @{}
8181
$script:SuppressedCount = 0
8282

83-
$script:Version = "0.4.4"
83+
$script:Version = "0.4.5"
8484

8585
# ── Helpers (loaded first) ───────────────────────────────────────────────────
8686

@@ -341,22 +341,20 @@ if ($script:NonInteractive) {
341341
Write-Host " |$verdictPad|"
342342
Write-Host " +$hbar+"
343343

344-
function Write-SummaryLine { param($Label, $Value, $Color, $Width)
345-
$content = " $Label$Value"
346-
$innerWidth = $Width - 2
344+
function Write-SummaryLine { param($Label, $Value, $Width)
347345
$line = " | $Label$Value".PadRight($Width + 3) + " |"
348346
Write-Host $line
349347
}
350348

351-
Write-SummaryLine "CRITICAL " "$critCount" "Red" $w
352-
Write-SummaryLine "WARNING " "$warnCount" "Yellow" $w
353-
Write-SummaryLine "INFO " "$infoCount" "DarkCyan" $w
354-
Write-SummaryLine "Suppressed " "$($script:SuppressedCount)" "DarkGray" $w
349+
Write-SummaryLine "CRITICAL " "$critCount" $w
350+
Write-SummaryLine "WARNING " "$warnCount" $w
351+
Write-SummaryLine "INFO " "$infoCount" $w
352+
Write-SummaryLine "Suppressed " "$($script:SuppressedCount)" $w
355353
Write-Host " | $(' ' * ($w - 2)) |"
356-
Write-SummaryLine "Total " "$totalCount findings" "White" $w
357-
Write-SummaryLine "Duration " "$durationStr" "DarkGray" $w
354+
Write-SummaryLine "Total " "$totalCount findings" $w
355+
Write-SummaryLine "Duration " "$durationStr" $w
358356
Write-Host " | $(' ' * ($w - 2)) |"
359-
Write-SummaryLine "Report " "See path below" "DarkGray" $w
357+
Write-SummaryLine "Report " "See path below" $w
360358
Write-Host " +$hbar+"
361359
} else {
362360
Write-Host "$('' * $w)" -ForegroundColor DarkCyan

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

7+
## [0.4.5] - 2026-03-15
8+
9+
### Fixed
10+
- **README CI JSON example** -- updated to include `suppressed` key and correct version
11+
- **SECURITY.md** -- added 0.4.x to supported versions table
12+
- **Dead code cleanup** -- removed unused `Get-ProcessParentId`, `Get-ProcessCommandLine` from Helpers.ps1, unused `$maxPenalty` from ReportGenerator.ps1, unused `$Color` parameter from CI summary writer
13+
- **Redundant guard in Check-Processes.ps1** -- removed unreachable `System32 + whitelist` check (already handled by earlier whitelist guard)
14+
- **`Get-DefaultConfig` missing fields** -- added `TrustedAppDirs` and `Suppressions` defaults so configless runs don't silently skip filtering
15+
16+
### Changed
17+
- **`fix-bom.ps1` now tracked** -- removed from `.gitignore` and updated to use `$PSScriptRoot` instead of hardcoded path; new clones now include the BOM-fix utility referenced by the pre-commit hook and CONTRIBUTING.md
18+
719
## [0.4.4] - 2026-03-15
820

921
### Added

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[![PowerShell 5.1+](https://img.shields.io/badge/PowerShell-5.1%2B-0d1117?style=for-the-badge&logo=powershell&logoColor=5391FE)](https://docs.microsoft.com/powershell/)
1313
[![Windows 10/11](https://img.shields.io/badge/Windows-10%20%2F%2011-0d1117?style=for-the-badge&logo=windows&logoColor=white)](https://www.microsoft.com/windows)
1414
[![License: MIT](https://img.shields.io/badge/License-MIT-0d1117?style=for-the-badge&logoColor=white)](LICENSE)
15-
[![Version](https://img.shields.io/badge/Version-0.4.4-FF6B6B?style=for-the-badge)](#changelog)
15+
[![Version](https://img.shields.io/badge/Version-0.4.5-FF6B6B?style=for-the-badge)](#changelog)
1616

1717
[![Zero Dependencies](https://img.shields.io/badge/Dependencies-Zero-0d1117?style=flat-square&labelColor=0d1117)](#)
1818
[![MITRE ATT&CK](https://img.shields.io/badge/MITRE%20ATT%26CK-40%2B%20Techniques-ff3333?style=flat-square&labelColor=0d1117)](#mitre-attck-coverage)
@@ -140,7 +140,7 @@ Baselines enable **change detection** — the most powerful signal for catching
140140

141141
```
142142
---AMIHACKED-SUMMARY-JSON---
143-
{"verdict":"CAUTION","critical":0,"warning":3,"info":12,"total":15,"duration":28.4,"reportPath":"...","version":"0.4.3"}
143+
{"verdict":"CAUTION","critical":0,"warning":3,"info":12,"suppressed":0,"total":15,"duration":28.4,"reportPath":"...","version":"0.4.5"}
144144
```
145145

146146
- Exit code reflects findings: **0** = clean, **1** = warnings only, **2** = critical findings detected

SECURITY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
| Version | Supported |
66
|---------|-----------|
7+
| 0.4.x | Yes |
78
| 0.3.x | Yes |
89
| < 0.3 | No |
910

fix-bom.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$enc = New-Object System.Text.UTF8Encoding $true
2+
$root = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $MyInvocation.MyCommand.Path }
3+
foreach ($f in (Get-ChildItem $root -Recurse -Filter '*.ps1')) {
4+
[System.IO.File]::WriteAllText($f.FullName, [System.IO.File]::ReadAllText($f.FullName, [System.Text.Encoding]::UTF8), $enc)
5+
}
6+
Write-Host "BOM applied to all .ps1 files under $root"

lib/Helpers.ps1

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,15 @@ function Get-DefaultConfig {
284284
"Apple Inc.", "Adobe Inc.", "Valve Corporation"
285285
)
286286

287+
TrustedAppDirs = @()
288+
287289
TrustedDomainSuffixes = @(
288290
".microsoft.com", ".windowsupdate.com", ".akamaized.net",
289291
".cloudfront.net", ".slack-msgs.com", ".googleapis.com",
290292
".gstatic.com", ".steamcontent.com"
291293
)
294+
295+
Suppressions = @()
292296
}
293297
}
294298

@@ -307,26 +311,6 @@ function New-DefaultConfig {
307311

308312
# ── Utility Functions ────────────────────────────────────────────────────────
309313

310-
function Get-ProcessParentId {
311-
param([int]$ProcessId)
312-
try {
313-
$proc = Get-CimInstance Win32_Process -Filter "ProcessId = $ProcessId" -ErrorAction SilentlyContinue
314-
return $proc.ParentProcessId
315-
} catch {
316-
return $null
317-
}
318-
}
319-
320-
function Get-ProcessCommandLine {
321-
param([int]$ProcessId)
322-
try {
323-
$proc = Get-CimInstance Win32_Process -Filter "ProcessId = $ProcessId" -ErrorAction SilentlyContinue
324-
return $proc.CommandLine
325-
} catch {
326-
return ""
327-
}
328-
}
329-
330314
function Test-IsTrustedIP {
331315
param([string]$IP)
332316

lib/ReportGenerator.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function Generate-HtmlReport {
1717
$infoCount = ($Findings | Where-Object { $_.Severity -eq "INFO" }).Count
1818
$totalCount = $Findings.Count
1919

20-
$maxPenalty = [math]::Max(1, $totalCount)
2120
$penalty = ($critCount * 25) + ($warnCount * 5) + ($infoCount * 0.5)
2221
$score = [math]::Max(0, [math]::Min(100, [math]::Round(100 - $penalty)))
2322
$scoreColor = if ($score -ge 80) { "#22c55e" } elseif ($score -ge 50) { "#f59e0b" } else { "#ef4444" }

modules/Check-Processes.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ function Invoke-ProcessesChecks {
2828

2929
if ($whitelist -contains $procName) { continue }
3030
if (-not $procPath) { continue }
31-
if ($procPath -match "^C:\\Windows\\System32" -and $whitelist -contains $procName) { continue }
3231
if ($procPath -match '^C:\\Program Files\\WindowsApps\\') { continue }
3332
if ($script:Config.TrustedAppDirs) {
3433
$inTrustedDir = $false

0 commit comments

Comments
 (0)