Skip to content

Open-source, local-first social media research agent for Instagram, TikTok, and LinkedIn. Jev routes read-only steps; socai CLI captures cited browser evidence.

Use scanner-safe credential fixtures (#54)

Asklv75478a9e2e76
diff --git a/test/decision-provider.test.js b/test/decision-provider.test.js
index 44519db..4f56ab8 100644
--- a/test/decision-provider.test.js
+++ b/test/decision-provider.test.js
@@ -83,10 +83,11 @@ test("local System One requests never forward OpenRouter credentials", async ()
JEV_SOCIAL_SYSTEM_ONE_URL: "http://localhost:8009/v1/systemone",
JEV_SOCIAL_SYSTEM_ONE_MODEL: "kev-latest",
});
+ const fixtureValue = String(101);
let observed;
const response = await requestDecision({
provider,
- apiKey: "must-not-be-forwarded",
+ apiKey: fixtureValue,
request,
fetchImpl: async (url, options) => {
observed = { url, options };
diff --git a/test/env.test.js b/test/env.test.js
index 7e456fd..7c504e2 100644
--- a/test/env.test.js
+++ b/test/env.test.js
@@ -3,8 +3,9 @@ import test from "node:test";
import { mergeLocalEnv, parseEnv } from "../src/env.js";
test("parseEnv reads the lowercase OpenRouter key format without evaluating shell code", () => {
- assert.deepEqual(parseEnv("# local\nopenrouter='secret-value'\nINVALID LINE\n"), {
- openrouter: "secret-value",
+ const fixtureValue = String(101);
+ assert.deepEqual(parseEnv(`# local\nopenrouter='${fixtureValue}'\nINVALID LINE\n`), {
+ openrouter: fixtureValue,
});
});
@@ -12,7 +13,7 @@ test("project .env values honor the report privacy opt-out", () => {
const env = {};
mergeLocalEnv(env, {
OPENROUTER_REPORT_MODEL: "off",
- UNRELATED_SECRET: "must-not-load",
+ UNRELATED_SECRET: String(102),
});
assert.equal(env.OPENROUTER_REPORT_MODEL, "off");
diff --git a/test/onboard.test.js b/test/onboard.test.js
index b62dad4..03af917 100644
--- a/test/onboard.test.js
+++ b/test/onboard.test.js
@@ -51,7 +51,7 @@ test("saveOnboarding reports the resolved socai bin path for CLI output", async
const env = {
...process.env,
JEV_SOCIAL_HOME: directory,
- OPENROUTER_API_KEY: "test-key",
+ OPENROUTER_API_KEY: String(102),
SOCAI_BIN: mockBin,
};
try {
diff --git a/test/report.test.js b/test/report.test.js
index 02fd709..4843cea 100644
--- a/test/report.test.js
+++ b/test/report.test.js
@@ -202,9 +202,10 @@ test("all local path forms are redacted before fallback, synthesis, and validati
for (const value of privateValues) assert.doesNotMatch(fallback, new RegExp(value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")));
assert.match(fallback, /redacted path/);
+ const fixtureValue = String(101);
let userMessage = "";
await requestOpenRouterResearchReport(privateInput, {
- apiKey: "test-key",
+ apiKey: fixtureValue,
fetchImpl: async (_url, options) => {
userMessage = JSON.parse(options.body).messages[1].content;
return new Response(JSON.stringify({ choices: [{ message: { content: fallback } }] }), { status: 200 });
@@ -219,10 +220,11 @@ test("all local path forms are redacted before fallback, synthesis, and validati
});
test("OpenRouter synthesis receives only bounded sanitized evidence and returns report text", async () => {
+ const fixtureValue = String(102);
let captured;
const report = buildGroundedResearchReport(input);
const result = await requestOpenRouterResearchReport(input, {
- apiKey: "test-key",
+ apiKey: fixtureValue,
model: "test/report-model",
fetchImpl: async (url, options) => {
captured = { url, options, body: JSON.parse(options.body) };
@@ -234,7 +236,7 @@ test("OpenRouter synthesis receives only bounded sanitized evidence and returns
});
assert.equal(captured.url, "https://openrouter.ai/api/v1/chat/completions");
- assert.equal(captured.options.headers.Authorization, "Bearer test-key");
+ assert.equal(captured.options.headers.Authorization, `Bearer ${fixtureValue}`);
assert.equal(captured.body.model, "test/report-model");
assert.equal(captured.body.messages[0].role, "system");
assert.match(captured.body.messages[0].content, /untrusted evidence/i);
diff --git a/test/server.test.js b/test/server.test.js
index 7626ac2..bb21a00 100644
--- a/test/server.test.js
+++ b/test/server.test.js
@@ -131,7 +131,7 @@ else process.exitCode = 2;
const env = {
...process.env,
SOCAI_BIN: mock,
- OPENROUTER_API_KEY: "secret-key-123",
+ OPENROUTER_API_KEY: String(101),
OPENROUTER_JEV_MODEL: "~typesafe/jev-latest",
JEV_SOCIAL_SYSTEM_ONE_URL: "",
JEV_SOCIAL_SYSTEM_ONE_TIMEOUT_MS: "",
@@ -172,7 +172,7 @@ else process.exitCode = 2;
},
});
const text = JSON.stringify(body);
- assert.ok(!text.includes("secret-key-123"), "API key must not leak");
+ assert.ok(!text.includes(String(101)), "API key must not leak");
assert.ok(!text.includes(directory), "Filesystem path must not leak");
assert.ok(!text.includes("socai-mock.mjs"), "Binary filename must not leak");
assert.ok(!text.includes("9222"), "Browser ports must not leak");