mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
style: apply Biome formatting to enterprise files
This commit is contained in:
@@ -86,7 +86,11 @@ export async function apiKeyRoutes(app: FastifyInstance): Promise<void> {
|
||||
return reply.status(409).send({ error: "Failed to create API key" });
|
||||
}
|
||||
|
||||
await auditFromRequest(request)("API_KEY_CREATED", { userId: user.id, keyId: id, keyName: name });
|
||||
await auditFromRequest(request)("API_KEY_CREATED", {
|
||||
userId: user.id,
|
||||
keyId: id,
|
||||
keyName: name,
|
||||
});
|
||||
|
||||
// Return the raw key ONCE — it cannot be retrieved again
|
||||
return reply.status(201).send({
|
||||
|
||||
@@ -35,9 +35,9 @@ export async function registerSiemRoutes(app: FastifyInstance): Promise<void> {
|
||||
// Enterprise package not available
|
||||
}
|
||||
if (!featureEnabled) {
|
||||
return reply
|
||||
.status(403)
|
||||
.send({ error: "SIEM forwarding requires an enterprise license with the siem_forwarding feature" });
|
||||
return reply.status(403).send({
|
||||
error: "SIEM forwarding requires an enterprise license with the siem_forwarding feature",
|
||||
});
|
||||
}
|
||||
|
||||
const [row] = await db
|
||||
@@ -65,10 +65,7 @@ export async function registerSiemRoutes(app: FastifyInstance): Promise<void> {
|
||||
// PUT /api/v1/enterprise/siem/config
|
||||
app.put(
|
||||
"/api/v1/enterprise/siem/config",
|
||||
async (
|
||||
request: FastifyRequest<{ Body: unknown }>,
|
||||
reply: FastifyReply,
|
||||
) => {
|
||||
async (request: FastifyRequest<{ Body: unknown }>, reply: FastifyReply) => {
|
||||
const user = await requirePermission("webhooks:manage")(request, reply);
|
||||
if (!user) return;
|
||||
|
||||
@@ -81,14 +78,16 @@ export async function registerSiemRoutes(app: FastifyInstance): Promise<void> {
|
||||
// Enterprise package not available
|
||||
}
|
||||
if (!featureEnabled) {
|
||||
return reply
|
||||
.status(403)
|
||||
.send({ error: "SIEM forwarding requires an enterprise license with the siem_forwarding feature" });
|
||||
return reply.status(403).send({
|
||||
error: "SIEM forwarding requires an enterprise license with the siem_forwarding feature",
|
||||
});
|
||||
}
|
||||
|
||||
const parsed = configSchema.safeParse(request.body);
|
||||
if (!parsed.success) {
|
||||
return reply.status(400).send({ error: "Invalid SIEM config", details: parsed.error.issues });
|
||||
return reply
|
||||
.status(400)
|
||||
.send({ error: "Invalid SIEM config", details: parsed.error.issues });
|
||||
}
|
||||
|
||||
const config = { ...parsed.data };
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
||||
import { z } from "zod";
|
||||
import { env } from "../config.js";
|
||||
import { db, schema } from "../db/index.js";
|
||||
import { auditFromRequest } from "../lib/audit.js";
|
||||
import { env } from "../config.js";
|
||||
import { encrypt, decrypt, isEncrypted } from "../lib/encryption.js";
|
||||
import { decrypt, encrypt, isEncrypted } from "../lib/encryption.js";
|
||||
import { requirePermission } from "../permissions.js";
|
||||
import { requireAuth } from "../plugins/auth.js";
|
||||
|
||||
@@ -37,8 +37,11 @@ async function decryptIfNeeded(value: string): Promise<string> {
|
||||
if (!isEncrypted(value)) return value;
|
||||
if (!env.DATA_ENCRYPTION_KEY) return value;
|
||||
return (
|
||||
(await decrypt(value, env.DATA_ENCRYPTION_KEY, env.DATA_ENCRYPTION_KEY_PREVIOUS || undefined)) ??
|
||||
value
|
||||
(await decrypt(
|
||||
value,
|
||||
env.DATA_ENCRYPTION_KEY,
|
||||
env.DATA_ENCRYPTION_KEY_PREVIOUS || undefined,
|
||||
)) ?? value
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user