Realtime settings updates#285
Open
marksmith wants to merge 22 commits into
Open
Conversation
4b0495c to
06c4790
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
6bce945 to
d83199f
Compare
for port in PostgreSQL tests
for port in MySQL tests
To detect whether the update method completed.
An updater method returns early if the updater is already updating.
By mocking Aikido::Zen::APIStream to prevent real HTTP request to https://runtime.aikido.dev/api/runtime/stream.
By scaling down durations by 10x.
4c7ddfc to
6616f75
Compare
105009c to
ddef592
Compare
in API stream tests
ddef592 to
d83199f
Compare
d83199f to
b7534cc
Compare
03a8743 to
b7534cc
Compare
In case the server-side event stream ever contains sensitive data.
To emphasize the mutual exclusion property of defined updater methods.
tomaisthorpe
left a comment
There was a problem hiding this comment.
I think not covered in this PR is the change of URL for zen realtime. We're moving to https://zen.aikido.dev, but as part of that, we need to ensure we can still fallback to the old URL incase there's network level blocking.
You can see how node is handling it here:
https://github.com/AikidoSec/firewall-node/blob/16a288a5880380ad540017397d56e3597b6d4a71/library/agent/realtime/probeRealtimeURL.ts
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.
This change adds realtime settings updates from server-side events. The
Aikido::Zen::Agentattempts to connect the realtime endpoint at startup and warns the user that realtime settings updates will not be available because the startup connection attempt failed.Realtime settings updates are implemented on
Aikido::Zen::APIStream. The API stream implements a simple server-side events client, which connects to the realtime endpoint and reads events. The API streams executes concurrently using aConcurrent::SingleThreatExecutor, and calls all registered event handlers for each event received. Currently, the agent registers a single event handler for theconfig-updatedevent.Event handlers are executed by the single thread executor, and access to the runtime settings object must be synchronized; because of this change, the runtime settings object is now accessed from multiple threads. Synchronization is localized in the agent using the
update_settings_from_runtime_config!andupdate_settings_from_runtime_firewall_lists!methods, defined usingupdater.The change includes a number of important tangential fixes. Notable is the fix to outbound connection blocking with multiple processes, where the default
Aikido::Zen::RuntimeSettings::DomainSettings.noneobject identity check fails because each process instantiates its own process local default after forking. The globally unique sentinalnilis now used as the default, and the implementation and tests for outbound connection blocking have been modified.Summary by Aikido
🚀 New Features
⚡ Enhancements
More info