Repository navigation
feat(runtime): evidence format, storage and secfoo runtime ingest (#53) - #88
Merged
1 commit merged intoNov 11, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
NDJSON session/load/hit events as specified in #53, a JSON Schema, three new tables (runtime_sessions, runtime_evidence with an FK to sca_findings, runtime_packages), and secfoo runtime ingest. Validation and the idempotent upsert live in secfoo/runtime/evidence.py so the live ingest API (#66) can reuse them. Malformed lines and unknown fingerprints are skipped and reported, never abort; re-ingesting a file replaces running totals instead of double-counting; unknown fields, concrete URLs and non file:line frames never reach the database. Closes #53 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 11, 2026
Leaderboard update
karthickmk2001 now has 19 points (rank #1). 6 more to reach Bronze. |
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.
Closes #53
What does this change, and why?
The shared contract for runtime evidence that #54 (coverage import), #55/#56 (Python and Node probes), #57 (SCA dashboard) and the live sensor (#66/#67) all build on. It follows the format in the issue exactly, so those can start in parallel.
Event format. NDJSON with
session,loadandhitlines, using the fields and enums from the issue. There's a JSON Schema insrc/secfoo/runtime/evidence.schema.json, and the full field table is indocs/REFERENCE.md→ Runtime evidence.Storage.
schema.sqlgainsruntime_sessions,runtime_evidenceandruntime_packages:runtime_evidencehas a foreign key tosca_findingson (project, fingerprint), with one row per session, finding, symbol and route.runtime_packagesholds the loaded inventory per session.CREATE TABLE IF NOT EXISTS, so existing stores get them on the next open. A test drops them from an existing DB and reopens it.secfoo runtime ingest events.ndjson --project <id|name|path>. Validation and the idempotent upsert live in one module,secfoo/runtime/evidence.py(ingest_events(conn, project_id, lines)), so the live API in #66 can reuse it as asked. The CLI prints what was stored and lists each skipped line with its number. It exits1if anything was skipped, so CI notices.id, hits by (session, fingerprint, symbol, route). A hit'scountis the session's running total, so a re-ingest or a later flush of the same session replaces the value instead of summing.first_seen/last_seenkeep the earliest and latest. A later file may add hits to a session stored earlier.Privacy, per #51 rule 3:
argsorrequest_bodyare dropped before the database, and a test checks this.routewith a scheme, query string or fragment is rejected as a concrete URL.entry_frameandstack_samplemust befile:lineframes, at most 50.Two decisions for reviewers:
countis replace-on-reingest, not additive. Additive would double-count a re-ingested file, which the issue rules out. Probes should therefore send running totals per session.routeas''. That keeps the uniqueness key working, since SQLite treats NULLs as distinct.Testing
pytest testspasses. 1050 passed locally. The only failures are the 4 existing Windows-only POSIX permission and symlink tests that fail onmaintoo; Linux CI is unaffected.ruff check .adds no new findings (the new files are clean; changed files matchmain's count).tests/test_runtime/test_evidence.py(29 tests):🤖 Generated with Claude Code