Skip to content

Commit 08138ca

Browse files
authored
refactor(policy): drop unreachable sensitive-logging redaction check (#113993)
The policy/data-handling-redaction-disabled check could never emit a finding: scanPolicyDataHandling records the sensitiveLoggingRedaction evidence with a hardcoded value true, and the finding builder only fired on value !== true. Redaction is unconditional in src/logging/redact.ts, which hardcodes tools mode and reads only redactPatterns, so no config can turn it off. Delete the check, its finding builder, check id, and the validateOnly fix class that existed solely for it. Keep the public dataHandling.sensitiveLogging.requireRedaction policy key: it is a policy.jsonc contract, it still drives openclaw policy compare baseline strictness, and its shape stays validated. Make the key's satisfied status explicit instead of silent: the policy rule declares satisfiedByInvariant pointing at the evidence source policy state records (oc://openclaw.invariant/logging/redaction), which openclaw policy check emits in dataHandling evidence and the attestation. A metadata test asserts every rule names either its checks or its invariant, never both and never neither, and that policy state actually emits the declared source. Also drop the stale logging.redactSensitive entry from the policy config coverage manifest; that config key is retired.
1 parent 71cb266 commit 08138ca

10 files changed

Lines changed: 59 additions & 66 deletions

File tree

‎docs/cli/policy.md‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,11 @@ Cross-cutting notes not obvious from the rule tables below:
196196
- Secret and auth-profile evidence records provider/source posture and
197197
SecretRef metadata only, never raw values. Policy does not read or attest
198198
per-agent credential stores such as `auth-profiles.json`.
199-
- Data-handling evidence is config-level posture only (redaction mode,
200-
telemetry capture toggle, session maintenance mode, transcript-indexing
201-
setting). It does not inspect logs, telemetry exports, transcripts, or
202-
memory files, and a clean result does not prove that no personal data or
203-
secrets exist in them.
199+
- Data-handling evidence is config-level posture (telemetry capture toggle,
200+
session maintenance mode, transcript-indexing setting) plus the always-on log
201+
redaction invariant. It does not inspect logs, telemetry exports,
202+
transcripts, or memory files, and a clean result does not prove that no
203+
personal data or secrets exist in them.
204204
- Routing probes reuse OpenClaw's runtime binding resolver. Routing evidence
205205
records only the probe id, resolved agent, match kind, and redacted binding
206206
metadata. It never records peer, account, guild, team, or role identifiers.
@@ -411,7 +411,7 @@ allowlist such as `["all"]`.
411411

412412
| Policy field | Observed state | Use when |
413413
| --------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
414-
| `dataHandling.sensitiveLogging.requireRedaction` | Sensitive log redaction, which is always on | Set to `true` to record the requirement; OpenClaw always satisfies it. |
414+
| `dataHandling.sensitiveLogging.requireRedaction` | Runtime invariant `oc://openclaw.invariant/logging/redaction` | Set to `true` to record the requirement; OpenClaw always satisfies it. |
415415
| `dataHandling.telemetry.denyContentCapture` | `diagnostics.otel.captureContent` | Set to `true` to reject telemetry content capture. |
416416
| `dataHandling.retention.requireSessionMaintenance` | `session.maintenance.mode` | Set to `true` to require effective session maintenance mode `enforce`. |
417417
| `dataHandling.memory.denySessionTranscriptIndexing` | `memory.qmd.sessions.enabled`, `memory.search.experimental.sessionMemory`, and per-agent overrides | Set to `true` to reject session transcript indexing into memory. |
@@ -845,7 +845,6 @@ the interval.
845845
| `policy/sandbox-container-runtime-socket-mount` | A container-backed sandbox or browser mount exposes the container runtime socket. |
846846
| `policy/sandbox-container-unconfined-profile` | Container sandbox profile is unconfined when policy denies it. |
847847
| `policy/sandbox-browser-cdp-source-range-missing` | Sandbox browser CDP source range is missing when policy requires one. |
848-
| `policy/data-handling-redaction-disabled` | Sensitive logging redaction is disabled when policy requires it. |
849848
| `policy/data-handling-telemetry-content-capture` | Telemetry content capture is enabled when policy denies it. |
850849
| `policy/data-handling-session-retention-not-enforced` | Session retention maintenance is not enforced when policy requires it. |
851850
| `policy/data-handling-session-transcript-memory-enabled` | Session transcript memory indexing is enabled when policy denies it. |
@@ -1013,8 +1012,13 @@ Scoped elevated-tools repairs are detect-only. Scoped data-handling repairs are
10131012
also skipped when the finding reports shared telemetry config, because changing
10141013
the shared setting would affect more than the scoped policy target.
10151014

1016-
`dataHandling.sensitiveLogging.requireRedaction` has no repair. Sensitive log
1017-
redaction is unconditional, so the check only validates the policy declaration.
1015+
`dataHandling.sensitiveLogging.requireRedaction` has no check and no repair.
1016+
Sensitive log redaction is unconditional in OpenClaw, so nothing can report it
1017+
as disabled. The key stays a supported policy rule: `openclaw policy` validates
1018+
its shape, `openclaw policy compare` still requires a candidate policy to be at
1019+
least as strict as the baseline for it, and `openclaw policy check` records the
1020+
runtime invariant `oc://openclaw.invariant/logging/redaction` in the
1021+
`dataHandling` evidence and attestation as proof the requirement is satisfied.
10181022

10191023
Scoped required-deny repairs are skipped when the finding reports inherited
10201024
root `tools.deny`, because adding the required tool to root config would affect

‎extensions/policy/src/doctor/check-ids.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export const CHECK_IDS = {
4747
policySandboxContainerRuntimeSocketMount: "policy/sandbox-container-runtime-socket-mount",
4848
policySandboxContainerUnconfinedProfile: "policy/sandbox-container-unconfined-profile",
4949
policySandboxBrowserCdpSourceRangeMissing: "policy/sandbox-browser-cdp-source-range-missing",
50-
policyDataHandlingRedactionDisabled: "policy/data-handling-redaction-disabled",
5150
policyDataHandlingTelemetryContentCapture: "policy/data-handling-telemetry-content-capture",
5251
policyDataHandlingSessionRetentionNotEnforced:
5352
"policy/data-handling-session-retention-not-enforced",
@@ -120,7 +119,6 @@ export const POLICY_CHECK_IDS = [
120119
CHECK_IDS.policySandboxContainerRuntimeSocketMount,
121120
CHECK_IDS.policySandboxContainerUnconfinedProfile,
122121
CHECK_IDS.policySandboxBrowserCdpSourceRangeMissing,
123-
CHECK_IDS.policyDataHandlingRedactionDisabled,
124122
CHECK_IDS.policyDataHandlingTelemetryContentCapture,
125123
CHECK_IDS.policyDataHandlingSessionRetentionNotEnforced,
126124
CHECK_IDS.policyDataHandlingSessionTranscriptMemory,

‎extensions/policy/src/doctor/data-auth-findings.ts‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,9 @@ function dataHandlingFindingsForRule(
110110
return [];
111111
}
112112
const findings: HealthFinding[] = [];
113-
if (readPolicyBoolean(dataHandling, ["sensitiveLogging", "requireRedaction"]) === true) {
114-
findings.push(
115-
...dataHandlingEntries(evidence, "sensitiveLoggingRedaction")
116-
.filter(evidenceFilter)
117-
.filter((entry) => entry.value !== true)
118-
.map((entry) =>
119-
dataHandlingFinding(entry, {
120-
checkId: CHECK_IDS.policyDataHandlingRedactionDisabled,
121-
message: "Sensitive logging redaction is disabled.",
122-
requirement: `oc://${policyDocName}/${requirementBase}/sensitiveLogging/requireRedaction`,
123-
fixHint: "Sensitive log redaction is always enabled; update policy after review.",
124-
}),
125-
),
126-
);
127-
}
113+
// dataHandling.sensitiveLogging.requireRedaction has no check here on purpose: redaction is
114+
// an unconditional runtime invariant (src/logging/redact.ts), so policy state records it as
115+
// satisfied evidence (oc://openclaw.invariant/logging/redaction) instead of a finding.
128116
if (readPolicyBoolean(dataHandling, ["telemetry", "denyContentCapture"]) === true) {
129117
findings.push(
130118
...dataHandlingEntries(evidence, "telemetryContentCapture")

‎extensions/policy/src/doctor/fix-metadata.ts‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Policy doctor fix metadata classifies findings before patch builders exist.
22
import { CHECK_IDS, POLICY_CHECK_IDS } from "./check-ids.js";
33

4-
type PolicyFixClass = "automatic" | "reviewRequired" | "manual" | "validateOnly" | "unsupported";
4+
type PolicyFixClass = "automatic" | "reviewRequired" | "manual" | "unsupported";
55

66
type PolicyFixMetadata = {
77
readonly checkId: (typeof POLICY_CHECK_IDS)[number];
@@ -327,15 +327,6 @@ const POLICY_FIX_METADATA = [
327327
configTargets: ["agents.sandbox.browser"],
328328
},
329329
),
330-
// Sensitive log redaction is an unconditional runtime invariant (src/logging/redact.ts),
331-
// so this requirement has no config target to patch. Adding one would emit a retired
332-
// config key that strict validation rejects.
333-
m(
334-
CHECK_IDS.policyDataHandlingRedactionDisabled,
335-
"validateOnly",
336-
"Update the policy requirement; sensitive log redaction is always enabled.",
337-
{ policyPath: ["dataHandling", "sensitiveLogging", "requireRedaction"] },
338-
),
339330
m(
340331
CHECK_IDS.policyDataHandlingTelemetryContentCapture,
341332
"automatic",

‎extensions/policy/src/doctor/metadata.test.ts‎

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Policy doctor metadata tests cover rule metadata.
22
import { describe, expect, it } from "vitest";
3+
import { scanPolicyDataHandling } from "../policy-state-data.js";
34
import { CHECK_IDS, POLICY_CHECK_IDS } from "./check-ids.js";
45
import { POLICY_FIX_METADATA_BY_CHECK_ID } from "./fix-metadata.js";
56
import { POLICY_RULE_METADATA, type PolicyRuleMetadata } from "./metadata.js";
@@ -207,10 +208,6 @@ describe("policy doctor metadata", () => {
207208
.get("unsupported")
208209
?.map((rule) => rule.checkId)
209210
.toSorted(),
210-
validateOnly: grouped
211-
.get("validateOnly")
212-
?.map((rule) => rule.checkId)
213-
.toSorted(),
214211
}).toEqual({
215212
automatic: [
216213
"policy/agents-tool-not-denied",
@@ -285,7 +282,33 @@ describe("policy doctor metadata", () => {
285282
"policy/tools-profile-unapproved",
286283
],
287284
unsupported: ["policy/sandbox-container-posture-unobservable"],
288-
validateOnly: ["policy/data-handling-redaction-disabled"],
289285
});
290286
});
287+
288+
it("declares how every policy rule is enforced", () => {
289+
const rules = POLICY_RULE_METADATA as readonly PolicyRuleMetadata[];
290+
// Every rule names either its doctor checks or the invariant that satisfies it, never
291+
// both and never neither, so an accepted policy key cannot enforce nothing in silence.
292+
expect(
293+
rules
294+
.filter((rule) => rule.checkIds.length > 0 === (rule.satisfiedByInvariant !== undefined))
295+
.map((rule) => rule.policyPath.join(".")),
296+
).toEqual([]);
297+
const invariantSources = new Set(scanPolicyDataHandling({}).map((entry) => entry.source));
298+
expect(
299+
rules
300+
.filter((rule) => rule.satisfiedByInvariant !== undefined)
301+
.map((rule) => [
302+
rule.policyPath.join("."),
303+
rule.satisfiedByInvariant,
304+
invariantSources.has(rule.satisfiedByInvariant ?? ""),
305+
]),
306+
).toEqual([
307+
[
308+
"dataHandling.sensitiveLogging.requireRedaction",
309+
"oc://openclaw.invariant/logging/redaction",
310+
true,
311+
],
312+
]);
313+
});
291314
});

‎extensions/policy/src/doctor/metadata.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export type PolicyRuleMetadata = {
2424
| "string"
2525
| "string-list";
2626
readonly checkIds: readonly (typeof POLICY_CHECK_IDS)[number][];
27+
/**
28+
* Evidence source of the runtime invariant that satisfies this rule unconditionally.
29+
* Set only when `checkIds` is empty, so a rule can never enforce nothing without saying
30+
* why; `metadata.test.ts` asserts the pairing and that policy state emits the source.
31+
*/
32+
readonly satisfiedByInvariant?: string;
2733
readonly emptyList?: PolicyEmptyListSemantics;
2834
readonly allowedValues?: readonly string[];
2935
readonly caseSensitive?: boolean;
@@ -339,10 +345,14 @@ export const POLICY_RULE_METADATA = [
339345
scopeSelectors: ["channelIds"],
340346
},
341347
{
348+
// Redaction is unconditional in src/logging/redact.ts, so no doctor check can fail for
349+
// this rule. The key stays a policy contract: `openclaw policy compare` still enforces
350+
// baseline strictness, and policy state records the invariant below as satisfied.
342351
policyPath: ["dataHandling", "sensitiveLogging", "requireRedaction"],
343352
strictness: "requires-true",
344353
valueType: "boolean",
345-
checkIds: [CHECK_IDS.policyDataHandlingRedactionDisabled],
354+
checkIds: [],
355+
satisfiedByInvariant: "oc://openclaw.invariant/logging/redaction",
346356
},
347357
{
348358
policyPath: ["dataHandling", "telemetry", "denyContentCapture"],

‎extensions/policy/src/doctor/register.base.test-utils.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ describe("registerPolicyDoctorChecks", () => {
301301
"policy/sandbox-container-runtime-socket-mount",
302302
"policy/sandbox-container-unconfined-profile",
303303
"policy/sandbox-browser-cdp-source-range-missing",
304-
"policy/data-handling-redaction-disabled",
305304
"policy/data-handling-telemetry-content-capture",
306305
"policy/data-handling-session-retention-not-enforced",
307306
"policy/data-handling-session-transcript-memory-enabled",
@@ -1562,7 +1561,6 @@ describe("registerPolicyDoctorChecks", () => {
15621561
remote: { allow: false },
15631562
},
15641563
dataHandling: {
1565-
sensitiveLogging: { requireRedaction: true },
15661564
telemetry: { denyContentCapture: true },
15671565
},
15681566
}),

‎extensions/policy/src/doctor/scopes/data-auth.ts‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@ import type { PolicyDoctorCheckDeps } from "../types.js";
77
export function createPolicyDataAuthChecks(deps: PolicyDoctorCheckDeps): readonly HealthCheck[] {
88
const { evaluatePolicy, findingsForCheck } = deps;
99

10-
const policyDataHandlingRedactionDisabledCheck: HealthCheck = {
11-
id: CHECK_IDS.policyDataHandlingRedactionDisabled,
12-
kind: "plugin",
13-
description: "Sensitive logging redaction remains enabled when policy requires it.",
14-
source: "policy",
15-
async detect(ctx) {
16-
return findingsForCheck(
17-
await evaluatePolicy(ctx),
18-
CHECK_IDS.policyDataHandlingRedactionDisabled,
19-
);
20-
},
21-
};
2210
const policyDataHandlingTelemetryContentCaptureCheck: HealthCheck = {
2311
id: CHECK_IDS.policyDataHandlingTelemetryContentCapture,
2412
kind: "plugin",
@@ -118,7 +106,6 @@ export function createPolicyDataAuthChecks(deps: PolicyDoctorCheckDeps): readonl
118106
};
119107

120108
return [
121-
policyDataHandlingRedactionDisabledCheck,
122109
policyDataHandlingTelemetryContentCaptureCheck,
123110
policyDataHandlingSessionRetentionNotEnforcedCheck,
124111
policyDataHandlingSessionTranscriptMemoryCheck,

‎extensions/policy/src/policy-state-data.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ export function scanPolicyDataHandling(
5252
cfg: Record<string, unknown>,
5353
): readonly PolicyDataHandlingEvidence[] {
5454
const entries: PolicyDataHandlingEvidence[] = [];
55+
// Redaction has no config surface: src/logging/redact.ts always redacts. This invariant
56+
// record is how dataHandling.sensitiveLogging.requireRedaction reports as satisfied in
57+
// `openclaw policy check` evidence and the attestation, since no doctor check can fail.
5558
entries.push({
5659
id: "logging-redaction",
5760
kind: "sensitiveLoggingRedaction",

‎scripts/lib/policy-config-coverage.jsonc‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"gateway.nodes.commands.deny.*",
3030
"gateway.tailscale.mode",
3131
"gateway.tailscale.preserveFunnel",
32-
"logging.redactSensitive",
3332
"memory.qmd.sessions.enabled",
3433
"mcp.servers.*.command",
3534
"mcp.servers.*.transport",
@@ -174,14 +173,6 @@
174173
"policy": "ingress.session.requireDmScope",
175174
"reason": "Policy observes direct-message session isolation scope.",
176175
},
177-
{
178-
"pattern": "logging.redactSensitive",
179-
"status": "observed",
180-
"area": "dataHandling",
181-
"policy": "dataHandling.sensitiveLogging.requireRedaction",
182-
"reason": "Policy observes sensitive log redaction posture.",
183-
"allowNoSchemaPath": true,
184-
},
185176
{
186177
"pattern": "diagnostics.otel.captureContent",
187178
"status": "observed",

0 commit comments

Comments
 (0)