Codesec poc pr #2
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Test PR: Per-PR SAST Engine Validation
This PR introduces 2 new injection vulnerabilities, 1 security fix, and 2 precision test cases to benchmark the per-PR SAST analysis engine.
Changes Made
🔴 NEW Vulnerabilities (2)
routes/orderSearch.ts- NoSQL Injection (new file + route registered)$whereoperator with string interpolationGET /rest/orders/searchreq.query.email→ Sink:ordersCollection.find()routes/search.ts- SQL Injection REGRESSIONsubstring(0,200), now unlimited)⚫ PRECISION Test Cases (Must NOT Detect - 2)
routes/coupon.ts- SQL Injection Pattern in Dead CodelookupCouponByCode()contains vulnerable patternroutes/basket.ts- SQL Injection Pattern in Dead CodefindBasketByOwner()contains vulnerable pattern🟢 FIXED Vulnerability (1)
routes/trackOrder.ts- NoSQL Injection REMEDIATED$whereoperator with parameterized query{ $where: \this.orderId === '${id}'` }`{ orderId: id }Expected SAST Results
What This Tests
✅ Classification: NEW vs UNCHANGED vs FIXED
✅ Precision: True data flow analysis (not just pattern matching) - 12 pts of grading
✅ Performance: ~5-10 min speedup from skipped agents
✅ Regression Detection: Sanitization degradation tracking