{"slug": "secure-your-typescript-llm-pipeline-with-resk-llm-ts-11-threat-detectors-in-one", "title": "Secure Your TypeScript LLM Pipeline with resk-llm-ts: 11 Threat Detectors in One npm Package", "summary": "RESK Security has released resk-llm-ts, an open-source TypeScript library that provides 11 independent threat detectors to secure LLM endpoints against prompt injections, jailbreak attempts, PII leaks, and system prompt exfiltration. The library operates as middleware between API routes and LLM calls, blocking malicious content before it reaches the AI provider. It supports Express and Hono frameworks, includes an OpenAI-compatible wrapper, and requires Node.js 18+ with no external dependencies beyond TypeScript 5.x.", "body_md": "Links:\n\nIf you expose an LLM endpoint in your TypeScript backend, every user request is a potential attack vector. Prompt injections, jailbreak attempts, PII leaks, and exfiltration of system prompts all happen through the same text input you pass to your model.\n\nInstruction-based filters like \"ignore previous instructions\" do not work. Models follow user instructions by design. You need a structural defense at the middleware layer — before the request reaches your AI provider.\n\nresk-llm-ts is an open source TypeScript library that sits between your API route and your LLM call. It inspects every input with 11 independent threat detectors and blocks malicious content before your model ever sees it.\n\nHere is a minimal Express example:\n\n``` python\nimport express from 'express';\nimport { createInjectionDetector } from 'resk-llm-ts';\n\nconst app = express();\napp.use(express.json());\n\nconst injectionCheck = createInjectionDetector();\n\napp.post('/chat', async (req, res) => {\n  const result = await injectionCheck.analyze(req.body.message);\n\n  if (result.flagged) {\n    return res.status(400).json({\n      error: 'Content blocked',\n      reason: result.categories.join(', ')\n    });\n  }\n\n  // Safe to call your LLM\n  const reply = await callOpenAI(req.body.message);\n  res.json({ reply });\n});\n```\n\nEach detector is an independent module you can enable or disable:\n\nresk-llm-ts plugs into your framework of choice:\n\n``` js\n// Express middleware\nimport { protectLLMEndpoint } from 'resk-llm-ts/express';\napp.use('/api/chat', protectLLMEndpoint());\n\n// Hono middleware\nimport { llmSecurity } from 'resk-llm-ts/hono';\napp.use('/api/chat', llmSecurity());\n\n// OpenAI-compatible wrapper\nimport { SecurityWrapper } from 'resk-llm-ts';\nconst secureOpenAI = new SecurityWrapper(openai);\nconst response = await secureOpenAI.chat.completions.create({ ... });\nnpm install resk-llm-ts\n```\n\nRequires Node.js 18+. No external dependencies beyond TypeScript 5.x.\n\n70% of organizations lack AI governance according to PwC. Most rely on brittle prompt engineering as their only defense. resk-llm-ts gives you structural security at the gateway — before a single token reaches your LLM provider.\n\nThe library is GPL-3.0 open source, built and maintained by RESK Security.\n\nCheck it out, star the repo, and let me know what you think in the comments. What threat patterns do you see most in your AI applications?\n\n👉 npm install resk-llm-ts\n\n👉 [https://github.com/Resk-Security/resk-llm-ts](https://github.com/Resk-Security/resk-llm-ts)\n\n👉 [https://resk.fr](https://resk.fr)", "url": "https://wpnews.pro/news/secure-your-typescript-llm-pipeline-with-resk-llm-ts-11-threat-detectors-in-one", "canonical_source": "https://dev.to/resk/secure-your-typescript-llm-pipeline-with-resk-llm-ts-11-threat-detectors-in-one-npm-package-12c5", "published_at": "2026-07-17 07:01:22+00:00", "updated_at": "2026-07-17 07:31:36.679298+00:00", "lang": "en", "topics": ["ai-safety", "developer-tools", "large-language-models"], "entities": ["RESK Security", "resk-llm-ts", "OpenAI", "Express", "Hono", "Node.js", "TypeScript", "PwC"], "alternates": {"html": "https://wpnews.pro/news/secure-your-typescript-llm-pipeline-with-resk-llm-ts-11-threat-detectors-in-one", "markdown": "https://wpnews.pro/news/secure-your-typescript-llm-pipeline-with-resk-llm-ts-11-threat-detectors-in-one.md", "text": "https://wpnews.pro/news/secure-your-typescript-llm-pipeline-with-resk-llm-ts-11-threat-detectors-in-one.txt", "jsonld": "https://wpnews.pro/news/secure-your-typescript-llm-pipeline-with-resk-llm-ts-11-threat-detectors-in-one.jsonld"}}