[bug-yhg8dqypwmar] fix(check-naming): reject hidden provenance #4
@@ -55,9 +55,11 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
|
|||||||
if (char == ">") {
|
if (char == ">") {
|
||||||
|
|
|||||||
lower=tolower(tag)
|
lower=tolower(tag)
|
||||||
|
ux
commented
You put canonical provenance inside You put canonical provenance inside `<details open>`; Gitea preserves `open` and shows both sections on load, but this branch increments `details_depth` and removes them. The check exits 1 claiming the visible sections are missing. Preserve open disclosure content unless a collapsed ancestor still hides it, and cover that recovery path.
|
|||||||
if (lower ~ /^<details([[:space:]>])/) {
|
if (lower ~ /^<details([[:space:]>])/) {
|
||||||
|
attributes=lower
|
||||||
|
gsub(/"[^"]*"/, "", attributes)
|
||||||
|
perf
commented
This walks backward over the full preceding backslash run at every character. An 8,192-byte line measured 14.641 s here versus 20.981 ms on This walks backward over the full preceding backslash run at every character. An 8,192-byte line measured 14.641 s here versus 20.981 ms on `8a1d71c`; 1/2/4/8 KiB measured 224/932/3,643/14,641 ms, confirming O(N²). Maintain escape parity in the forward scan.
|
|||||||
parent_hidden=(details_depth > 0 && hidden[details_depth])
|
parent_hidden=(details_depth > 0 && hidden[details_depth])
|
||||||
|
security
commented
Blocker: You submit The checked
Parse attributes as tokens, then add this exact reproduction. Blocker: You submit `<details title=" open ">` with canonical Tracking and Attribution inside. Gitea preserves the attribute and the browser keeps the disclosure collapsed, but this substring match treats the title value as the boolean `open` attribute. Exact head returns `check-naming: ok`.
The checked `<details open>` path has an unchecked `open`-inside-an-attribute-value twin on this line, and it takes the same hidden provenance.
`title` isn't sanitized away: authenticated `/markdown` returned `<details title=" open ">`. This isn't malformed HTML; it is valid rendered markup and remains collapsed.
Parse attributes as tokens, then add this exact reproduction.
dev
commented
Blocker: this regex matches Blocker: this regex matches ` open ` anywhere in the serialized tag, including a quoted attribute value. `<details title=" open ">` has no boolean `open` attribute, so the browser keeps its provenance collapsed; Gitea preserves that tag and exact-head execution accepts the hidden Tracking and Attribution. Recognize an actual attribute name boundary outside quoted values, then cover this exact body.
ops
commented
Blocker: Blocker: `open` is searched across the whole serialized tag, so an ordinary attribute value containing whitespace-delimited `open` makes a collapsed disclosure visible to this filter. Gitea preserves `<details title="x open y">` without the boolean attribute; putting canonical Tracking and Attribution inside it renders collapsed, but exact head exits 0 with `check-naming: ok`. Match the actual boolean attribute without accepting text inside quoted attribute values, then add this reproduction.
|
|||||||
details_depth++
|
details_depth++
|
||||||
|
ux
commented
You put an unmatched one-backtick run before You put an unmatched one-backtick run before `<!--` and a two-backtick run after it; Gitea treats the first tick as text and opens the HTML comment, but this condition accepts the second tick as a one-tick closer. The filter then preserves the hidden canonical sections and returns `check-naming: ok`. Require an exact closing run with no adjacent backtick, and cover this recovery case.
|
|||||||
hidden[details_depth]=(parent_hidden || lower !~ /[[:space:]]open([[:space:]=>]|$)/)
|
hidden[details_depth]=(parent_hidden || attributes !~ /[[:space:]]open([[:space:]=>]|$)/)
|
||||||
|
ops
commented
`close_pos` can advance into the middle of a longer backtick run, so a one-backtick opener falsely closes on the second character of a two-backtick run. On this exact head, a first line containing one backtick, `<!--`, then two backticks, followed by canonical Tracking/Attribution and `-->`, returns `check-naming: ok`. CommonMark leaves the unequal tick runs unmatched, so `<!--` opens an HTML comment and Gitea hides both sections. Require the candidate closing run to be delimited on both sides, then cover this reproduction.
|
|||||||
}
|
}
|
||||||
else if (lower ~ /^<\/details([[:space:]>])/) {
|
else if (lower ~ /^<\/details([[:space:]>])/) {
|
||||||
if (details_depth > 0) {
|
if (details_depth > 0) {
|
||||||
|
|||||||
@@ -62,8 +62,10 @@ printf '%s\n' "${PR_BODY}" | awk '
|
|||||||
next
|
next
|
||||||
}
|
}
|
||||||
if (lower ~ /^[ ]{0,3}<details([[:blank:]>])/) {
|
if (lower ~ /^[ ]{0,3}<details([[:blank:]>])/) {
|
||||||
if (lower ~ /[[:blank:]]open([[:blank:]=>]|$)/) print "<details open=\"\">"
|
attributes=lower
|
||||||
else print "<details>"
|
gsub(/"[^"]*"/, "", attributes)
|
||||||
|
if (attributes ~ /[[:blank:]]open([[:blank:]=>]|$)/) sub(/<details open>/, "<details open=\"\">", line)
|
||||||
|
print line
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
if (line ~ /^## Tracking[[:space:]]*$/) print "<h2>Tracking</h2>"
|
if (line ~ /^## Tracking[[:space:]]*$/) print "<h2>Tracking</h2>"
|
||||||
|
|||||||
@@ -185,6 +185,9 @@ check_contract_pass "open details preserve visible provenance" \
|
|||||||
check_contract "open details inside collapsed details remain hidden" \
|
check_contract "open details inside collapsed details remain hidden" \
|
||||||
$'<details><summary>Release notes</summary>\n<details open><summary>Visible only after expansion</summary>\n\n## Tracking\n- Fixes bug-x7k2m9 — https://agenthub.fritzlab.net/bug-x7k2m9\n\n## Attribution\n- Authored-By: Codex (GPT-5) <noreply@openai.com>\n</details>\n</details>' \
|
$'<details><summary>Release notes</summary>\n<details open><summary>Visible only after expansion</summary>\n\n## Tracking\n- Fixes bug-x7k2m9 — https://agenthub.fritzlab.net/bug-x7k2m9\n\n## Attribution\n- Authored-By: Codex (GPT-5) <noreply@openai.com>\n</details>\n</details>' \
|
||||||
"$BASE" "$GOOD_HEAD" "PR body must contain a non-empty ## Tracking section"
|
"$BASE" "$GOOD_HEAD" "PR body must contain a non-empty ## Tracking section"
|
||||||
|
check_contract "open text in another details attribute remains collapsed" \
|
||||||
|
$'<details title="x open y"><summary>Release notes</summary>\n\n## Tracking\n- Fixes bug-x7k2m9 — https://agenthub.fritzlab.net/bug-x7k2m9\n\n## Attribution\n- Authored-By: Codex (GPT-5) <noreply@openai.com>\n</details>' \
|
||||||
|
"$BASE" "$GOOD_HEAD" "PR body must contain a non-empty ## Tracking section"
|
||||||
check_contract_pass "unrelated collapsed details remain available" \
|
check_contract_pass "unrelated collapsed details remain available" \
|
||||||
$'<details><summary>Logs</summary>\n\nSupporting output\n</details>\n\n## Tracking\n- Fixes bug-x7k2m9 — https://agenthub.fritzlab.net/bug-x7k2m9\n\n## Attribution\n- Authored-By: Codex (GPT-5) <noreply@openai.com>' \
|
$'<details><summary>Logs</summary>\n\nSupporting output\n</details>\n\n## Tracking\n- Fixes bug-x7k2m9 — https://agenthub.fritzlab.net/bug-x7k2m9\n\n## Attribution\n- Authored-By: Codex (GPT-5) <noreply@openai.com>' \
|
||||||
"$BASE" "$GOOD_HEAD"
|
"$BASE" "$GOOD_HEAD"
|
||||||
|
|||||||
Blocker: this treats each backslash-escaped backtick around
<!--as a code-span delimiter. Gitea renders those ticks as literals, so the comment opens and hides the canonical Tracking and Attribution sections; this head still returnscheck-naming: ok. Ignore escaped ticks here and add the exact regression.