mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 17:48:56 +01:00
Adopt uuids for generating webview nonces
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { Disposable } from './dispose';
|
||||
import { generateUuid } from './uuid';
|
||||
|
||||
|
||||
export interface ShowOptions {
|
||||
@@ -112,7 +113,7 @@ export class SimpleBrowserView extends Disposable {
|
||||
private getHtml(url: string) {
|
||||
const configuration = vscode.workspace.getConfiguration('simpleBrowser');
|
||||
|
||||
const nonce = getNonce();
|
||||
const nonce = generateUuid();
|
||||
|
||||
const mainJs = this.extensionResourceUrl('media', 'index.js');
|
||||
const mainCss = this.extensionResourceUrl('media', 'main.css');
|
||||
@@ -181,12 +182,3 @@ export class SimpleBrowserView extends Disposable {
|
||||
function escapeAttribute(value: string | vscode.Uri): string {
|
||||
return value.toString().replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function getNonce() {
|
||||
let text = '';
|
||||
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for (let i = 0; i < 64; i++) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user