Skip to content

Commit f31d137

Browse files
author
CometAPI
committed
fix: reject composed release URL wrappers
1 parent 61aeb02 commit f31d137

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

scripts/_checks.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -683,17 +683,17 @@ def _canonical_actions_run_violations(
683683
findings: list[tuple[int, str]] = []
684684
normalized = unicodedata.normalize("NFKC", body)
685685
direct = normalized
686-
markdown_unescaped = re.sub(r"\\([/\\.:?&=%#])", r"\1", normalized)
687-
browser_normalized = re.sub(
688-
r"(?i)(https?://[^\s<>)\]]*)\\([^\s<>)\]]*)",
689-
lambda match: match.group(0).replace("\\", "/"),
690-
markdown_unescaped,
691-
)
692686
for _ in range(3):
693687
decoded = html.unescape(direct)
694688
if decoded == direct:
695689
break
696690
direct = decoded
691+
markdown_unescaped = re.sub(r"\\([/\\.:?&=%#])", r"\1", direct)
692+
browser_normalized = re.sub(
693+
r"(?i)(https?://[^\s<>)\]]*)\\([^\s<>)\]]*)",
694+
lambda match: match.group(0).replace("\\", "/"),
695+
markdown_unescaped,
696+
)
697697

698698
path_matches = list(_ACTIONS_PATH.finditer(direct))
699699
canonical_matches = list(_CANONICAL_ACTIONS_URL.finditer(direct))

tests/test_release_documents.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ def test_release_evidence_rejects_obsolete_workflow_reference_marker(
713713
"https://github.com/cometapi-dev/cometapi-python/actions&#x2F;runs&#x2F;30511373822",
714714
"https://github.com/cometapi-dev/cometapi-python/actions\\/runs\\/30511373822",
715715
"https://github.com/cometapi-dev/cometapi-python/actions\\runs\\30511373822",
716+
"https://github.com/cometapi-dev/cometapi-python&#92;actions&#92;runs&#92;30511373822",
716717
"https://github.com/cometapi-dev/cometapi-python/actions/runs/30511373822.evil",
717718
"https://github.com/cometapi-dev/cometapi-python/actions/runs/30511373822/attempts/0",
718719
],

0 commit comments

Comments
 (0)