Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7fab2e7
fix(tier3): mask credentials after JSON-escaped line breaks in judge …
rng1995 Nov 12, 2026
cfa306f
fix(tier3): keep tool-call arguments and empty-reply bodies in RAGAS …
rng1995 Nov 12, 2026
53a09fa
docs(changelog): note judge evidence masking at JSON-escaped line starts
rng1995 Nov 12, 2026
9455fc3
docs(changelog): place the judge evidence masking entry with the judg…
rng1995 Nov 12, 2026
e3b545a
fix(tier3): mask quoted credentials escaped twice in judge evidence
rng1995 Nov 13, 2026
86776ef
fix(tier3): mask judge evidence credentials after escaped tabs and no…
rng1995 Nov 13, 2026
76b5a4c
docs(changelog): cover escaped tabs, non-ASCII escapes and twice-esca…
rng1995 Nov 13, 2026
42b964b
fix(tier3): mask judge evidence after an escaped tab at a JSON-escape…
rng1995 Nov 13, 2026
ea146fe
docs(tier3): name the JSON-escaped Cookie shapes judge evidence still…
rng1995 Nov 13, 2026
f867027
Merge main into naren/fix-tier3-ragas-evidence-masking
rng1995 Nov 13, 2026
960d86c
fix(tier3): keep RAGAS reply evidence to the text RAGAS parses
rng1995 Nov 13, 2026
f223507
fix(tier3): mask judge evidence credentials after JSON escapes
rng1995 Nov 13, 2026
862a355
fix(tier3): mask whole judge evidence text before its escaped lines
rng1995 Nov 13, 2026
a66f119
Merge main into naren/fix-tier3-ragas-evidence-masking
rng1995 Nov 13, 2026
6661151
fix(tier3): mask credential values in JSON-escaped quotes
rng1995 Nov 14, 2026
f81cb6a
ci(gitleaks): allow the JSON-escaped-quote judge evidence test placeh…
rng1995 Nov 14, 2026
aac2a96
fix(tier3): mask the line after a credential value that reads through…
rng1995 Nov 14, 2026
2ef8839
fix(tier3): mask a line's value only where the whole pass took its name
rng1995 Nov 14, 2026
19d5c98
fix(tier3): keep a bare -p argv element in JSON-escaped text
rng1995 Nov 14, 2026
19e4f08
fix(tier3): mask a twice-escaped attached -pVALUE argv element again
rng1995 Nov 14, 2026
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
7 changes: 7 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ targetRules = ["curl-auth-user"]
regexes = ['''^["']admin:quoted-user-password["']$''']
paths = ['''^tests/tier3/test_judge_contracts\.py$''']

[[allowlists]]
description = "Synthetic JSON-escaped-quote curl credential placeholder used by judge evidence redaction tests"
condition = "AND"
targetRules = ["curl-auth-user"]
regexes = ['''^"admin:\{_QUOTED_SECRET\}"$''']
paths = ['''^tests/tier3/test_judge_contracts\.py$''']

