Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+7
@@ -53,6 +53,13 @@ describe("PluginSettingsFrame", () => {
|
||||
expect(PLUGIN_SETTINGS_FRAME_DEFAULT_ERROR_MESSAGES).toEqual(en.settings.plugins.settings.frameErrors);
|
||||
});
|
||||
|
||||
it("never falls back to predictable randomness for channel or nonce generation", () => {
|
||||
const source = readRepoFile("apps/web/app/modules/plugins/components/PluginSettingsFrame.tsx");
|
||||
expect(source).not.toContain("Math.random");
|
||||
expect(source).toContain("Secure randomness is required for the plugin settings frame channel.");
|
||||
expect(source).toContain("Secure randomness is required for the plugin settings frame nonce.");
|
||||
});
|
||||
|
||||
it("renders a sandboxed opaque-origin iframe with an embedded CSP", () => {
|
||||
render(<PluginSettingsFrame pluginId="com.acme.settings" title="Acme settings" trustedHtml="<main><h1>Settings</h1></main>" />);
|
||||
|
||||
|
||||
+10
-10
@@ -510,19 +510,19 @@ function assertSafePluginSettingsFrameScriptNonce(scriptNonce: string): void {
|
||||
}
|
||||
|
||||
function createPluginSettingsFrameChannelId() {
|
||||
const bytes = new Uint8Array(16);
|
||||
globalThis.crypto?.getRandomValues?.(bytes);
|
||||
if (bytes.some((byte) => byte !== 0)) {
|
||||
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
||||
if (!globalThis.crypto?.getRandomValues) {
|
||||
throw new Error("Secure randomness is required for the plugin settings frame channel.");
|
||||
}
|
||||
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
||||
const bytes = new Uint8Array(16);
|
||||
globalThis.crypto.getRandomValues(bytes);
|
||||
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
||||
}
|
||||
|
||||
function createPluginSettingsFrameScriptNonce() {
|
||||
const bytes = new Uint8Array(16);
|
||||
globalThis.crypto?.getRandomValues?.(bytes);
|
||||
if (bytes.some((byte) => byte !== 0)) {
|
||||
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
||||
if (!globalThis.crypto?.getRandomValues) {
|
||||
throw new Error("Secure randomness is required for the plugin settings frame nonce.");
|
||||
}
|
||||
return createPluginSettingsFrameChannelId();
|
||||
const bytes = new Uint8Array(16);
|
||||
globalThis.crypto.getRandomValues(bytes);
|
||||
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
||||
}
|
||||
Reference in new issue
Block a user