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: 1 addition & 1 deletion backend/secuscan/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,7 @@ def _parse_results(self, plugin, output: str) -> Dict[str, Any]:
except Exception as exc:
logger.error("Unexpected error running parser sandbox for '%s': %s", plugin.id, exc)
raise RuntimeError(
f"Custom parser encountered an unexpected error for plugin '{plugin.id}'"
f"Custom parser encountered an unexpected error for plugin '{plugin.id}': {redact(str(exc))}"
) from exc

# 2. Fallback to legacy built-in parsers (only reached when no parser.py exists)
Expand Down
10 changes: 6 additions & 4 deletions backend/secuscan/parser_sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
from pathlib import Path
from typing import Any, Dict

from .redaction import redact

logger = logging.getLogger(__name__)

# Defaults — overridden by the Settings values passed at call time.
Expand Down Expand Up @@ -84,11 +86,11 @@ class ParserSandboxError(RuntimeError):
def __init__(self, plugin_id: str, reason: str, stderr: str = "") -> None:
self.plugin_id = plugin_id
self.reason = reason
# Keep stderr private; callers must not surface this to API consumers.
sanitized = redact(stderr[:2000]) if stderr else ""
self._stderr_diagnostic: str = stderr
self.stderr_excerpt = stderr[:2000] if stderr else ""
# User-facing message: reason only — no stderr content.
super().__init__(f"Parser sandbox failed for '{plugin_id}' ({reason})")
self.stderr_excerpt = sanitized
detail = f": {sanitized[:200]}" if sanitized.strip() else ""
super().__init__(f"Parser sandbox failed for '{plugin_id}' ({reason}){detail}")


# ---------------------------------------------------------------------------
Expand Down
Loading