mirror of
https://github.com/openai/codex-security.git
synced 2026-12-02 18:33:19 +08:00
* refactor(evals): remove Promptfoo patch and generated calibration YAML * fix(evals): preserve provider snapshots and CLI overrides * fix(evals): share SAST settings across config entry points
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const evalRoot = path.resolve(import.meta.dirname, "..");
|
|
const sourceRoot = path.resolve(evalRoot, "../..");
|
|
|
|
// Preserve the stable bindings used by saved native-provider configs, including
|
|
// viewer replay, which does not rerun transforms. Current configs bind their
|
|
// temporary runtime through the runner's preload instead.
|
|
export default (vars: Record<string, unknown>) => {
|
|
const nodePath = fs.realpathSync(process.execPath);
|
|
let targetRepo = vars.target_repo;
|
|
if (vars.calibration_repo) {
|
|
targetRepo = path.join(
|
|
(vars.calibration_repo_root ||
|
|
process.env.TRIAGE_CALIBRATION_ROOT ||
|
|
path.join(evalRoot, "artifacts", "calibration-repos")) as string,
|
|
vars.calibration_repo as string,
|
|
);
|
|
} else if (
|
|
typeof targetRepo === "string" &&
|
|
targetRepo.startsWith("evals/triage-finding/fixtures/")
|
|
) {
|
|
targetRepo = path.join(sourceRoot, targetRepo);
|
|
}
|
|
return {
|
|
...vars,
|
|
target_repo: targetRepo,
|
|
triage_runtime_root: path.join(sourceRoot, "plugins", "codex-security"),
|
|
triage_fixture_root: path.join(evalRoot, "fixtures"),
|
|
triage_node_path: nodePath,
|
|
triage_node_root: path.dirname(nodePath),
|
|
sastbench_git_cache_root: path.join(
|
|
evalRoot,
|
|
"artifacts",
|
|
"sastbench-git-cache",
|
|
),
|
|
};
|
|
};
|