Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bench/tasks/c-rand-token/answer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
issues:
- id: c-rand-token-001
file: token.c
severity: MEDIUM
cwe: CWE-338
vulnSlugs: [c-rand-for-security]
location: { startLine: 10, endLine: 12, tolerance: 3 }
scanner: { mustEmitCandidate: true }
decoys:
- id: c-rand-no-security-context-decoy
file: dice.c
line: 5
forbiddenSlugs: [c-rand-for-security]
6 changes: 6 additions & 0 deletions bench/tasks/c-rand-token/source/dice.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <stdlib.h>

/* Dice rolls for the game module. No security keywords here. */
int dice_roll(void) {
return rand() % 6 + 1;
}
15 changes: 15 additions & 0 deletions bench/tasks/c-rand-token/source/token.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

/*
* Mint a per-session token. Tags for the security audit:
* token, nonce, secret, key, password, session, salt, csrf
*/
void mint_session_token_vulnerable(char *out, int len) {
srand((unsigned)time(NULL));
for (int i = 0; i < len; i++) {
out[i] = 'a' + (rand() % 26);
}
out[len - 1] = '\0';
}
9 changes: 9 additions & 0 deletions bench/tasks/c-rand-token/task.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[provenance]
source = "handcraft"
added_at = "2026-05-14"
reviewer = "@noeljackson"
review_due = "2027-05-14"
notes = "C rand() / srand(time()) in security-flavoured context (token, session, csrf)."

[labels]
change_rule = "freeze"
13 changes: 13 additions & 0 deletions bench/tasks/java-spring-cors-wildcard/answer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
issues:
- id: java-spring-cors-wildcard-001
file: ApiController.java
severity: MEDIUM
cwe: CWE-942
vulnSlugs: [java-spring-cors-wildcard]
location: { startLine: 10, endLine: 10, tolerance: 2 }
scanner: { mustEmitCandidate: true }
decoys:
- id: java-cors-explicit-origin-decoy
file: ApiController.java
line: 16
forbiddenSlugs: [java-spring-cors-wildcard]
21 changes: 21 additions & 0 deletions bench/tasks/java-spring-cors-wildcard/source/ApiController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.api;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ApiController {

@CrossOrigin(origins = "*", allowCredentials = "true")
@GetMapping("/profile")
public String profileVulnerable() {
return "{}";
}

@CrossOrigin(origins = "https://example.com")
@GetMapping("/health")
public String healthSafe() {
return "ok";
}
}
7 changes: 7 additions & 0 deletions bench/tasks/java-spring-cors-wildcard/source/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>cors-fixture</artifactId>
<version>0.0.1</version>
</project>
9 changes: 9 additions & 0 deletions bench/tasks/java-spring-cors-wildcard/task.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[provenance]
source = "handcraft"
added_at = "2026-05-14"
reviewer = "@noeljackson"
review_due = "2027-05-14"
notes = "Java Spring @CrossOrigin(origins=\"*\") + allowCredentials=true — credentialed wildcard CORS."

[labels]
change_rule = "freeze"
20 changes: 20 additions & 0 deletions bench/tasks/rust-serde-deserialize/answer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
issues:
- id: rust-serde-from-str-001
file: src/lib.rs
severity: MEDIUM
cwe: CWE-502
vulnSlugs: [rust-deserialize-from-str-untrusted, rust-panic-on-untrusted]
location: { startLine: 9, endLine: 9, tolerance: 2 }
scanner: { mustEmitCandidate: true }
- id: rust-bincode-deserialize-001
file: src/lib.rs
severity: MEDIUM
cwe: CWE-502
vulnSlugs: [rust-deserialize-from-str-untrusted, rust-panic-on-untrusted]
location: { startLine: 13, endLine: 13, tolerance: 2 }
scanner: { mustEmitCandidate: true }
decoys:
- id: rust-non-deserializer-builder-decoy
file: src/lib.rs
line: 17
forbiddenSlugs: [rust-deserialize-from-str-untrusted]
9 changes: 9 additions & 0 deletions bench/tasks/rust-serde-deserialize/source/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "fixture"
version = "0.0.1"
edition = "2021"

[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = "1"
bincode = "1"
18 changes: 18 additions & 0 deletions bench/tasks/rust-serde-deserialize/source/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use serde::Deserialize;

#[derive(Deserialize)]
pub struct Msg {
pub user: String,
}

pub fn parse_json_vulnerable(body: &str) -> Msg {
serde_json::from_str(body).unwrap()
}

pub fn parse_bincode_vulnerable(bytes: &[u8]) -> Msg {
bincode::deserialize(bytes).unwrap()
}

pub fn build_default() -> Msg {
Msg { user: String::from("default") }
}
9 changes: 9 additions & 0 deletions bench/tasks/rust-serde-deserialize/task.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[provenance]
source = "handcraft"
added_at = "2026-05-14"
reviewer = "@noeljackson"
review_due = "2027-05-14"
notes = "Rust serde_json::from_str + bincode::deserialize from untrusted bytes — confirm-source matcher."

[labels]
change_rule = "freeze"
Loading