mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
Run the layer acceptance under a default-deny network policy with per-layer assertion manifests and strict switch contracts
Every scenario runs through scripts/qa-strict-harness.mjs: each page, frame and worker gets an ordered block list before it runs (paid hosts and routes first, then only the preview, declared fixtures, keyless probes and cached free tile hosts), switches with real input on the picker, and records its assertions per layer and engine. The runner reads the catalog from the live page, fails any layer without an assertion on either engine, can build and serve a keyless checkout itself, and adds rapid, hidden-tab, context-loss, failure-injection, cold-chunk and soak scenarios. The main chunk gets a 1% size budget.
This commit is contained in:
1 parent
3144169057
commit
1773494116
36 files changed
+6003
-1774
No files matched your search
@@ -1,6 +1,11 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { blockPaidQaMaps } from './qa-map-policy.mjs';
|
||||
import {
|
||||
blockPaidQaMaps,
|
||||
KEYLESS_PROBES,
|
||||
probePattern,
|
||||
strictBlockPatterns,
|
||||
} from './qa-map-policy.mjs';
|
||||
|
||||
test('routine QA blocks direct Google tiles, hosted Google assets and token fallback', async () => {
|
||||
const calls = [];
|
||||
@@ -25,3 +30,54 @@ test('a necessary 3D-specific check must explicitly opt out of the request block
|
||||
{ allowPaidMaps: true },
|
||||
);
|
||||
});
|
||||
|
||||
test('the strict policy blocks paid hosts and routes first and everything unlisted last', () => {
|
||||
const patterns = strictBlockPatterns('http://127.0.0.1:4208', {
|
||||
fixtures: ['https://tiles.dontgetflocked.com/*'],
|
||||
});
|
||||
const decide = (url) =>
|
||||
patterns.find(({ urlPattern }) => new URLPattern(urlPattern).test(url))
|
||||
?.block;
|
||||
for (const url of [
|
||||
'https://tile.googleapis.com/v1/3dtiles/root.json',
|
||||
'https://maps.googleapis.com/maps/api/js',
|
||||
'https://fonts.gstatic.com/s/inter.woff2',
|
||||
'https://api.cesium.com/v1/assets/1/endpoint',
|
||||
'https://assets.ion.cesium.com/google-credit.png',
|
||||
'http://127.0.0.1:4208/api/openai/hud-summary',
|
||||
'http://127.0.0.1:4208/api/realtime/token',
|
||||
'http://127.0.0.1:4208/api/google/nearby-places?lat=1',
|
||||
'https://example.com/anything',
|
||||
'wss://example.com/socket',
|
||||
])
|
||||
assert.equal(decide(url), true, url);
|
||||
for (const url of [
|
||||
'http://127.0.0.1:4208/assets/index.js',
|
||||
'http://127.0.0.1:4208/api/flights',
|
||||
'https://tiles.dontgetflocked.com/cameras-us-hourly/1/2/3.mvt',
|
||||
'https://tile.openstreetmap.org/1/2/3.png',
|
||||
'https://terrain.reearth.land/cesium-mesh/layer.json',
|
||||
'https://tiles.maps.eox.at/wmts/1.0.0/s2/1/2/3.jpg',
|
||||
])
|
||||
assert.equal(decide(url), false, url);
|
||||
});
|
||||
|
||||
test('the keyless probes are let through only to their exact routes', () => {
|
||||
const patterns = strictBlockPatterns('http://127.0.0.1:4208');
|
||||
const decide = (url) =>
|
||||
patterns.find(({ urlPattern }) => new URLPattern(urlPattern).test(url))
|
||||
?.block;
|
||||
for (const probe of KEYLESS_PROBES) {
|
||||
const url = probePattern('http://127.0.0.1:4208', probe).replace(
|
||||
/\*$/,
|
||||
'?family=Inter',
|
||||
);
|
||||
assert.equal(decide(url), false, url);
|
||||
}
|
||||
assert.equal(
|
||||
decide('http://127.0.0.1:4208/api/openai/hud-summary'),
|
||||
true,
|
||||
'the paid summary itself stays blocked',
|
||||
);
|
||||
assert.equal(decide('https://fonts.googleapis.com/icon?family=x'), true);
|
||||
});
|
||||
Reference in new issue
Block a user