Files
bot/apps/macos/Tests/BotIPCTests/HostEnvSanitizerTests.swift
zeekay 71c1bb3520 Merge openclaw/main via rebrand bridge
Merged 3580 upstream commits from openclaw/main through a bridge branch
that applied the openclaw→hanzo-bot rebrand before merging.

Key upstream additions:
- Android device diagnostics and notification actions
- Device-auth v2 migration improvements
- Docker CLI packaging fixes
- Ollama discovery log demotion
- Channel health monitoring
- Slack native streaming
- Linq iMessage channel
- Gemini OAuth and FTS improvements
- Inbound sender metadata
- Daemon PATH improvements
- Canvas host and onboarding enhancements
- Security hardening (session files, exec allowlist)
2026-02-26 22:47:28 -08:00

37 lines
1.1 KiB
Swift

import Testing
@testable import Bot
struct HostEnvSanitizerTests {
@Test func sanitizeBlocksShellTraceVariables() {
let env = HostEnvSanitizer.sanitize(overrides: [
"SHELLOPTS": "xtrace",
"PS4": "$(touch /tmp/pwned)",
"BOT_TEST": "1",
])
#expect(env["SHELLOPTS"] == nil)
#expect(env["PS4"] == nil)
#expect(env["BOT_TEST"] == "1")
}
@Test func sanitizeShellWrapperAllowsOnlyExplicitOverrideKeys() {
let env = HostEnvSanitizer.sanitize(
overrides: [
"LANG": "C",
"LC_ALL": "C",
"BOT_TOKEN": "secret",
"PS4": "$(touch /tmp/pwned)",
],
shellWrapper: true)
#expect(env["LANG"] == "C")
#expect(env["LC_ALL"] == "C")
#expect(env["BOT_TOKEN"] == nil)
#expect(env["PS4"] == nil)
}
@Test func sanitizeNonShellWrapperKeepsRegularOverrides() {
let env = HostEnvSanitizer.sanitize(overrides: ["BOT_TOKEN": "secret"])
#expect(env["BOT_TOKEN"] == "secret")
}
}