Repository navigation
feat(decorators): the SecurityDecorator family - the per-endpoint decorator surface with route identity - #60
Merged
Merged
Conversation
…orator surface with route identity The decorator mixin family port (guard_core/decorators/__init__.py: BaseSecurityDecorator + access_control, rate_limiting, behavioral, authentication, content_filtering, advanced): - src/Decorators/SecurityDecorator.php: the 25 config methods (requireIp, blockCountries, allowCountries, blockClouds, bypass, rateLimit, geoRateLimit, usageMonitor, returnMonitor, behaviorAnalysis, suspiciousFrequency, requireHttps, requireAuth, apiKeyAuth, requireAuthorizationHeader, requireHeaders, blockUserAgents, contentTypeFilter, maxRequestSize, requireReferrer, customValidation, detectionExclusion, timeWindow, suspiciousDetection, honeypotDetection) plus the base infra (config, routeConfigRevision, getRouteConfig, routeConfigs, initializeBehaviorTracking, initializeAgent and the five send_*_event emitters) and the getRouteDecoratorConfig helper. - src/Decorators/RouteDecoration.php: the immutable decoration chain, the port of the decorator closures the mixin methods return; decorate() is the application step against a callable endpoint or a route pattern. - src/Decorators/DecoratedEndpoint.php: the _guard_route_id-stamped endpoint shell (invokable call-through, pattern shells throw). - src/Decorators/RouteConfigRevision.php: the shared revision cell. - Route identity (the _get_route_id port): the stamped id is reused only when this instance assigned it to this endpoint, otherwise the base id suffixes #2..#n; new routes seed enable_suspicious_detection from the config like _ensure_route_config; every applied decoration bumps the shared cell. - GuardEngine::setDecoratorHandler (the set_decorator_handler port): requests stamped with a route id resolve their RouteConfig through the handler's registry, and decorator mutations rebuild the pipeline via the revision staleness seam. - BehaviorRuleValidation::validateReturnPatternAgainstScanFlag: the single-pattern scan gate (the _validate_return_pattern_body_scan path). - bin/test_decorators.php (210 assertions) mirrors the reference decorator tests and joins the CI test steps, the coverage collect list and the Makefile runners; the ip_ban initialization catch waiver moves with its shifted lines in coverage-unreachable.php.
3 tasks done
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.
The decorator mixin family port (guard_core/decorators): the 25 config methods + the 9 base infra methods, the route-identity mechanism (the
_guard_route_idequivalent), the shared revision cell, and the engineset_decorator_handlerseam.What lands
Consumption
Decorated endpoints flow through the identical pipeline checks: adapters hand the registry (
SecurityDecorator::routeConfigs()) to the existing path-pattern route maps, or stampstate->guardRouteIdand let the engine resolve through the handler.Tests