Privacy hardening, remote-peer IP masking and review fixes
- Add privacy projection (core/privacy.py), private report storage, bounded
process capture; omit identities, free text and unapproved paths
- Mask remote peer IPs: only loopback/host/wildcard stay numeric, others are
reduced to remote_scope private/public (schema + scoring updated)
- Map ss TCP states to canonical names; ASCII-only numeric fields; fix
"Microsoft Visual C++" product matching (Python and PowerShell)
- Merge 7fed3b9: -Diagnostic switch, serialization exit code 3, PS7 module
path, UI error detail; keep hardened task/certificate collectors
- Add audit docs, privacy docs and regression tests
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,29 +1,38 @@
|
||||
# Local Windows Server inventory
|
||||
# Local Windows Server collection
|
||||
|
||||
Targets: Windows Server 2016/2019/2022/2025, Windows PowerShell 5.1, 64-bit execution. **Real Windows host validation is still pending in this Linux development workspace.** No remoting or credentials are used.
|
||||
Read-only collection commands for supported Server release builds 2016/2019/2022/2025.
|
||||
The Python workflow launches fixed sections using system Windows PowerShell 5.1,
|
||||
NoProfile, fixed argument lists, bounded memory output and time/cancellation limits.
|
||||
No remoting/configuration, execution-policy bypass, elevation or credential storage.
|
||||
Actual Windows runtime/least-privilege acceptance is still pending.
|
||||
|
||||
`Get-ServerInventory.ps1` is the fixed JSON driver. With no arguments it emits a full v1 inventory envelope. `-Section system|roles|services|network|tasks|software|storage|shares|certificates` emits an internal per-section JSON result. The Python collector invokes these independently to enforce time/output limits while preserving other sections after failures.
|
||||
The bundled `samsara/assets/privacy_policy.json` and `privacy_catalogue.json` are
|
||||
required. Protect the deployment against unauthorized changes. Name/path projection
|
||||
occurs before PowerShell JSON output and again at Python UI/report boundaries.
|
||||
|
||||
| Module | Local read-only source |
|
||||
| --- | --- |
|
||||
| Get-ServerSystem.ps1 | CIM OS/product type/build, boot, domain membership, adapter configuration |
|
||||
| Get-ServerRoles.ps1 | Installed Get-WindowsFeature entries |
|
||||
| Get-ServerServices.ps1 | Win32_Service metadata and service identities; no PathName/arguments |
|
||||
| Get-ServerNetwork.ps1 | Get-NetTCPConnection and Get-Process names/IDs |
|
||||
| Get-ServerTasks.ps1 | Get-ScheduledTask visible definitions, accounts, safe executable basenames, selected triggers |
|
||||
| Get-ServerSoftware.ps1 | HKLM uninstall registrations using explicit Registry32/Registry64 read-only handles |
|
||||
| Get-ServerStorage.ps1 | Get-Volume, Get-SmbShare and aggregate Get-SmbOpenFile share-root correlation; volumes/shares share the existing storage inventory category |
|
||||
| Get-ServerCertificates.ps1 | Public metadata in accessible LocalMachine certificate stores |
|
||||
| Inventory.Common.ps1 | Section timing, safe errors and permission limitations |
|
||||
| Module | Default queries | Privacy/coverage limits |
|
||||
| --- | --- | --- |
|
||||
| System | Local OS/build/boot, domain-joined boolean, adapter IPs | Fixed OS labels, opaque identities; no domain string/adapter description requested |
|
||||
| Roles | Get-WindowsFeature installed identifiers | Canonical/opaque names; no active-use assertion |
|
||||
| Services | Win32_Service Name, State, StartMode, ProcessId | No StartName, DisplayName, PathName; names canonical/opaque |
|
||||
| Network | Get-Process names/PIDs, Get-NetTCPConnection | No command lines; names canonical/opaque; historical direction unverified |
|
||||
| Tasks | MSFT_ScheduledTask TaskName, TaskPath, State only | Opaque identities/category; no Actions, Principals, Triggers, Settings, XML or arguments requested; partial |
|
||||
| Software | Read-only HKLM uninstall registry views | DoNotExpandEnvironmentNames; canonical/opaque display name, numeric version; no installer query |
|
||||
| Storage | Fixed Win32_LogicalDisk size/free/filesystem/drive metadata | No labels, mount-only volumes or child paths; partial |
|
||||
| Shares | Get-SmbShare configured roots | Only exact reviewed local roots retained; no Get-SmbOpenFile or session enumeration; partial |
|
||||
| Certificates | No provider call | not_collected pending a separately approved minimal design |
|
||||
|
||||
No Win32_Product, installer operations, private-key export, task execution, service changes, registry writes or remoting setup. No execution-policy bypass; use approved script signing/distribution if enterprise policy blocks scripts. Non-elevated sensitive checks are conservatively partial even if their visible query succeeds. Elevation is never attempted automatically. Domain Administrator privileges are not required; assess with the least-privileged authorized account and treat omitted evidence explicitly.
|
||||
Provider-returned strings may enter process memory before projection; explicit
|
||||
properties do not prove that native provider internals process no other metadata.
|
||||
The application cannot promise PHI-free memory or zero incidental OS writes.
|
||||
Permission failures have categorical errors, timestamps and limitations; no raw
|
||||
exception messages are returned. Missing evidence must never imply inactivity.
|
||||
|
||||
The Windows Server gate uses CIM ProductType 2/3 plus the release build map; Windows 10/11 are not Server targets even where their kernel builds overlap. The gate is enforced by Python and by full-envelope PowerShell use. `-Section system` can return failed/partial identity details for diagnostics, but Python will not accept an unverified identity as an assessment.
|
||||
Prefer the Python CLI and its configured private local report folder. Direct driver
|
||||
output is not supervised by Python's bounds or secure writer: do not use arbitrary
|
||||
shell redirects on production hosts. See [privacy setup and native validation](../docs/PRIVACY_HARDENING.md).
|
||||
|
||||
Direct full-script use has no Python timeout/cancellation supervisor; use the Python CLI or GUI for bounded execution. Both paths honor local script execution policy. Every script emits only selected public/administrative metadata, never raw CIM objects, exception text, task XML, task arguments or service command lines.
|
||||
|
||||
See README.md for exact GUI, headless and real-host validation instructions. `tests/powershell/Test-Collectors.ps1` parses scripts and mocks their data sources; this is synthetic testing, not real host validation.
|
||||
|
||||
Implementation references: [Get-WindowsFeature](https://learn.microsoft.com/en-us/powershell/module/servermanager/get-windowsfeature), [Win32_Service](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-service), [Get-NetTCPConnection](https://learn.microsoft.com/en-us/powershell/module/nettcpip/get-nettcpconnection), [Get-ScheduledTask](https://learn.microsoft.com/en-us/powershell/module/scheduledtasks/get-scheduledtask), [registry software inventory](https://learn.microsoft.com/en-us/powershell/scripting/samples/working-with-software-installations), [certificate provider](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/about/about_certificate_provider).
|
||||
|
||||
Scoring v2 excludes default administrative shares, but keeps them in inventory. Business-share client confirmation requires share-root-correlated open-file counts, not just TCP 445 activity. The read-only activity query exports no file names, session users or client names; same-root administrative aliases remain ambiguous. See docs/SCORING.md. This new query still requires native Windows validation.
|
||||
`tests/powershell/Test-Collectors.ps1` parses ASTs and invokes synthetic mocked
|
||||
providers only. It makes forbidden certificate, open-file, full-task and label
|
||||
enumeration fail. Run on an authorized lab host with its existing script policy;
|
||||
no real collector runs in that test. A passing mock test is not real-host acceptance.
|
||||
|
||||
Reference in New Issue
Block a user