Skip to content

Escape single quotes in PowerShell login script inputs - #599

Open
MaddyMicrosoft wants to merge 2 commits into
Azure:masterfrom
MaddyMicrosoft:fix/ps-injection-escape-inputs
Open

Escape single quotes in PowerShell login script inputs#599
MaddyMicrosoft wants to merge 2 commits into
Azure:masterfrom
MaddyMicrosoft:fix/ps-injection-escape-inputs

Conversation

@MaddyMicrosoft

Copy link
Copy Markdown
Member

Apply the same single-quote escape already used for the service principal secret to the remaining values interpolated into the generated PowerShell login script: tenant-id, subscription-id, client-id, federated token, and the AzureStack resourceManagerEndpointUrl.

Factor the escape into a shared helper (escapePSSingleQuoted) so every interpolation site uses the same treatment, and add regression tests that assert each field is escaped across all supported auth paths.

No behaviour change for valid inputs; legitimate values contain no single quotes.

Apply the same single-quote escape already used for the service principal
secret to the remaining values interpolated into the generated PowerShell
login script: tenant-id, subscription-id, client-id, federated token,
and the AzureStack resourceManagerEndpointUrl.

Factor the escape into a shared helper (escapePSSingleQuoted) so every
interpolation site uses the same treatment, and add regression tests that
assert each field is escaped across all supported auth paths.

No behaviour change for valid inputs; legitimate values contain no single quotes.
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.

1 participant