test(live-smoke): cover the exempt_ips skip-list end to end - #145
Conversation
…the guard-core exempt_ips release Three scenarios against the live stack: an exempt IP (the stack's fixed client IP from nginx's X-Real-IP) exceeding rate_limit 2 keeps getting 200 across the crossing while the pipeline writes no rate-limit bucket for it (smoke:rate_limit:rate:<ip> stays absent in Redis, pinning that the exempt skip sits ahead of the limiter), a penetration payload from the exempt IP still gets 400 (exemption is not immunity); the same limit without exempt_ips throttles the identical sequence at 429 and leaves exactly the bucket the exempt run never wrote (the paired configs express the exempt/non-exempt contrast the single-client harness allows); and an IP that is both exempt and blacklisted gets 403 (blacklist beats exemption). Red against PyPI guard-core below 4.1.0 (the override key is ignored by the older pydantic model, so the no-throttle assertions fail) by design: this is release prep riding the documented lockstep hold. Verified live against a locally built guard-core 4.1.0 wheel: LIVE_SMOKE_ONLY_MODULES= exempt_ips green (3/3), full-module completeness check green.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe change adds live smoke scenarios for exempt IP behavior, non-exempt throttling, penetration detection, and blacklist precedence. The changelog records the expected outcomes and the guard-core version used for the successful run. ChangesExempt IP smoke scenarios
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Other Merge Risk: ⚪ Minimal · up to The new smoke scenarios cover the stated exemption behavior. No merge-blocking issue is established; run the normal checks with guard-core 4.1.0. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The scenarios do not add an application endpoint or change the rate-limit implementation. The separate response-header change has limited apparent security impact, but compatibility with the pending engine release remains unverified here. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Adds the exempt_ips live-smoke scenario required before the next fastapi-guard release tracks the guard-core release that ships the field (guard-core PR #118). The single-client harness (nginx pins the resolved client IP to 192.168.50.50 for every request) expresses the maintainer's suggested exempt/non-exempt contrast through paired scenario configs:
exempt_ip_exceeds_the_rate_limit_without_being_throttled: withexempt_ipscovering the client IP andrate_limit2, four requests stay 200 across the crossing, the pipeline writes no rate-limit bucket for the exempt IP at all (smoke:rate_limit:rate:<ip>absent in Redis, pinning that the exempt skip sits ahead of the limiter), and a penetration payload from the exempt IP still gets 400 (exemption is not immunity)the_same_limit_throttles_a_non_exempt_client: the identical limit withoutexempt_ipsthrottles at 429 and leaves exactly the bucket the exempt run never wroteblacklist_beats_exemption: an IP that is both exempt and blacklisted gets 403Compatibility note
The scenarios are red against PyPI guard-core below 4.1.0 by design: the older engine's pydantic model ignores the
exempt_ipsoverride key, so the no-throttle assertions fail until the guard-core release ships. This rides the documented lockstep hold pattern (v8.0.0 was held until guard-core 4.0.0 shipped), and the live smoke CI on this PR is expected red until then.Test plan
LIVE_SMOKE_ONLY_MODULES=exempt_ips pytest tests/live_smoke -m live_smokegreen (3/3 scenarios, stack up/down clean)Summary by CodeRabbit