Skip to content

Commit 0fb65f1

Browse files
committed
refactor(policy): drop retired redactSensitive doctor remediation
Sensitive log redaction became unconditional and `logging.redactSensitive` was retired from the config schema, but the policy doctor still classified `dataHandling.sensitiveLogging.requireRedaction` as an automatic repair that would have written the retired key back into config. Remove the automatic repair (check-id registration, patch branch, and the `enableSensitiveLoggingRedaction` writer), drop the `logging.redactSensitive` config target, and reclassify the check as `validateOnly`. The check keeps evaluating the policy declaration against the redaction invariant; it just no longer claims a fixable config target. Refresh the policy docs, the finding fix hint, and a stale comment in `src/logging/redact.ts`.
1 parent 3387699 commit 0fb65f1

7 files changed

Lines changed: 21 additions & 52 deletions

File tree

‎docs/cli/policy.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ allowlist such as `["all"]`.
411411

412412
| Policy field | Observed state | Use when |
413413
| --------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
414-
| `dataHandling.sensitiveLogging.requireRedaction` | `logging.redactSensitive` | Set to `true` to reject `logging.redactSensitive: "off"`. |
414+
| `dataHandling.sensitiveLogging.requireRedaction` | Sensitive log redaction, which is always on | 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. |
@@ -1005,16 +1005,16 @@ workspace config:
10051005
denies open group ingress
10061006
- set reported channel ingress `requireMention` paths to `true` when policy
10071007
requires group mentions
1008-
- set `logging.redactSensitive=tools` when policy requires sensitive logging
1009-
redaction
10101008
- set `diagnostics.otel.captureContent=false`, or
10111009
`diagnostics.otel.captureContent.enabled=false` for object-form telemetry
10121010
capture settings, when policy denies telemetry content capture
10131011

10141012
Scoped elevated-tools repairs are detect-only. Scoped data-handling repairs are
1015-
also skipped when the finding reports shared logging or telemetry config,
1016-
because changing the shared setting would affect more than the scoped policy
1017-
target.
1013+
also skipped when the finding reports shared telemetry config, because changing
1014+
the shared setting would affect more than the scoped policy target.
1015+
1016+
`dataHandling.sensitiveLogging.requireRedaction` has no repair. Sensitive log
1017+
redaction is unconditional, so the check only validates the policy declaration.
10181018

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

‎extensions/policy/src/doctor/automatic-repairs.ts‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const AUTOMATIC_REPAIR_CHECK_IDS = new Set<PolicyCheckId>([
2525
CHECK_IDS.policyGatewayRemoteEnabled,
2626
CHECK_IDS.policyIngressOpenGroupsDenied,
2727
CHECK_IDS.policyIngressGroupMentionRequired,
28-
CHECK_IDS.policyDataHandlingRedactionDisabled,
2928
CHECK_IDS.policyDataHandlingTelemetryContentCapture,
3029
]);
3130

