-
Notifications
You must be signed in to change notification settings - Fork 22
[feat] add NetworkRequestDetailBottomSheet #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Manabu-GT
commented
Dec 5, 2025
- add NetworkRequestDetailBottomSheet to show captured network request details
|
Claude finished @Manabu-GT's task —— View job Code Review Complete ✅I've reviewed this PR which adds a comprehensive SummaryWhat's New:
Architecture: The refactoring cleanly separates concerns—badge components, text utilities, and formatters are well-organized and reusable. Issues Found🔴 Security Issues
🟡 Major Issues
🟢 Minor Issues
Positive Observations ✨
Testing RecommendationsPer ./gradlew :debugoverlay-core:checkManual Testing Checklist:
Recommendations PriorityHigh Priority (Security):
Medium Priority (Robustness): Low Priority (Maintainability): VerdictApprove with minor fixes recommended. The implementation is solid and production-ready. The security issues identified are low-risk in this debug-only context, but should be addressed as a best practice. The regex performance concerns are worth monitoring but unlikely to cause issues with typical API responses. Great work on the comprehensive feature implementation! 🎉 |
| AndroidView( | ||
| factory = { context -> | ||
| WebView(context).apply { | ||
| settings.javaScriptEnabled = false // Security: No JS needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security: JavaScript should remain disabled
Good security practice to disable JavaScript! However, consider also adding:
settings.allowFileAccess = false
settings.allowContentAccess = falseThis prevents potential file:// access vulnerabilities, especially since you're loading HTML from untrusted network responses.
debugoverlay-core/src/main/kotlin/com/ms/square/debugoverlay/internal/ui/Texts.kt
Outdated
Show resolved
Hide resolved
debugoverlay-core/src/main/kotlin/com/ms/square/debugoverlay/internal/data/TextType.kt
Outdated
Show resolved
Hide resolved
| /** | ||
| * Format JSON as syntax-highlighted HTML. | ||
| */ | ||
| @Suppress("MaxLineLength") // HTML template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security: HTML escaping needs review
The HTML escaping here only handles basic entities (&, <, >, "). However:
- Missing single quote: Should also escape
'→'or' - Order matters: The
&replacement should happen first (which it does ✓), otherwise you'd double-escape.
Consider using a well-tested HTML escaping library instead of manual regex, or at minimum add single quote escaping:
.replace("'", "'")| .replace("\"", """) | ||
|
|
||
| // Simple syntax highlighting with regex | ||
| val highlighted = escaped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Quality: Regex performance and correctness
These regex patterns for syntax highlighting have some issues:
-
Backtracking risk: The pattern
""""[^&]+""""could cause catastrophic backtracking with malicious input containing many&characters. -
Incorrect matching: The key pattern
"""("[^&]+")\s*:"""will fail on keys like"foo&bar"because[^&]excludes ampersands. -
Performance: Running 5 separate regex replacements on potentially large JSON (up to 500KB) could be slow.
Consider:
- Use a proper JSON formatter library (e.g., kotlinx.serialization with pretty print)
- Or use more robust regex patterns:
""""([^&"]|&[^&]*?;)+"""" - Or limit syntax highlighting to small JSON only
| Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) { | ||
| IconButton(onClick = { | ||
| scope.launch { | ||
| val clipboardLabel = context.getString(R.string.debugoverlay_clipboard_label) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consistency: Consider reusing clipboard logic
The clipboard copying logic appears multiple times (here, lines 244-248, 328-334, 364-370, 412-417, 437-442). Consider extracting to a helper function:
private fun CoroutineScope.copyToClipboard(
clipboard: ClipboardManager,
context: Context,
text: String
) {
launch {
val clipboardLabel = context.getString(R.string.debugoverlay_clipboard_label)
val clipEntry = ClipEntry(ClipData.newPlainText(clipboardLabel, text))
clipboard.setClipEntry(clipEntry)
}
}This would reduce code duplication and make future changes easier.
| shape = RoundedCornerShape(8.dp), | ||
| color = MaterialTheme.colorScheme.surfaceContainerLowest | ||
| ) { | ||
| // No verticalScroll - LazyColumn parent handles vertical scrolling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accessibility: Consider adding verticalScroll comment justification
Good comment explaining why verticalScroll is not used! For clarity, you might also mention that this is inside a LazyColumn item, which already handles scrolling.
|
Claude finished @Manabu-GT's task —— View job Code Review Complete ✅I've reviewed the latest changes (commit Summary of Changes in Latest CommitThe author made comprehensive improvements addressing all previous review feedback:
Changes AnalysisNew Files Added
Major Refactorings
Verification of Previous Issues
Current Implementation AssessmentArchitecture (Simplified & Improved): Key Improvements:
Remaining Observations (Minor)No blocking issues remain! Just a few minor notes for consideration:
Testing RecommendationsPer ./gradlew :debugoverlay-core:checkManual Testing Checklist:
Final Verdict✅ APPROVE - Ready to merge! The refactoring addressed all previous feedback comprehensively and resulted in a simpler, more secure, and more maintainable implementation. The author made excellent architectural decisions:
This is exemplary code review follow-through. Great work! 🚀 Diff SummaryKey changes:
|