You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(auth): fail open when the rate-limit Durable Object errors (#5000) (#5041)
enforceRateLimit runs as global middleware ahead of every route's own
try/catch, and no app.onError is registered anywhere -- an uncaught
Durable Object hiccup (eviction, migration, a rolling-deploy blip)
escaped as Hono's bare, unstructured 500 for whatever route the
caller happened to be hitting. Traced the 95 orb_broker_unavailable
(500) events back to this middleware, not the /v1/orb/token handler
itself: that handler and its DB-touching helpers were already
hardened by the earlier #orb-broker-500 fix, but this shared
rate-limit check ran ahead of it, unguarded, for every route. Fail
open on both the DO check and its 429-denial audit write -- the rate
limiter protects the app, it must not crash the request it's gating.
it("REGRESSION (#5000): fails OPEN when the rate-limit Durable Object itself throws, instead of crashing the request with a bare framework 500",async()=>{
expect(errors.mock.calls.some(([line])=>typeofline==="string"&&line.includes("rate_limit_check_failed")&&line.includes("not an Error instance"))).toBe(true);
524
+
errors.mockRestore();
525
+
});
526
+
527
+
it("REGRESSION (#5000): a failed rate_limit.denied audit write does not stop the 429 itself from reaching the caller",async()=>{
expect(warnings.mock.calls.some(([line])=>typeofline==="string"&&line.includes("rate_limit_denied_audit_failed")&&line.includes("not an Error instance"))).toBe(true);
558
+
warnings.mockRestore();
559
+
});
560
+
482
561
it("starts GitHub device flow and rejects malformed provider responses",async()=>{
0 commit comments