From 938617acbfb953f23637d88ce2dc8bb046a7365f Mon Sep 17 00:00:00 2001 From: tjcouch-sil Date: Thu, 7 Sep 2023 16:06:40 -0500 Subject: [PATCH] Make resource viewer take whole webview width, prevent extensions with .. in the name because the extension name is used in file system calls --- extensions/src/resource-viewer/resource-viewer.ts | 2 ++ extensions/src/resource-viewer/resource-viewer.web-view.scss | 5 +++++ src/extension-host/services/extension.service.ts | 2 ++ 3 files changed, 9 insertions(+) create mode 100644 extensions/src/resource-viewer/resource-viewer.web-view.scss diff --git a/extensions/src/resource-viewer/resource-viewer.ts b/extensions/src/resource-viewer/resource-viewer.ts index 2679638085..235ee5b44a 100644 --- a/extensions/src/resource-viewer/resource-viewer.ts +++ b/extensions/src/resource-viewer/resource-viewer.ts @@ -3,6 +3,7 @@ import type { IWebViewProvider } from 'shared/models/web-view-provider.model'; import type { SavedWebViewDefinition, WebViewDefinition } from 'shared/data/web-view.model'; import type { ExecutionActivationContext } from 'extension-host/extension-types/extension-activation-context.model'; import resourceViewerWebView from './resource-viewer.web-view?inline'; +import resourceViewerWebViewStyles from './resource-viewer.web-view.scss?inline'; const { logger } = papi; logger.info('Resource Viewer is importing!'); @@ -22,6 +23,7 @@ const resourceWebViewProvider: IWebViewProvider = { ...savedWebView, title: 'Resource Viewer', content: resourceViewerWebView, + styles: resourceViewerWebViewStyles, }; }, }; diff --git a/extensions/src/resource-viewer/resource-viewer.web-view.scss b/extensions/src/resource-viewer/resource-viewer.web-view.scss new file mode 100644 index 0000000000..4ebcde9d7a --- /dev/null +++ b/extensions/src/resource-viewer/resource-viewer.web-view.scss @@ -0,0 +1,5 @@ +// This class is built into the `usxeditor` library. We just need to override it +/* stylelint-disable-next-line selector-class-pattern */ +.usxEditor { + width: auto !important; +} diff --git a/src/extension-host/services/extension.service.ts b/src/extension-host/services/extension.service.ts index 2a6d6ef36c..927124d41f 100644 --- a/src/extension-host/services/extension.service.ts +++ b/src/extension-host/services/extension.service.ts @@ -107,6 +107,8 @@ let availableExtensions: ExtensionInfo[]; /** Parse string extension manifest into an object and perform any transformations needed */ function parseManifest(extensionManifestJson: string): ExtensionManifest { const extensionManifest = JSON.parse(extensionManifestJson) as ExtensionManifest; + if (extensionManifest.name.includes('..')) + throw new Error('Extension name must not include `..`!'); // Replace ts with js so people can list their source code ts name but run the transpiled js if (extensionManifest.main && extensionManifest.main.toLowerCase().endsWith('.ts')) extensionManifest.main = `${extensionManifest.main.slice(0, -3)}.js`;