Skip to content

Schedule background tasks before sending start event - #391

Draft
hansott wants to merge 1 commit into
increase-cloud-timeoutsfrom
schedule-tasks-before-startup-calls
Draft

hansott wants to merge 1 commit into
increase-cloud-timeoutsfrom
schedule-tasks-before-startup-calls

Conversation

@hansott

@hansott hansott commented Oct 19, 2026

Copy link
Copy Markdown
Member

No description provided.

@hansott
hansott added this pull request to stack #392 October 19, 2026 14:22
// make api calls on start, slow responses should not delay the tasks above
Optional<APIResponse> res = api.report(Started.get());
res.ifPresent(ServiceConfigStore::updateFromAPIResponse);
// Fetch blocked lists using separate API call

@aikido-pr-checks aikido-pr-checks Bot Oct 19, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The comment that blocked lists use a separate API call restates api.fetchBlockedLists() without adding context.

Suggested change
// Fetch blocked lists using separate API call
Details

✨ AI Reasoning
​The comment repeats what the adjacent api.fetchBlockedLists() call already shows and gives no reason for making it a separate call. The other added comment explains that slow responses should not delay scheduled tasks, so it provides rationale.

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

@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hansott
hansott force-pushed the schedule-tasks-before-startup-calls branch from a92de90 to 6fb3e6d Compare October 19, 2026 15:13
Comment on lines +56 to +60
Optional<APIResponse> res = api.report(Started.get());
res.ifPresent(ServiceConfigStore::updateFromAPIResponse);
// Fetch blocked lists using separate API call
Optional<ReportingApi.APIListsResponse> listsRes = api.fetchBlockedLists();
listsRes.ifPresent(ServiceConfigStore::updateFromAPIListsResponse);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High - Concurrent startup refreshes can overwrite newer blocking rules

When the startup event or list request takes longer than the newly scheduled 30/60-second tasks, HeartbeatTask or RealtimeTask can fetch a newer configuration while the original startup responses are still in flight. The startup responses are then applied without version checks, and a late list response replaces the entire list set, so newly enabled IP/UA blocks or blocking mode can be reverted and matching requests or attacks can pass until a later refresh.

Show fix

Keep startup fetches serialized ahead of scheduled refreshes, or make configuration and list updates version-aware so an older response cannot replace a newer snapshot. Do not let the initial list response clear newer rules based solely on arrival order.

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

@hansott
hansott marked this pull request as draft October 20, 2026 08:03
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