Skip to content

Conversation

@itxcjm
Copy link
Member

@itxcjm itxcjm commented Jan 29, 2026

No description provided.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e57deb759

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +96 to +99
$storeDir = Split-Path $storePath -Parent
if (-not (Test-Path $storeDir)) {
New-Item -Path $storeDir -ItemType Directory -Force | Out-Null
}

Choose a reason for hiding this comment

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

P2 Badge Handle relative SCRIPT_WHITELIST_GUARD_STORE paths

If a user sets SCRIPT_WHITELIST_GUARD_STORE to a relative path or bare filename (a reasonable customization), Split-Path -Parent returns an empty string and New-Item -Path $storeDir fails, which makes Set-WhitelistData return $false and prevents any whitelist from being saved. The guard then silently can’t persist entries in that configuration. This only occurs when the env var points to a relative path or filename (not an absolute path).

Useful? React with 👍 / 👎.

Comment on lines +398 to +401
# Early return if no command or no command name
if (-not $commandAst -or -not ($commandName = $commandAst.GetCommandName())) {
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
return

Choose a reason for hiding this comment

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

P2 Badge Don’t skip scripts invoked via call operator

The handler exits whenever GetCommandName() returns null, which happens for common forms like & "C:\Path With Spaces\script.ps1" or other dynamic/quoted invocations. In those cases the guard accepts the line without any whitelist check, so interactive script execution is unguarded whenever users rely on the call operator. This only impacts invocations where the command name is not a bare token.

Useful? React with 👍 / 👎.

Comment on lines +392 to +396
$ast = [System.Management.Automation.Language.Parser]::ParseInput($line, [ref]$null, [ref]$null)
$commandAst = $ast.FindAll({
param($node)
$node -is [System.Management.Automation.Language.CommandAst]
}, $false) | Select-Object -First 1

Choose a reason for hiding this comment

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

P2 Badge Only first command in a line is checked

The handler selects the first CommandAst and ignores the rest of the line, so Get-Process; .\script.ps1 (or any script after ;/&&) will run without whitelist validation. This is a functional gap whenever users chain commands on a single line, because only the first command is inspected.

Useful? React with 👍 / 👎.

@itxcjm itxcjm merged commit da33465 into main Jan 29, 2026
2 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