PowerShell / PowerShell/PSScriptAnalyzer

PSAvoidUsingConvertToSecureStringWithPlainText how can i encrypt plain strings then??

Open
#574 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Rules Issue - Discussion
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

So, im trying to convert a string to a securestring, so it can be secure when i serialize it to disk. How am i supposed to do it with doing:

ConvertTo-SecureString -String 'EncryptMe' -AsPlainText -Force

In my situation, i am getting return data that is a string, i cannot prompt the user to input it as a pscredential or something as the user does not know what it is. But after i have the data, i want to secure it, hence, convertto-securestring. Please advise how i can do this (ideally without just using ExcludeRule).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PSAvoidUsingConvertToSecureStringWithPlainText rule and the documented behavior of ConvertTo-SecureString when given plain text. The issue names no file, test, or concrete documentation change, so clarify the expected guidance and define what a completed update should cover before editing.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
security, tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.