Skip to content

Commit d24c6f8

Browse files
Reject embedded reserved summary markers
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
1 parent 462b2de commit d24c6f8

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎.github/actions/pr-review/action.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ runs:
6868
exit 1
6969
fi
7070
for reserved in "### Connector PR Review:" "### General PR Review:" "### PR Review:"; do
71-
if [[ "${SUMMARY_MARKER}" != "${reserved}" && "${SUMMARY_MARKER}" == "${reserved}"* ]]; then
72-
echo "::error::summary_marker must not extend a reserved review heading"
71+
if [[ "${SUMMARY_MARKER}" != "${reserved}" && "${SUMMARY_MARKER}" == *"${reserved}"* ]]; then
72+
echo "::error::summary_marker must not embed a reserved review heading"
7373
exit 1
7474
fi
7575
done

‎.github/actions/pr-review/scripts/fetch-pr-context.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ def is_valid_summary_heading(value: str) -> bool:
5050
return False
5151
if not value.startswith("### ") or not value.endswith(":"):
5252
return False
53-
# Prefix-based legacy consumers must not mistake a custom summary for
53+
# Substring-based legacy consumers must not mistake a custom summary for
5454
# their own. Exact built-in headings remain valid for existing callers.
55-
if value != LEGACY_REVIEW_SUMMARY_HEADING and value.startswith(LEGACY_REVIEW_SUMMARY_HEADING):
55+
if value != LEGACY_REVIEW_SUMMARY_HEADING and LEGACY_REVIEW_SUMMARY_HEADING in value:
5656
return False
5757
for reserved in BUILT_IN_REVIEW_SUMMARY_HEADINGS:
58-
if value != reserved and value.startswith(reserved):
58+
if value != reserved and reserved in value:
5959
return False
6060
return bool(value[len("### "):-1].strip())
6161

‎.github/actions/pr-review/scripts/test_verdict_scaffolding.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,11 +628,14 @@ def test_rejects_malformed_headings(self):
628628
with self.subTest(value=value):
629629
self.assertFalse(fpc.is_valid_summary_heading(value))
630630

631-
def test_rejects_reserved_heading_extensions(self):
631+
def test_rejects_reserved_heading_collisions(self):
632632
for value in (
633633
"### Connector PR Review: Replay:",
634634
"### General PR Review: Replay:",
635635
"### PR Review: Replay:",
636+
"### Replay: ### Connector PR Review:",
637+
"### Replay: ### General PR Review:",
638+
"### Replay: ### PR Review:",
636639
):
637640
with self.subTest(value=value):
638641
self.assertFalse(fpc.is_valid_summary_heading(value))

0 commit comments

Comments
 (0)