Repository navigation
fix(detection): port the passive-log, semantic-header opt-out, cookie split and request-metrics fixes - #78
Merged
Merged
Conversation
…ics and config edits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #77
I ported the verified reference fixes to the PHP engine, one commit per point, each with a test that fails on master.
fix(logging): a passive-mode suspicious line without a trigger now reads[PASSIVE MODE] Suspicious activity detected from ... - Reason: ... - Headers: ...instead of dropping the reason under a "Penetration attempt" label (guard-core #165).docs(config):enableDynamicRulesnow lists exactly what a rule changes. This documents what PHP does today:ip_blacklistandip_whitelistmerge into the blacklist and whitelist, andip_ban_durationis parsed but not applied, unlike the reference where the blacklist is a timed ban. I did not change that behaviour here.feat(detection): opt-inexcludedSemanticDetectionHeadersonSecurityConfig(default empty) andRouteConfig(merged with the global set, also reachable asdetectionExclusion(semanticHeaders: ...)). Listed headers skip only the semantic analyzer and the regex scan still runs.fix(detection): the Cookie header is scanned onename=valuepair at a time (split on;, only spaces trimmed so CR and LF stay, empty pairs skipped), each pair taking the same header path, so the semantic opt-out applies per pair (guard-core #162).feat(metrics):GuardEngine::processResponsenow emitsresponse_time,request_countanderror_ratethrough aMetricsCollectorthe engine owns, once an agent handler withsendMetricis attached andagentEnableMetricsis on.response_timeruns from the pipeline start (RequestState::$pipelineStartedAt, stamped inexecute()).I did not port the per-request scan time budget: PHP runs one request per process and detection keeps no per-request scan state shared across requests.
I left the conformance fixtures untouched.