/** * @module @arcis/node/sanitizers/jsonp * JSONP callback sanitization to prevent XSS via callback parameters */ /** * Validates and sanitizes a JSONP callback parameter. * * Returns the callback name if safe, or null if the callback is dangerous. * Use this to validate `?callback=` query parameters before wrapping responses. * * @param callback - The callback parameter value * @param maxLength - Maximum allowed length (default: 128) * @returns The safe callback name, or null if invalid * * @example * ```ts * const cb = sanitizeJsonpCallback(req.query.callback); * if (cb) { * res.set('Content-Type', 'application/javascript'); * res.send(`${cb}(${JSON.stringify(data)})`); * } else { * res.status(400).json({ error: 'Invalid callback' }); * } * ``` */ export declare function sanitizeJsonpCallback(callback: string, maxLength?: number): string | null; /** * Checks if a JSONP callback parameter contains potentially dangerous content. * * @param callback - The callback parameter value * @returns True if the callback is dangerous / invalid */ export declare function detectJsonpInjection(callback: string): boolean; //# sourceMappingURL=jsonp.d.ts.map