Skip to content

credential_process with space in file path fails even with double quotation marks #393

@randallt

Description

@randallt

Describe the bug

As described in this page

I am attempting to use the credential_process in a ~/.aws/config file. I have it pointing to a custom Powershell script that handles some cert issues first, then calls the aws_signing_helper.exe utility and outputs the result. As such, my config file looks like:

[default]
region = eu-west-1
credential_process = "C:\Program Files\PowerShell\7\pwsh.exe" -ExecutionPolicy Bypass -File "C:\path_without_spaces\GetCredentials.ps1"

This works for the current AWS CLI as well as Python's boto3 package but does not work for AWS Tools for Powershell, which outputs, e.g. with Get-S3Object:

Get-S3Object: Command returned non-zero exit value 1 with the error - 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

If I change the contents of the config file to:

[default]
region = eu-west-1
credential_process = C:\PROGRA~1\PowerShell\7\pwsh.exe -ExecutionPolicy Bypass -File "C:\path_without_spaces\GetCredentials.ps1"

then the command succeeds. I tested this with both 5.0.28 and 4.1.874 and the behavior is identical. I did not test any other version.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

It is expected that the AWS Tools for Powershell can handle spaces in the files paths as indicated by the documentation referenced.

Current Behavior

Error:

Command returned non-zero exit value 1 with the error - 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

Reproduction Steps

Use a ~/.aws/config file with 'credential_process' with a space in the command path.

Possible Solution

No response

Additional Information/Context

No response

AWS Tools for PowerShell version used

AWS.Tools.S3 4.1.874
AWS.Tools.S3 5.0.28

PowerShell version used

Name Value


PSVersion 7.5.2
PSEdition Core
GitCommitId 7.5.2
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Operating System and version

Windows 11 Enterprise, Version 10.0.26100 Build 26100

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.p2This is a standard priority issuequeued

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions