-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35433a0
commit ff6ced1
Showing
3 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
enum StorageKeys { | ||
doNotShowSecurityPromptAgain = 'stripeDoNotShowSecurityPromptAgain', | ||
} | ||
|
||
export class SecurityPrompt { | ||
storage: vscode.Memento; | ||
|
||
constructor(context: vscode.ExtensionContext) { | ||
this.storage = context.globalState; | ||
} | ||
|
||
public activate(): void { | ||
if (this.shouldShowBannerOnStartup()) { | ||
this.show(); | ||
} | ||
} | ||
|
||
public shouldShowBannerOnStartup(): boolean { | ||
if (vscode.workspace.getConfiguration('stripe').has('projectName')) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public async show() { | ||
if (this.storage.get(StorageKeys.doNotShowSecurityPromptAgain)) { | ||
return; | ||
} | ||
const selection = await vscode.window.showInformationMessage( | ||
"Warning: Debugging from `launch.json` files you didn't create or using code from unofficial sources can expose your system to security risks. Please ensure you understand the implications of the code you are executing.", | ||
'Do not show again', | ||
); | ||
if (!selection) { | ||
return; | ||
} | ||
this.storage.update(StorageKeys.doNotShowSecurityPromptAgain, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters