Skip to main content
interlace
Plugin: gemini-securityRules

no-disabled-safety-settings

Forbid disabling Gemini harm-category filters

Forbid disabling Gemini harm-category filters.

Why

threshold: BLOCK_NONE (or OFF) switches off the model's content filter for that harm category. Where output reaches users โ€” or feeds another system โ€” that removes the only server-side control over what the model may emit. Each disabled category is reported separately.

Both the string form and the enum form (HarmBlockThreshold.BLOCK_NONE) are detected.

Incorrect

import { GoogleGenAI } from '@google/genai';

const config = {
  safetySettings: [
    { category: 'HARM_CATEGORY_HARASSMENT', threshold: 'BLOCK_NONE' },
  ],
};

Correct

const config = {
  safetySettings: [
    { category: 'HARM_CATEGORY_HARASSMENT', threshold: 'BLOCK_MEDIUM_AND_ABOVE' },
  ],
};

When not to use it

Red-teaming or eval harnesses that deliberately probe unfiltered output. Disable the rule for those files specifically rather than globally.

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.