Skip to content

[Bug]: Minor Tweaks - Module Aliases, Global Variables, code logic #6

@cksapp

Description

@cksapp

What happened?

Noticed a few minor changes to be made to the module functions, i.e 'bcdr' variable updated to reflect 'saas', alias attributes, and API secret key is not passed as secure string. Meaning when passing secure string object down from pipeline or secret store this must first be converted to plain text and passed to the function as plain text, possibly leading to secret key being captured in logs.

Expected behavior?

Do not fail with error in creating new alias for functions, saas parameters variable should be named appropriately, and API secret key should be passed as secure string.

Possible Solution?

https://github.com/cksapp/Datto-PowerShellWrapper/tree/moduleTweaks

PowerShell Version

7.4.x - (PowerShell Core)

What operating system are you seeing the problem on?

Windows

Relevant log output

New-Alias -Name Set-DattoBaseURI -Value Add-DattoBaseURI
New-Alias: The alias is not allowed, because an alias with the name 'Set-DattoBaseURI' already exists.



$Key = read-host "enter key" -AsSecureString
enter key: ***********

$key
System.Security.SecureString

Add-DattoApiKey -Api_Key_Public A1B23C -Api_Key_Secret $key

Get-DattoAPIKey

PublicKey                    SecretKey
---------                    ---------
A1B23C    System.Security.SecureString

Get-DattoAPIKey -plainText

PublicKey SecretKey
--------- ---------
A1B23C    System.Security.SecureString

Help Commands

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions