Skip to content

Commit

Permalink
fix(tools): encrypt updated api keys (#160)
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Pilar <tomas.pilar@apoco.com>
  • Loading branch information
pilartomas authored Jan 22, 2025
1 parent e7b8eab commit 1d561d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/tools/dtos/tool-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const toolUpdateBodySchema = {
type: 'string'
},
api_key: {
type: 'string'
type: 'string',
nullable: true
},
metadata: metadataSchema,
user_description: { type: 'string' }
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tools.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ export async function updateTool({
code: APIErrorCode.INVALID_INPUT
});
}
tool.apiKey = getUpdatedValue(body.api_key, tool.apiKey);
tool.apiKey = getUpdatedValue(body.api_key && encrypt(body.api_key), tool.apiKey);
}

if ('parameters' in body) {
Expand Down

0 comments on commit 1d561d6

Please sign in to comment.