mirror of
https://github.com/hanzoai/bot.git
synced 2026-11-01 18:02:28 +00:00
Automated rebrand of all openclaw references to hanzo bot: - Package: openclaw -> @hanzo/bot - Binary: openclaw -> hanzo-bot - Config: ~/.openclaw -> ~/.hanzo/bot - Docker: ghcr.io/hanzoai/bot - Env vars: OPENCLAW_* -> BOT_* - Bundle IDs: ai.hanzo.bot.* - Product name: Hanzo Bot
37 lines
1.1 KiB
Swift
37 lines
1.1 KiB
Swift
import Testing
|
|
@testable import Hanzo Bot
|
|
|
|
struct HostEnvSanitizerTests {
|
|
@Test func `sanitize blocks shell trace variables`() {
|
|
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 `sanitize shell wrapper allows only explicit override keys`() {
|
|
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 `sanitize non shell wrapper keeps regular overrides`() {
|
|
let env = HostEnvSanitizer.sanitize(overrides: ["BOT_TOKEN": "secret"])
|
|
#expect(env["BOT_TOKEN"] == "secret")
|
|
}
|
|
}
|