Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Close mirrored workflow scalar syntax gaps
pulse-triage[bot]5b204cdc7545
diff --git a/scripts/check_workflow_trust.py b/scripts/check_workflow_trust.pyindex a332d5285e..3697353f3b 100644--- a/scripts/check_workflow_trust.py+++ b/scripts/check_workflow_trust.py@@ -40,6 +40,13 @@ WITH_RE = re.compile(rf"^(\s*)(?:-\s*)?{_yaml_key('with')}\s*:\s*(.*)$")RUN_RE = re.compile(rf"^(\s*)(?:-\s*)?{_yaml_key('run')}\s*:\s*(.*)$")ENV_RE = re.compile(rf"^(\s*)(?:-\s*)?{_yaml_key('env')}\s*:\s*$")ENV_ENTRY_RE = re.compile(r"^\s*([A-Za-z_][A-Za-z0-9_]*)\s*:\s*(.*?)\s*$")+SEQUENCE_ITEM_RE = re.compile(r"^\s*-(?:\s|$)")+# A block scalar may carry a chomping indicator, an explicit indentation+# indicator, and a trailing YAML comment. All of those forms still introduce+# source lines that need generated-program auditing.+BLOCK_SCALAR_HEADER_RE = re.compile(+ r"^[|>](?:(?:[1-9][+-]?)|(?:[+-][1-9]?))?(?:\s+#.*)?$"+)EXPRESSION_RE = re.compile(r"\$\{\{(.*?)\}\}")GITHUB_COMMAND_FILE_RE = re.compile(r"\bGITHUB_(?:ENV|OUTPUT|PATH|STATE)\b")SHELL_ASSIGNMENT_RE = re.compile(@@ -310,13 +317,13 @@ def _action_block(lines: list[str], uses_index: int) -> list[tuple[int, str]]:uses_indent = _indent(lines[uses_index])step_start = uses_indexstep_indent = uses_indent- if not lines[uses_index].lstrip().startswith("- "):+ if not SEQUENCE_ITEM_RE.match(lines[uses_index]):for index in range(uses_index - 1, -1, -1):line = lines[index]if (line.strip()and _indent(line) < uses_indent- and line.lstrip().startswith("- ")+ and SEQUENCE_ITEM_RE.match(line)):step_start = indexstep_indent = _indent(line)@@ -328,7 +335,7 @@ def _action_block(lines: list[str], uses_index: int) -> list[tuple[int, str]]:stripped = line.strip()if index != step_start and stripped and (_indent(line) < step_indent- or (_indent(line) == step_indent and stripped.startswith("- "))+ or (_indent(line) == step_indent and SEQUENCE_ITEM_RE.match(line))):breakblock.append((index, line))@@ -342,7 +349,7 @@ def _action_generated_code_lines(uses_indent = _indent(lines[uses_index])field_indent = (uses_indent + 2- if lines[uses_index].lstrip().startswith("- ")+ if SEQUENCE_ITEM_RE.match(lines[uses_index])else uses_indent)block = _action_block(lines, uses_index)@@ -357,7 +364,7 @@ def _action_generated_code_lines(if not with_match:continuewith_field_indent = len(with_match.group(1)) + (- 2 if code.lstrip().startswith("- ") else 0+ 2 if SEQUENCE_ITEM_RE.match(code) else 0)if with_field_indent != field_indent:continue@@ -375,7 +382,7 @@ def _action_generated_code_lines(if not input_match or len(input_match.group(1)) != input_indent:continuevalue = input_match.group(2).strip()- if value not in {"|", "|-", "|+", ">", ">-", ">+"}:+ if not BLOCK_SCALAR_HEADER_RE.fullmatch(value):generated_lines.append((input_index, input_match.group(2)))continuefor script_index in range(input_index + 1, with_end):@@ -431,7 +438,7 @@ def _run_script_lines(lines: list[str], run_index: int) -> list[tuple[int, str]]return []run_indent = len(match.group(1))value = match.group(2).strip()- if value not in {"|", "|-", "|+", ">", ">-", ">+"}:+ if not BLOCK_SCALAR_HEADER_RE.fullmatch(value):return [(run_index, match.group(2))]script: list[tuple[int, str]] = []@@ -557,7 +564,7 @@ def _step_env_bindings(lines: list[str], run_index: int) -> dict[str, str]:if (line.strip()and _indent(line) == field_indent - 2- and line.lstrip().startswith("- ")+ and SEQUENCE_ITEM_RE.match(line)):step_start = indexbreak@@ -568,7 +575,7 @@ def _step_env_bindings(lines: list[str], run_index: int) -> dict[str, str]:if (line.strip()and _indent(line) == field_indent - 2- and line.lstrip().startswith("- ")+ and SEQUENCE_ITEM_RE.match(line)):step_end = indexbreakdiff --git a/scripts/tests/test_workflow_trust.py b/scripts/tests/test_workflow_trust.pyindex 042f7a521f..969c7a0c10 100644--- a/scripts/tests/test_workflow_trust.py+++ b/scripts/tests/test_workflow_trust.py@@ -765,6 +765,9 @@ jobs:- run: |echo "${{ secrets.ACCESS_TOKEN }}"echo "${{ github.token }}"+ -+ run: |2- # explicit indentation remains generated shell source+ echo "${{ github.event.issue.title }}"- env:NAME: ${{ inputs.name }}TOKEN: ${{ github.token }}@@ -773,7 +776,7 @@ jobs:)self.assertEqual(sum("must enter run scripts through env" in finding for finding in findings),- 5,+ 6,)def test_rejects_template_data_in_executable_action_inputs(self) -> None:@@ -796,11 +799,16 @@ jobs:with:inlineScript: |Write-Output '${{{{ steps.prepare.outputs.command }}}}'+ -+ with:+ script: |2- # explicit indentation remains generated source+ const body = '${{{{ github.event.comment.body }}}}';+ uses: actions/github-script@{PIN}""")self.assertEqual(sum("executable action inputs" in finding for finding in findings),- 4,+ 5,)safe = self.audit(@@ -863,11 +871,15 @@ jobs:- run: |EVENT_TAG=$(jq -r '.release.tag_name' "$GITHUB_EVENT_PATH")echo "tag=$EVENT_TAG" >> "$GITHUB_OUTPUT"+ -+ env:+ BARE_RELEASE: ${{ inputs.bare_release }}+ run: echo "bare=$BARE_RELEASE" >> "$GITHUB_OUTPUT"""")self.assertEqual(sum("validated or encoded" in finding for finding in findings),- 4,+ 5,)def test_rejects_aliased_workflow_data_in_github_command_files(self) -> None: