@fuzdev/fuz_app 0.171.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/http/CLAUDE.md +2 -1
- 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/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/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 +5 -6
- 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/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
|
@@ -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,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAI3E;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,wDAAyD,CAAC;AAK3F,8DAA8D;AAC9D,MAAM,WAAW,oCAAoC;IACpD;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC7D;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IACzE,yFAAyF;IACzF,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjD,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,6DAA6D;AAC7D,MAAM,WAAW,mCAAoC,SAAQ,oCAAoC;IAChG,gEAAgE;IAChE,QAAQ,CAAC,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACjD;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wCAAwC,GACpD,SAAS,oCAAoC,KAC3C,CAAC,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,eAAe,CAAC,CA+BpD,CAAC;AAiCF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uCAAuC,GACnD,SAAS,mCAAmC,KAC1C,cAUA,CAAC"}
|
|
@@ -4,9 +4,8 @@ import { account_status_route_shape, create_account_route_shapes } from '../../a
|
|
|
4
4
|
import { create_signup_route_shape } from '../../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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E;AACxE,MAAM,WAAW,sBAAsB;IACtC;;;;;;;;OAQG;IACH,iBAAiB,EAAE,CAAC,OAAO,CAAC,EAAE,uBAAuB,KAAK,CAAC,GAAG,EAAE,IAAI,KAAK,gBAAgB,CAAC;CAC1F;AAED,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC/B,mFAAmF;IACnF,GAAG,EAAE,IAAI,CAAC;IACV;;;;OAIG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,0CAA0C;AAC1C,MAAM,WAAW,yBAAyB;IACzC,+CAA+C;IAC/C,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACzE,0EAA0E;IAC1E,GAAG,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;;;;;;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G;IACH,iBAAiB,EAAE,CAAC,OAAO,CAAC,EAAE,uBAAuB,KAAK,CAAC,GAAG,EAAE,IAAI,KAAK,gBAAgB,CAAC;CAC1F;AAED,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC/B,mFAAmF;IACnF,GAAG,EAAE,IAAI,CAAC;IACV;;;;OAIG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,0CAA0C;AAC1C,MAAM,WAAW,yBAAyB;IACzC,+CAA+C;IAC/C,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACzE,0EAA0E;IAC1E,GAAG,CAAC,EAAE,UAAU,CAAC;CACjB;AAED;;;;;;;;GAQG;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);
|
package/dist/testing/stubs.d.ts
CHANGED
|
@@ -225,6 +225,12 @@ export interface CreateTestAppSurfaceSpecOptions {
|
|
|
225
225
|
* read: the spec's handler here is a stub.
|
|
226
226
|
*/
|
|
227
227
|
max_body_size?: number | null;
|
|
228
|
+
/**
|
|
229
|
+
* Symmetric with `AppServerOptions.host_gate` — `false` leaves out the host
|
|
230
|
+
* gate's spec, so the stub surface matches a server built without it.
|
|
231
|
+
* Defaults to `true`.
|
|
232
|
+
*/
|
|
233
|
+
host_gate?: boolean;
|
|
228
234
|
}
|
|
229
235
|
/**
|
|
230
236
|
* Create an `AppSurfaceSpec` for the standard testing suites.
|
|
@@ -244,9 +250,10 @@ export interface CreateTestAppSurfaceSpecOptions {
|
|
|
244
250
|
* middleware's scope (`assert_endpoint_in_auth_scope`), of a route that
|
|
245
251
|
* reads or mints a credential outside it
|
|
246
252
|
* (`assert_credential_routes_in_auth_scope`), and of a
|
|
247
|
-
* `transform_middleware` that doesn't keep the proxy and auth stack
|
|
248
|
-
* (`assert_middleware_stack_mounted`). The middleware list mirrors the
|
|
249
|
-
* one:
|
|
253
|
+
* `transform_middleware` that doesn't keep the host gate, proxy and auth stack
|
|
254
|
+
* mounted (`assert_middleware_stack_mounted`). The middleware list mirrors the
|
|
255
|
+
* real one: the host gate's shape at `'*'` (unless `host_gate` is `false`), a
|
|
256
|
+
* stub `trusted_proxy` spec at `'*'`, then the stub auth stack (with
|
|
250
257
|
* `daemon_token` when `options.daemon_token` is set). If
|
|
251
258
|
* `create_app_server` changes how it wires routes, update this helper
|
|
252
259
|
* to stay in sync (single source of truth for all consumers). The body
|
|
@@ -259,7 +266,7 @@ export interface CreateTestAppSurfaceSpecOptions {
|
|
|
259
266
|
* credential, is outside `AUTH_MIDDLEWARE_PATH`, a
|
|
260
267
|
* `ws_endpoints` spec declares no `allowed_origins` and no `allowed_origins`
|
|
261
268
|
* option is given, or `transform_middleware` moves, drops, duplicates,
|
|
262
|
-
* reorders, wraps, or replaces the stub proxy
|
|
269
|
+
* reorders, wraps, or replaces the stub host gate, proxy or auth spec
|
|
263
270
|
*/
|
|
264
271
|
export declare const create_test_app_surface_spec: (options: CreateTestAppSurfaceSpecOptions) => AppSurfaceSpec;
|
|
265
272
|
//# sourceMappingURL=stubs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stubs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/stubs.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"stubs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/stubs.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