Redact runtime capabilities and require the SDK isolation check

HTTP request logs retained the runtime GitHub capability header. Add it to the shared redaction policy and cover success, denied, and failed requests with canary credentials.

Run the real optional Sentry SDK regression in a dedicated CI job with the audited peer installed outside the workspace. Require the SDK in that job so missing installation cannot silently skip the regression.

Validation: 123 focused tests, the canonical real-SDK CI command, server typecheck, module boundaries, YAML parse, and secret scans passed.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Devin FoleyandPaperclip committed 2026-09-22 12:32:18 -07:00
1 parent af846cfd8e
commit c9db03bcab
4 files changed
+97

No files matched your search

@@ -399,6 +399,35 @@ describe("HTTP logger redaction", () => {
expect(log.res.headers["set-cookie"]).toBe("[Redacted]");
});
it.each([200, 403, 500])("redacts runtime GitHub capabilities from HTTP %i logs", async (status) => {
const capability = "runtime-github-capability-canary";
const chunks: string[] = [];
const stream = new Writable({
write(chunk, _encoding, callback) {
chunks.push(chunk.toString());
callback();
},
});
const app = express();
app.use(createHttpLogger(pino({ redact: [...HTTP_LOG_REDACT_PATHS] }, stream)));
app.post("/runtime-tools/github/credentials", (_req, res) => {
res.status(status).json({ status });
});
await request(app)
.post("/runtime-tools/github/credentials")
.set("X-Paperclip-Github-Capability", capability)
.send({})
.expect(status);
const output = chunks.join("");
expect(output).not.toContain(capability);
const log = JSON.parse(output.trim());
expect(log.req.headers["x-paperclip-github-capability"]).toBe("[Redacted]");
expect(log.req.url).toBe("/runtime-tools/github/credentials");
expect(log.res.statusCode).toBe(status);
});
it("drops OAuth callback query data from the message and structured request", async () => {
const chunks: string[] = [];
const stream = new Writable({
@@ -20,6 +20,10 @@ const sentryPackage = (() => {
}
})();
if (process.env.PAPERCLIP_REQUIRE_SENTRY_TEST_SDK === "1" && !sentryPackage) {
throw new Error("The Sentry SDK contract job requires the audited optional peer");
}
afterEach(async () => {
await sentryPackage?.close(2000);
vi.unstubAllEnvs();
@@ -10,6 +10,8 @@ export const HTTP_LOG_REDACT_PATHS = [
'req.headers["x-csrf-token"]',
'req.headers["x-xsrf-token"]',
'req.headers["x-api-key"]',
// Runtime GitHub capabilities authorize credential acquisition for a live run.
'req.headers["x-paperclip-github-capability"]',
// Telegram's optional webhook verification header is a reusable bearer
// secret sent on every provider callback.
'req.headers["x-telegram-bot-api-secret-token"]',