mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 10:30:37 +09:00
Redact current user in comments and token checks
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
b1bf09970f
commit
088eaea0cb
6 changed files with 225 additions and 55 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import type { Db } from "@paperclipai/db";
|
||||
import { activityLog } from "@paperclipai/db";
|
||||
import { publishLiveEvent } from "./live-events.js";
|
||||
import { redactCurrentUserValue } from "../log-redaction.js";
|
||||
import { sanitizeRecord } from "../redaction.js";
|
||||
|
||||
export interface LogActivityInput {
|
||||
|
|
@ -17,6 +18,7 @@ export interface LogActivityInput {
|
|||
|
||||
export async function logActivity(db: Db, input: LogActivityInput) {
|
||||
const sanitizedDetails = input.details ? sanitizeRecord(input.details) : null;
|
||||
const redactedDetails = sanitizedDetails ? redactCurrentUserValue(sanitizedDetails) : null;
|
||||
await db.insert(activityLog).values({
|
||||
companyId: input.companyId,
|
||||
actorType: input.actorType,
|
||||
|
|
@ -26,7 +28,7 @@ export async function logActivity(db: Db, input: LogActivityInput) {
|
|||
entityId: input.entityId,
|
||||
agentId: input.agentId ?? null,
|
||||
runId: input.runId ?? null,
|
||||
details: sanitizedDetails,
|
||||
details: redactedDetails,
|
||||
});
|
||||
|
||||
publishLiveEvent({
|
||||
|
|
@ -40,7 +42,7 @@ export async function logActivity(db: Db, input: LogActivityInput) {
|
|||
entityId: input.entityId,
|
||||
agentId: input.agentId ?? null,
|
||||
runId: input.runId ?? null,
|
||||
details: sanitizedDetails,
|
||||
details: redactedDetails,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue