Repository navigation
feat(intune): extend the shared redaction grammar - #533
Conversation
Review finding 8, shared-module half, in its own commit so sibling lanes' green suites gate it (all 2232 parser tests pass unchanged). New masking rules in apps/windows/common/redaction.rs, all reusing the module's existing token behavior (no new token API per ADR-004): - account fields (RunAsUser, UserName, LoggedOnUser, ...): value bounded by delimiter/quote/line-end like the path rule, never by whitespace, so 'CONTOSO\John Doe' no longer leaks its second half; a prefix guard plus a non-space leading value class keep the projection idempotent against the [upn:...]/[account:...] tokens themselves. - MSI-property-style credentials (PASSWORD=/PWD=/LICENSEKEY= etc.) with no sigil for the flag rule to anchor on; benign properties like INSTALLDIR= stay visible. - credential flags now accept the '/' sigil alongside '-'. - Windows SIDs with three or more sub-authorities, anywhere in the text; well-known short SIDs (S-1-5-18) identify nobody and survive. - hostname fields (ComputerName/MachineName/HostName/DeviceName) and the server segment of UNC paths, single or JSON-escaped separators, with a drive-colon guard so 'C:\\Users' never reads as a UNC root. - field-anchored tenant ids; bare GUIDs remain correlation keys and survive untouched. No sibling goldens required updates: the new shapes do not occur in the scripts/remediations/store corpora, whose prohibition scanners already forbade committing them.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughWindows text redaction now masks additional credential, account, host, tenant, and SID patterns. The implementation preserves existing masks, line boundaries, and trailing whitespace. Tests cover exclusions and idempotence. ChangesWindows redaction
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR extends the shared Intune Windows redaction helper (common/redaction.rs) to cover additional sensitive “shapes” found in Win32/installer evidence so downstream analyzers can export privacy-safe text deterministically.
Changes:
- Expand command-line masking to support
/-sigil flags and multi-token-Command-style values. - Add new redaction rules for MSI property credentials, account fields (including space-containing values), tenant-id fields, host/device names (including UNC hosts), and SIDs.
- Add unit tests covering the new masking behaviors and idempotence.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| Regex::new( | ||
| r"(?i)(?P<pre>^|[^\[])(?P<field>\b(?:RunAsUser|RunAsAccount|UserName|UserPrincipalName|LoggedOnUser|Account|UserId|Upn)\s*[:=]\s*)(?P<value>[^\s,;\r\n\x22\[][^,;\r\n\x22]*)", | ||
| ) |
| let masked = tenant_field_re().replace_all(&masked, |caps: ®ex::Captures<'_>| { | ||
| format!("{}{}", &caps["field"], stable_token("tenant", &caps["value"])) | ||
| }); | ||
|
|
||
| let masked = host_field_re().replace_all(&masked, |caps: ®ex::Captures<'_>| { | ||
| let value = &caps["value"]; | ||
| if already_masked(value) { | ||
| return format!("{}{}", &caps["field"], value); | ||
| } | ||
| format!("{}{}", &caps["field"], stable_token("host", value)) |
Carved out of PR #525 so the shared-module change gets focused review and the lane PR shrinks (ultrareview rejected #525 at 109 files).
Extends
apps/windows/common/redaction.rswith the secret shapes the Win32 review found missing: MSI-property-style credentials (PASSWORD=/PWD=/LICENSEKEY=without a sigil), multi-token-Commandvalues, an account-field rule that survives space-containing names, SID masking, device-name masking, and the JSON-escaped profile-path separator fix applied consistently. No new stable-token kinds (ADR-004: equality-scope contract stays with the Store pilot).All existing consumers (scripts, microsoft_store via its fork, and sibling goldens) stay green: 2133 parser tests, 0 failures; clippy
-D warningsclean.Once merged,
lane/intune-357-win32rebases and drops its duplicate commit. Refs #357.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes