Files
Open_Ultra_SAST/benchmarks/pairs/vfc-js/angular-http-server-1-0-0/fixed.js
T
Marius CiepluchandClaude Fable 5.1 8ab4207618 feat(pair-corpus-honesty): add vibe-py, vfc-js and agent-vfc slices with mechanism vocabulary
Tasks 1.1, 5.1, 5.2, 5.4 and the data half of 5.3.

- mechanisms.toml: closed vocabulary v1 (20 ids) every expected row cites.
- vibe-py: 35 Real-Vuln-Benchmark pairs (Apache-2.0), human provenance only
  because the LLM-generated repositories carry no license (escalated).
- vfc-js: 17 Node fix-commit pairs harvested upstream (MIT/Apache-2.0),
  SecBench.js itself is not vendored (no license); sinks derived on 13/17.
- agent-vfc: 29 agent-trailer fixes as catalog-candidates.toml plus
  REVIEW.md; the loaded catalog stays empty until a human reviews them.
- datasets.toml and README document every slice and its review status.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
2026-09-05 10:45:42 +02:00

56 lines
2.1 KiB
JavaScript

// Provenance: simonh1000/angular-http-server (fixed).
// repo: simonh1000/angular-http-server
// commit: 8bafc9577161469f5dea01e0b98ea9c525d063e9
// parent: d171a771a92e4685b24fb77cb894a7b7b8024c5c
// commit_url: https://github.com/simonh1000/angular-http-server/commit/8bafc9577161469f5dea01e0b98ea9c525d063e9
// cve:
// license: Apache-2.0
// function: requestListener
// relpath: angular-http-server.js
// provenance: human
// mechanism: path_join_user_input
// upstream_start: 45
function requestListener(req, res) {
// Add CORS header if option chosen
if (argv.cors) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Request-Method', '*');
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
res.setHeader('Access-Control-Allow-Headers', 'authorization, content-type');
// When the request is for CORS OPTIONS (rather than a page) return just the headers
if (req.method === 'OPTIONS') {
res.writeHead(200);
res.end();
return;
}
}
// Request is for a page instead
// Only interested in the part before any query params
var url = req.url.split('?')[0]
// Attaches path prefix with --path option
var possibleFilename = resolveUrl(url.slice(1)) || "dummy";
var safeFileName = path.normalize(possibleFilename).replace(/^(\.\.[\/\\])+/, '');
var safeFullFilename = path.join(__dirname, safeFileName);
fs.stat(safeFullFilename, function(err, stats) {
var fileBuffer;
if (!err && stats.isFile()) {
fileBuffer = fs.readFileSync(safeFullFilename);
let ct = mime.lookup(safeFullFilename);
log(`Sending ${safeFullFilename} with Content-Type ${ct}`);
res.writeHead(200, { 'Content-Type': ct });
} else {
log("Route %s, replacing with index.html", safeFullFilename);
fileBuffer = returnDistFile();
res.writeHead(200, { 'Content-Type': 'text/html' });
}
res.write(fileBuffer);
res.end();
});
}