IAPL rename, scripted: preferred names in src, bin, scripts, services, tests; bin files and skill folders moved
Replaced by an explicit list of forms only (ten exported names, runtime env names, project file names and marks, commands, skill names, the log prefix, the brand in prose). Package name, import paths, routes, CSS tokens, data attributes, custom keys, context flags, the cookie and kv keys are not touched. package.json keeps the five old bin names beside the five new ones. The old names stop working in this commit and come back as aliases in the next; docs follow. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
414a4702df
commit
0a4f001797
@@ -23,7 +23,7 @@ export function createDailyPurge(collection: string) {
|
||||
.then(() => payload.db.deleteMany({ collection: collection as never, where }))
|
||||
.catch((err: unknown) => {
|
||||
lastPurge = 0
|
||||
payload.logger.error(`[ipal] ${collection} retention purge failed: ${err instanceof Error ? err.message : String(err)}`)
|
||||
payload.logger.error(`[iapl] ${collection} retention purge failed: ${err instanceof Error ? err.message : String(err)}`)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ type CheckArgs = { cost?: number } & RateLimitArgs
|
||||
|
||||
/**
|
||||
* Requests with no usable client IP (a proxy that strips the header, a
|
||||
* misconfigured IPAL_IP_HEADER) share one bucket with a roomier limit. Letting
|
||||
* misconfigured IAPL_IP_HEADER) share one bucket with a roomier limit. Letting
|
||||
* them through unlimited meant a client that simply omits the header walked
|
||||
* past every limiter; one shared bucket keeps real visitors flowing while
|
||||
* capping the flood.
|
||||
@@ -153,7 +153,7 @@ export async function consumeRateLimit({
|
||||
try {
|
||||
bucket = await store.hit(id, cost, windowMs)
|
||||
} catch (err) {
|
||||
console.warn('[ipal] rate limit store failed, allowing request:', err instanceof Error ? err.message : err)
|
||||
console.warn('[iapl] rate limit store failed, allowing request:', err instanceof Error ? err.message : err)
|
||||
return { ok: true, retryAfter: 0 }
|
||||
}
|
||||
} else {
|
||||
@@ -173,7 +173,7 @@ export function retryAfterSeconds(key: string, scope = 'form'): number {
|
||||
export type ClientIpOptions = {
|
||||
/**
|
||||
* Read the IP from this header only (e.g. 'cf-connecting-ip' behind
|
||||
* Cloudflare, 'x-real-ip' behind nginx). Falls back to the IPAL_IP_HEADER env
|
||||
* Cloudflare, 'x-real-ip' behind nginx). Falls back to the IAPL_IP_HEADER env
|
||||
* var. Pin it in production: without it the headers below are tried in turn,
|
||||
* and a client that reaches the app directly could set any of them.
|
||||
*/
|
||||
@@ -203,12 +203,12 @@ let warnedUnpinned = false
|
||||
|
||||
export function clientIp(source: Headers | Request, options: ClientIpOptions = {}): string {
|
||||
const h = source instanceof Headers ? source : source.headers
|
||||
const pinned = options.header ?? process.env.IPAL_IP_HEADER
|
||||
const pinned = options.header ?? process.env.IAPL_IP_HEADER
|
||||
if (!pinned && !warnedUnpinned && process.env.NODE_ENV === 'production') {
|
||||
warnedUnpinned = true
|
||||
console.warn(
|
||||
'[ipal] IPAL_IP_HEADER is not set — the rate limit trusts whichever IP header a request carries, ' +
|
||||
'so a client reaching the app directly can spoof it. Set IPAL_IP_HEADER=cf-connecting-ip ' +
|
||||
'[iapl] IAPL_IP_HEADER is not set — the rate limit trusts whichever IP header a request carries, ' +
|
||||
'so a client reaching the app directly can spoof it. Set IAPL_IP_HEADER=cf-connecting-ip ' +
|
||||
'(behind Cloudflare) or x-forwarded-for (behind Traefik/nginx only).',
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user