my-durable 0.0.66 → 0.0.68
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/apps/dpi-backend/src/gc-cli.ts +87 -10
- package/apps/dpi-backend/src/gc.ts +9 -3
- package/apps/dpi-backend/src/pairing.ts +65 -25
- package/apps/dpi-backend/src/routes.ts +19 -1
- package/apps/dpi-backend/src/store.ts +7 -3
- package/apps/dpi-backend/src/telegram.ts +83 -11
- package/apps/dpi-backend/src/tunnel.ts +7 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/{index-d3YKeCCM.js → index-CpNu1wqa.js} +23 -23
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/index.html +1 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/src/client/hub.ts +16 -1
- package/apps/dpi-playground/apps/dpi-playground-hub/src/limiter.ts +22 -0
- package/apps/dpi-playground/apps/dpi-playground-hub/src/pairing.ts +38 -2
- package/apps/dpi-playground/apps/dpi-playground-hub/src/proxy.ts +23 -7
- package/apps/dpi-playground/apps/dpi-playground-hub/src/transport.ts +7 -0
- package/apps/dpi-playground/apps/dpi-playground-hub/src/tunnel-transport.ts +3 -0
- package/apps/dpi-sdk/src/client.ts +6 -0
- package/apps/dpi-sdk/src/protocol/limits.ts +5 -2
- package/apps/dpi-sdk/src/protocol/tunnel.ts +4 -0
- package/apps/dpi-tui/src/app.ts +10 -4
- package/apps/dpi-tui/src/render.ts +19 -9
- package/apps/dpi-tui/src/sanitize.ts +16 -0
- package/apps/dpi-tui/src/views.ts +25 -13
- package/deploy/Caddyfile +53 -12
- package/package.json +1 -1
package/deploy/Caddyfile
CHANGED
|
@@ -8,12 +8,18 @@
|
|
|
8
8
|
# DPI_ADMIN_HASH bcrypt hash for the single admin user (caddy hash-password;
|
|
9
9
|
# the PLAINTEXT never lives in this repo or in env logs)
|
|
10
10
|
#
|
|
11
|
-
# Auth matrix (05):
|
|
12
|
-
# exempt (exact path
|
|
13
|
-
# POST /api/pair/verify ·
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
11
|
+
# Auth matrix (05) — the exemption set is EXACT and EXHAUSTIVE:
|
|
12
|
+
# exempt (exact path+method): GET /healthz · POST /api/pair/start ·
|
|
13
|
+
# POST /api/pair/verify · POST /api/pair/request (device-initiated
|
|
14
|
+
# enrollment — the device holds no Basic credential by design) ·
|
|
15
|
+
# GET /share/* (public capability page — the 18-byte token IS the boundary) ·
|
|
16
|
+
# GET /api/tunnel (WS upgrade) — everything else — including WRONG METHODS
|
|
17
|
+
# on the exempt paths — requires HTTP Basic auth, and the Authorization
|
|
18
|
+
# header is STRIPPED before the hub so device tokens and admin credentials
|
|
19
|
+
# can never mix. The final handle is a matcher-less CATCH-ALL so no request
|
|
20
|
+
# class falls through to Caddy's anonymous empty-200 default (audit run-1:
|
|
21
|
+
# admin-matcher method-gap). Client-supplied XFF/XFP are overwritten from
|
|
22
|
+
# the real connection.
|
|
17
23
|
{
|
|
18
24
|
admin off
|
|
19
25
|
auto_https off
|
|
@@ -50,11 +56,13 @@ https://{$DPI_PUBLIC_HOST} {
|
|
|
50
56
|
# Do not "harden" this file by adding one; the harness also runs without
|
|
51
57
|
# Caddy, so the hub must be correct on its own either way.
|
|
52
58
|
|
|
53
|
-
# Admin surface = everything except the
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
# Admin surface = everything except the exact exemptions below. The final
|
|
60
|
+
# handle is a matcher-less catch-all: wrong-method requests on exempt paths
|
|
61
|
+
# land here (Basic challenge), never in Caddy's empty-200 default.
|
|
62
|
+
@tunnel {
|
|
63
|
+
method GET
|
|
64
|
+
path /api/tunnel
|
|
56
65
|
}
|
|
57
|
-
@tunnel path /api/tunnel
|
|
58
66
|
@pairstart {
|
|
59
67
|
method POST
|
|
60
68
|
path /api/pair/start
|
|
@@ -63,6 +71,14 @@ https://{$DPI_PUBLIC_HOST} {
|
|
|
63
71
|
method POST
|
|
64
72
|
path /api/pair/verify
|
|
65
73
|
}
|
|
74
|
+
@pairrequest {
|
|
75
|
+
method POST
|
|
76
|
+
path /api/pair/request
|
|
77
|
+
}
|
|
78
|
+
@share {
|
|
79
|
+
method GET
|
|
80
|
+
path /share/*
|
|
81
|
+
}
|
|
66
82
|
@healthz {
|
|
67
83
|
method GET
|
|
68
84
|
path /healthz
|
|
@@ -97,6 +113,29 @@ https://{$DPI_PUBLIC_HOST} {
|
|
|
97
113
|
}
|
|
98
114
|
}
|
|
99
115
|
|
|
116
|
+
# Device-initiated enrollment (audit run-1: exemption drift): the machine
|
|
117
|
+
# running `dpi pair --hub` holds no Basic credential BY DESIGN — the hub
|
|
118
|
+
# guards this route with per-IP limits, failure windows and the device-mint
|
|
119
|
+
# sub-cap; approval stays the only issuance gate.
|
|
120
|
+
handle @pairrequest {
|
|
121
|
+
reverse_proxy {$DPI_HUB_ADDR} {
|
|
122
|
+
header_up X-Forwarded-For {remote_host}
|
|
123
|
+
header_up X-Forwarded-Proto https
|
|
124
|
+
header_up -Authorization
|
|
125
|
+
flush_interval -1
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# Public share page (audit run-1: exemption drift): the tokenized link is
|
|
130
|
+
# the designed boundary; the page is server-side rendered with zero scripts.
|
|
131
|
+
handle @share {
|
|
132
|
+
reverse_proxy {$DPI_HUB_ADDR} {
|
|
133
|
+
header_up X-Forwarded-For {remote_host}
|
|
134
|
+
header_up X-Forwarded-Proto https
|
|
135
|
+
header_up -Authorization
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
100
139
|
handle @healthz {
|
|
101
140
|
reverse_proxy {$DPI_HUB_ADDR} {
|
|
102
141
|
header_up X-Forwarded-For {remote_host}
|
|
@@ -105,8 +144,10 @@ https://{$DPI_PUBLIC_HOST} {
|
|
|
105
144
|
}
|
|
106
145
|
}
|
|
107
146
|
|
|
108
|
-
# Everything else
|
|
109
|
-
|
|
147
|
+
# Everything else — every non-exempt path AND every wrong-method request
|
|
148
|
+
# on an exempt path: basic auth, then STRIP Authorization before the hub.
|
|
149
|
+
# Matcher-less = exhaustive (audit run-1: method-gap fallthrough).
|
|
150
|
+
handle {
|
|
110
151
|
basic_auth {
|
|
111
152
|
admin {$DPI_ADMIN_HASH}
|
|
112
153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-durable",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.68",
|
|
4
4
|
"description": "Durable Pi — the durable agent network: hub web UI, device backend daemon, TUI admin and the shared SDK, packaged as one runnable monorepo install",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|