MCP site tools, Turnstile key alert, required 2FA injection, a11y, more tests
- MCP: new get_site_info and list_pages tools (public by design, published
and indexable content only); search results collapse the homepage to root.
New listContent() helper shared with searchContent.
- Dashboard alert when Turnstile is half-configured (it is silently off then).
- twoFactor.plugin is now required; the dynamic-import fallback (which never
worked under Next and caused a Turbopack warning) is gone.
- a11y: cookie category checkboxes are labelled, buttons have type, test-email
input is labelled; tab labels keep localized collection labels.
- IPAL_IP_HEADER: one-time production warning when unset, opt-in
ipalEnvRules({ ipHeader: true }).
- Tests: SEO/robots/sitemap/hreflang, CSP, Markdown, consent, MCP, and a real
Payload + SQLite integration test for forms and the roles guard (74 total).
- Drop unused mongodb-memory-server; dev .env.example for SQLite.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -167,9 +167,19 @@ export type ClientIpOptions = {
|
||||
* Empty string when nothing usable is present — the limiter then lets the
|
||||
* request through.
|
||||
*/
|
||||
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
|
||||
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 ' +
|
||||
'(behind Cloudflare) or x-forwarded-for (behind Traefik/nginx only).',
|
||||
)
|
||||
}
|
||||
if (pinned) {
|
||||
const value = h.get(pinned)
|
||||
if (!value) {return ''}
|
||||
|
||||
Reference in New Issue
Block a user