Skip to content

Commit 2d126fc

Browse files
authored
fix(infra): expand host env security policy denylist [AI] (openclaw#63277)
* fix: address issue * fix: address PR review feedback * fix: address PR review feedback * fix: address PR review feedback * fix: address PR review feedback * fix: address PR review feedback * fix: address PR review feedback * fix: address PR review feedback * fix: address PR review feedback * fix: close host env inherited sanitization gap * fix: enforce host env reported baseline coverage * fix: address PR review feedback * fix: address PR review feedback * fix: address PR review feedback * docs: add changelog entry for PR merge
1 parent 71617ef commit 2d126fc

13 files changed

Lines changed: 1165 additions & 21 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Docs: https://docs.openclaw.ai
1515

1616
### Fixes
1717

18+
- fix(infra): expand host env security policy denylist [AI]. (#63277) Thanks @pgondhi987.
1819
- fix(agents): guard nodes tool outPath against workspace boundary [AI-assisted]. (#63551) Thanks @pgondhi987.
1920
- fix(qqbot): enforce media storage boundary for all outbound local file paths [AI]. (#63271) Thanks @pgondhi987.
2021
- iMessage/self-chat: distinguish normal DM outbound rows from true self-chat using `destination_caller_id` plus chat participants, while preserving multi-handle self-chat aliases so outbound DM replies stop looping back as inbound messages. (#61619) Thanks @neeravmakwana.

apps/macos/Sources/OpenClaw/HostEnvSanitizer.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ struct HostEnvOverrideDiagnostics: Equatable {
88
enum HostEnvSanitizer {
99
/// Generated from src/infra/host-env-security-policy.json via scripts/generate-host-env-security-policy-swift.mjs.
1010
/// Parity is validated by src/infra/host-env-security.policy-parity.test.ts.
11+
private static let blockedInheritedKeys = HostEnvSecurityPolicy.blockedInheritedKeys
12+
private static let blockedInheritedPrefixes = HostEnvSecurityPolicy.blockedInheritedPrefixes
1113
private static let blockedKeys = HostEnvSecurityPolicy.blockedKeys
1214
private static let blockedPrefixes = HostEnvSecurityPolicy.blockedPrefixes
1315
private static let blockedOverrideKeys = HostEnvSecurityPolicy.blockedOverrideKeys
@@ -28,6 +30,11 @@ enum HostEnvSanitizer {
2830
return self.blockedPrefixes.contains(where: { upperKey.hasPrefix($0) })
2931
}
3032

33+
private static func isBlockedInherited(_ upperKey: String) -> Bool {
34+
if self.blockedInheritedKeys.contains(upperKey) { return true }
35+
return self.blockedInheritedPrefixes.contains(where: { upperKey.hasPrefix($0) })
36+
}
37+
3138
private static func isBlockedOverride(_ upperKey: String) -> Bool {
3239
if self.blockedOverrideKeys.contains(upperKey) { return true }
3340
return self.blockedOverridePrefixes.contains(where: { upperKey.hasPrefix($0) })
@@ -113,7 +120,7 @@ enum HostEnvSanitizer {
113120
let key = rawKey.trimmingCharacters(in: .whitespacesAndNewlines)
114121
guard !key.isEmpty else { continue }
115122
let upper = key.uppercased()
116-
if self.isBlocked(upper) { continue }
123+
if self.isBlockedInherited(upper) { continue }
117124
merged[key] = value
118125
}
119126

0 commit comments

Comments
 (0)