on master help sign in
Remove export workaround from rateLimit definitions; compiler bug fixed
7f6069aiko
server.knot+2−4
@@ -254,9 +254,7 @@ type ForwardFailure = {server: Text, failedAt: Timestamp, failures: Int, firstFa
254
254
255-- Per-pubkey token bucket on /auth/challenge: prevents one key from
255-- Per-pubkey token bucket on /auth/challenge: prevents one key from
256-- exhausting the challenge pool by repeated nonce requests.
256-- exhausting the challenge pool by repeated nonce requests.
257−-- (`export` is a workaround for a compiler bug where the unused-name pass
258−-- doesn't walk route `rateLimit` clauses.)
259−export challengeRateLimit = {
257+challengeRateLimit = {
260 key: \input ctx -> Just {value: input.pubkey},
258 key: \input ctx -> Just {value: input.pubkey},
261 limit: {requests: maxChallengeRatePerKey, window: challengeRateWindowMs}
259 limit: {requests: maxChallengeRatePerKey, window: challengeRateWindowMs}
262}
260}
@@ -264,7 +262,7 @@ export challengeRateLimit = {
264-- Per-session token bucket on /messages, keyed by the Bearer token. A pubkey
262-- Per-session token bucket on /messages, keyed by the Bearer token. A pubkey
265-- is capped at `maxSessionsPerKey` live sessions, so the effective per-pubkey
263-- is capped at `maxSessionsPerKey` live sessions, so the effective per-pubkey
266-- send budget is bounded as well.
264-- send budget is bounded as well.
267−export sendRateLimit = {
265+sendRateLimit = {
268 key: \input ctx -> Just {value: input.authorization},
266 key: \input ctx -> Just {value: input.authorization},
269 limit: {requests: maxSendRatePerKey, window: sendRateWindowMs}
267 limit: {requests: maxSendRatePerKey, window: sendRateWindowMs}
270}
268}