/* * Copyright: 2026 Contrast Security, Inc * Contact: support@contrastsecurity.com * License: Commercial * NOTICE: This Software and the patented inventions embodied within may only be * used as part of Contrast Security’s commercial offerings. Even though it is * made available through public repositories, use of this Software is subject to * the applicable End User Licensing Agreement found at * https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed * between Contrast Security and the End User. The Software may not be reverse * engineered, modified, repackaged, sold, redistributed or otherwise used in a * way not consistent with the End User License Agreement. */ import { Rule, ConfigurationRule } from '@contrast/common'; import { Config } from '@contrast/config'; import { Core as _Core } from '@contrast/core'; import { Deadzones } from '@contrast/deadzones'; import { DepHooks } from '@contrast/dep-hooks'; import { Logger } from '@contrast/logger'; import { Patcher } from '@contrast/patcher'; import { ReporterBus } from '@contrast/reporter'; import { Rewriter } from '@contrast/rewriter'; import { Scopes } from '@contrast/scopes'; import { IncomingMessage, ServerResponse } from 'node:http'; export interface Core extends _Core { config: Config; logger: Logger; depHooks: DepHooks; patcher: Patcher rewriter: Rewriter; scopes: Scopes; deadzones: Deadzones; reporter: ReporterBus; instrumentation: any; metrics: any; } export interface SourceContext { responseData: { contentType: string, }, policy: { enabledRules: Set, } } export interface Policy { enabledRules: Set, } export interface RuleScopes { run(ruleId: Rule, cb: void): void; isLocked(ruleId: Rule): boolean; } export interface SessionRuleState { reported: boolean, valuesAnalyzed: Set, } export interface RuleState { [ConfigurationRule.HTTPONLY]?: SessionRuleState, [ConfigurationRule.SECURE_FLAG_MISSING]?: SessionRuleState, [ConfigurationRule.GRAPHQL_INTROSPECTION]?: SessionRuleState, } export interface Assess { getPolicy(): Policy, getPropagatorContext(): SourceContext | null, getSinkContext(ruleId: Rule): SourceContext | null, getSourceContext(): SourceContext | null, makeSourceContext(req: IncomingMessage, res: ServerResponse): SourceContext, ruleScopes: RuleScopes, ruleState: RuleState, } declare function init(core: Core): Assess; export = init;