@@ -104,14 +103,6 @@ function applyAutomaticPatch(
104103
return setFindingConfigValues(cfg, findings, "groupPolicy", "allowlist");
105104
case CHECK_IDS.policyIngressGroupMentionRequired:
106105
return setFindingConfigValues(cfg, findings, "requireMention", true);
107-
case CHECK_IDS.policyDataHandlingRedactionDisabled:
108-
if (hasScopedPolicyRequirement(findings)) {
109-
return skippedUnsafeScopedRepair(
110-
cfg,
111-
"Skipped scoped data-handling repair. The finding reports shared logging config, so changing it would affect more than the scoped policy target.",
112-
);
113-
}
114-
return enableSensitiveLoggingRedaction(cfg);
115106
case CHECK_IDS.policyDataHandlingTelemetryContentCapture:
116107
if (hasScopedPolicyRequirement(findings)) {
117108
return skippedUnsafeScopedRepair(
@@ -227,19 +218,6 @@ function disableRemoteGatewayMode(
227218
: { config: cfg, changes };
228219
}
229220

230-
function enableSensitiveLoggingRedaction(cfg: OpenClawConfig): RepairPatch {
231-
const next = cloneConfig(cfg);
232-
const logging = ensureRecord(next, "logging");
233-
if (logging.redactSensitive !== "off") {
234-
return { config: cfg, changes: [] };
235-
}
236-
logging.redactSensitive = "tools";
237-
return {
238-
config: next as OpenClawConfig,
239-
changes: ["Set logging.redactSensitive=tools for policy conformance."],
240-
};
241-
}
242-
243221
function disableTelemetryContentCapture(cfg: OpenClawConfig): RepairPatch {
244222
const next = cloneConfig(cfg);
245223
const diagnostics = ensureRecord(next, "diagnostics");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function dataHandlingFindingsForRule(
120120
checkId: CHECK_IDS.policyDataHandlingRedactionDisabled,
121121
message: "Sensitive logging redaction is disabled.",
122122
requirement: `oc://${policyDocName}/${requirementBase}/sensitiveLogging/requireRedaction`,
123-
fixHint: "Set logging.redactSensitive to tools or update policy after review.",
123+
fixHint: "Sensitive log redaction is always enabled; update policy after review.",
124124
}),
125125
),
126126
);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,14 @@ 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.
330333
m(
331334
CHECK_IDS.policyDataHandlingRedactionDisabled,
332-
"automatic",
333-
"Set sensitive logging to a redacting mode.",
334-
{
335-
policyPath: ["dataHandling", "sensitiveLogging", "requireRedaction"],
336-
configTargets: ["logging.redactSensitive"],
337-
},
335+
"validateOnly",
336+
"Update the policy requirement; sensitive log redaction is always enabled.",
337+
{ policyPath: ["dataHandling", "sensitiveLogging", "requireRedaction"] },
338338
),
339339
m(
340340
CHECK_IDS.policyDataHandlingTelemetryContentCapture,

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,14 @@ describe("policy doctor metadata", () => {
207207
.get("unsupported")
208208
?.map((rule) => rule.checkId)
209209
.toSorted(),
210-
validateOnly:
211-
grouped
212-
.get("validateOnly")
213-
?.map((rule) => rule.checkId)
214-
.toSorted() ?? [],
210+
validateOnly: grouped
211+
.get("validateOnly")
212+
?.map((rule) => rule.checkId)
213+
.toSorted(),
215214
}).toEqual({
216215
automatic: [
217216
"policy/agents-tool-not-denied",
218217
"policy/channels-denied-provider",
219-
"policy/data-handling-redaction-disabled",
220218
"policy/data-handling-telemetry-content-capture",
221219
"policy/gateway-control-ui-insecure",
222220
"policy/gateway-http-endpoint-enabled",
@@ -287,7 +285,7 @@ describe("policy doctor metadata", () => {
287285
"policy/tools-profile-unapproved",
288286
],
289287
unsupported: ["policy/sandbox-container-posture-unobservable"],
290-
validateOnly: [],
288+
validateOnly: ["policy/data-handling-redaction-disabled"],
291289
});
292290
});
293291
});

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ export function createPolicyDataAuthChecks(deps: PolicyDoctorCheckDeps): readonl
1818
CHECK_IDS.policyDataHandlingRedactionDisabled,
1919
);
2020
},
21-
repair(ctx, findings) {
22-
return repairPolicyAutomaticNarrower(
23-
ctx,
24-
findings,
25-
CHECK_IDS.policyDataHandlingRedactionDisabled,
26-
);
27-
},
2821
};
2922
const policyDataHandlingTelemetryContentCaptureCheck: HealthCheck = {
3023
id: CHECK_IDS.policyDataHandlingTelemetryContentCapture,

‎src/logging/redact.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,9 +1122,9 @@ function resolveToolPayloadRedaction(
11221122
return { mode: "tools", patterns };
11231123
}
11241124

1125-
// Forces tools-mode regardless of `logging.redactSensitive` (which governs log
1126-
// output, not UI surfaces), and merges user `logging.redactPatterns` with the
1127-
// built-in defaults so both apply.
1125+
// Forces tools-mode so UI/tool payloads never inherit a caller-supplied "off"
1126+
// mode, and merges user `logging.redactPatterns` with the built-in defaults so
1127+
// both apply.
11281128
export function redactToolPayloadText(text: string): string {
11291129
return redactToolPayloadTextWithConfig(text, readLoggingConfig());
11301130
}

0 commit comments

Comments
 (0)