Skip to content

Bug Fix: Quote parameters to prevent errors when they contain whitespaces#33

Merged
cdhunt merged 4 commits intocdhunt:mainfrom
Ben-m-s:main
Apr 8, 2025
Merged

Bug Fix: Quote parameters to prevent errors when they contain whitespaces#33
cdhunt merged 4 commits intocdhunt:mainfrom
Ben-m-s:main

Conversation

@Ben-m-s
Copy link
Contributor

@Ben-m-s Ben-m-s commented Apr 1, 2025

This PR contains a fix that prevent errors when parameters contain whitespaces. More specifically, when the name of a vault in 1Password contains whitespaces, the API requests that target that vault fail because the 1Password CLI see each word as a parameter. This fix surrounds all params with double quotations to prevent this issue going forward.

The release numbers are also updated to allow the PowerShell Gallery to identify the latest version.

@Ben-m-s
Copy link
Contributor Author

Ben-m-s commented Apr 1, 2025

Hi @cdhunt,

The issues with the build checks seems to be related with Testspace, which is unrelated with the submitted code. I'll assume that you will look into it when possible.

I am aware of your availability constraints.

Thanks,

Kind regards,

Ben

@cdhunt cdhunt merged commit 775b253 into cdhunt:main Apr 8, 2025
3 of 6 checks passed
@cdhunt
Copy link
Owner

cdhunt commented Apr 8, 2025

Yeah, no worries. I'm aware of the build failures. I attempted to get op.exe running in the pipeline so the tests would run, but I could not find a way to authenticate non-interactively.

@Ben-m-s
Copy link
Contributor Author

Ben-m-s commented Apr 10, 2025

The 1Password CLI API is meant to be used interactively, through the 1Password Desktop app. Thus, It is not possible to use it with "application permissions" (non-interactively). See the following article for details:

https://developer.1password.com/docs/cli/app-integration-security/

Thus, the tests for the SecretManagement.1Password extension are useful while developing to validate changes. Specially useful when doing big changes.

Please, consider removing the code that is triggering build failurs as it may prevent us from detecting other real errors.

@Ben-m-s
Copy link
Contributor Author

Ben-m-s commented May 22, 2025

Hi @cdhunt ,

Regarding this conversation, you may be interested to have a look to the 1Password Service Accounts feature:

1Password Service Accounts are a sort of application identity that may allow you to run the 1Password CLI with an identity that doesn't trigger the password pop-up.

Service accounts work well for shared environments because they provide an authentication method for 1Password CLI that isn't associated with an individual. You control which vaults are accessible and which actions the service account can perform. And you can see what items a service account accesses by creating a usage report.

I hope this helps,

Kind regads,

Ben

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