@fuzdev/fuz_app 0.170.0 → 0.172.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/CLAUDE.md +3 -3
- package/dist/actions/action_codegen.d.ts +5 -3
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +11 -27
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +5 -6
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +3 -2
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +2 -1
- package/dist/auth/middleware.d.ts +6 -2
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +14 -2
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +5 -7
- package/dist/http/CLAUDE.md +5 -3
- package/dist/http/error_schemas.d.ts +3 -4
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +4 -5
- package/dist/http/host.d.ts +137 -0
- package/dist/http/host.d.ts.map +1 -0
- package/dist/http/host.js +203 -0
- package/dist/http/json_text.d.ts +53 -0
- package/dist/http/json_text.d.ts.map +1 -0
- package/dist/http/json_text.js +152 -0
- package/dist/http/origin.d.ts +9 -0
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +6 -2
- package/dist/http/origin_wildcard.d.ts +20 -5
- package/dist/http/origin_wildcard.d.ts.map +1 -1
- package/dist/http/origin_wildcard.js +22 -10
- package/dist/http/route_result.d.ts +2 -1
- package/dist/http/route_result.d.ts.map +1 -1
- package/dist/http/route_spec.d.ts +1 -1
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +10 -9
- package/dist/http/schema_helpers.d.ts +10 -9
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/server/app_server.d.ts +10 -0
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +14 -3
- package/dist/testing/CLAUDE.md +6 -7
- package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
- package/dist/testing/adversarial_input_cases.js +2 -4
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +7 -2
- package/dist/testing/cross_backend/in_process_setup.d.ts +1 -1
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +2 -1
- package/dist/testing/cross_backend/origin_conformance.d.ts +62 -1
- package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_conformance.js +19 -3
- package/dist/testing/cross_backend/origin_conformance.json +330 -0
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -6
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -15
- package/dist/testing/cross_backend/testing_origin_check.d.ts +16 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +12 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +2 -2
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +3 -3
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.js +8 -0
- package/dist/testing/rpc_envelope_cases.d.ts +7 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +21 -0
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +8 -18
- package/dist/testing/stubs.d.ts +11 -4
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +10 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"origin_conformance.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/origin_conformance.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"origin_conformance.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/origin_conformance.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA6B9B,OAAO,EAgBN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAItC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D,OAAO,EACN,wBAAwB,EAExB,KAAK,uBAAuB,EAC5B,MAAM,2BAA2B,CAAC;AAEnC,2CAA2C;AAC3C,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE1E,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAOpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEhF,oFAAoF;AACpF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;EAKpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEhF,8FAA8F;AAC9F,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;EAKnC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE9E,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEhE,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,EAAE,GAA2D,CAAC;AAEjG;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,QAAO,iBACiD,CAAC;AAE7F,wDAAwD;AACxD,MAAM,WAAW,sBAAsB;IACtC,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,uBAAuB,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;CAC5C;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GACxC,OAAO,iBAAiB,KACtB,KAAK,CAAC,sBAAsB,CAmB9B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACrC,QAAQ,aAAa,CAAC,sBAAsB,CAAC,EAC7C,QAAQ,aAAa,CAAC,OAAO,CAAC,EAC9B,SAAS,MAAM,KACb,IAiBF,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,iCAAiC,GAAG,wBAAwB,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,uCAAuC,GACnD,SAAS,iCAAiC,KACxC,IA4BF,CAAC"}
|
|
@@ -4,7 +4,8 @@ import '../assert_dev_env.js';
|
|
|
4
4
|
* runs it against each backend over the wire.
|
|
5
5
|
*
|
|
6
6
|
* `origin_conformance.json` (beside this module) is the one statement of the
|
|
7
|
-
* allowlist grammar and matcher
|
|
7
|
+
* allowlist grammar and matcher, and of the host gate's check over them, both
|
|
8
|
+
* spines implement. It holds three tables:
|
|
8
9
|
*
|
|
9
10
|
* - **parse** rows — `{raw, ok: true}` or `{raw, errors: [{index?, kind}]}`:
|
|
10
11
|
* an allowlist value (as `FUZ_ALLOWED_ORIGINS` would carry it) and whether
|
|
@@ -12,6 +13,8 @@ import '../assert_dev_env.js';
|
|
|
12
13
|
* list-level refusal) and its `AllowedOriginsErrorKind`.
|
|
13
14
|
* - **match** rows — `{patterns, origin, allowed}`: a valid allowlist, one
|
|
14
15
|
* `Origin` value (`null` for none), and the request-level answer.
|
|
16
|
+
* - **host** rows — `{patterns, hosts, allowed}`: a valid allowlist, the
|
|
17
|
+
* request's `Host` values (`[]` for none), and the host gate's answer.
|
|
15
18
|
*
|
|
16
19
|
* A row may carry a `note` for the reader. The TS unit test reads the table
|
|
17
20
|
* directly; `describe_origin_conformance_cross_tests` sends every row to a
|
|
@@ -48,10 +51,18 @@ export const OriginConformanceMatchRow = object({
|
|
|
48
51
|
allowed: boolean,
|
|
49
52
|
note: optional(string)
|
|
50
53
|
});
|
|
54
|
+
/** A host row: a valid allowlist, the request's `Host` values, and the host gate's answer. */
|
|
55
|
+
export const OriginConformanceHostRow = object({
|
|
56
|
+
patterns: string,
|
|
57
|
+
hosts: array(string),
|
|
58
|
+
allowed: boolean,
|
|
59
|
+
note: optional(string)
|
|
60
|
+
});
|
|
51
61
|
/** The conformance table, a `@fuzdev/fuz_schema` `object`. */
|
|
52
62
|
export const OriginConformance = object({
|
|
53
63
|
parse: pipe(array(OriginConformanceParseRow), min_length(1)),
|
|
54
|
-
match: pipe(array(OriginConformanceMatchRow), min_length(1))
|
|
64
|
+
match: pipe(array(OriginConformanceMatchRow), min_length(1)),
|
|
65
|
+
host: pipe(array(OriginConformanceHostRow), min_length(1))
|
|
55
66
|
});
|
|
56
67
|
/** The committed table, resolved relative to this module. */
|
|
57
68
|
export const ORIGIN_CONFORMANCE_URL = new URL('./origin_conformance.json', import.meta.url);
|
|
@@ -68,7 +79,7 @@ export const load_origin_conformance = () => parse_or_throw(OriginConformance, J
|
|
|
68
79
|
* `{ok: true, allowed: true}`.
|
|
69
80
|
*
|
|
70
81
|
* @param table - the conformance table
|
|
71
|
-
* @returns one check per row
|
|
82
|
+
* @returns one check per row: parse rows, then match rows, then host rows
|
|
72
83
|
*/
|
|
73
84
|
export const to_origin_conformance_checks = (table) => [
|
|
74
85
|
...table.parse.map((row) => ({
|
|
@@ -82,6 +93,11 @@ export const to_origin_conformance_checks = (table) => [
|
|
|
82
93
|
label: `match ${JSON.stringify(row.patterns)} × ${JSON.stringify(row.origin)}`,
|
|
83
94
|
input: { patterns: row.patterns, origin: row.origin },
|
|
84
95
|
expected: { ok: true, allowed: row.allowed }
|
|
96
|
+
})),
|
|
97
|
+
...table.host.map((row) => ({
|
|
98
|
+
label: `host ${JSON.stringify(row.patterns)} × ${JSON.stringify(row.hosts)}`,
|
|
99
|
+
input: { patterns: row.patterns, origin: null, hosts: [...row.hosts] },
|
|
100
|
+
expected: { ok: true, allowed: row.allowed }
|
|
85
101
|
}))
|
|
86
102
|
];
|
|
87
103
|
/**
|
|
@@ -1675,5 +1675,335 @@
|
|
|
1675
1675
|
"allowed": false,
|
|
1676
1676
|
"note": "fullwidth digits are not digits"
|
|
1677
1677
|
}
|
|
1678
|
+
],
|
|
1679
|
+
"host": [
|
|
1680
|
+
{
|
|
1681
|
+
"patterns": "https://app.example.com",
|
|
1682
|
+
"hosts": [],
|
|
1683
|
+
"allowed": true,
|
|
1684
|
+
"note": "a request without a Host passes"
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
"patterns": "https://app.example.com",
|
|
1688
|
+
"hosts": [
|
|
1689
|
+
"localhost"
|
|
1690
|
+
],
|
|
1691
|
+
"allowed": true
|
|
1692
|
+
},
|
|
1693
|
+
{
|
|
1694
|
+
"patterns": "https://app.example.com",
|
|
1695
|
+
"hosts": [
|
|
1696
|
+
"localhost:4460"
|
|
1697
|
+
],
|
|
1698
|
+
"allowed": true,
|
|
1699
|
+
"note": "a loopback name passes at any port"
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
"patterns": "https://app.example.com",
|
|
1703
|
+
"hosts": [
|
|
1704
|
+
"LOCALHOST:5173"
|
|
1705
|
+
],
|
|
1706
|
+
"allowed": true,
|
|
1707
|
+
"note": "the name is case-insensitive"
|
|
1708
|
+
},
|
|
1709
|
+
{
|
|
1710
|
+
"patterns": "https://app.example.com",
|
|
1711
|
+
"hosts": [
|
|
1712
|
+
"127.0.0.1"
|
|
1713
|
+
],
|
|
1714
|
+
"allowed": true
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
"patterns": "https://app.example.com",
|
|
1718
|
+
"hosts": [
|
|
1719
|
+
"127.0.0.1:4460"
|
|
1720
|
+
],
|
|
1721
|
+
"allowed": true
|
|
1722
|
+
},
|
|
1723
|
+
{
|
|
1724
|
+
"patterns": "https://app.example.com",
|
|
1725
|
+
"hosts": [
|
|
1726
|
+
"127.1.2.3:80"
|
|
1727
|
+
],
|
|
1728
|
+
"allowed": true,
|
|
1729
|
+
"note": "all of 127.0.0.0/8 is loopback"
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
"patterns": "https://app.example.com",
|
|
1733
|
+
"hosts": [
|
|
1734
|
+
"[::1]"
|
|
1735
|
+
],
|
|
1736
|
+
"allowed": true
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
"patterns": "https://app.example.com",
|
|
1740
|
+
"hosts": [
|
|
1741
|
+
"[::1]:4460"
|
|
1742
|
+
],
|
|
1743
|
+
"allowed": true
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
"patterns": "https://app.example.com",
|
|
1747
|
+
"hosts": [
|
|
1748
|
+
"[0:0:0:0:0:0:0:1]"
|
|
1749
|
+
],
|
|
1750
|
+
"allowed": true,
|
|
1751
|
+
"note": "::1 in any IPv6 spelling"
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
"patterns": "https://app.example.com",
|
|
1755
|
+
"hosts": [
|
|
1756
|
+
"localhost:65535"
|
|
1757
|
+
],
|
|
1758
|
+
"allowed": true
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
"patterns": "https://app.example.com",
|
|
1762
|
+
"hosts": [
|
|
1763
|
+
"[::1]:1"
|
|
1764
|
+
],
|
|
1765
|
+
"allowed": true
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
"patterns": "https://app.example.com",
|
|
1769
|
+
"hosts": [
|
|
1770
|
+
"[::1]junk"
|
|
1771
|
+
],
|
|
1772
|
+
"allowed": false,
|
|
1773
|
+
"note": "anything after the name but a port refuses it"
|
|
1774
|
+
},
|
|
1775
|
+
{
|
|
1776
|
+
"patterns": "https://app.example.com",
|
|
1777
|
+
"hosts": [
|
|
1778
|
+
"[::1]:"
|
|
1779
|
+
],
|
|
1780
|
+
"allowed": false
|
|
1781
|
+
},
|
|
1782
|
+
{
|
|
1783
|
+
"patterns": "https://app.example.com",
|
|
1784
|
+
"hosts": [
|
|
1785
|
+
"[::1]:abc"
|
|
1786
|
+
],
|
|
1787
|
+
"allowed": false
|
|
1788
|
+
},
|
|
1789
|
+
{
|
|
1790
|
+
"patterns": "https://app.example.com",
|
|
1791
|
+
"hosts": [
|
|
1792
|
+
"[::1"
|
|
1793
|
+
],
|
|
1794
|
+
"allowed": false
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
"patterns": "https://app.example.com",
|
|
1798
|
+
"hosts": [
|
|
1799
|
+
"localhost:abc"
|
|
1800
|
+
],
|
|
1801
|
+
"allowed": false
|
|
1802
|
+
},
|
|
1803
|
+
{
|
|
1804
|
+
"patterns": "https://app.example.com",
|
|
1805
|
+
"hosts": [
|
|
1806
|
+
"localhost: 1"
|
|
1807
|
+
],
|
|
1808
|
+
"allowed": false
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
"patterns": "https://app.example.com",
|
|
1812
|
+
"hosts": [
|
|
1813
|
+
"localhost:"
|
|
1814
|
+
],
|
|
1815
|
+
"allowed": false
|
|
1816
|
+
},
|
|
1817
|
+
{
|
|
1818
|
+
"patterns": "https://app.example.com",
|
|
1819
|
+
"hosts": [
|
|
1820
|
+
"localhost:+1"
|
|
1821
|
+
],
|
|
1822
|
+
"allowed": false
|
|
1823
|
+
},
|
|
1824
|
+
{
|
|
1825
|
+
"patterns": "https://app.example.com",
|
|
1826
|
+
"hosts": [
|
|
1827
|
+
"localhost:65536"
|
|
1828
|
+
],
|
|
1829
|
+
"allowed": false,
|
|
1830
|
+
"note": "a port above 65535 is not a port"
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
"patterns": "https://app.example.com",
|
|
1834
|
+
"hosts": [
|
|
1835
|
+
"127.0.0.1:4460x"
|
|
1836
|
+
],
|
|
1837
|
+
"allowed": false
|
|
1838
|
+
},
|
|
1839
|
+
{
|
|
1840
|
+
"patterns": "https://app.example.com",
|
|
1841
|
+
"hosts": [
|
|
1842
|
+
"127.0.0.01"
|
|
1843
|
+
],
|
|
1844
|
+
"allowed": false,
|
|
1845
|
+
"note": "an IPv4 octet with a leading zero is not an address"
|
|
1846
|
+
},
|
|
1847
|
+
{
|
|
1848
|
+
"patterns": "http://localhost:4460",
|
|
1849
|
+
"hosts": [
|
|
1850
|
+
"evil.example.com"
|
|
1851
|
+
],
|
|
1852
|
+
"allowed": false
|
|
1853
|
+
},
|
|
1854
|
+
{
|
|
1855
|
+
"patterns": "http://localhost:4460",
|
|
1856
|
+
"hosts": [
|
|
1857
|
+
"evil.example.com:4460"
|
|
1858
|
+
],
|
|
1859
|
+
"allowed": false
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
"patterns": "http://localhost:4460",
|
|
1863
|
+
"hosts": [
|
|
1864
|
+
"localhost.evil.example.com:4460"
|
|
1865
|
+
],
|
|
1866
|
+
"allowed": false
|
|
1867
|
+
},
|
|
1868
|
+
{
|
|
1869
|
+
"patterns": "http://localhost:4460",
|
|
1870
|
+
"hosts": [
|
|
1871
|
+
"127.0.0.1.nip.io:4460"
|
|
1872
|
+
],
|
|
1873
|
+
"allowed": false,
|
|
1874
|
+
"note": "a name that resolves to loopback is not loopback"
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
"patterns": "http://localhost:4460",
|
|
1878
|
+
"hosts": [
|
|
1879
|
+
"0.0.0.0:4460"
|
|
1880
|
+
],
|
|
1881
|
+
"allowed": false
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
"patterns": "http://localhost:4460",
|
|
1885
|
+
"hosts": [
|
|
1886
|
+
"[::ffff:127.0.0.1]:4460"
|
|
1887
|
+
],
|
|
1888
|
+
"allowed": false,
|
|
1889
|
+
"note": "an IPv4-mapped address is not loopback"
|
|
1890
|
+
},
|
|
1891
|
+
{
|
|
1892
|
+
"patterns": "http://localhost:4460",
|
|
1893
|
+
"hosts": [
|
|
1894
|
+
"10.0.0.1:4460"
|
|
1895
|
+
],
|
|
1896
|
+
"allowed": false
|
|
1897
|
+
},
|
|
1898
|
+
{
|
|
1899
|
+
"patterns": "http://localhost:4460",
|
|
1900
|
+
"hosts": [
|
|
1901
|
+
""
|
|
1902
|
+
],
|
|
1903
|
+
"allowed": false,
|
|
1904
|
+
"note": "an empty Host names nothing"
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
"patterns": "https://zzz.example.com, http://*.fuz.dev:*",
|
|
1908
|
+
"hosts": [
|
|
1909
|
+
"zzz.example.com"
|
|
1910
|
+
],
|
|
1911
|
+
"allowed": true,
|
|
1912
|
+
"note": "a host an allowed origin names passes"
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
"patterns": "https://zzz.example.com, http://*.fuz.dev:*",
|
|
1916
|
+
"hosts": [
|
|
1917
|
+
"ZZZ.example.com"
|
|
1918
|
+
],
|
|
1919
|
+
"allowed": true
|
|
1920
|
+
},
|
|
1921
|
+
{
|
|
1922
|
+
"patterns": "https://zzz.example.com, http://*.fuz.dev:*",
|
|
1923
|
+
"hosts": [
|
|
1924
|
+
"api.fuz.dev:8080"
|
|
1925
|
+
],
|
|
1926
|
+
"allowed": true,
|
|
1927
|
+
"note": "a wildcard entry admits the hosts it admits as origins"
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
"patterns": "https://zzz.example.com, http://*.fuz.dev:*",
|
|
1931
|
+
"hosts": [
|
|
1932
|
+
"zzz.example.com:8443"
|
|
1933
|
+
],
|
|
1934
|
+
"allowed": false,
|
|
1935
|
+
"note": "an entry without a port admits the host without one"
|
|
1936
|
+
},
|
|
1937
|
+
{
|
|
1938
|
+
"patterns": "https://zzz.example.com, http://*.fuz.dev:*",
|
|
1939
|
+
"hosts": [
|
|
1940
|
+
"fuz.dev"
|
|
1941
|
+
],
|
|
1942
|
+
"allowed": false
|
|
1943
|
+
},
|
|
1944
|
+
{
|
|
1945
|
+
"patterns": "http://localhost:*, https://zzz.example.com",
|
|
1946
|
+
"hosts": [
|
|
1947
|
+
"evil.example.com@zzz.example.com"
|
|
1948
|
+
],
|
|
1949
|
+
"allowed": false,
|
|
1950
|
+
"note": "userinfo would reshape the origin"
|
|
1951
|
+
},
|
|
1952
|
+
{
|
|
1953
|
+
"patterns": "http://localhost:*, https://zzz.example.com",
|
|
1954
|
+
"hosts": [
|
|
1955
|
+
"zzz.example.com/x"
|
|
1956
|
+
],
|
|
1957
|
+
"allowed": false,
|
|
1958
|
+
"note": "a path would reshape the origin"
|
|
1959
|
+
},
|
|
1960
|
+
{
|
|
1961
|
+
"patterns": "http://localhost:4460",
|
|
1962
|
+
"hosts": [
|
|
1963
|
+
"localhost:4460",
|
|
1964
|
+
"localhost:4460"
|
|
1965
|
+
],
|
|
1966
|
+
"allowed": false,
|
|
1967
|
+
"note": "more than one Host is refused, even the same one twice"
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
"patterns": "http://localhost:4460",
|
|
1971
|
+
"hosts": [
|
|
1972
|
+
"localhost:4460",
|
|
1973
|
+
"rebind.example.com"
|
|
1974
|
+
],
|
|
1975
|
+
"allowed": false
|
|
1976
|
+
},
|
|
1977
|
+
{
|
|
1978
|
+
"patterns": "http://localhost:4460",
|
|
1979
|
+
"hosts": [
|
|
1980
|
+
"localhost:4460, rebind.example.com"
|
|
1981
|
+
],
|
|
1982
|
+
"allowed": false,
|
|
1983
|
+
"note": "two Hosts joined into one value, as the runtimes join them"
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
"patterns": "http://localhost:4460",
|
|
1987
|
+
"hosts": [
|
|
1988
|
+
"localhost\u0000"
|
|
1989
|
+
],
|
|
1990
|
+
"allowed": false,
|
|
1991
|
+
"note": "a value outside header text is refused"
|
|
1992
|
+
},
|
|
1993
|
+
{
|
|
1994
|
+
"patterns": "http://localhost:4460",
|
|
1995
|
+
"hosts": [
|
|
1996
|
+
"localhost\u007f"
|
|
1997
|
+
],
|
|
1998
|
+
"allowed": false
|
|
1999
|
+
},
|
|
2000
|
+
{
|
|
2001
|
+
"patterns": "http://localhost:4460",
|
|
2002
|
+
"hosts": [
|
|
2003
|
+
"localhost\t"
|
|
2004
|
+
],
|
|
2005
|
+
"allowed": false,
|
|
2006
|
+
"note": "a tab is header text but names no host"
|
|
2007
|
+
}
|
|
1678
2008
|
]
|
|
1679
2009
|
}
|
|
@@ -66,11 +66,11 @@ export interface RustSpineConsumerSurfaceSpecOptions extends RustSpineConsumerRp
|
|
|
66
66
|
/** The backend's session config — its cookie name above all. */
|
|
67
67
|
readonly session_options: SessionOptions<string>;
|
|
68
68
|
/**
|
|
69
|
-
* Whether the server
|
|
70
|
-
* (`fuz_http::StackOptions::host_gate
|
|
71
|
-
* layer
|
|
69
|
+
* Whether the server mounts the spine's host gate
|
|
70
|
+
* (`fuz_http::StackOptions::host_gate`, on by default), declared as the
|
|
71
|
+
* `host` layer `create_test_app_surface_spec` lists.
|
|
72
72
|
*
|
|
73
|
-
* @default
|
|
73
|
+
* @default true
|
|
74
74
|
*/
|
|
75
75
|
readonly host_gate?: boolean;
|
|
76
76
|
}
|
|
@@ -89,8 +89,8 @@ export declare const create_rust_spine_consumer_rpc_endpoints: (options: RustSpi
|
|
|
89
89
|
* on `create_test_app_surface_spec`: the spine routes (health, the account
|
|
90
90
|
* router's paths, signup, and bootstrap as a `surface_only` shape), the RPC
|
|
91
91
|
* endpoint from `create_rust_spine_consumer_rpc_endpoints`, the daemon-token
|
|
92
|
-
* layer every consumer test binary wires, and —
|
|
93
|
-
* `
|
|
92
|
+
* layer every consumer test binary wires, and — unless `host_gate` is
|
|
93
|
+
* `false` — the host gate's `host` layer.
|
|
94
94
|
*
|
|
95
95
|
* @param options - the consumer's session config, action specs, extras and roles
|
|
96
96
|
* @returns the surface spec, for `describe_spine_cross_suites`'s `surface_source`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rust_spine_consumer_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/rust_spine_consumer_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAA6B,MAAM,8BAA8B,CAAC;AAM/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"rust_spine_consumer_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/rust_spine_consumer_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAA6B,MAAM,8BAA8B,CAAC;AAM/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO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../../auth/signup_route_schema.js';
|
|
5
5
|
import { create_standard_rpc_actions } from '../../auth/standard_rpc_actions.js';
|
|
6
6
|
import { create_health_route_spec } from '../../http/common_routes.js';
|
|
7
|
-
import { REST_FORBIDDEN_HOST } from '../../http/error_schemas.js';
|
|
8
7
|
import { prefix_route_specs } from '../../http/route_spec.js';
|
|
9
|
-
import { create_test_app_surface_spec,
|
|
8
|
+
import { create_test_app_surface_spec, stub_route_spec } from '../stubs.js';
|
|
10
9
|
import { SPINE_ACCOUNT_PATH_PREFIX, SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
11
10
|
/**
|
|
12
11
|
* The routes `fuz_auth::account_router` mounts, relative to `/api/account`. An
|
|
@@ -85,8 +84,8 @@ const create_spine_consumer_route_specs = (ctx) => {
|
|
|
85
84
|
* on `create_test_app_surface_spec`: the spine routes (health, the account
|
|
86
85
|
* router's paths, signup, and bootstrap as a `surface_only` shape), the RPC
|
|
87
86
|
* endpoint from `create_rust_spine_consumer_rpc_endpoints`, the daemon-token
|
|
88
|
-
* layer every consumer test binary wires, and —
|
|
89
|
-
* `
|
|
87
|
+
* layer every consumer test binary wires, and — unless `host_gate` is
|
|
88
|
+
* `false` — the host gate's `host` layer.
|
|
90
89
|
*
|
|
91
90
|
* @param options - the consumer's session config, action specs, extras and roles
|
|
92
91
|
* @returns the surface spec, for `describe_spine_cross_suites`'s `surface_source`
|
|
@@ -101,15 +100,5 @@ export const create_rust_spine_consumer_surface_spec = (options) => create_test_
|
|
|
101
100
|
bootstrap: { mode: 'surface_only' },
|
|
102
101
|
// consumer test binaries wire a daemon-token state (production ones don't)
|
|
103
102
|
daemon_token: true,
|
|
104
|
-
|
|
105
|
-
? (specs) => [
|
|
106
|
-
{
|
|
107
|
-
name: 'host_validation',
|
|
108
|
-
path: '*',
|
|
109
|
-
handler: stub_mw,
|
|
110
|
-
errors: [REST_FORBIDDEN_HOST]
|
|
111
|
-
},
|
|
112
|
-
...specs
|
|
113
|
-
]
|
|
114
|
-
: undefined
|
|
103
|
+
host_gate: options.host_gate ?? true
|
|
115
104
|
});
|
|
@@ -17,14 +17,21 @@ import { type RpcAction } from '../../actions/action_types.js';
|
|
|
17
17
|
export declare const TestingOriginCheckInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
18
18
|
patterns: string;
|
|
19
19
|
origin: string | null;
|
|
20
|
+
hosts?: string[] | undefined;
|
|
20
21
|
}, {
|
|
21
22
|
patterns: string;
|
|
22
23
|
origin: string | null;
|
|
24
|
+
hosts?: string[] | undefined;
|
|
23
25
|
}, "object", {
|
|
24
26
|
/** An allowlist value, as `FUZ_ALLOWED_ORIGINS` would carry it. */
|
|
25
27
|
patterns: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
26
28
|
/** One `Origin` header's value, or `null` for a request without one. */
|
|
27
29
|
origin: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
30
|
+
/**
|
|
31
|
+
* The request's `Host` header values (`[]` for none), checked by the host
|
|
32
|
+
* gate (`allows_request_hosts`); absent, the host gate isn't asked.
|
|
33
|
+
*/
|
|
34
|
+
hosts: import("@fuzdev/fuz_schema/schema.ts").Schema<string[] | undefined, string[] | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string[], string[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
|
|
28
35
|
}>;
|
|
29
36
|
export type TestingOriginCheckInput = Infer<typeof TestingOriginCheckInput>;
|
|
30
37
|
/**
|
|
@@ -94,7 +101,8 @@ export type TestingOriginCheckOutput = Infer<typeof TestingOriginCheckOutput>;
|
|
|
94
101
|
/**
|
|
95
102
|
* Answer one `_testing_origin_check` input: parse `patterns` with
|
|
96
103
|
* `parse_allowed_origins`, then run the request-level check for one `Origin`
|
|
97
|
-
* carrying `origin` (`null` — no `Origin` — passes)
|
|
104
|
+
* carrying `origin` (`null` — no `Origin` — passes), and with `hosts` the host
|
|
105
|
+
* gate's check of those `Host` values too. The action handler and
|
|
98
106
|
* the conformance table's unit test both call this, so the table checks the
|
|
99
107
|
* same function the wire serves.
|
|
100
108
|
*
|
|
@@ -129,14 +137,21 @@ export declare const testing_origin_check_action_spec: {
|
|
|
129
137
|
readonly input: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
130
138
|
patterns: string;
|
|
131
139
|
origin: string | null;
|
|
140
|
+
hosts?: string[] | undefined;
|
|
132
141
|
}, {
|
|
133
142
|
patterns: string;
|
|
134
143
|
origin: string | null;
|
|
144
|
+
hosts?: string[] | undefined;
|
|
135
145
|
}, "object", {
|
|
136
146
|
/** An allowlist value, as `FUZ_ALLOWED_ORIGINS` would carry it. */
|
|
137
147
|
patterns: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
138
148
|
/** One `Origin` header's value, or `null` for a request without one. */
|
|
139
149
|
origin: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
150
|
+
/**
|
|
151
|
+
* The request's `Host` header values (`[]` for none), checked by the host
|
|
152
|
+
* gate (`allows_request_hosts`); absent, the host gate isn't asked.
|
|
153
|
+
*/
|
|
154
|
+
hosts: import("@fuzdev/fuz_schema/schema.ts").Schema<string[] | undefined, string[] | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string[], string[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
|
|
140
155
|
}>;
|
|
141
156
|
readonly output: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
142
157
|
ok: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_origin_check.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_origin_check.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;GAWG;AAEH,OAAO,EAaN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"testing_origin_check.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_origin_check.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;GAWG;AAEH,OAAO,EAaN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAU3E,yEAAyE;AACzE,eAAO,MAAM,uBAAuB;;;;;;;;;IACnC,mEAAmE;;IAEnE,wEAAwE;;IAExE;;;OAGG;;EAEF,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWnC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE9E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GACpC,OAAO,uBAAuB,KAC5B,wBAgBF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;QA5E5C,mEAAmE;;QAEnE,wEAAwE;;QAExE;;;WAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiF0C,CAAC;AAE/C,8EAA8E;AAC9E,eAAO,MAAM,kCAAkC,QAAO,SACyC,CAAC"}
|
|
@@ -14,13 +14,19 @@ import '../assert_dev_env.js';
|
|
|
14
14
|
import { array, boolean, literal, min_value, nullable, number, object, optional, pipe, safe_integer, string, union } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
15
|
import { rpc_action } from '../../actions/action_types.js';
|
|
16
16
|
import { AllowedOriginsErrorKind, parse_allowed_origins, should_allow_origin } from '../../http/origin.js';
|
|
17
|
+
import { allows_request_hosts } from '../../http/host.js';
|
|
17
18
|
import { TESTING_ACTION_AUTH } from './spine_surface_constants.js';
|
|
18
19
|
/** Input of `_testing_origin_check`, a `@fuzdev/fuz_schema` `object`. */
|
|
19
20
|
export const TestingOriginCheckInput = object({
|
|
20
21
|
/** An allowlist value, as `FUZ_ALLOWED_ORIGINS` would carry it. */
|
|
21
22
|
patterns: string,
|
|
22
23
|
/** One `Origin` header's value, or `null` for a request without one. */
|
|
23
|
-
origin: nullable(string)
|
|
24
|
+
origin: nullable(string),
|
|
25
|
+
/**
|
|
26
|
+
* The request's `Host` header values (`[]` for none), checked by the host
|
|
27
|
+
* gate (`allows_request_hosts`); absent, the host gate isn't asked.
|
|
28
|
+
*/
|
|
29
|
+
hosts: optional(array(string))
|
|
24
30
|
});
|
|
25
31
|
/**
|
|
26
32
|
* Output of `_testing_origin_check`, a `@fuzdev/fuz_schema` `union`: the
|
|
@@ -40,7 +46,8 @@ export const TestingOriginCheckOutput = union([
|
|
|
40
46
|
/**
|
|
41
47
|
* Answer one `_testing_origin_check` input: parse `patterns` with
|
|
42
48
|
* `parse_allowed_origins`, then run the request-level check for one `Origin`
|
|
43
|
-
* carrying `origin` (`null` — no `Origin` — passes)
|
|
49
|
+
* carrying `origin` (`null` — no `Origin` — passes), and with `hosts` the host
|
|
50
|
+
* gate's check of those `Host` values too. The action handler and
|
|
44
51
|
* the conformance table's unit test both call this, so the table checks the
|
|
45
52
|
* same function the wire serves.
|
|
46
53
|
*
|
|
@@ -57,7 +64,8 @@ export const run_testing_origin_check = (input) => {
|
|
|
57
64
|
}
|
|
58
65
|
return {
|
|
59
66
|
ok: true,
|
|
60
|
-
allowed: input.origin === null || should_allow_origin(input.origin, parsed.origins)
|
|
67
|
+
allowed: (input.origin === null || should_allow_origin(input.origin, parsed.origins)) &&
|
|
68
|
+
(input.hosts === undefined || allows_request_hosts(input.hosts, parsed.origins))
|
|
61
69
|
};
|
|
62
70
|
};
|
|
63
71
|
/**
|
|
@@ -84,7 +92,7 @@ export const testing_origin_check_action_spec = {
|
|
|
84
92
|
output: TestingOriginCheckOutput,
|
|
85
93
|
async: true,
|
|
86
94
|
description: "Test-binary only — answer the origin allowlist's parse and request check for one " +
|
|
87
|
-
'{patterns, origin}
|
|
95
|
+
'{patterns, origin, hosts?} input, for the cross-impl origin conformance table.'
|
|
88
96
|
};
|
|
89
97
|
/** Build the standalone `_testing_origin_check` action (see the spec doc). */
|
|
90
98
|
export const create_testing_origin_check_action = () => rpc_action(testing_origin_check_action_spec, async (input) => run_testing_origin_check(input));
|
|
@@ -172,7 +172,7 @@ export interface StartTestingServerOptions {
|
|
|
172
172
|
* interface IP — e.g. `--host 192.168.1.50` — would otherwise slip through.
|
|
173
173
|
* Covers `localhost`, the IPv4 loopback `127.0.0.0/8`, and IPv6 `::1`.
|
|
174
174
|
*/
|
|
175
|
-
export declare const
|
|
175
|
+
export declare const is_loopback_bind_host: (host: string) => boolean;
|
|
176
176
|
/**
|
|
177
177
|
* Boot a test-mode server using the supplied runtime adapter.
|
|
178
178
|
*
|
|
@@ -181,7 +181,7 @@ export declare const is_loopback_host: (host: string) => boolean;
|
|
|
181
181
|
* caller's no-domain (or domain) `StartTestingServerOptions.build_app`
|
|
182
182
|
* and the runtime boundary is the `TestingServerAdapter`. Refuses any
|
|
183
183
|
* non-loopback bind host (the test binary must stay on loopback — see
|
|
184
|
-
* `
|
|
184
|
+
* `is_loopback_bind_host`).
|
|
185
185
|
*/
|
|
186
186
|
export declare const start_testing_server: (options: StartTestingServerOptions) => Promise<void>;
|
|
187
187
|
//# sourceMappingURL=testing_server_core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_server_core.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,iFAAiF;IACjF,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,4DAA4D;AAC5D,MAAM,WAAW,uBAAuB;IACvC;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IACjC,wBAAwB,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,gBAAgB,CAAC;IAC1D,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CACjD;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB,0FAA0F;IAC1F,OAAO,EAAE,WAAW,CAAC;IACrB,6DAA6D;IAC7D,iBAAiB,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAA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,CAAC,EAAE,UAAU,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"testing_server_core.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,iFAAiF;IACjF,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,4DAA4D;AAC5D,MAAM,WAAW,uBAAuB;IACvC;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IACjC,wBAAwB,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,gBAAgB,CAAC;IAC1D,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CACjD;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB,0FAA0F;IAC1F,OAAO,EAAE,WAAW,CAAC;IACrB,6DAA6D;IAC7D,iBAAiB,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;IACtD,8EAA8E;IAC9E,iBAAiB,EAAE,CAAC,OA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QG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,OAGpD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAU,SAAS,yBAAyB,KAAG,OAAO,CAAC,IAAI,CAkE3F,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { write_daemon_info, read_daemon_info, is_daemon_running } from '../daemo
|
|
|
10
10
|
* interface IP — e.g. `--host 192.168.1.50` — would otherwise slip through.
|
|
11
11
|
* Covers `localhost`, the IPv4 loopback `127.0.0.0/8`, and IPv6 `::1`.
|
|
12
12
|
*/
|
|
13
|
-
export const
|
|
13
|
+
export const is_loopback_bind_host = (host) => {
|
|
14
14
|
const h = host.replace(/^\[(.*)\]$/, '$1'); // unwrap an `[::1]`-style IPv6 literal
|
|
15
15
|
return h === 'localhost' || h === '::1' || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(h);
|
|
16
16
|
};
|
|
@@ -22,13 +22,13 @@ export const is_loopback_host = (host) => {
|
|
|
22
22
|
* caller's no-domain (or domain) `StartTestingServerOptions.build_app`
|
|
23
23
|
* and the runtime boundary is the `TestingServerAdapter`. Refuses any
|
|
24
24
|
* non-loopback bind host (the test binary must stay on loopback — see
|
|
25
|
-
* `
|
|
25
|
+
* `is_loopback_bind_host`).
|
|
26
26
|
*/
|
|
27
27
|
export const start_testing_server = async (options) => {
|
|
28
28
|
const { adapter, daemon_name, host, port, app_version, build_app } = options;
|
|
29
29
|
const log = options.log ?? new Logger(`[${daemon_name}]`);
|
|
30
30
|
const { runtime } = adapter;
|
|
31
|
-
if (!
|
|
31
|
+
if (!is_loopback_bind_host(host)) {
|
|
32
32
|
log.error(`FATAL: binding to '${host}' exposes the test binary (which ships deterministic ` +
|
|
33
33
|
`dev secrets) beyond loopback. Use --host localhost (default), 127.0.0.1, or ::1 instead.`);
|
|
34
34
|
adapter.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws_envelope.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/ws_envelope.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA8C9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AACzD,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ws_envelope.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/ws_envelope.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA8C9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AACzD,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAe1E,4DAA4D;AAC5D,MAAM,WAAW,0BAA2B,SAAQ,gBAAgB;IACnE,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,6FAA6F;IAC7F,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;CAC3C;AA+ED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,GAAI,SAAS,0BAA0B,KAAG,IAoFtF,CAAC"}
|