Title: Can we get a MaskInput parameter on Read-Host? · Issue #10847 · PowerShell/PowerShell · GitHub
Open Graph Title: Can we get a MaskInput parameter on Read-Host? · Issue #10847 · PowerShell/PowerShell
X Title: Can we get a MaskInput parameter on Read-Host? · Issue #10847 · PowerShell/PowerShell
Description: Summary of the new feature/enhancement In order to avoid secrets getting stored in my PSReadLine history, I never paste a secret directly onto the command line as a parameter value. I always use Read-Host -AsSecureString and then paste t...
Open Graph Description: Summary of the new feature/enhancement In order to avoid secrets getting stored in my PSReadLine history, I never paste a secret directly onto the command line as a parameter value. I always use Re...
X Description: Summary of the new feature/enhancement In order to avoid secrets getting stored in my PSReadLine history, I never paste a secret directly onto the command line as a parameter value. I always use Re...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/10847
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Can we get a MaskInput parameter on Read-Host?","articleBody":"# Summary of the new feature/enhancement\r\n\r\nIn order to avoid secrets getting stored in my PSReadLine history, I never paste a secret directly onto the command line as a parameter value. I always use `Read-Host -AsSecureString` and then paste the secret at the Read-Host prompt. The secret input is masked with `*` chars. Then I run through this little dance to extract the plain text secret into a variable which honestly, is getting a little tiresome to do (and explain to folks why they need to do this):\r\n```\r\nPS> $ss = Read-Host -AsSecureString\r\n*******************************\r\nPS> $apiKey = [pscredential]::new('jpgr', $ss).GetNetworkCredential().Password\r\n```\r\nThen I use the `$apiKey` variable as the parameter value. Now, yeah, it would be better to use a SecureString but unfortunately, I have to use commands that don't accept a secure string and on top of that, SecureString isn't really secure on any platform except Windows.\r\n\r\nWhat would make life easier in this scenario is this simple addition to `Read-Host`:\r\n```\r\n$apiKey = Read-Host -MaskInput\r\n```\r\nRead-Host already knows how to mask input since it does this when you specify `-AsSecureString`\r\n\r\n# Proposed technical implementation details (optional)\r\n\r\nAdd a new parameter set to Read-Host that adds `-MaskInput` and is mutually exclusive with `-AsSecureString` and outputs a System.String object. Now, if you want to require this new parameter to require a `-Force` parameter to work ala `ConvertTo-SecureString 'foo' -AsPlainText -Force`, that would be OK. And without the `-Force` parameter, this would error with a similar error message - `The system cannot protect plain text input. To suppress this warning and process the plain text secret, reissue the command specifying the Force parameter.`.","author":{"url":"https://github.com/rkeithhill","@type":"Person","name":"rkeithhill"},"datePublished":"2019-10-19T21:10:06Z","url":"https://github.com/PowerShell/PowerShell/issues/10847"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b4051dac-7426-ab8c-a9e4-566f0499b80f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 95C2:1F2140:1CEC66:27C03C:6AFD500C |
| html-safe-nonce | e3c7d5a1ad1ed11f2b5ca4dc3cfc2293c28f034c97639243e36653e396647c78 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUMyOjFGMjE0MDoxQ0VDNjY6MjdDMDNDOjZBRkQ1MDBDIiwidmlzaXRvcl9pZCI6IjIzNzI3MzU2ODM1MzQ4Njg0OTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a7e3132fb6ee3e7bd7d1a2cbacf94c76cf0feefef57fcd301eef5eeac80a8be5 |
| hovercard-subject-tag | issue:509510160 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/10847/issue_layout |
| twitter:image | https://opengraph.githubassets.com/35d21f2695cc0818d958fd6f7176e4916d7a504667347c95447a8c7a27408edb/PowerShell/PowerShell/issues/10847 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/35d21f2695cc0818d958fd6f7176e4916d7a504667347c95447a8c7a27408edb/PowerShell/PowerShell/issues/10847 |
| og:image:alt | Summary of the new feature/enhancement In order to avoid secrets getting stored in my PSReadLine history, I never paste a secret directly onto the command line as a parameter value. I always use Re... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rkeithhill |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width