Skip to content

Fix event-store Bandit baseline - #2

Open
brainx wants to merge 1 commit into
mainfrom
fix/bandit-event-baseline
Open

Fix event-store Bandit baseline#2
brainx wants to merge 1 commit into
mainfrom
fix/bandit-event-baseline

Conversation

@brainx

@brainx brainx commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace dynamic event-list SQL assembly with one fixed statement while keeping cursor pagination, ordering, limit handling, and all four filters parameterized
  • isolate subscriber exceptions at the post-commit callback boundary and emit only a fixed, data-free warning so later subscribers still run
  • add focused regressions for combined filtering and pagination, injection-shaped filter input, persisted-event integrity, subscriber continuation, and secret-safe failure handling

Scope

This is a focused prerequisite for #1. It does not modify or replace that compatibility pull request and does not change Zeus compatibility, OpenAPI fixtures, Kimi support, versions, or documentation.

Verification

  • .venv/bin/python -m unittest tests.test_events — 6 tests passed
  • .venv/bin/bandit -r olymp — no issues identified; zero lines skipped and zero suppressions
  • sh scripts/repo_check.sh — passed; 197 tests, 85% coverage, formatting, Ruff, mypy, Bandit, lifecycle smoke, and repository scans
  • sh scripts/test.sh — 197 tests passed with 85% coverage
  • git diff --check — passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b8f0037ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread olymp/events.py
SELECT *
FROM events
{where}
WHERE (? IS NULL OR event_id > ?)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore the rowid seek for cursor pagination

When GET /events or GET /runs/{run_id}/events supplies a non-null after_event_id, wrapping the primary-key predicate in ? IS NULL OR ... prevents SQLite from seeking by rowid: EXPLAIN QUERY PLAN reports SCAN events here, whereas the previous event_id > ? predicate reports SEARCH events USING INTEGER PRIMARY KEY (rowid>?). Consequently, every cursor request scans all events preceding the cursor, making repeated polling increasingly expensive as this append-only ledger grows; select a fixed statement containing a direct event_id > ? predicate when a cursor is present while continuing to bind all filter values.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant