Filter settings exported when rageshaking (#30236)

* Submit filtered settings to rageshakes and sentry.

* Add flag to omit some settings from being exported.

* Hide user timezone

* Hide recent searches and media event ids

* Lint

* use better wording

* lint

* Prevent language from being sent

* Add tests to check keys are prevented from being uploaded.

* don't export invite rules

* Update tests
This commit is contained in:
Will Hunt
2025-07-02 09:03:31 +01:00
committed by GitHub
parent 99f7656d09
commit e1fea71c97
7 changed files with 107 additions and 34 deletions

View File

@@ -14,7 +14,7 @@ import SdkConfig from "../../../src/SdkConfig";
import { SettingLevel } from "../../../src/settings/SettingLevel";
import SettingsStore from "../../../src/settings/SettingsStore";
import { mkStubRoom, mockPlatformPeg, stubClient } from "../../test-utils";
import { type SettingKey } from "../../../src/settings/Settings.tsx";
import { SETTINGS, type SettingKey } from "../../../src/settings/Settings.tsx";
import MatrixClientBackedController from "../../../src/settings/controllers/MatrixClientBackedController.ts";
const TEST_DATA = [
@@ -55,6 +55,7 @@ describe("SettingsStore", () => {
beforeEach(() => {
SdkConfig.reset();
SettingsStore.reset();
});
describe("getValueAt", () => {
@@ -82,6 +83,16 @@ describe("SettingsStore", () => {
});
});
describe("exportForRageshake", () => {
it("should not export settings marked as non-exportable", async () => {
await SettingsStore.setValue("userTimezone", null, SettingLevel.DEVICE, "Europe/London");
const values = JSON.parse(SettingsStore.exportForRageshake()) as Record<SettingKey, unknown>;
for (const exportedKey of Object.keys(values) as SettingKey[]) {
expect(SETTINGS[exportedKey].shouldExportToRageshake).not.toEqual(false);
}
});
});
describe("runMigrations", () => {
let client: MatrixClient;
let room: Room;