no-training-data-exposure
This rule identifies code patterns where user data might be sent to LLM training endpoints or when training data coll...
Prevents user data from being sent to LLM training endpoints.
📊 Rule Details
| Property | Value |
|---|---|
| Type | problem |
| Severity | 🟡 HIGH |
| OWASP LLM | LLM03: Training Data Poisoning |
| CWE | CWE-359: Privacy Violation |
| CVSS | 7.0 |
| Config Default | off (recommended), error (strict) |
🔍 What This Rule Detects
This rule identifies code patterns where user data might be sent to LLM training endpoints or when training data collection is enabled.
❌ Incorrect Code
// Training enabled
const config = {
training: true,
};
// Allow training flag
const options = {
allowTraining: true,
};
// Training endpoint
fetch('https://api.openai.com/v1/fine-tune');✅ Correct Code
// Training disabled
const config = {
training: false,
};
// No training endpoint
await generateText({
model: openai('gpt-4'),
prompt: userInput,
});⚙️ Options
| Option | Type | Default | Description |
|---|---|---|---|
trainingPatterns | string[] | ["train","training","finetune","fine-tune","fine_tune"] | Patterns suggesting training endpoints |
🛡️ Why This Matters
Exposing user data to training can:
- Privacy violations - User data used without consent
- Data poisoning - Malicious data taints model
- Compliance violations - GDPR, CCPA violations
- IP leakage - Proprietary information exposed
🔄 Changes in the 2026-10-10 FP/FN audit
- URLs are matched by whole path segment (
/v1/fine_tuning/jobs,/api/train/model), not substring:/trainersand/training-scheduleare not reported. feedback,improveandlearnwere removed from the defaults: a thumbs-up/down/api/feedbackendpoint andshowFeedback: trueare product features, not training opt-ins. Flag names are matched by whole word.- Now
offinrecommended: the rule has no tie to a provider setting. - Options: the documented
defaultOptionsnow apply. Earlier versions readcontext.optionsand silently ran a shorter hard-coded list instead.
Known False Negatives
The following patterns are not detected due to static analysis limitations:
Environment-Based Training Flags
Why: Environment variables are not resolved.
// ❌ NOT DETECTED - Training from env
const options = { training: process.env.ENABLE_TRAINING };Mitigation: Hardcode training: false. Never use env for training flags.
Training Endpoints in Config
Why: Endpoints from config files are not visible.
// ❌ NOT DETECTED - Endpoint from config
fetch(config.apiEndpoint); // May be fine-tune endpointMitigation: Review API configurations for training endpoints.
Implicit Training via SDK Options
Why: Hidden SDK options enabling training may not be detected.
// ❌ NOT DETECTED - SDK defaults to training
const client = new AIClient(); // training: true by defaultMitigation: Explicitly set training: false in all SDK configs.
📚 References
Use this rule
npm install -D oxlint-plugin-vercel-ai-security{ "jsPlugins": ["oxlint-plugin-vercel-ai-security"], "rules": { "vercel-ai-security/no-training-data-exposure": "error" }}import { defineConfig } from 'vite-plus';export default defineConfig({ lint: { jsPlugins: ['oxlint-plugin-vercel-ai-security'], rules: { 'vercel-ai-security/no-training-data-exposure': 'error', }, },});oxlint-plugin-vercel-ai-security re-exports eslint-plugin-vercel-ai-security/oxlint: the same rules under the same IDs, and no ESLint install. Why oxlint.
Did this rule catch something? Star the repo to get new CWE coverage as we ship it — or follow the AI-code-security benchmarks behind these rules.