▸case-13 Review this React UI component modification for XSS vulnerabilities.
### Git patch
```diff
diff --git a/CommentView.tsx b/CommentView.tsx
--- a/CommentView.tsx
+++ b/CommentView.tsx
@@ -10,2 +10,2 @@ export function CommentView({ text }: { text: string }) {
- return <div>{text}</div>;
+ return <div dangerouslySetInnerHTML={{ __html: text }} />;
```
### Source file
[CommentView.tsx]
export function CommentView({ text }: { text: string }) {
return <div dangerouslySetInnerHTML={{ __html: text }} />;
} | fail→fail | 4,896 | 5,590 | +14% | 1 | 1 | 0% | 975 | 1,500 | +54% | 0 | 0 | — |
▸case-09 Analyze this log processor modification for resource handling flaws.
### Diff delta
```diff
diff --git a/process_logs.py b/process_logs.py
--- a/process_logs.py
+++ b/process_logs.py
@@ -21,3 +21,3 @@ def write_log(entry):
- with open("app.log", "a") as f:
- f.write(entry)
+ f = open("app.log", "a")
+ f.write(entry)
```
### Source file
[process_logs.py]
def write_log(entry):
f = open("app.log", "a")
f.write(entry) | fail→pass | 6,127 | 5,367 | -12% | 1 | 1 | 0% | 1,125 | 1,388 | +23% | 0 | 0 | — |
▸case-10 Review this multithreaded state counter change in counter_service.go.
### Diff view
```diff
diff --git a/counter_service.go b/counter_service.go
--- a/counter_service.go
+++ b/counter_service.go
@@ -30,3 +30,1 @@ func Increment() {
- mu.Lock()
globalCounter++
- mu.Unlock()
```
### File view
[counter_service.go]
func Increment() {
globalCounter++
} | fail→fail | 6,082 | 7,665 | +26% | 1 | 1 | 0% | 1,081 | 1,943 | +80% | 0 | 0 | — |
▸case-11 Audit this deployment script patch for command execution risks.
### Git diff
```diff
diff --git a/deployment_script.py b/deployment_script.py
--- a/deployment_script.py
+++ b/deployment_script.py
@@ -13,2 +13,2 @@ def run_deploy(branch):
- subprocess.run(["git", "checkout", branch], check=True)
+ subprocess.run(f"git checkout {branch}", shell=True)
```
### Source file
[deployment_script.py]
def run_deploy(branch):
subprocess.run(f"git checkout {branch}", shell=True) | fail→pass | 9,847 | 9,228 | -6% | 1 | 1 | 0% | 1,416 | 2,090 | +48% | 0 | 0 | — |
▸case-12 Audit this authorization update in document_router.ts.
### Git diff
```diff
diff --git a/document_router.ts b/document_router.ts
--- a/document_router.ts
+++ b/document_router.ts
@@ -18,3 +18,1 @@ export function getDoc(req: Request) {
- if (!req.user.ownsDoc(req.params.id)) {
- throw new Error("Unauthorized");
- }
return db.find(req.params.id);
```
### Source file
[document_router.ts]
export function getDoc(req: Request) {
return db.find(req.params.id);
} | fail→fail | 4,649 | 5,550 | +19% | 1 | 1 | 0% | 874 | 1,526 | +75% | 0 | 0 | — |
▸case-01 I need a deep security and correctness review on the changes attached below. Please evaluate the modified code for logical bugs, breaking changes, and cross-module side effects. Provide a prioritized list of findings with explicit file paths and line numbers for evidence.
### Git / diff output
```diff
diff --git a/src/auth/session.ts b/src/auth/session.ts
index a1b2c3d..e4f5g6h 100644
--- a/src/auth/session.ts
+++ b/src/auth/session.ts
@@ -12,4 +12,6 @@ export function validateSession(token: string) {
+ if (!token) return null;
+ const decoded = jwt.decode(token);
+ return decoded;
```
### Changed file contents
[src/auth/session.ts]
import jwt from 'jsonwebtoken';
export function validateSession(token: string) {
if (!token) return null;
const decoded = jwt.decode(token);
return decoded;
} | fail→fail | 13,190 | 16,204 | +23% | 1 | 1 | 0% | 1,028 | 2,051 | +100% | 0 | 0 | — |
▸case-02 Can you conduct a thorough review on these branch updates? Focus on discovering defects or safety flaws in the modified logic, and present the final feedback grouped by severity levels alongside clear file:line pointers.
### Git / diff output
```diff
diff --git a/services/user_service.py b/services/user_service.py
--- a/services/user_service.py
+++ b/services/user_service.py
@@ -88,3 +88,2 @@ def update_user_email(user_id, new_email):
- if not is_valid_email(new_email):
- raise ValueError("Invalid email")
db.users.update_one({"_id": user_id}, {"$set": {"email": new_email}})
```
### Changed file contents
[services/user_service.py]
def update_user_email(user_id, new_email):
db.users.update_one({"_id": user_id}, {"$set": {"email": new_email}}) | pass→pass | 5,578 | 7,033 | +26% | 1 | 1 | 0% | 1,115 | 1,867 | +67% | 0 | 0 | — |
▸case-03 Inspect the recent changes in legacy_data.py for logical errors and security vulnerabilities. Restrict analysis to modified lines.
### Patch delta
```diff
diff --git a/src/legacy_data.py b/src/legacy_data.py
--- a/src/legacy_data.py
+++ b/src/legacy_data.py
@@ -45,2 +45,2 @@ def process_record(record_id):
- data = raw_eval(record_id)
+ data = sanitize_and_parse(record_id)
```
### Current file state
[src/legacy_data.py]
def legacy_unsafe_query(input_str):
return eval(input_str)
def process_record(record_id):
data = sanitize_and_parse(record_id)
return data | fail→pass | 8,092 | 12,415 | +53% | 1 | 1 | 0% | 1,049 | 2,239 | +113% | 0 | 0 | — |
▸case-04 Audit this database query patch for vulnerabilities and provide file and line evidence.
### Commit diff
```diff
diff --git a/db_query.py b/db_query.py
--- a/db_query.py
+++ b/db_query.py
@@ -10,3 +10,3 @@ def fetch_user(user_input):
- cursor.execute("SELECT * FROM users WHERE username = %s", (user_input,))
+ cursor.execute(f"SELECT * FROM users WHERE username = '{user_input}'")
```
### File view
[db_query.py]
def fetch_user(user_input):
cursor.execute(f"SELECT * FROM users WHERE username = '{user_input}'")
return cursor.fetchone() | fail→fail | 4,357 | 5,050 | +16% | 1 | 1 | 0% | 925 | 1,442 | +56% | 0 | 0 | — |
▸case-05 Review this controller update for API breaking changes or bugs.
### Patch summary
```diff
diff --git a/controllers/user_controller.ts b/controllers/user_controller.ts
--- a/controllers/user_controller.ts
+++ b/controllers/user_controller.ts
@@ -24,3 +24,2 @@ export function getUserResponse(user: User) {
- return { userId: user.id, username: user.name };
+ return { name: user.name };
```
### Code file
[controllers/user_controller.ts]
export function getUserResponse(user: User) {
return { name: user.name };
} | fail→pass | 5,924 | 4,883 | -18% | 1 | 1 | 0% | 1,136 | 1,524 | +34% | 0 | 0 | — |
▸case-06 Review the changed path handling logic in file_handler.go.
### Diff output
```diff
diff --git a/file_handler.go b/file_handler.go
--- a/file_handler.go
+++ b/file_handler.go
@@ -17,2 +17,2 @@ func ReadFile(filename string) ([]byte, error) {
- cleanPath := filepath.Clean(filename)
- return os.ReadFile(filepath.Join("/var/app/data", cleanPath))
+ return os.ReadFile("/var/app/data/" + filename)
```
### File content
[file_handler.go]
func ReadFile(filename string) ([]byte, error) {
return os.ReadFile("/var/app/data/" + filename)
} | fail→pass | 9,756 | 8,470 | -13% | 1 | 1 | 0% | 1,881 | 1,897 | +1% | 0 | 0 | — |
▸case-07 Examine this configuration update for security hazards.
### Diff
```diff
diff --git a/app_config.py b/app_config.py
--- a/app_config.py
+++ b/app_config.py
@@ -7,2 +7,2 @@ CONFIG = {
- "api_key": os.getenv("API_KEY")
+ "api_key": "sk-proj-9988112233445566778899"
```
### Content
[app_config.py]
CONFIG = {
"api_key": "sk-proj-9988112233445566778899"
} | fail→fail | 11,418 | 11,807 | +3% | 1 | 1 | 0% | 1,026 | 1,520 | +48% | 0 | 0 | — |
▸case-08 Evaluate this async networking function for error handling issues.
### Diff block
```diff
diff --git a/api_client.ts b/api_client.ts
--- a/api_client.ts
+++ b/api_client.ts
@@ -14,4 +14,2 @@ export async function syncData() {
- try {
- await fetchRemote();
- } catch (err) {
- logger.error(err);
- }
+ await fetchRemote();
```
### Code block
[api_client.ts]
export async function syncData() {
await fetchRemote();
} | fail→fail | 8,431 | 10,034 | +19% | 1 | 1 | 0% | 1,384 | 2,360 | +71% | 0 | 0 | — |
▸case-14 Audit this buffer processing loop modification in buffer_utils.cpp.
### Patch diff
```diff
diff --git a/buffer_utils.cpp b/buffer_utils.cpp
--- a/buffer_utils.cpp
+++ b/buffer_utils.cpp
@@ -15,2 +15,2 @@ void processBuffer(int* buf, int size) {
- for (int i = 0; i < size; i++) {
+ for (int i = 0; i <= size; i++) {
buf[i] = 0;
```
### Source code
[buffer_utils.cpp]
void processBuffer(int* buf, int size) {
for (int i = 0; i <= size; i++) {
buf[i] = 0;
}
} | fail→pass | 4,945 | 6,781 | +37% | 1 | 1 | 0% | 981 | 1,856 | +89% | 0 | 0 | — |
▸case-15 Audit this token generation patch in token_generator.py.
### Diff output
```diff
diff --git a/token_generator.py b/token_generator.py
--- a/token_generator.py
+++ b/token_generator.py
@@ -6,2 +6,2 @@ def generate_reset_token():
- return secrets.token_hex(16)
+ return str(random.randint(100000, 999999))
```
### Code file
[token_generator.py]
def generate_reset_token():
return str(random.randint(100000, 999999)) | fail→fail | 8,400 | 12,658 | +51% | 1 | 1 | 0% | 1,672 | 2,822 | +69% | 0 | 0 | — |
▸case-16 Audit this client HTTP request modification in network_client.py.
### Git diff
```diff
diff --git a/network_client.py b/network_client.py
--- a/network_client.py
+++ b/network_client.py
@@ -11,2 +11,2 @@ def send_payload(url, data):
- return requests.post(url, json=data)
+ return requests.post(url, json=data, verify=False)
```
### Source file
[network_client.py]
def send_payload(url, data):
return requests.post(url, json=data, verify=False) | fail→pass | 5,744 | 5,108 | -11% | 1 | 1 | 0% | 1,044 | 1,386 | +33% | 0 | 0 | — |
▸case-17 Audit this C pointer handling logic change in user_parser.c.
### Git diff
```diff
diff --git a/user_parser.c b/user_parser.c
--- a/user_parser.c
+++ b/user_parser.c
@@ -9,3 +9,2 @@ void parse_user(User* u) {
- if (!u) return;
u->status = 1;
```
### Source file
[user_parser.c]
void parse_user(User* u) {
u->status = 1;
} | fail→fail | 6,443 | 5,129 | -20% | 1 | 1 | 0% | 1,109 | 1,408 | +27% | 0 | 0 | — |
▸case-18 Audit this route addition in auth_routes.ts for missing security protections.
### Git diff
```diff
diff --git a/auth_routes.ts b/auth_routes.ts
--- a/auth_routes.ts
+++ b/auth_routes.ts
@@ -21,1 +21,2 @@ router.post("/login", rateLimiter, loginHandler);
+router.post("/login-v2", loginHandler);
```
### Source file
[auth_routes.ts]
router.post("/login", rateLimiter, loginHandler);
router.post("/login-v2", loginHandler); | fail→pass | 12,973 | 13,979 | +8% | 1 | 1 | 0% | 1,019 | 1,673 | +64% | 0 | 0 | — |
▸case-19 Audit this secret comparison update in crypto_utils.ts.
### Git diff
```diff
diff --git a/crypto_utils.ts b/crypto_utils.ts
--- a/crypto_utils.ts
+++ b/crypto_utils.ts
@@ -13,2 +13,2 @@ export function compareSignatures(sigA: string, sigB: string) {
- return crypto.timingSafeEqual(Buffer.from(sigA), Buffer.from(sigB));
+ return sigA === sigB;
```
### Source file
[crypto_utils.ts]
export function compareSignatures(sigA: string, sigB: string) {
return sigA === sigB;
} | fail→pass | 7,708 | 7,326 | -5% | 1 | 1 | 0% | 1,303 | 1,896 | +46% | 0 | 0 | — |
▸case-20 Fix the bug in session.ts where invalid tokens return null instead of throwing an error, and return the modified code file. | pass→pass | 8,824 | 17,120 | +94% | 1 | 1 | 0% | 1,602 | 2,144 | +34% | 0 | 0 | — |
▸case-21 Write a public pull request description and release notes summary for our upcoming v2.0 blog post based on recent git commits. | pass→pass | 14,853 | 13,916 | -6% | 1 | 1 | 0% | 2,334 | 2,810 | +20% | 0 | 0 | — |
▸case-22 Refactor the entire user authentication module in `auth.py` to use asynchronous functions and object-oriented syntax. | pass→pass | 20,752 | 29,558 | +42% | 1 | 1 | 0% | 4,345 | 6,007 | +38% | 0 | 0 | — |