Feat(aegis): add telemetry JSON-LD schema and scaffolding#518
Open
Jean-Regis-M wants to merge 1 commit into
Open
Feat(aegis): add telemetry JSON-LD schema and scaffolding#518Jean-Regis-M wants to merge 1 commit into
Jean-Regis-M wants to merge 1 commit into
Conversation
- Add finbot/aegis/telemetry/schema.py with AuditEvent models - Add AEGIS_ENABLED and AEGIS_TELEMETRY_ENABLED settings - Extend events.py to support 'aegis.*' namespaces - Add unit tests for telemetry schema - Update conftest.py for aegis package discovery Week 1 deliverable - GSoC 2026 OWASP FinBot AEGIS
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.
Feat(aegis): telemetry JSON-LD schema and package scaffolding
📋 Summary
This PR introduces the foundational AEGIS telemetry audit event schema and package scaffolding as the first incremental step of the FinBot-AEGIS security framework (GSoC 2026). It is additive-only: no existing agent, CTF detector, guardrail, or event-bus logic is modified in any breaking way. All new AEGIS functionality is disabled by default behind feature flags.
🎯 Motivation
The Gap This Closes
As documented in the accepted GSoC proposal, FinBot currently has no structured, queryable, tamper-evident audit trail. Agent tool calls are written to application logs but:
This directly exposes the platform to OWASP ASI10 (Insufficient Monitoring and Logging) — one of the ten agentic threat classes the platform is designed to teach.
Why Start Here
The telemetry schema is the single dependency of every other AEGIS pillar:
Establishing a stable, reviewed schema now prevents costly interface churn in later PRs.
🗂️ Files Changed
New Files
finbot/aegis/__init__.pyAuditEvent,AuditEventTypefinbot/aegis/telemetry/__init__.pyfinbot/aegis/telemetry/schema.pytests/unit/aegis/__init__.pytests/unit/aegis/test_telemetry_schema.pyModified Files
finbot/config.pyAEGIS_ENABLED,AEGIS_TELEMETRY_ENABLED(bothFalseby default)finbot/core/messaging/events.pyaegis.*namespace support; backward-compatibletests/conftest.pyfinbot.aegisin pytest discovery path🔬 Technical Design
Schema Architecture:
finbot/aegis/telemetry/schema.pyThe schema is designed around three principles drawn from the proposal:
1. JSON-LD Compatibility
Every
AuditEventcarries a@contextand@typefield so events are interpretable as Linked Data. This future-proofs the audit trail for SIEM ingestion, EU AI Act Article 9 compliance exports, and the OWASP CycloneDX AIBOM roadmap item.2. Tamper-Evidence Readiness
Each event contains a
prev_hashfield (SHA-256 of the prior event's canonical serialization). This PR establishes the field; PR 2 populates it via the HMAC chain publisher. Establishing it now in the schema means PR 2 requires zero schema changes.3. Coverage of All FinBot Agent Actions
The
AuditEventTypeenum covers every event category needed across all four pillars:All event type strings use the
aegis.*namespace prefix, which is registered infinbot/core/messaging/events.pyin this PR. This guarantees zero collision with existingagent.*,ctf.*, andlabs.*event types on the Redis EventBus.Core Event Model:
Why Pydantic v2?
FinBot's existing codebase (
finbot/ctf/schemas/challenge.py,finbot/aegis/schemas.py) already uses Pydantic v2. Using the same version avoids dependency conflicts and lets us usemodel_validate,model_dump(by_alias=True), andConfigDictconsistently.Namespace Registration:
finbot/core/messaging/events.pyThe change adds a single constant block:
No existing constants, functions, or Redis stream handlers are modified. The existing
CTFEventProcessorignoresaegis.*events (it filters by its registered detector event types). This is verified in the test suite.Feature Flags:
finbot/config.pyAll flags default to
False. Existing deployments are completely unaffected.✅ Testing
Run the New Test Suite
What the Tests Cover
test_audit_event_defaultstest_audit_event_json_ld_alias@contextand@typeserialization withby_alias=Truetest_audit_event_type_enum_valuesAuditEventTypemembers useaegis.*namespace prefixtest_audit_event_roundtripmodel_dump→model_validateround-trip fidelitytest_prev_hash_field_optionalprev_hash=Noneis valid (populated by next PR )test_namespace_field_requirednamespacetest_owasp_agentic_fieldtest_severity_literaltest_event_id_uniquenesstest_aegis_prefix_no_conflict_with_ctf_eventsaegis.*strings do not match any existing CTFevent_typevaluesExpected output:
Coverage of
finbot/aegisat this stage: ≥ 95% (target across full project: ≥ 80%).🔒 Security Considerations
detailsAuditEvent.detailsis typeddict[str, Any]. PII redaction middleware (AEGIS Pillar 3 Phase 2) will sanitize before emission. No PII flows in this PR.AEGIS_ENABLED=FalseandAEGIS_TELEMETRY_ENABLED=False. Zero runtime impact on existing deployments.events.pyandconfig.pyare additive. No existing constant, class, or function is renamed or removed.pydanticis already a FinBot dependency. No new packages added topyproject.toml.🗺️ OWASP Agentic Top 10 Coverage
This PR is foundational infrastructure for addressing:
DELEGATION_START/DELEGATION_ENDevent types establish the schema for inter-agent attributionMEMORY_READ/MEMORY_WRITEevent types support forensic memory provenance (Pillar 2)TOOL_CALL_BLOCKEDevent type readies the schema for Policy Engine integration🔗 What This Unblocks
feat(aegis): HMAC chain + Redis publisherAuditEvent,AuditEventTypefeat(aegis): SSE observability endpointAuditEventstreamtest(aegis): telemetry tamper unit testsAuditEventsequencefeat(aegis): MCPPolicyInterceptor alphaPOLICY_ALLOW/POLICY_DENYevents📐 Code Quality
All files pass the FinBot code quality baseline:
No
# type: ignorecomments. NoAnyleakage in public API signatures.AuditEvent.detailsusesdict[str, Any]intentionally (open-ended event payload), documented with an inline comment.👀 Reviewer Checklist
For mentors Nirupam Ghosh and Carolina Steadham:
aegis.*event type strings do not conflict with any existing CTF detectorevent_typefilters infinbot/ctf/definitions/challenges/AuditEventTypemembers cover the event categories you'd expect for the Pillar 3 milestone demo on July 10?AEGIS_ENABLEDandAEGIS_TELEMETRY_ENABLEDconsistent with FinBot's existing config naming conventions?@contextvalue (https://owasp.org/aegis/audit/v1) is a placeholder. Should this point to a live schema document, or is a placeholder acceptable until the OWASP blog post lands?prev_hashfield: Confirm you are happy withprev_hash: str | None = Noneas the tamper-evidence hook — populated to a real HMAC value in PR 2.📅 Timeline Context
feat(aegis): telemetry JSON-LD schema and scaffoldingfeat(aegis): HMAC chain + Redis publisherfeat(aegis): SSE observability endpoint + simulator scaffold🔖 References
Part of GSoC 2026 — GenAI-Security-Project/finbot-ctf · AEGIS Telemetry Pipeline
Prepared by Jean Francois Regis MUKIZA · GSoC 2026 Contributor · OWASP GenAI Security Project