demo: C# EF Core VG001-VG003#10
Open
eitamring wants to merge 1 commit into
Open
Conversation
| { | ||
| public void RawSqlViolations(DbContext db) | ||
| { | ||
| db.Database.ExecuteSqlRaw("SELECT * FROM users LIMIT 1"); |
There was a problem hiding this comment.
VG001: avoid SELECT *; project only required columns | Query: SELECT * FROM users LIMIT 1
| public void RawSqlViolations(DbContext db) | ||
| { | ||
| db.Database.ExecuteSqlRaw("SELECT * FROM users LIMIT 1"); | ||
| db.Database.ExecuteSqlRaw("UPDATE users SET active = false"); |
There was a problem hiding this comment.
🚫 [valk-guard] reported by reviewdog 🐶
VG002: UPDATE without WHERE may affect all rows; add a WHERE clause | Query: UPDATE users SET active = false
| { | ||
| db.Database.ExecuteSqlRaw("SELECT * FROM users LIMIT 1"); | ||
| db.Database.ExecuteSqlRaw("UPDATE users SET active = false"); | ||
| db.Database.ExecuteSqlRaw("DELETE FROM orders"); |
There was a problem hiding this comment.
🚫 [valk-guard] reported by reviewdog 🐶
VG003: DELETE without WHERE may affect all rows; add a WHERE clause | Query: DELETE FROM orders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
This PR adds a C# EF Core demo branch that mirrors the existing SQL/Go/Python rule-triggering PRs.
Expected Findings In This PR
VG001(select-star): expected onSELECT * FROM users LIMIT 1.VG002(missing-where-update): expected onUPDATE users SET active = false.VG003(missing-where-delete): expected onDELETE FROM orders.These are intentional violations to prove C# scanner and inline review comment behavior.
Workflow Updates
VALK_GUARD_INSTALL_REFtov0.1.5, which includes the C# scanner stdout-noise fix.actions/setup-dotnetso the C# scanner can run in CI.**/*.csin changed-file detection.Local Verification
PATH=/tmp/valk-dotnet-bin:$PATH go run github.com/valkdb/valk-guard/cmd/valk-guard@v0.1.5 scan demo/violations/csharp-vg001-003/csharp/efcore_queries.cs --config .valk-guard.yaml --format rdjsonlResult: exactly 3 diagnostics:
VG001,VG002, andVG003.