Skip to main content

Security Capabilities

This page is the honest scorecard of what the framework actually implements vs. what it documents as best practice vs. what ships as example code. Use it for vendor-evaluation checklists and threat-model reviews.

For how to report a vulnerability, see SECURITY.md in the repo.

Legendโ€‹

MarkerMeaning
๐ŸŸข ImplementedCode in the public API with tests. Follows the SEMVER policy.
๐ŸŸก RecommendedThe framework provides primitives and documentation, but the user is responsible for the wiring. We don't ship a "turn it on" switch.
๐ŸŸ  ExperimentalExported from @devilsdev/rag-pipeline-utils/experimental. Simulated or incomplete; not covered by SEMVER. Do not rely on it in production.
๐Ÿ”ด Not in scopeOutside the framework's responsibility โ€” handled by surrounding infrastructure.

Pre-retrieval guardrailsโ€‹

CapabilityStatusWhere it livesNotes
Prompt-injection detection๐ŸŸข ImplementedPreRetrievalGuard (preRetrieval.enableInjectionDetection), detectInjection()Pattern rules matched against normalised text (NFKC, zero-width characters removed, homoglyph and leetspeak folding). Extra patterns via injectionPatterns. The query is never rewritten; strict mode blocks. Heuristic, not a guarantee.
Topic / off-topic filtering๐ŸŸข ImplementedpreRetrieval.blockedTopics / preRetrieval.allowedTopicsKeyword-based topic lists (opt-in via enableTopicFiltering).
Query length limits๐ŸŸข ImplementedpreRetrieval.maxQueryLengthDefault 10000 characters.
Rate limiting per principal๐ŸŸก RecommendedWire your own middleware (Fastify, Express, Lambda authorizer)The framework does not own the request lifecycle.
Authentication / authorization๐Ÿ”ด Not in scopeYour edge / API gatewayThe framework receives an authenticated principal; it does not authenticate.

Retrieval-time guardrailsโ€‹

CapabilityStatusWhere it livesNotes
Runs before generation๐ŸŸข ImplementedGuardrailsPipeline โ†’ options.filterResultsSince 2.5.0 the retrieval guard runs between retrieval and generation, so the LLM never sees removed documents. Removed documents are reported by id only.
Minimum relevance threshold๐ŸŸข Implementedretrieval.minRelevanceScoreDrops results whose score is below the threshold.
ACL filtering๐ŸŸข Implementedretrieval.enforceACL + context.userPermissionsChecks each document's requiredRole / acl (on the result or in its metadata) against the caller's roles. Fails closed since 2.5.0: without userPermissions, restricted documents are removed. Tenant isolation in your vector store is still your job.
Indirect prompt-injection scan๐ŸŸข Implementedretrieval.detectInjection, injectionActionOpt-in. Scans retrieved document text; removes (default) or flags matching documents.
Freshness filter๐ŸŸข Implementedretrieval.maxAgeDaysDisabled by default (0).
Retrieved text as untrusted๐ŸŸข ImplementedBuilt-in LLM connectorsSince 2.5.0 retrieved context goes in the user message as delimited reference data, never in the system role, with a system prompt telling the model to treat it as data.

Post-generation guardrailsโ€‹

CapabilityStatusWhere it livesNotes
PII detection and redaction๐ŸŸข ImplementedpostGeneration.enablePIIDetection, piiPatternsRegex patterns for emails, phone numbers, SSNs and credit cards. Since 2.5.0 PII is also redacted in citations and evaluation details, and strict-mode blocks do not return the raw answer.
Groundedness scoring๐ŸŸข ImplementedpostGeneration.enableGroundednessCheck, CitationTracker, computeGroundedness()Lexical support per sentence plus a numeric-consistency check. Negation, units and multi-document claims are not checked.
Hallucination detection๐ŸŸข ImplementeddetectHallucinations(), computeFaithfulness()Lexical (not LLM-judged): sentences with low support in the retrieved documents are flagged.
Toxicity / safety classification๐ŸŸก RecommendedYour own check on result.answerNot shipped (model choice is policy-laden).

Supply-chain securityโ€‹

