import type { Filter } from "../lib/modules/Lightweight-Directory-Access-Protocol-V3/Filter.ta.mjs"; /** * @summary Normalizes a Filter (mostly) as specified in ITU Recommendation X.501 (2019), Annex Q. * @description * * This function deviates from the rules described in Annex Q because following * those rules would open up an attack vector for denial-of-service, since the * normalization of boolean filter according to them could result in a * combinatorial explosion of new filters. * * This is the particular simplification that is dangerous: * * - "and { or {x,y,z}, p, q} is the same as or { and {x,p,q}, and {y,p,q}, and {z,p,q} }" * * The number of subfilters in the inner `or` is multiplied by all the other * subfilters in the `and`, which themselves may also be `or` subfilters. This * is handled by capping the number of filters that may be produced from such a * transformation. If the number exceeds this cap, the filter is left unchanged, * which means that this function may return a filter that is not perfectly * normalized. * * These are also a little dangerous: * * - "not { and {x,y,z} } is the same as or { not {x}, not {y}, not {z}}" doubles * the number of filters within the inner `and`, although it subtracts by one. * - "not { or {x,y,z} } is the same as and { not {x}, not {y}, not {z} }" does * the same. * * These normalizations are fine, because they do not produce more filters: * * - "not { not {x}} is the same as x" * - "and { and {x,y,z}, p, q } is the same as and { x,y,z,p,q }" * - "or { or {x,y,z}, p, q } is the same as or { x,y,z,p,q }" * * @param filter The filter to be normalized. * @param recursionTTL The recursion "time-to-live" hops: this number is * decremented with each function invocation. If it reaches zero, recursion * stops: no normalization occurs deeper beneath this. This is to prevent stack * overflows from maliciously huge filters. Defaults to 20. * @returns A normalized filter. * * @function */ export declare function normalizeFilter(filter: Filter, recursionTTL?: number): Filter; export default normalizeFilter; //# sourceMappingURL=normalizeFilter.d.mts.map