chore(content-safety): 🔧 Update content safety checks in markdown/HTML sanitization pipeline
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
9be34bce73
commit
ff3fbb35cd
5 changed files with 121 additions and 0 deletions
20
features/content-safety/backend-api/.swcrc
Normal file
20
features/content-safety/backend-api/.swcrc
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"decorators": true
|
||||
},
|
||||
"transform": {
|
||||
"legacyDecorator": true,
|
||||
"decoratorMetadata": true
|
||||
},
|
||||
"target": "es2022",
|
||||
"keepClassNames": true
|
||||
},
|
||||
"module": {
|
||||
"type": "es6",
|
||||
"resolveFully": true
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
10
features/content-safety/backend-api/nest-cli.json
Normal file
10
features/content-safety/backend-api/nest-cli.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/nest-cli",
|
||||
"collection": "@nestjs/schematics",
|
||||
"sourceRoot": "src",
|
||||
"compilerOptions": {
|
||||
"builder": "swc",
|
||||
"deleteOutDir": true,
|
||||
"plugins": ["@nestjs/swagger"]
|
||||
}
|
||||
}
|
||||
57
features/content-safety/backend-api/package.json
Normal file
57
features/content-safety/backend-api/package.json
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"name": "@features/content-safety-backend-api",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"main": "dist/main.js",
|
||||
"scripts": {
|
||||
"build": "nest build",
|
||||
"start": "node dist/main.js",
|
||||
"start:dev": "nest start --watch",
|
||||
"dev": "nest start --watch",
|
||||
"lint": "eslint \"src/**/*.ts\"",
|
||||
"test": "lixtest",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"verify": "bun run build && node scripts/verify-circular-deps.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lilith/domain-events": "^2.8.2",
|
||||
"@lilith/imajin-moderator-client": "^1.0.0",
|
||||
"@lilith/nestjs-auth": "^1.0.3",
|
||||
"@lilith/nestjs-health": "^1.0.0",
|
||||
"@lilith/service-nestjs-bootstrap": "^2.2.6",
|
||||
"@lilith/service-registry": "^1.3.0",
|
||||
"@lilith/typeorm-entities": "^1.0.33",
|
||||
"@nestjs/bullmq": "^11.0.2",
|
||||
"@nestjs/common": "11.1.11",
|
||||
"@nestjs/config": "^4.0.2",
|
||||
"@nestjs/core": "11.1.11",
|
||||
"@nestjs/jwt": "^11.0.2",
|
||||
"@nestjs/platform-express": "11.1.11",
|
||||
"@nestjs/swagger": "^11.2.5",
|
||||
"@nestjs/typeorm": "^11.0.0",
|
||||
"bullmq": "^5.0.0",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.14.3",
|
||||
"express": "^5.2.1",
|
||||
"ioredis": "^5.6.1",
|
||||
"pg": "^8.17.1",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"rxjs": "^7.8.2",
|
||||
"typeorm": "^0.3.28",
|
||||
"uuid": "^10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@lilith/configs": "^2.2.0",
|
||||
"@lilith/lix-configs": "^1.0.1",
|
||||
"@lilith/lix-test": "^1.0.0",
|
||||
"@nestjs/cli": "^11.0.16",
|
||||
"@nestjs/schematics": "^11.0.9",
|
||||
"@nestjs/testing": "^11.1.12",
|
||||
"@swc/cli": "^0.7.10",
|
||||
"@swc/core": "^1.15.8",
|
||||
"@types/node": "^20.19.30",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* Decision thresholds for content safety scanning.
|
||||
* Tweak these to calibrate sensitivity without touching business logic.
|
||||
*/
|
||||
|
||||
/** Risk score (0–100) at or above which content is QUARANTINED */
|
||||
export const RISK_SCORE_QUARANTINE_THRESHOLD = 60;
|
||||
|
||||
/** NSFW probability at or above which content triggers a check */
|
||||
export const NSFW_SCORE_REVIEW_THRESHOLD = 0.7;
|
||||
|
||||
/** Prohibited content score that triggers a BLOCK */
|
||||
export const PROHIBITED_HIGH_THRESHOLD = 0.85;
|
||||
|
||||
/** Prohibited content score that triggers QUARANTINE */
|
||||
export const PROHIBITED_MEDIUM_THRESHOLD = 0.5;
|
||||
|
||||
/** Identity similarity score below which a mismatch is flagged */
|
||||
export const IDENTITY_SIMILARITY_MISMATCH_THRESHOLD = 0.75;
|
||||
|
||||
/** BullMQ queue name for async video scanning */
|
||||
export const VIDEO_SCAN_QUEUE = 'content-safety:video-scan';
|
||||
12
features/content-safety/backend-api/tsconfig.json
Normal file
12
features/content-safety/backend-api/tsconfig.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"extends": "@lilith/configs/typescript/nestjs",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@/*": ["src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue