Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Guard Core Php Laravel Package

rennf93/guard-core-php

Framework-agnostic core for Guard, the PHP authentication and authorization library. Provides reusable primitives for guards, identity checks, and access control, usable in standalone PHP apps or alongside Laravel and other frameworks.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package fits as Laravel HTTP middleware/engine for application-layer detection, IP access control, dynamic rules, response modification, and agent-backed telemetry. v4.4.0 aligns with core engines at 4.4.0 and adds useful seams: a per-request regex CPU budget, semantic-header exclusions, a response modifier hook, and request metrics. It is best treated as defense-in-depth alongside edge WAF/CDN controls, not as a replacement.

Integration feasibility. Standard Laravel integration is feasible, but this is a behavior-heavy release, not a drop-in patch. Feasibility depends on current use of the agent, dynamic rules, enrichment, trusted proxies, IP lists, and custom response handling. The new config validation requiring enableAgent when enableDynamicRules or enableEnrichment is on can block deployment if existing configs are not updated. Metrics require an agent handler exposing sendMetric; dynamic rules require an agent handler exposing getDynamicRules().

Technical risk. Medium-high for production adoption. Key risks:

  • Config validation can fail at boot for previously valid configurations.
  • Client identity and IP-list precedence changes can cause new bans, rate-limit matches, or access denials for clients that previously did not match.
  • Dynamic rule semantics changed materially: ip_blacklist is now a timed ban through the engine ban manager, ip_whitelist unbans, versions apply over base config, failed applies keep the prior version, expiry restores base, and emergency mode halves the auto-ban threshold once.
  • detectionMaxScanSeconds limits regex scan CPU per request, but direct detect() calls outside a request scan are not capped and need separate safeguards.
  • The response modifier exception behavior is silent unless the modifier itself logs; ordering after security headers and before CORS must be validated.
  • Passive-mode log wording changed, which can break SIEM/alerts.
  • Cookie scanning was corrected, likely reducing false positives, but detection outcomes for authenticated sessions should be regression-tested.
  • Existing logSensitiveHeaders address-header workarounds should be removed per docs; removing them can re-enable detection on headers that were previously skipped, creating new findings.

Key questions.

  • Which Laravel/PHP versions and runtime modes are supported, including Octane or long-running workers?
  • Is the application behind a load balancer, reverse proxy, CDN, or multiple proxy hops? What exact trustedProxies and forwarded-header depth are configured?
  • Are dynamic rules, enrichment, or agent metrics already in use? If so, is enableAgent enabled and is a compatible agent handler attached?
  • Do existing IP whitelists/blacklists and route-level overrides depend on the old precedence behavior?
  • Are any log parsers, alerts, or dashboards matching passive-mode wording or event envelopes?
  • Is customResponseModifier needed, and can it safely fail without affecting security headers or CORS?
  • Are there direct GuardEngine::detect() calls outside middleware that bypass the new scan budget?
  • What is the latency budget, and are large IP lists or many regex rules expected?

Integration Approach

Stack fit. The middleware model is a good fit for Laravel request/response handling. The response modifier seam supports adapters that need to alter pass-through responses. Agent-backed dynamic rules and metrics fit environments that already run the matching agent/core version. Compatibility with core engines is explicitly lockstep at 4.4.0, so agent, core, and package versions should be managed together.

Migration path.

  1. Inventory current config: enableAgent, enableDynamicRules, enableEnrichment, agentEnableEvents, agentEnableMetrics, trustedProxies, IP lists, route overrides, and any logSensitiveHeaders workaround.
  2. Upgrade in a branch and run config validation in CI before deploying.
  3. Add or confirm enableAgent wherever dynamic rules or enrichment are enabled; otherwise disable those features explicitly.
  4. Rebuild trusted-proxy and forwarded-header test cases: ports in X-Forwarded-For, empty entries, over-counted proxy depth, mapped IPv6, zoned addresses, malformed CIDRs, and unix peer cases.
  5. Regression-test IP list matching with IPv4, IPv4 CIDR, bracketed, and IPv4-mapped IPv6 clients.
  6. Validate dynamic rule behavior in staging: ip_blacklist timed ban, ip_whitelist unban, blocked countries, cloud-provider blocks, user-agent blocks, endpoint rate limits, version failure/expiry, and emergency mode.
  7. Test the response modifier against normal responses, error responses, security headers, and CORS ordering; ensure exceptions are logged by the modifier.
  8. Update SIEM/alerts for the new passive-mode string and any event-envelope checks.
  9. Remove stale address-header workarounds only after confirming the resulting detection volume is acceptable.

Compatibility. Treat v4.4.0 as a minor-version release with breaking behavioral changes. Pin the package version and the matching agent/core versions. Do not mix v4.4.0 with an older agent handler that lacks getDynamicRules() or sendMetric if those features are enabled.

Sequencing. Use a staged rollout: preflight config and proxy review, staging with enforcement disabled or passive where possible, canary with metrics and log review, then production. Keep a rollback plan that includes reverting config, not just the package version, because validation and rule semantics changed.

Operational Impact

Maintenance. Maintain configuration as code and review diffs for proxy, IP-list, and dynamic-rule changes. Track package, agent, and core-engine versions together. Expect ongoing tuning of detectionMaxScanSeconds, IP list size, and semantic-header exclusions. Any custom response modifier becomes application-owned code and needs tests.

Support. Publish runbooks for pattern_timeout, spoofing_detected, dynamic-rule apply failures, emergency mode activation, and unexpected IP-list denials. Update log parsers for the passive-mode wording change. Support teams should know that dynamic rule changes may be delayed by dynamicRuleInterval (minimum 60 seconds, default 300), so it is not an instant-update mechanism.

Scaling. The per-request scan budget reduces regex CPU worst cases but does not eliminate scanning cost. Benchmark large IP lists, many patterns, and metrics emission under representative traffic. Request metrics add value but also agent and telemetry overhead. Dynamic rule polling is interval-gated, which helps control agent load but introduces rule staleness. Response modification runs on every returned response and should be lightweight.

Failure modes.

  • Invalid config prevents boot when agent-dependent features are enabled without enableAgent.
  • Agent unavailability or incompatible handler can disable dynamic rules or metrics; define fail-open versus fail-closed expectations.
  • Failed dynamic-rule apply leaves the previous version active, which is safe but can leave stale policy.
  • Expiry restores base config, which may unexpectedly remove temporary protections.
  • Scan-budget exhaustion records a pattern_timeout threat and may trigger blocking; tune carefully to avoid false positives.
  • IP identity corrections can newly match bans, rate limits, or lists, causing legitimate-user impact if whitelists are incomplete.
  • Response modifier exceptions are swallowed; without explicit logging, customization failures may be invisible.
  • Log-wording changes can silently break detections and dashboards.

Ramp-up. Plan a multi-sprint hardening cycle rather than a routine dependency bump: one track for Laravel/agent integration and config validation, one for security-operations validation of proxy identity, IP lists, dynamic rules, logging, and rollback. Canary traffic and side-by-side log review are strongly recommended before broad enforcement.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin