@simplelayer/graniteer-core 0.3.6 → 0.3.7
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.
|
@@ -17,6 +17,24 @@ const corsHeaders = {
|
|
|
17
17
|
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
|
|
18
18
|
};
|
|
19
19
|
const TIMEOUT_MS = 20_000;
|
|
20
|
+
// D32 item #3 (2026-09-23): a two-pin grant's UniFi collision-retry logic
|
|
21
|
+
// can, in the corrected worst case, take up to ~65-70s inside ftw-middleware
|
|
22
|
+
// alone (one wall-clock-budget-gated retry attempt can itself make up to 3
|
|
23
|
+
// UniFi calls before the budget check ever gets a chance to abort it -- see
|
|
24
|
+
// event_access.py's _TWO_PIN_PROVISION_BUDGET_SEC comment for the full
|
|
25
|
+
// derivation). The original 20s TIMEOUT_MS fired long before the middleware
|
|
26
|
+
// could ever return a real (success or definitive-failure) response for a
|
|
27
|
+
// grant, forcing staff to see a spurious 502 middleware_unreachable while
|
|
28
|
+
// the middleware kept working in the background -- wasting a minted PIN and
|
|
29
|
+
// requiring a manual Revoke+Grant. GRANT_TIMEOUT_MS gives grant-only
|
|
30
|
+
// headroom (95s) that sits comfortably above ftw-middleware's own
|
|
31
|
+
// _GRANT_HANDLER_TIMEOUT_SEC (85s, itself raised in the same pass to clear
|
|
32
|
+
// the corrected worst case) while staying under the Cloudflare Tunnel
|
|
33
|
+
// edge's own ~100s proxied-HTTP limit for ftw.granitecity.io -- past that,
|
|
34
|
+
// Cloudflare cuts the connection with a 524 regardless of what this signal
|
|
35
|
+
// says, so there is no point setting this any higher. door/revoke keep the
|
|
36
|
+
// original 20s: neither has a retry loop and both should fail fast.
|
|
37
|
+
const GRANT_TIMEOUT_MS = 95_000;
|
|
20
38
|
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
21
39
|
const JWKS_URL_SUFFIX = '/auth/v1/.well-known/jwks.json';
|
|
22
40
|
let jwksCache = null;
|
|
@@ -226,7 +244,7 @@ export function createEventAccessAdminHandler(config) {
|
|
|
226
244
|
'X-Event-Access-Timestamp': ts,
|
|
227
245
|
},
|
|
228
246
|
body: rawBody,
|
|
229
|
-
signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
247
|
+
signal: AbortSignal.timeout(action === 'grant' ? GRANT_TIMEOUT_MS : TIMEOUT_MS),
|
|
230
248
|
});
|
|
231
249
|
}
|
|
232
250
|
catch (e) {
|