pub fn classify_imperva(
reese84: &str,
incap_ses: &str,
challenge_present: bool,
) -> ImpervaClearanceExpand description
Pure classifier for Imperva clearance, given the reese84 (ABP) value and
the incap_ses_* (classic) value plus whether the _Incapsula_Resource
challenge is still present.
Decision (most-authoritative first):
reese84long-form ⇒Valid(modern ABP gate).- else, classic pass: challenge gone AND
incap_ses_*set ⇒Valid. - else, any cookie present but not yet qualifying ⇒
Pending. - else ⇒
Missing.
visid_incap is deliberately NOT a pass signal, it is assigned on first
visit before the challenge is solved, so trusting it would report a pass
that never happened.
§Examples
use captchaforge::solver::vendors::imperva::{classify_imperva, ImpervaClearance};
// Modern ABP: a long reese84 token is a pass regardless of challenge state.
let reese = "A1b2C3d4".repeat(20);
assert_eq!(classify_imperva(&reese, "", true), ImpervaClearance::Valid);
// Classic: challenge gone + a real incap_ses ⇒ pass.
assert_eq!(classify_imperva("", "Tfje92kfASDFkjasdf9012", false), ImpervaClearance::Valid);
// Classic: incap_ses set but challenge STILL present ⇒ not yet.
assert_eq!(classify_imperva("", "Tfje92kfASDFkjasdf9012", true), ImpervaClearance::Pending);
// Nothing ⇒ missing.
assert_eq!(classify_imperva("", "", true), ImpervaClearance::Missing);