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/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/method): GET /healthz · POST /api/pair/start ·
13
- # POST /api/pair/verify · GET /api/tunnel (WS) — everything else requires
14
- # HTTP Basic auth, and the Authorization header is STRIPPED before the hub
15
- # so device tokens and admin credentials can never mix. Client-supplied
16
- # XFF/XFP are overwritten from the real connection.
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 four exact exemptions below.
54
- @admin {
55
- not path /api/tunnel /api/pair/start /api/pair/verify /healthz
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: basic auth, then STRIP Authorization before the hub.
109
- handle @admin {
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.66",
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": {