Skip to content

Reduce blocking of event loop when updating ip lists - #1126

Open
timokoessler wants to merge 3 commits into
mainfrom
async-ip-list-updating
Open

Reduce blocking of event loop when updating ip lists#1126
timokoessler wants to merge 3 commits into
mainfrom
async-ip-list-updating

Conversation

@timokoessler

Copy link
Copy Markdown
Member

Simpler approach than #1122

Comment thread library/agent/ServiceConfig.ts
Comment on lines +287 to +290
await yieldToEventLoop();
}

this.allowedIPAddresses = built;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Medium - Async IP-list rebuilds keep enforcing the old access policy during config reloads

The new update*IPAddresses methods yield back to the event loop before replacing the in-memory matchers, and Agent.updateBlockedLists now awaits those async rebuilds during live list refreshes. While that rebuild is in progress, request handling continues to call isAllowedIPAddress/isIPAddressBlocked against the previous lists, so a newly denied or newly blocked IP can still reach the application until the update finishes. Before this change the event loop stayed blocked until the new lists were installed, so this PR creates a real window where IP-based protections are bypassed.

Show fix

Do not yield while the active policy is still the old one. Either build the new matchers off-thread and swap all affected lists atomically once the full snapshot is ready, or fail closed during reloads for policies that are becoming more restrictive so requests cannot be evaluated against stale allow/block data.

More info - Reply on this comment to give feedback or ignore the issue.

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
library/agent/ServiceConfig.ts 94.87% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

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