[pitboss] phase 05: M5 — JS/TS, Go, Java, PHP harness emitters

This commit is contained in:
pitboss 2026-05-12 02:20:55 -04:00
parent 84638e7d57
commit 345b44d3cc
103 changed files with 5637 additions and 34 deletions

View file

@ -0,0 +1,27 @@
// File I/O negative fixture.
// Safe: normalizes path and checks it stays within the base directory.
// Entry: Entry.readFile(String) Cap: FILE_IO
// Expected verdict: NotConfirmed
import java.io.*;
import java.nio.file.*;
public class Entry {
private static final String BASE_DIR = "/var/data";
public static void readFile(String userPath) throws Exception {
Path base = Paths.get(BASE_DIR).toRealPath();
Path resolved = base.resolve(userPath).normalize();
if (!resolved.startsWith(base)) {
System.out.println("Access denied");
return;
}
try {
byte[] data = Files.readAllBytes(resolved);
int len = Math.min(data.length, 100);
System.out.write(data, 0, len);
} catch (IOException e) {
System.out.println("File not found");
}
}
}