fix: resolve workspace integration blockers (#5)

This commit is contained in:
2026-07-29 10:01:17 +09:00
parent 3279ac099e
commit cadbd5fb60
37 changed files with 1817 additions and 73 deletions
+21
View File
@@ -0,0 +1,21 @@
import { describe, expect, it } from 'vitest';
import {
assertCadByteLength,
resolveCadUrl,
} from '../apps/viewer-2d-sample/src/cadInputPolicy';
describe('CAD input policy', () => {
it('accepts same-origin URLs and rejects cross-origin model URLs', () => {
expect(resolveCadUrl('/samples/simple.dxf', new URL('https://viewer.example/app/')).href).toBe(
'https://viewer.example/samples/simple.dxf',
);
expect(() =>
resolveCadUrl('https://attacker.example/oversized.dxf', new URL('https://viewer.example/')),
).toThrow('같은 origin');
});
it('rejects CAD input larger than 50 MiB', () => {
expect(() => assertCadByteLength(50 * 1024 * 1024)).not.toThrow();
expect(() => assertCadByteLength(50 * 1024 * 1024 + 1)).toThrow('50 MiB');
});
});