Mask/blur text in a document #104
-
I would like to add secret masking to our Dotenv official extension. [1] Scenario: For example, take a .env file like this opened in Code:
If a user accidentally opens up that file while someone is watching (it might be on a screenshare or a screen recording) they've now put themselves and/or their organization at risk. They have to rotate those keys immediately to be safe. Solution: I'd like to add a masking/blur feature, so that when they open their .env file anyone watching would not see the values. Instead, it would look something like this:
When the user hovers over the masked/blurred value only then will the value be displayed. Question: Is there a mechanism in VSCode extensions methods to accomplish this? [1] https://marketplace.visualstudio.com/items?itemName=dotenv.dotenv-vscode&ssr=false#overview |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
You can set the color of the text to equal the backgroundColor using https://code.visualstudio.com/api/references/vscode-api#DecorationRenderOptions so it will appear as a solid block. You could also look at using You can add an action above the first line of the .env to uncensor using https://code.visualstudio.com/api/references/vscode-api#CodeLensProvider%3CT%3E . It might be possible purely with syntax highlighting or semantic tokens highlighting but I'm not familiar with that. |
Beta Was this translation helpful? Give feedback.
You can set the color of the text to equal the backgroundColor using https://code.visualstudio.com/api/references/vscode-api#DecorationRenderOptions so it will appear as a solid block. You could also look at using
opacity
.You can add an action above the first line of the .env to uncensor using https://code.visualstudio.com/api/references/vscode-api#CodeLensProvider%3CT%3E .
It might be possible purely with syntax highlighting or semantic tokens highlighting but I'm not familiar with that.