Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #6976: XSS in New File dialog. #6977

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/browser/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export abstract class AbstractDialog<T> extends BaseWidget {
if (this.acceptButton) {
this.acceptButton.disabled = !DialogError.getResult(error);
}
this.errorMessageNode.innerHTML = DialogError.getMessage(error);
this.errorMessageNode.innerText = DialogError.getMessage(error);
}

protected addCloseAction<K extends keyof HTMLElementEventMap>(element: HTMLElement, ...additionalEventTypes: K[]): void {
Expand Down
4 changes: 2 additions & 2 deletions packages/workspace/src/browser/workspace-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@ export class WorkspaceCommandContribution implements CommandContribution {
}
// check and validate each sub-paths
if (name.split(/[\\/]/).some(file => !file || !validFilename(file) || /^\s+$/.test(file))) {
return `The name <strong>${this.trimFileName(name)}</strong> is not a valid file or folder name.`;
return `The name "${this.trimFileName(name)}" is not a valid file or folder name.`;
}
const childUri = new URI(parent.uri).resolve(name).toString();
const exists = await this.fileSystem.exists(childUri);
if (exists) {
return `A file or folder <strong>${this.trimFileName(name)}</strong> already exists at this location.`;
return `A file or folder "${this.trimFileName(name)}" already exists at this location.`;
}
return '';
}
Expand Down