Skip to content

feat(intune): extend the shared redaction grammar - #533

Merged
adamgell merged 1 commit into
mainfrom
feat/shared-redaction-grammar
Aug 8, 2026
Merged

adamgell merged 1 commit into
mainfrom
feat/shared-redaction-grammar

Conversation

@adamgell

@adamgell adamgell commented Aug 8, 2026 •

Copy link
Copy Markdown
Owner

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.rs with the secret shapes the Win32 review found missing: MSI-property-style credentials (PASSWORD=/PWD=/LICENSEKEY= without a sigil), multi-token -Command values, 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 warnings clean.

Once merged, lane/intune-357-win32 rebases and drops its duplicate commit. Refs #357.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Expanded Windows text redaction to mask credential flags, MSI credential properties, account details, hostnames, UNC hosts, tenant IDs, and Windows SIDs.
  • Bug Fixes

    • Improved redaction consistency when processing already-masked content.
    • Preserved line boundaries and trailing whitespace during redaction.

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.
@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 61e82c4b-81ae-4919-b7b4-e7766e7f0cce

📥 Commits

Reviewing files that changed from the base of the PR and between 2e6c03b and ae73bb9.

📒 Files selected for processing (1)
  • crates/cmtraceopen-parser/src/intune/apps/windows/common/redaction.rs

📝 Walkthrough

Walkthrough

Windows 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.

Changes

Windows redaction

Layer / File(s) Summary
Pattern detection and replacement validation
crates/cmtraceopen-parser/src/intune/apps/windows/common/redaction.rs
Adds detection for slash-prefixed credentials, MSI credential properties, account fields, device and UNC hosts, tenant IDs, and Windows SIDs.
Redaction pipeline integration
crates/cmtraceopen-parser/src/intune/apps/windows/common/redaction.rs
Applies the new masking categories and preserves existing replacements, line boundaries, and trailing whitespace.
Pattern and idempotence tests
crates/cmtraceopen-parser/src/intune/apps/windows/common/redaction.rs
Tests new patterns, benign properties, path exclusions, tenant-only GUIDs, and repeated redaction.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: apps, test

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/shared-redaction-grammar

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added enhancement New feature or request feature New feature intune Microsoft Intune related parser Log parser related labels Aug 8, 2026
@adamgell
adamgell marked this pull request as ready for review August 8, 2026 16:21
Copilot AI lite review requested due to automatic review settings August 8, 2026 16:21
@adamgell
adamgell merged commit b14f331 into main Aug 8, 2026
14 checks passed
@adamgell
adamgell deleted the feat/shared-redaction-grammar branch August 8, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +122 to +124
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]*)",
)
Comment on lines +220 to +229
let masked = tenant_field_re().replace_all(&masked, |caps: &regex::Captures<'_>| {
format!("{}{}", &caps["field"], stable_token("tenant", &caps["value"]))
});

let masked = host_field_re().replace_all(&masked, |caps: &regex::Captures<'_>| {
let value = &caps["value"];
if already_masked(value) {
return format!("{}{}", &caps["field"], value);
}
format!("{}{}", &caps["field"], stable_token("host", value))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature New feature intune Microsoft Intune related parser Log parser related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants