Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/goose/src/security/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl SecurityManager {
let config = Config::global();

config
.get_param::<bool>("security_prompt_enabled")
.get_param::<bool>("SECURITY_PROMPT_ENABLED")
.unwrap_or(false)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/goose/src/security/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl PromptInjectionScanner {
use crate::config::Config;
let config = Config::global();

if let Ok(threshold) = config.get_param::<f64>("security_prompt_threshold") {
if let Ok(threshold) = config.get_param::<f64>("SECURITY_PROMPT_THRESHOLD") {
return threshold as f32;
}

Expand Down
6 changes: 3 additions & 3 deletions documentation/docs/guides/config-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ The following settings can be configured at the root level of your config.yaml f
| `GOOSE_AUTO_COMPACT_THRESHOLD` | Set the percentage threshold at which goose [automatically summarizes your session](/docs/guides/sessions/smart-context-management#automatic-compaction). | Float between 0.0 and 1.0 (disabled at 0.0)| 0.8 | No |
| `otel_exporter_otlp_endpoint` | OTLP endpoint URL for [observability](/docs/guides/environment-variables#opentelemetry-protocol-otlp) | URL (e.g., `http://localhost:4318`) | None | No |
| `otel_exporter_otlp_timeout` | Export timeout in milliseconds for [observability](/docs/guides/environment-variables#opentelemetry-protocol-otlp) | Integer (ms) | 10000 | No |
| `security_prompt_enabled` | Enable [prompt injection detection](/docs/guides/security/prompt-injection-detection) to identify potentially harmful commands | true/false | false | No |
| `security_prompt_threshold` | Sensitivity threshold for [prompt injection detection](/docs/guides/security/prompt-injection-detection) (higher = stricter) | Float between 0.01 and 1.0 | 0.7 | No |
| `SECURITY_PROMPT_ENABLED` | Enable [prompt injection detection](/docs/guides/security/prompt-injection-detection) to identify potentially harmful commands | true/false | false | No |
| `SECURITY_PROMPT_THRESHOLD` | Sensitivity threshold for [prompt injection detection](/docs/guides/security/prompt-injection-detection) (higher = stricter) | Float between 0.01 and 1.0 | 0.7 | No |

## Experimental Features

Expand Down Expand Up @@ -91,7 +91,7 @@ otel_exporter_otlp_endpoint: "http://localhost:4318"
otel_exporter_otlp_timeout: 20000

# Security Configuration
security_prompt_enabled: true
SECURITY_PROMPT_ENABLED: true

# Extensions Configuration
extensions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ When in doubt, deny.
Add these settings to your [`config.yaml`](/docs/guides/config-files):

```yaml
security_prompt_enabled: true
security_prompt_threshold: 0.7 # Optional, default is 0.7
SECURITY_PROMPT_ENABLED: true
SECURITY_PROMPT_THRESHOLD: 0.7 # Optional, default is 0.7
```

</TabItem>
Expand Down
12 changes: 6 additions & 6 deletions ui/desktop/src/components/settings/security/SecurityToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { Switch } from '../../ui/switch';
import { useConfig } from '../../ConfigContext';

interface SecurityConfig {
security_prompt_enabled?: boolean;
security_prompt_threshold?: number;
SECURITY_PROMPT_ENABLED?: boolean;
SECURITY_PROMPT_THRESHOLD?: number;
}

export const SecurityToggle = () => {
const { config, upsert } = useConfig();

const {
security_prompt_enabled: enabled = false,
security_prompt_threshold: configThreshold = 0.7,
SECURITY_PROMPT_ENABLED: enabled = false,
SECURITY_PROMPT_THRESHOLD: configThreshold = 0.7,
} = (config as SecurityConfig) ?? {};

const [thresholdInput, setThresholdInput] = useState(configThreshold.toString());
Expand All @@ -22,12 +22,12 @@ export const SecurityToggle = () => {
}, [configThreshold]);

const handleToggle = async (enabled: boolean) => {
await upsert('security_prompt_enabled', enabled, false);
await upsert('SECURITY_PROMPT_ENABLED', enabled, false);
};

const handleThresholdChange = async (threshold: number) => {
const validThreshold = Math.max(0, Math.min(1, threshold));
await upsert('security_prompt_threshold', validThreshold, false);
await upsert('SECURITY_PROMPT_THRESHOLD', validThreshold, false);
};

return (
Expand Down
4 changes: 2 additions & 2 deletions ui/desktop/src/utils/configUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const configLabels: Record<string, string> = {
GOOSE_RECIPE_GITHUB_REPO: 'Recipe GitHub Repo',

// security settings
security_prompt_enabled: 'Prompt Injection Detection Enabled',
security_prompt_threshold: 'Prompt Injection Detection Threshold',
SECURITY_PROMPT_ENABLED: 'Prompt Injection Detection Enabled',
SECURITY_PROMPT_THRESHOLD: 'Prompt Injection Detection Threshold',

// openai
OPENAI_API_KEY: 'OpenAI API Key',
Expand Down
Loading