WEEK 7: Implement Policy Interceptor and Agent Profiles for FinBot Security Framework - #543
Conversation
- Add finbot/aegis/telemetry/schema.py with AuditEvent models - Add AEGIS_ENABLED and AEGIS_TELEMETRY_ENABLED settings in config.py - Extend events.py to accept 'aegis.*' event namespaces (backward compatible) - Add unit tests for telemetry schema - Update conftest.py to include aegis package Week 1 deliverable (GSoC 2026 - OWASP FinBot AEGIS)
- Implement PolicyInterceptor, Capsule, Memory, and agent profiles - Add unit tests for policy interceptor
| "data:visualize": {"max_calls_per_minute": 10}, | ||
| "filesystem:read": {"max_calls_per_minute": 60}, | ||
| }, | ||
| secret_key="data-analyst-secret-key-change-in-production", |
There was a problem hiding this comment.
Multiple agent profiles define hardcoded default secrets such as:
Do not embed predictable default secrets in code. Load them from configuration or generate cryptographically secure secrets.
import secrets
secret_key = (
settings.get("AEGIS_AGENT_SECRET")
or secrets.token_hex(32)
)
or fail fast
secret = settings.get("AEGIS_AGENT_SECRET")
if not secret:
raise RuntimeError(
"AEGIS_AGENT_SECRET must be configured."
)
secret_key = secret
There was a problem hiding this comment.
Thank you for your review and suggestions, @mekaizen! I've updated the agent profiles to remove hardcoded secrets and instead load the secret key from configuration (with a fallback to a cryptographically generated secret for development). The changes are in line with the project's security best practices. Please let me know if you have any further feedback.
Signed-off-by: JEAN REGIS <240509606@firat.edu.tr>
Summary
This week's work focused on implementing the core security infrastructure for the FinBot project by developing the Policy Interceptor and predefined Agent Profiles as outlined in the GSoC proposal. The implementation addresses OWASP ASI02 (Tool Misuse), ASI03 (Excessive Agency), and ASI07 (Prompt Injection) through least-privilege access controls and intent-based security mechanisms.
Changes Made
Core Implementation (
finbot/aegis/policy/)__init__.py- Package initialization exporting all policy componentsagent_profiles.py- Defines six least-agency agent profiles:interceptor.py- ImplementsMCPPolicyInterceptorwith:Week 8 Stubs (Forward Compatibility)
capsule.py- Stub forIntentCapsulewith HMAC signing/validation interfacememory.py- Stub forMemoryNamespaceManagerwith provenance tracking interfaceComprehensive Test Suite
tests/unit/aegis/test_policy_interceptor.py- Full test coverage including:Key Features
Testing Status
✅ All unit tests passing
✅ Edge cases covered (invalid profiles, exceeded limits, unauthorized tool access)
✅ Metrics collection verified
✅ Agent profile combinations tested
Next Steps (Week 8)
In Week 8, the stub files will be replaced with full implementations featuring:
Acknowledgments
Special thanks to my mentors @mekaizen and @steadhac for their continuous guidance, insightful feedback, and unwavering support throughout this GSoC journey. Their expertise has been instrumental in shaping this security-focused implementation.