CapabilityStatusWhere it livesNotes
Pinned GitHub Actions by SHA๐ŸŸข Implemented.github/workflows/*.ymlActions are pinned to a commit SHA, not a tag.
Dependabot enabled๐ŸŸข Implemented.github/dependabot.ymlWeekly npm scan.
Runtime npm audit gate๐ŸŸข Implemented.github/workflows/supply-chain.ymlnpm audit --audit-level=high --omit=dev. For 2.5.0 it reports no high or critical findings.
License allowlist enforcement๐ŸŸข Implementedsupply-chain.yml license-checker stepProduction dependencies are checked against an allowlist of licenses.
SBOM generation๐ŸŸข Implementednpm run sbomCycloneDX format.
Provenance attestation (npm publish --provenance)๐ŸŸข Implemented.github/workflows/release.ymlReleases are published from the release workflow with OIDC and --provenance.
Tarball smoke test๐ŸŸข Implementednpm run smoke:packInstalls the packed tarball in a clean project and imports it (CJS, ESM, TypeScript) in CI and before publish.
Signed git tags๐ŸŸก RecommendedUse git tag -sNot enforced by the project.

Plugin trustโ€‹

CapabilityStatusWhere it livesNotes
Ed25519 manifest signatures๐ŸŸข ImplementedPluginSignatureVerifier, pluginRegistry.register()On and fail-closed by default when NODE_ENV=production. The trust store is empty by default (2.5.0); add signers explicitly.
Code binding (contentDigest)๐ŸŸข ImplementedSigned manifest fieldA signed contentDigest binds the plugin files and is always checked when present (the shared registry verifies by default only when NODE_ENV=production). requireContentDigest / requireSignedPlugins are opt-in.
Install-time static scan๐ŸŸข Implementedrag-pipeline hub installHigh-risk findings block the install unless --allow-risky; the stage contract is checked in a separate process.
Plugin sandboxing๐ŸŸ  ExperimentalPluginSandbox (/experimental)Non-functional; plugins run in-process with your privileges. See Experimental.

Authentication primitivesโ€‹

CapabilityStatusWhere it livesNotes
JWT validation helper๐ŸŸข ImplementedJWTValidatorVerifies signature, expiry, audience, issuer. Replay protection via a bounded jti store (maxTrackedJtis); external tokens are single-use by default (singleUseTokens).
SSO (OAuth2 / OIDC / SAML / AD)๐ŸŸ  Experimental@devilsdev/rag-pipeline-utils/experimentalOIDC validates id_tokens and uses PKCE, but the flows are untested against real identity providers; SAMLProvider refuses to authenticate. Use a vetted library such as openid-client in production.

Logging and auditโ€‹

CapabilityStatusWhere it livesNotes
Structured logging๐ŸŸข Implementedlogger export (pino-based)JSON output.
Secret redaction in logs๐ŸŸข ImplementedInternal secure-logging utilitiesPattern-based redaction of API keys and bearer tokens in log data.
Audit log๐ŸŸข ImplementedAuditLoggerEncrypted fields (createCipheriv, random IV) when a key is set via encryptionKey or RAG_AUDIT_ENCRYPTION_KEY; requireEncryption makes a missing key an error.
Tamper detection๐ŸŸข ImplementedAuditLogger.verifyIntegrity()HMAC signatures compared in constant time. Pass a stable signingKey, otherwise records written before a restart are flagged.
Centralized log shipping๐Ÿ”ด Not in scopeWire your own (Datadog, Splunk, Loki, OTEL)The framework writes structured logs; shipping is a platform concern.

Input validationโ€‹

CapabilityStatusWhere it livesNotes
Basic input validation๐ŸŸข ImplementedvalidateInput(input, { maxLength })Length limit and a small denylist of tokens; returns { valid, reasons, sanitized }.
Path traversal protection๐ŸŸก RecommendedYour application codeNo path sanitizer is exported; see the Security guide.
JSON schema validation for plugin contracts๐ŸŸข Implementedcontracts/*.jsonPlugins fail to register if they don't implement the stage contract.
ReDoS protection on user-supplied regex๐ŸŸก RecommendedYour application codeIf you accept regex from users, run it through a safe runtime (e.g. an RE2 binding).

Data governanceโ€‹

CapabilityStatusWhere it livesNotes
Multi-tenancy / governance๐ŸŸ  ExperimentalTenantManager, DataGovernanceManager in /experimentalSimulated: usage figures and data classification are random and GDPR erasure deletes nothing. Do not use for isolation or compliance.
Data retention policies๐ŸŸก RecommendedImplement on your storage backendThe framework reads/writes; lifecycle is the storage layer's job.
Encryption at rest๐Ÿ”ด Not in scopeStorage backend (Postgres TDE, S3 SSE, etc.)We don't manage your storage. FileVectorStore writes a plain JSON file.
Encryption in transit๐ŸŸก RecommendedBuilt-in cloud connectors use HTTPSVerify your custom plugins do too.

Security testingโ€‹

CapabilityStatusWhere it livesNotes
Unit tests for security utilities๐ŸŸข Implemented__tests__/unit/security/**JWT, audit logging, plugin signatures, command injection, SSO.
Guardrails tests๐ŸŸข Implemented__tests__/unit/guardrails/All three guardrail layers.
Static analysis (CodeQL)๐ŸŸข Implemented.github/workflows/security.ymlOn pushes and pull requests to main, plus weekly.
Penetration testing๐Ÿ”ด Not in scopeCustomer responsibilityWe publish disclosure-coordinated fixes.

What this framework does not protect againstโ€‹

Calling this out so it's not assumed:

  • Compromised LLM provider โ€” if your LLM API is hijacked, no framework guardrail will save you. Use trusted providers and treat outputs accordingly.
  • Embedding model bias โ€” embedding models reflect their training data. We don't debias them. Use evaluation to detect regressions.
  • Side-channel timing attacks โ€” guardrail evaluation takes measurable time; if you expose a public endpoint, a sufficiently motivated attacker can infer guardrail decisions from timing. Mitigate with constant-time response patterns at the HTTP layer.
  • Model exfiltration via inversion attacks โ€” if your corpus contains secrets, an attacker with sufficient query budget can reconstruct fragments of it. The framework helps you set rate limits and ACLs but cannot eliminate this class of attack entirely.
  • Bring-your-own-plugin maliciousness โ€” plugins run in your Node process with your privileges. Audit any third-party plugins you load.

See alsoโ€‹