[[allowlists]]
description = "Synthetic NVIDIA Build token used by streaming redaction tests"
condition = "AND"
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,18 @@ All notable changes to SkillEvaluator are documented in this file.
user-request section when it is set below 2,000, and that a check budget too
small to hold the final response beside some tool history is logged as a
warning rather than quietly raised — lower the final-response limit with it.
- `judge_attempts.json` now masks `Cookie` header values, credential flag values
(`--token`, `--password`, `-u user:password`, `--cookie`) and keys such as
`sk-proj-...` that start a line in JSON-escaped text, as in RAGAS prompts and
replies. A line break there is the two characters `\n`, and these values were
saved in clear after it or after an escaped tab (`\t`). Judge and security
finding evidence also masks a double-quoted `-u user:password`, MySQL `-p` or
`.netrc` password value, and the value in an argv list such as
`["tool", "--password", "..."]`, when JSON escapes the quotes (`\"...\"`), as
in the tool-call arguments every judge prompt holds; these were saved in clear.
A RAGAS `replied` entry for a reply with no text and no tool call, such as a
refusal or a content-filter stop, now saves the whole reply body instead of an
empty reply.
- Code Risk Analysis reports Semgrep file-level parse errors as one partial-scan
error that names up to 20 unparsed files, relative to the skill and with the
line of the first error, instead of the first three truncated messages. The
Expand Down
34 changes: 19 additions & 15 deletions docs/tier3-live-evaluation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1379,21 +1379,25 @@ the case is judged and scored normally.
truncated reply, the LLM attempts keep their own status (`rejected`, or
`error` if the retry failed in transport), and an `accepted` `salvage`
entry, numbered like the truncated attempt, holds the rebuilt results.
When the RAGAS goal scorer runs, each request it sends is saved as a
`ragas` entry with its messages as the prompt and the model named in the
request: `replied` with the judge's reply, which is the text or the
tool-call arguments RAGAS parses, or `error` with the HTTP status and body,
or with the reason the reply was not received. A request that fails before
any response arrives, such as a refused connection, saves no entry of its
own. A last `ragas` entry is `accepted` with the score RAGAS computed, or
`error` with the reason the prompt judge ran instead. Only that last entry
counts toward `--max-judge-calls`; the request entries do not.
Configured credentials, common key shapes, URL userinfo, `Authorization`,
API-key, token and `Cookie` header values, and credential flag values
(`--token`, `--password`, `curl -u user:password`) are masked, and long
prompts and replies are shortened. The prompts contain the task question,
expected answer, and agent evidence. Pass `--harbor-keep-jobs` to keep the
Harbor trial directories that hold this file.
When the RAGAS goal scorer runs, each request it sends is saved as a `ragas`
entry with its messages as the prompt and the model named in the request. A
`replied` entry holds the judge's reply: the text or the tool-call arguments
RAGAS parses, or the whole reply body when it has neither, such as a refusal
or a content-filter stop. An `error` entry holds the HTTP status and body,
or the reason the reply was not received. A request that fails before any
response arrives, such as a refused connection, saves no entry of its own. A
last `ragas` entry is `accepted` with the score RAGAS computed, or `error`
with the reason the prompt judge ran instead. Only that last entry counts
toward `--max-judge-calls`; the request entries do not. Configured
credentials, common key shapes, URL userinfo, `Authorization`, API-key,
token and `Cookie` header values, and credential flag values (`--token`,
`--password`, `curl -u user:password`) are masked, also at the start of a
Comment thread
rng1995 marked this conversation as resolved.
Resolved
line in JSON-escaped text such as RAGAS prompts, where a line break is the
two characters `\n`, and inside JSON-escaped quotes (`-u \"user:password\"`),
as in tool-call arguments. Long prompts and replies are shortened. The prompts
contain the task question, expected answer, and agent evidence. Pass
`--harbor-keep-jobs` to keep the Harbor trial directories that hold this
file.
- **Reasoning models.** GPT-5 and GPT-6 judges get no `temperature` and at
least 32,768 output tokens, because reasoning tokens count against the
limit; other judges get 16,384. GPT-6 judges and Claude 5.5 or later judges
Expand Down
70 changes: 55 additions & 15 deletions src/skillevaluator/tier3/eval_core/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3354,10 +3354,16 @@ def _security_finding(
# value, although its marker holds spaces. A word never starts at a shell
# operator: in "git config --get github.token | curl ..." or "gh auth login
# --with-token < token.txt" the flag or key has no value on the command line.
# A double-quoted value whose quotes are JSON-escaped (\"VALUE\"), as a shell
# string reads in tool-call arguments and other JSON text, ends at the escaped
# closing quote or the end of the line.
_FINDING_EVIDENCE_ESCAPED_QUOTED_VALUE = r"\\\"(?:[^\"\\\r\n]|\\(?!\"))*(?:\\\")?"
_FINDING_EVIDENCE_FLAG_VALUE = (
"(?:"
+ _FINDING_EVIDENCE_PRIVATE_KEY_MARKER
+ r"|\\\"(?:[^\"\\\r\n]|\\(?!\"))*(?:\\\")?|\"(?:\\.|[^\"\\\r\n])*\"?|'[^'\r\n]*'?|(?![|&;<>])(?:\\.|[^\s'\"`\\])+)"
+ "|"
+ _FINDING_EVIDENCE_ESCAPED_QUOTED_VALUE
+ r"|\"(?:\\.|[^\"\\\r\n])*\"?|'[^'\r\n]*'?|(?![|&;<>])(?:\\.|[^\s'\"`\\])+)"
)
# Any long flag whose name holds a credential word ("--password", "--db-password",
# "--client-secret", "--github-token", "--oauth2-bearer", "--cookie"), and the
Expand Down Expand Up @@ -3385,14 +3391,16 @@ def _security_finding(
# "://" is a URL ("pip install -U git+https://..."), whose userinfo is already
# masked, one whose first colon starts a "/" path is a remote path ("rsync
# -u host:/data"), and a "+" with a "%" conversion before the first colon is
# a date format ("date -u +%H:%M:%S"); "-u +admin:VALUE" is still masked.
_FINDING_EVIDENCE_DATE_FORMAT = r"[\"']?\+[^\s'\"`:]*%"
# a date format ("date -u +%H:%M:%S"); "-u +admin:VALUE" is still masked. A
# quoted value may have JSON-escaped quotes (-u \"user:password\").
_FINDING_EVIDENCE_DATE_FORMAT = r"(?:\\?[\"'])?\+[^\s'\"`:]*%"
_FINDING_EVIDENCE_DATE_FORMAT_RE = re.compile(_FINDING_EVIDENCE_DATE_FORMAT)
_FINDING_EVIDENCE_USER_FLAG_RE = re.compile(
r"((?<![^\s'\"])(?:(?:-[A-Za-z]{0,8}?u|-U|--user|--proxy-user)(?:[ \t]+|=)"
r"|-[A-Za-z]{0,8}?u(?=[^\s'\"`:=-][^\s'\"`:]*:)))"
r"(?!" + _FINDING_EVIDENCE_DATE_FORMAT + r")(?![\"']?[^\s'\"`]*://)(?![\"']?[^\s'\"`:]*:/)"
r"(?:\"(?:\\.|[^\"\\\r\n:])*:(?:\\.|[^\"\\\r\n])*\"?|'[^'\r\n:]*:[^'\r\n]*'?|[^\s'\"`:]*:[^\s'\"`]*)"
r"(?!" + _FINDING_EVIDENCE_DATE_FORMAT + r")(?!(?:\\?[\"'])?[^\s'\"`]*://)(?!(?:\\?[\"'])?[^\s'\"`:]*:/)"
r"(?:\\\"(?:[^\"\\\r\n:]|\\(?!\"))*:(?:[^\"\\\r\n]|\\(?!\"))*(?:\\\")?"
r"|\"(?:\\.|[^\"\\\r\n:])*:(?:\\.|[^\"\\\r\n])*\"?|'[^'\r\n:]*:[^'\r\n]*'?|[^\s'\"`:]*:[^\s'\"`]*)"
)
# "-p" is a password after a login subcommand ("docker login -u bot -p VALUE",
# also attached as "-pVALUE"; "az login -u ID -p VALUE"; "helm registry login
Expand All @@ -3412,7 +3420,9 @@ def _security_finding(
_FINDING_EVIDENCE_MYSQL_PASSWORD_RE = re.compile(
r"((?<![^\s;&|('\"`])(?:[^\s'\"`;&|()<>]{0,128}/s?bin/)?"
r"(?:mysql|mysqldump|mysqladmin|mysqlimport|mysqlshow|mysqlcheck|mariadb|mariadb-dump)(?=[ \t])"
r"[^|;&\r\n]{0,256}?[ \t]-p)(?!ath\b|erm\b|rint|rune\b)(?:\"(?:\\.|[^\"\\\r\n])*\"?|'[^'\r\n]*'?|[^\s'\"`|;&]+)"
r"[^|;&\r\n]{0,256}?[ \t]-p)(?!ath\b|erm\b|rint|rune\b)(?:"
+ _FINDING_EVIDENCE_ESCAPED_QUOTED_VALUE
+ r"|\"(?:\\.|[^\"\\\r\n])*\"?|'[^'\r\n]*'?|[^\s'\"`|;&]+)"
)
# "aws configure set aws_secret_access_key VALUE" and a .netrc entry
# ("machine HOST login USER password VALUE"). A .netrc entry may span lines,
Expand Down Expand Up @@ -3451,7 +3461,9 @@ def _security_finding(
+ _FINDING_EVIDENCE_NETRC_SEPARATOR
+ "password"
+ _FINDING_EVIDENCE_NETRC_SEPARATOR
+ r")(?:\"(?:\\.|[^\"\\\r\n])*\"?|'[^'\r\n]*'?|"
+ r")(?:"
+ _FINDING_EVIDENCE_ESCAPED_QUOTED_VALUE
+ r"|\"(?:\\.|[^\"\\\r\n])*\"?|'[^'\r\n]*'?|"
+ _FINDING_EVIDENCE_NETRC_WORD
+ r"(?:[ \t]+(?!(?:machine|login|account|password|macdef|default)\b)"
+ _FINDING_EVIDENCE_NETRC_VALUE_WORD
Expand All @@ -3470,19 +3482,47 @@ def _security_finding(
# "-path", "-perm", "-print" and "-prune" are kept. An attached
# "-uUSER:PASSWORD" element is masked by the -u rule below. Each element may
# sit on its own line, as a formatter writes a long list, so up to 64 spaces
# and line breaks may follow the comma.
# and line breaks may follow the comma. In JSON text, such as tool-call
# arguments, the quotes are escaped (\"--password\", \"VALUE\") and a line
# break is the two characters "\n".
_FINDING_EVIDENCE_ARGV_QUOTE = r"\\?[\"']"
_FINDING_EVIDENCE_ARGV_SPACE = r"(?:\s|\\[nrt]){0,64}"
_FINDING_EVIDENCE_ARGV_FLAG_RE = re.compile(
r"([\"'])(" + _FINDING_EVIDENCE_CREDENTIAL_FLAG_NAME + r"|-[pub])\1[ \t]*,\s{0,64}(?=[\"'][^-\"'])",
r"("
+ _FINDING_EVIDENCE_ARGV_QUOTE
+ r")("
+ _FINDING_EVIDENCE_CREDENTIAL_FLAG_NAME
+ r"|-[pub])\1[ \t]*,"
+ _FINDING_EVIDENCE_ARGV_SPACE
+ r"(?="
+ _FINDING_EVIDENCE_ARGV_QUOTE
+ r"[^-\"'])",
re.IGNORECASE,
)
_FINDING_EVIDENCE_ARGV_VALUE_RE = re.compile(r"\"(?:\\.|[^\"\\\r\n])*\"?|'[^'\r\n]*'?")
_FINDING_EVIDENCE_ARGV_LOGIN_RE = re.compile(r"[\"']login[\"'][ \t]*,")
_FINDING_EVIDENCE_ARGV_SSHPASS_RE = re.compile(r"[\"'](?:[^\s'\"]{0,128}/)?sshpass[\"'][ \t]*,\s{0,64}$")
_FINDING_EVIDENCE_ARGV_VALUE_RE = re.compile(
_FINDING_EVIDENCE_ESCAPED_QUOTED_VALUE + r"|\"(?:\\.|[^\"\\\r\n])*\"?|'[^'\r\n]*'?"
)
_FINDING_EVIDENCE_ARGV_LOGIN_RE = re.compile(
_FINDING_EVIDENCE_ARGV_QUOTE + "login" + _FINDING_EVIDENCE_ARGV_QUOTE + r"[ \t]*,"
)
_FINDING_EVIDENCE_ARGV_SSHPASS_RE = re.compile(
_FINDING_EVIDENCE_ARGV_QUOTE
+ r"(?:[^\s'\"]{0,128}/)?sshpass"
+ _FINDING_EVIDENCE_ARGV_QUOTE
+ r"[ \t]*,"
+ _FINDING_EVIDENCE_ARGV_SPACE
+ "$"
)
_FINDING_EVIDENCE_ARGV_MYSQL_RE = re.compile(
r"[\"'](?:[^\s'\"]{0,128}/s?bin/)?"
r"(?:mysql|mysqldump|mysqladmin|mysqlimport|mysqlshow|mysqlcheck|mariadb|mariadb-dump)[\"'][ \t]*,"
_FINDING_EVIDENCE_ARGV_QUOTE
+ r"(?:[^\s'\"]{0,128}/s?bin/)?"
+ r"(?:mysql|mysqldump|mysqladmin|mysqlimport|mysqlshow|mysqlcheck|mariadb|mariadb-dump)"
+ _FINDING_EVIDENCE_ARGV_QUOTE
+ r"[ \t]*,"
)
_FINDING_EVIDENCE_ARGV_ATTACHED_PASSWORD_RE = re.compile(
"(" + _FINDING_EVIDENCE_ARGV_QUOTE + r")-p(?!ath\b|erm\b|rint|rune\b)([^\"'\r\n]+)\1"
)
_FINDING_EVIDENCE_ARGV_ATTACHED_PASSWORD_RE = re.compile(r"([\"'])-p(?!ath\b|erm\b|rint|rune\b)([^\"'\r\n]+)\1")
# Bearer, Basic, Token and Digest stay visible after a credential name too
# ("Authorization: Bearer <redacted>").
_FINDING_EVIDENCE_AUTH_SCHEME = r"(?:(?:bearer|basic|token|digest)[ \t]+)?"
Expand Down
54 changes: 46 additions & 8 deletions src/skillevaluator/tier3/harbor/templates/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2843,17 +2843,49 @@ def _judge_retry_feedback(problem):
)


def _redact_judge_evidence(text):
"""Mask credentials in a judge prompt, reply, or problem before it is saved."""
# RAGAS writes its input into the prompt as JSON, and tool-call arguments are
# JSON, so a line break or tab in that text arrives as the two characters "\n",
# "\r" or "\t". A header, flag or key that starts a line there follows the
# letter of the escape, where patterns that need a line start, a space or a
# word boundary before it do not match. So once the whole text is masked, the
# text between these escapes is masked again as lines of their own.
_JUDGE_EVIDENCE_ESCAPE_RE = re.compile(r"(\\[nrt])")


def _mask_judge_evidence_text(text):
"""Mask credentials in *text* read as one piece."""
# Share finding credential semantics without imposing the finding scanner's
# 2,000-character input budget on the longer judge prompt and reply budgets.
redacted = _shared_checks._mask_finding_evidence_credentials(str(text), preserve_header_format=True)
redacted = _shared_checks._mask_finding_evidence_credentials(text, preserve_header_format=True)
redacted = _redact_configured_credentials(_redact_evidence_text(redacted))
for pattern in _SECRET_PATTERNS:
redacted = pattern.sub("<redacted>", redacted)
return redacted


def _mask_judge_evidence_line(text):
"""Mask credentials in the text between two escapes, which is not trimmed."""
redacted = _shared_checks._mask_finding_evidence_credentials(text, preserve_header_format=True)
redacted = redact_secrets_in_log_line(redacted)
for pattern in _SECRET_PATTERNS:
redacted = pattern.sub("<redacted>", redacted)
return redacted


def _redact_judge_evidence(text):
"""Mask credentials in a judge prompt, reply, or problem before it is saved."""
# The whole text is masked first, so a form that runs over an escape (a
# private key block, a continued or quoted value, a value that holds "\n"
# or "\u00e4") is masked whole before the text is split at the escapes.
redacted = _mask_judge_evidence_text(str(text))
Comment thread
rng1995 marked this conversation as resolved.
Resolved
parts = _JUDGE_EVIDENCE_ESCAPE_RE.split(redacted)
if len(parts) == 1:
return redacted
# Text and escapes alternate.
parts[::2] = [_mask_judge_evidence_line(part) if part else part for part in parts[::2]]
return "".join(parts)


def _verifier_output_dir():
"""Directory that receives skill_evaluator_reward.json (see write_reward_outputs)."""
if (
Expand Down Expand Up @@ -3270,14 +3302,20 @@ def _ragas_request_text(body):


def _ragas_reply_text(body):
"""Return the judge's answer in one chat-completions reply: its text, or the tool-call arguments RAGAS parses."""
"""Return the judge's answer in one chat-completions reply: its text, or the tool-call arguments RAGAS parses.

A reply with neither, such as a refusal or a content-filter stop, is
returned whole, so the refusal or the finish reason is kept.
"""
try:
message = json.loads(body)["choices"][0]["message"]
if message.get("content") or not message.get("tool_calls"):
return str(message.get("content") or "")
return "\n".join(str(call["function"]["arguments"]) for call in message["tool_calls"])
if message.get("content"):
return str(message["content"])
if message.get("tool_calls"):
return "\n".join(str(call["function"]["arguments"]) for call in message["tool_calls"])
except (ValueError, LookupError, TypeError, AttributeError):
return body.decode("utf-8", "replace")
pass
return body.decode("utf-8", "replace")


def _record_ragas_exchange(response, problem=None):
Expand Down
Loading
Loading