Skip to content

Add config updates via SSE (behind FF)#667

Open
timokoessler wants to merge 3 commits into
mainfrom
config-updates-via-sse
Open

Add config updates via SSE (behind FF)#667
timokoessler wants to merge 3 commits into
mainfrom
config-updates-via-sse

Conversation

@timokoessler

@timokoessler timokoessler commented Jul 16, 2026

Copy link
Copy Markdown
Member

Feature Flag env: AIKIDO_FEATURE_SSE

Summary by Aikido

Security Issues: 0 🔍 Quality Issues: 1 Resolved Issues: 0

🚀 New Features

  • Implemented SSE client and parser to receive realtime events.

⚡ Enhancements

  • Added listener to fetch config updates via SSE when signaled.
  • Integrated SSE listener into CloudConnectionManager guarded by feature flag.

🔧 Refactors

  • Replaced hardcoded realtime endpoint with get_api_url for requests.

More info

@timokoessler timokoessler self-assigned this Jul 16, 2026
@timokoessler timokoessler changed the title Add config updates via SSE Add config updates via SSE (behind FF) Jul 16, 2026
@timokoessler timokoessler marked this pull request as ready for review July 16, 2026 11:27
Comment thread aikido_zen/background_process/realtime/sse_client/__init__.py
logger.debug(
"SSE config fetched, configUpdatedAt: %s", config.get("configUpdatedAt")
)
last_updated_at = config.get("configUpdatedAt", config_updated_at)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Callback mutates nonlocal last_updated_at and calls connection_manager.update_service_config/update_firewall_lists from a background thread. Synchronize access (e.g., use a lock) or confine mutations to a single thread.

Details

✨ AI Reasoning
​The listen_for_config_updates change defines on_event which captures and mutates last_updated_at and invokes connection_manager.update_service_config and update_firewall_lists. That callback is passed to connect_to_sse which starts a background thread, so those mutations now occur concurrently without synchronization. This introduces a new unsynchronized access path to connection_manager state from a background thread.

🔧 How do I fix it?
Use locks, concurrent collections, or atomic operations when accessing shared mutable state. Avoid modifying collections during iteration. Use proper synchronization primitives like mutex, lock, or thread-safe data structures.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

Comment thread aikido_zen/background_process/realtime/sse_client/parser.py Outdated
Comment thread aikido_zen/background_process/realtime/sse_client/parser.py Outdated
Comment thread aikido_zen/background_process/realtime/sse_client/parser.py Outdated
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