Opt-outs for the secure defaults; isPathVisibleIn in construction/logic
- setUnknownIpFactor (0 = old free pass), UNKNOWN_IP_FACTOR exported
- createContentHelpers({ settingsDepth }) and markdown/mcp isPathVisible overrides
- <RenderRichText safeLinks={false}>
- resolveRedirect({ draft: true }) for preview
- isPathVisibleIn(mode, path), pathOf, PathVisibility exported; page route uses it
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4585e0fc69
commit
0fd57c1d6a
@@ -5,6 +5,7 @@ import {
|
||||
clientIp,
|
||||
consumeRateLimit,
|
||||
setRateLimitStore,
|
||||
setUnknownIpFactor,
|
||||
UNKNOWN_IP_FACTOR,
|
||||
} from '../src/modules/shared/rateLimit.js'
|
||||
|
||||
@@ -65,6 +66,13 @@ describe('checkRateLimit (in memory)', () => {
|
||||
expect(checkRateLimit({ cost: 4, key: `k-${Math.random()}`, max: 3 })).toBe(false)
|
||||
})
|
||||
|
||||
test('setUnknownIpFactor(0) restores the old free pass; the default comes back', () => {
|
||||
setUnknownIpFactor(0)
|
||||
expect(checkRateLimit({ key: '', max: 0, scope: `z-${Math.random()}` })).toBe(true)
|
||||
setUnknownIpFactor(UNKNOWN_IP_FACTOR)
|
||||
expect(checkRateLimit({ key: '', max: 0, scope: `z-${Math.random()}` })).toBe(false)
|
||||
})
|
||||
|
||||
test('no key → one shared bucket with a roomier limit, not a free pass', () => {
|
||||
const scope = `s-${Math.random()}`
|
||||
for (let i = 0; i < 2 * UNKNOWN_IP_FACTOR; i++) {expect(checkRateLimit({ key: '', max: 2, scope })).toBe(true)}
|
||||
|
||||
Reference in New Issue
Block a user