Skip to content

Commit 977b3e3

Browse files
committed
👌 IMPROVE: Hide LLM key in logs
1 parent 16e526b commit 977b3e3

File tree

1 file changed

+9
-1
lines changed
  • packages/baseai/src/dev/routes/beta/pipes

1 file changed

+9
-1
lines changed

‎packages/baseai/src/dev/routes/beta/pipes/run.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,15 @@ const handleGenerateError = (c: any, error: unknown) => {
115115
const handleRun = async (c: any) => {
116116
try {
117117
const body = await c.req.json();
118-
logger('pipe.request', body, 'Pipe Request Body');
118+
119+
const llmKey = (body.llmApiKey as string) || '';
120+
const hiddenChars = new Array(45).fill('*').join('');
121+
const redactedKey = llmKey.length
122+
? llmKey.slice(0, 8) + hiddenChars
123+
: '';
124+
125+
const logData = { ...body, llmApiKey: redactedKey };
126+
logger('pipe.request', logData, 'Pipe Request Body');
119127

120128
const validatedBody = validateRequestBody(body);
121129

0 commit comments

Comments
 (0)