Improve suspicious string literals/secrets audit - #29
MarkLanser wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe source analyser now filters suspicious secret literals by credential-like value patterns. Parameterised tests cover reported credential formats and excluded non-secret values. ChangesSuspicious secret literal filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/Services/Source/TextSourceAnalyzer.php`:
- Around line 88-94: Update looksLikeCredential() to reject values containing
placeholder and validation-rule syntax characters, including %, :, , and /,
alongside the existing disallowed characters. Extend the related negative-case
provider to cover %_access_token, required_if:status,active, and
regex:/^[A-Z]+$/, ensuring these values do not produce suspicious-literal
findings.
- Around line 88-95: The credential detection logic in the surrounding analyzer
method must retain alphabetic-only values as possible credentials, including
long passphrases, instead of rejecting them via the final regex and whitespace
check. Replace those unconditional exclusions with context-aware or
confidence-based validation, and add a positive test case for an alphabetic
credential such as the reported api_key example.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0f13e129-2df6-4956-a6b2-8da88711cd90
📒 Files selected for processing (2)
src/Services/Source/TextSourceAnalyzer.phptests/Services/Audits/SourceAuditServiceTest.php
Problem
I noticed that we got a lot of false positives with this check.
SourceAuditService->TextSourceAnalyzerIt flagged:
access_tokenvalidation in the middleware:access_token => 'required|min:3'passwordvalidation in the middleware:required|same:password%_access_tokenin itTo name a few.
Proposed solution
Also check the value of keys to (somewhat rudimentary) see if there are actually suspicious values. This way it removes all above false positives.
Summary by CodeRabbit
Bug Fixes
Tests