Make log payloads opaque pass-through
This commit is contained in:
@@ -63,17 +63,18 @@ describe("Game Client Bridge safe projection schema", () => {
|
||||
{ sessionToken: "component-session-material" },
|
||||
{ componentSession: "component-session-material" },
|
||||
{ componentKey: "raw-component-key" },
|
||||
{ sourceSessionId: "component-session-1" },
|
||||
{ result: { ...safeCommand.result, payload: { dsn: "sqlite:///srv/scum/SCUM.db" } } },
|
||||
{ result: { ...safeCommand.result, payload: { endpoint: "tcp://127.0.0.1:9999" } } },
|
||||
{ result: { ...safeCommand.result, payload: { output: "/Users/operator/scum/config.yaml" } } }
|
||||
{ sourceSessionId: "component-session-1" }
|
||||
])("rejects forbidden command projection %#", (unsafe) => {
|
||||
expect(() => parseSafeGameClientBridgeCommand({ ...safeCommand, ...unsafe })).toThrow(/forbidden|sensitive/i);
|
||||
});
|
||||
|
||||
it("rejects credentials nested inside snapshot payloads", () => {
|
||||
const unsafe = structuredClone(safeSnapshotList);
|
||||
unsafe.items[0].payload = { players: [{ playerId: "player-1", credential: "raw-password" }] } as unknown as typeof unsafe.items[0]["payload"];
|
||||
expect(() => parseSafeGameClientBridgeSnapshotList(unsafe)).toThrow(/forbidden/i);
|
||||
it("preserves sensitive-looking command and snapshot payloads", () => {
|
||||
expect(parseSafeGameClientBridgeCommand({
|
||||
...safeCommand,
|
||||
result: { ...safeCommand.result, payload: { dsn: "sqlite:///srv/scum/SCUM.db", endpoint: "tcp://127.0.0.1:9999", output: "/Users/operator/scum/config.yaml" } }
|
||||
})).toMatchObject({ result: { payload: { dsn: "sqlite:///srv/scum/SCUM.db", endpoint: "tcp://127.0.0.1:9999", output: "/Users/operator/scum/config.yaml" } } });
|
||||
|
||||
const payload = { players: [{ playerId: "player-1", credential: "raw-password", note: "password=opaque" }] };
|
||||
expect(parseSafeGameClientBridgeSnapshotList({ ...safeSnapshotList, items: [{ ...safeSnapshotList.items[0], payload }] })).toMatchObject({ items: [{ payload }] });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user