Skip to content

feat(gateway): WinRM operations for PAM dependency detection and rotation (PAM-350) - #321

Merged
x032205 merged 7 commits into
mainfrom
bernie/pam-350-implement-support-for-domain-account-dependency-detection
Jul 27, 2026
Merged

feat(gateway): WinRM operations for PAM dependency detection and rotation (PAM-350)#321
x032205 merged 7 commits into
mainfrom
bernie/pam-350-implement-support-for-domain-account-dependency-detection

Conversation

@bernie-g

@bernie-g bernie-g commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Companion PR (backend + frontend): Infisical/infisical#7355

Adds the gateway's WinRM operations for finding Windows account dependencies and updating their passwords during rotation.

…ion (PAM-350)

Add enumerate-accounts, enumerate-dependencies, rotate-credential, and
sync-dependency WinRM operations so the control plane names a vetted operation
and passes parameters instead of sending raw PowerShell. Credential changes use
pure-PowerShell cmdlets (CIM Win32_Service.Change, Set-ScheduledTask,
Set-ADAccountPassword) so a password never crosses a native-exe argument line.
@linear

linear Bot commented Jul 21, 2026

Copy link
Copy Markdown

PAM-350

@infisical-review-police

Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cli-321-feat-gateway-winrm-operations-for-pam-dependency-detection-and

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

bernie-g added 3 commits July 20, 2026 21:37
- Change service credentials via CIM Win32_Service.Change and scheduled tasks via
  Set-ScheduledTask (pure PowerShell) so a password with quotes isn't mangled by
  native-exe argument quoting.
- Only restart a service/app-pool that was already running.
- Include InteractiveOrPassword scheduled tasks; fail the enumeration hard on a
  service/task error so partial results can't prune real dependency rows.
- Add a validate-credential op so the admin rotator can verify a local account's
  password on the box (ValidateCredentials) without logging in as the account.
- Only restart services/app-pools that were already running (done earlier), and
  now: harden local-account enumeration with ErrorActionPreference=Stop, include
  InteractiveOrPassword scheduled tasks, and gate IIS enumeration on the module
  being present so a real IIS error hard-fails instead of being swallowed.
- winrm/pam.go: resolve a scheduled task's run-as principal through the host's
  LSA (SID round-trip) so a member server's local account is not mis-anchored to
  a same-named domain account
- winrm/winrm.go: decode PowerShell CLIXML stderr to plain text so a WinRM
  command failure surfaces the real error instead of the raw XML envelope
Comment thread packages/gateway-v2/winrm/pam.go
@veria-ai

veria-ai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 2 · PR risk: 0/10

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds WinRM operations for Windows PAM dependency discovery and credential rotation. The main changes are:

  • Account, service, scheduled-task, and IIS app-pool enumeration.
  • Local and domain account password rotation.
  • Dependency password synchronization and local credential validation.
  • New gateway routes for the WinRM operations.
  • Readable decoding of PowerShell CLIXML errors.

Confidence Score: 4/5

The IIS app-pool synchronization path needs fixes before merging.

  • Wildcard characters in pool names can redirect credential writes.
  • A failed password write can leave the pool with mismatched credentials.
  • The other changed handlers and build surface show no blocking issue.

packages/gateway-v2/winrm/pam.go

Security Review

IIS provider wildcard expansion can apply credentials to an unintended app pool when a dependency name contains wildcard characters.

Important Files Changed

Filename Overview
packages/gateway-v2/winrm/pam.go Adds privileged discovery and credential operations; IIS synchronization can select the wrong pool or leave a partial credential update.
packages/gateway-v2/winrm/winrm.go Adds CLIXML error cleanup using standard-library regular expressions and numeric parsing.
packages/gateway-v2/winrm_handler.go Registers and implements five new WinRM request handlers.

Reviews (1): Last reviewed commit: "gateway: qualify scheduled-task principa..." | Re-trigger Greptile

Comment thread packages/gateway-v2/winrm/pam.go Outdated
Comment thread packages/gateway-v2/winrm/pam.go Outdated
- winrm/pam.go: Set-ItemProperty -LiteralPath so an app-pool name containing
  PowerShell wildcard chars is matched literally, not expanded as a pattern
- write only the pool password (the run-as identity is unchanged during a
  rotation), removing the separate userName write and its partial-commit hazard
@bernie-g
bernie-g requested a review from x032205 July 22, 2026 22:00
Comment thread packages/gateway-v2/winrm_handler.go Outdated
Comment thread packages/gateway-v2/winrm/pam.go
@x032205
x032205 merged commit 691b877 into main Jul 27, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants