The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
fix(logging): redact cloud authentication headers (#14413)
Devin Foley6f40e23536ad
diff --git a/server/src/__tests__/http-log-redaction.test.ts b/server/src/__tests__/http-log-redaction.test.tsindex 62def738d8..49fe5f11e4 100644--- a/server/src/__tests__/http-log-redaction.test.ts+++ b/server/src/__tests__/http-log-redaction.test.ts@@ -428,6 +428,58 @@ describe("HTTP logger redaction", () => {expect(log.res.statusCode).toBe(status);});+ it.each([200, 403, 500])("redacts cloud credentials and assertions from HTTP %i logs", async (status) => {+ const headers = {+ "X-Paperclip-Cloud-Tenant-Token": "cloud-tenant-token-canary",+ "X-Paperclip-Cloud-Session-Id": "cloud-session-id-canary",+ "X-Paperclip-Cloud-Runtime-Identity": "cloud-runtime-identity-canary",+ "X-Paperclip-Cloud-Control": "cloud-control-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.get("/api/companies", (_req, res, next) => {+ if (status === 403) {+ next(new HttpError(403, "Cloud tenant authentication required"));+ return;+ }+ if (status === 500) {+ next(new Error("Synthetic cloud request failure"));+ return;+ }+ res.status(status).json({ status });+ });+ app.use(errorHandler);++ const response = await request(app).get("/api/companies").set(headers).expect(status);+ if (status === 403) {+ expect(response.body).toEqual({ error: "Cloud tenant authentication required" });+ } else if (status === 500) {+ expect(response.body).toEqual({ error: "Internal server error" });+ }++ const output = chunks.join("");+ const log = JSON.parse(output.trim());+ for (const [header, secret] of Object.entries(headers)) {+ expect(output).not.toContain(secret);+ expect(log.req.headers[header.toLowerCase()]).toBe("[Redacted]");+ }+ expect(log.req.method).toBe("GET");+ expect(log.req.url).toBe("/api/companies");+ expect(log.res.statusCode).toBe(status);+ expect(log.level).toBe(status === 500 ? 50 : status === 403 ? 40 : 30);+ if (status === 500) {+ expect(log.errorContext.message).toBe("Synthetic cloud request failure");+ expect(log.err.message).toBe("Synthetic cloud request failure");+ }+ });+it("drops OAuth callback query data from the message and structured request", async () => {const chunks: string[] = [];const stream = new Writable({diff --git a/server/src/middleware/http-log-redaction.ts b/server/src/middleware/http-log-redaction.tsindex 8b50c5cf37..684e7cc13f 100644--- a/server/src/middleware/http-log-redaction.ts+++ b/server/src/middleware/http-log-redaction.ts@@ -10,6 +10,11 @@ export const HTTP_LOG_REDACT_PATHS = ['req.headers["x-csrf-token"]','req.headers["x-xsrf-token"]','req.headers["x-api-key"]',+ // Cloud proxy credentials and signed assertions authorize tenant access.+ 'req.headers["x-paperclip-cloud-tenant-token"]',+ 'req.headers["x-paperclip-cloud-session-id"]',+ 'req.headers["x-paperclip-cloud-runtime-identity"]',+ 'req.headers["x-paperclip-cloud-control"]',// 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