Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
|
||
| // Block if the hostname is in the blocked domains list | ||
| if (ServiceConfigStore.shouldBlockOutgoingRequest(hostname)) { | ||
| if (ServiceConfigStore.shouldBlockOutgoingRequest(hostname) && !BypassedContextStore.isBypassed()) { |
There was a problem hiding this comment.
report(...) now includes enforcement via BypassedContextStore.isBypassed(), mixing reporting and blocking. Rename/split the method or document the enforcement behavior.
Details
✨ AI Reasoning
The report(...) method in the DNSRecordCollector previously performed DNS-related reporting and SSRF detection. The recent change adds a bypass check and conditional blocking via BypassedContextStore.isBypassed(), introducing enforcement behavior into a method named 'report'. This increases mixing of responsibilities and makes the method's purpose less self-evident, especially when callers expect reporting-only side effects. The problematic change occurs where the blocking condition was tightened to include the bypass check.
🔧 How do I fix it?
Use descriptive verb-noun function names, add docstrings explaining the function's purpose, or provide meaningful return type hints.
Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info
draft: add DangerousBodyException
| if (!bypassed) { | ||
| // Bypassed IPs are trusted — don't report their outbound hostnames in heartbeats. | ||
| if (!ports.isEmpty()) { | ||
| for (int port : ports) { | ||
| HostnamesStore.incrementHits(hostname, port); | ||
| } | ||
| } else { | ||
| HostnamesStore.incrementHits(hostname, 0); | ||
| } |
There was a problem hiding this comment.
The if (!bypassed) block in report adds nesting around the main hostname-hit logic; invert the condition or use an early return/guard to flatten the method for clarity.
Show fix
| if (!bypassed) { | |
| // Bypassed IPs are trusted — don't report their outbound hostnames in heartbeats. | |
| if (!ports.isEmpty()) { | |
| for (int port : ports) { | |
| HostnamesStore.incrementHits(hostname, port); | |
| } | |
| } else { | |
| HostnamesStore.incrementHits(hostname, 0); | |
| } | |
| if (bypassed) { | |
| // Bypassed IPs are trusted — don't report their outbound hostnames in heartbeats. | |
| } else if (!ports.isEmpty()) { | |
| for (int port : ports) { | |
| HostnamesStore.incrementHits(hostname, port); | |
| } | |
| } else { | |
| HostnamesStore.incrementHits(hostname, 0); |
Details
✨ AI Reasoning
The report method now computes a bypassed flag and then wraps hostname hit-incrementing logic inside an if (!bypassed) else branch, increasing nesting. This buries the normal-path behavior and makes the flow harder to follow; using an early return or inverting the condition would flatten the logic and improve readability.
Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info
Summary by Aikido
⚡ Enhancements
More info