Skip to content

Conversation

@PopoviciMarian
Copy link
Contributor

@PopoviciMarian PopoviciMarian commented Jan 9, 2026

The firewall used a global EventCache singleton that was reset at every hook entry. When curl callbacks (CURLOPT_WRITEFUNCTION, etc.) invoked hooked PHP functions like file_put_contents(), nested hooks corrupted the outer hook's context. The POST handler then read empty values and skipped SSRF validation entirely.

Summary by Aikido

Security Issues: 0 🔍 Quality Issues: 4 Resolved Issues: 0

⚡ Enhancements

  • Added ScopedEventContext RAII and pushed contexts in handlers automatically.

🐛 Bugfixes

  • Fixed SSRF bypass caused by curl callback corrupting EventCache context.

🔧 Refactors

  • Replaced global EventCache with EventCacheStack and stack-based contexts.
  • Replaced direct eventCache field accesses with eventCacheStack.Top() calls.

More info

@PopoviciMarian PopoviciMarian marked this pull request as ready for review January 19, 2026 14:41
case FUNCTION_NAME:
ctx = "FUNCTION_NAME";
ret = eventCache.functionName;
ret = eventCacheStack.Empty() ? "" : eventCacheStack.Current().functionName;
Copy link
Contributor

Choose a reason for hiding this comment

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

Repeated conditional access pattern 'eventCacheStack.Empty() ? "" : eventCacheStack.Current().' appears across many case branches; centralize into a helper (e.g., GetCurrentEventField(name)) to remove duplication.

Details

✨ AI Reasoning
​Multiple case branches now repeat the exact conditional expression eventCacheStack.Empty() ? "" : eventCacheStack.Current(). to read different EventCache fields. This yields many near-identical lines that perform the same logical operation (get current event field, or empty string if stack empty). Consolidating that access into a small helper would reduce repetition and risk of inconsistent edits across branches.

🔧 How do I fix it?
Delete extra code. Extract repeated code sequences into reusable functions or methods. Use loops or data structures to eliminate repetitive patterns.

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

…+ Introduce a helper function to safely access EventCache field
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.

2 participants