Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ stricter subset of Keep a Changelog).
- Command output shown in error, timeout and interrupt panels is now cut to its last 100 lines so a noisy CRS no longer floods the terminal. For `oss-crs run`, the notice about omitted lines also prints the run's logs directory where the full output is saved.

### Added

- Secret redaction helper `redact_secrets` in `oss_crs.src.utils` and support in `MultiTaskProgress` to mask sensitive API keys and secrets from streaming terminal output and UI panels.
- `oss-crs list-harnesses --fuzz-proj-path <PATH_TO_PROJ>` — builds an OSS-Fuzz project through its default Docker compile path and lists its runnable fuzz harnesses, reusing cached build artifacts until the project inputs or repository HEAD change.
- `--extra-ca-certs` flag, `extra_ca_certs` compose key, and `OSS_CRS_EXTRA_CA_CERTS` env var — trust additional CA certificates for LLM endpoints whose certificate chains to an internal CA. The PEM is merged with the public root store and mounted read-only at `/etc/oss-crs/ca` in the internal LiteLLM proxy and every CRS run container, with `SSL_CERT_FILE`, `REQUESTS_CA_BUNDLE`, `CURL_CA_BUNDLE` and `NODE_EXTRA_CA_CERTS` pointed at it; the host-side external-LiteLLM `/models` check uses it too and now names this setting when a TLS verification error is what failed. Precedence is flag, then compose key, then env var. Does not affect `docker pull`/`docker build`, which use the Docker daemon's trust store. No option to skip verification is added.
- Run-phase exchange artifact inputs and forwarding: generated `oss-crs run` flags for `--pov/--pov-dir`, `--seed-dir`, `--bug-candidate/--bug-candidate-dir`, `--report/--report-dir`, and `--patch/--patch-dir`; `libCRS fetch patch` support via `FETCH_DIR/patches`; and `--forward-artifacts [<run-id>[,<run-id>...]]` to forward prior run artifacts into the new run's `FETCH_DIR`. Forwarding searches sibling compose-hash workdirs, prompts when a run ID maps to multiple source target/harness/sanitizer combinations, prefers processed POVs/seeds when available, and records provenance in `FORWARDED_ARTIFACTS.json`. Passing bare `--forward-artifacts` in an interactive terminal prompts with prior artifact-producing runs for the same target project across any CRS compose hash. Omitting the flag does not forward artifacts. `--diff` remains the special delta-mode reference diff input.
Expand Down
6 changes: 6 additions & 0 deletions oss_crs/src/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def __init__(
self._early_exit_triggered = threading.Event()
# Where the full output is persisted, shown when error output is tailed.
self.full_logs_hint: Optional[str] = None
# Configured secret substrings to redact from displayed output lines
self.secrets_to_redact: list[str] = []
self.statuses: dict[str, TaskStatus] = {
name: TaskStatus.PENDING for name in self.task_names
}
Expand Down Expand Up @@ -606,6 +608,10 @@ def _run_cleanup_tasks(self, parent: Optional[str]) -> TaskResult:

def add_output_line(self, line: str) -> None:
"""Add an output line for the current in-progress task."""
if self.secrets_to_redact:
from .utils import redact_secrets

line = redact_secrets(line, self.secrets_to_redact)
self.current_output_lines.append(line)
if self._headless:
self._print_headless(escape(line))
Expand Down
25 changes: 25 additions & 0 deletions oss_crs/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,31 @@ def generate_random_key(length: int = 10) -> str:
return "".join(secrets.choice(RAND_CHARS) for _ in range(length))


def redact_secrets(
text: str, secrets_to_redact: list[str] | set[str] | None = None
) -> str:
"""Redact configured secret values and API keys from a text string.

Replaces exact matches of known secrets with '[REDACTED]' to prevent
credential leakage in logs and terminal outputs.
"""
if not text:
return text
if not secrets_to_redact:
return text

redacted = text
# Filter out empty or trivially short secrets to prevent over-redaction
valid_secrets = [s for s in secrets_to_redact if s and len(s) >= 4]
# Sort descending by length so longer substrings are matched first
valid_secrets.sort(key=len, reverse=True)

for secret in valid_secrets:
if secret in redacted:
redacted = redacted.replace(secret, "[REDACTED]")
return redacted


def generate_run_id() -> str:
"""Generate a run ID from unix timestamp + 6 random alphanumeric chars.

Expand Down
33 changes: 33 additions & 0 deletions oss_crs/tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,36 @@ def test_suffix_varies_between_calls(self) -> None:
# event; the old 2-character suffix repeated within 50 draws ~60% of
# the time, so this fails loudly on a regression.
assert len(ids) == 50


class TestRedactSecrets:
def test_redact_secrets_replaces_known_secrets(self) -> None:
from oss_crs.src.utils import redact_secrets

secrets = ["sk-live-secret-key-12345", "postgres-super-secret"]
text = "Connecting with sk-live-secret-key-12345 to db with password postgres-super-secret"
redacted = redact_secrets(text, secrets)
assert redacted == "Connecting with [REDACTED] to db with password [REDACTED]"

def test_redact_secrets_noop_when_empty_or_none(self) -> None:
from oss_crs.src.utils import redact_secrets

assert redact_secrets("", ["secret"]) == ""
assert redact_secrets("normal text", None) == "normal text"
assert redact_secrets("normal text", []) == "normal text"

def test_redact_secrets_ignores_short_strings(self) -> None:
from oss_crs.src.utils import redact_secrets

# Short strings (< 4 chars) should not be redacted to prevent over-redaction
text = "A cat sat on a mat"
redacted = redact_secrets(text, ["a", "on"])
assert redacted == text

def test_redact_secrets_longest_first(self) -> None:
from oss_crs.src.utils import redact_secrets

secrets = ["secret", "secret_extended"]
text = "This contains secret_extended in output"
redacted = redact_secrets(text, secrets)
assert redacted == "This contains [REDACTED] in output"