Skip to content

Commit d2fe20b

Browse files
leliaclaude
andcommitted
Describe the log redaction by what it does rather than what it prevented
The changelog entry and the module and test docstrings spelled out the failure mode in enough detail to serve as a lookup guide, on a public repository, before the fix has shipped. Reworded to describe the behaviour -- configuration values and integration URLs are redacted in log output -- without the specifics. No functional change; redaction behaviour and tests are untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent ebf39ca commit d2fe20b

3 files changed

Lines changed: 11 additions & 27 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@
22

33
## 2.8.1
44

5-
### Fixed: credentials could appear in debug log output
6-
7-
- Running with `--debug` logged the whole configuration, including the Socket API
8-
token, in clear text. In CI that lands in the job log, which is retained, shared
9-
in support tickets and world-readable for public repositories. Configuration is
10-
now logged through a redacted view that masks credential-bearing fields.
11-
- The Slack integration logged the full webhook URL, once unconditionally at debug
12-
level. A webhook URL is a bearer credential -- anyone holding it can post into
13-
the channel. These log lines now show only the scheme and host. Because the
14-
Slack plugin runs while server log streaming is active, and that handler applies
15-
no level filter, those URLs were also being uploaded to Socket.
16-
- If a Socket API token or Slack webhook URL may have been exposed in CI logs,
17-
rotate it.
5+
### Fixed: debug logging could include sensitive configuration values
6+
7+
- Debug-level output could include configuration values and integration URLs
8+
verbatim. Both are now redacted in log output.
189

1910
### Fixed: manifest links used the wrong host for some organizations
2011

socketsecurity/redaction.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
"""Helpers for keeping credentials out of anything that reaches a log line.
22
3-
The CLI runs inside other people's pipelines. Its stdout is captured into CI job
4-
logs that are retained, pasted into support tickets, and world-readable for
5-
public repositories. Some of those records are also shipped to Socket by the log
6-
streamer in `core/streaming.py`, whose upload handler has no level filter and
7-
runs with its loggers forced to DEBUG -- so a debug line emitted while streaming
8-
is active leaves the machine entirely.
3+
The CLI runs inside other people's pipelines, and log output can be retained by
4+
CI and forwarded elsewhere, so credentials must not reach it.
95
106
Nothing here tries to be a general-purpose scrubber. It covers the two shapes
117
the CLI actually holds: a config mapping with credential-ish field names, and a
@@ -42,10 +38,9 @@ def is_sensitive_name(name: str) -> bool:
4238
def redact_url(value: Any) -> Any:
4339
"""Reduce a URL to scheme and host, dropping the parts that carry secrets.
4440
45-
A Slack webhook URL is a bearer credential: the secret is the path, and
46-
anyone holding it can post into the customer's channel. Keeping the host
47-
preserves what the debug line was for -- seeing *which* endpoint is
48-
configured -- without printing the credential.
41+
For webhook-style URLs the sensitive part is the path, so keeping the host
42+
preserves what a debug line is for -- seeing which endpoint is configured --
43+
without writing the rest.
4944
5045
Values that are not absolute URLs are returned unchanged, so placeholders
5146
such as "Not configured" stay readable.

tests/unit/test_redaction.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
"""Tests for credential redaction in log output.
22
3-
The CLI runs in customer CI. Its stdout lands in job logs that are retained,
4-
shared in support tickets and public for public repositories, and the log
5-
streamer uploads records to Socket with no level filter. Credentials must not
6-
reach any of that.
3+
Log output can be retained by CI and forwarded elsewhere, so credentials must
4+
not reach it.
75
"""
86

97
import dataclasses

0 commit comments

Comments
 (0)