Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
1446df5
security(ci): suppress automatic Docker build records in base-image.yml
mark-e-deyoung Oct 23, 2026
6d3ffa1
security(ci): suppress automatic Docker build records in nightly-soak…
mark-e-deyoung Oct 23, 2026
8542d58
security(ci): suppress automatic Docker build records in release.yml
mark-e-deyoung Oct 23, 2026
dba9304
security(ci): suppress automatic Docker build records in reusable-bui…
mark-e-deyoung Oct 23, 2026
879a3c0
test(ci): fail closed on future Docker build-record uploads
mark-e-deyoung Oct 23, 2026
37b321a
style(ci): normalize import-block spacing in artifact guard test
mark-e-deyoung Oct 23, 2026
4ac9b17
test(ci): support early no-dependency artifact policy gate
mark-e-deyoung Oct 23, 2026
0b10059
security(ci): enforce artifact publication policy in preflight lint
mark-e-deyoung Oct 23, 2026
d690e77
fix(test): permit guarded workflow header ending at jobs boundary
mark-e-deyoung Oct 23, 2026
cae00f9
qualification: combine exact asset repair with guarded CI artifacts
mark-e-deyoung Oct 23, 2026
4101c67
qualification: carry exact security reporter scripts/ci/sanitize-conf…
mark-e-deyoung Oct 23, 2026
5822a7c
qualification: carry exact security reporter tests/test_ci_public_con…
mark-e-deyoung Oct 23, 2026
1f79ace
qualification: use exact sanitized conformance upload workflow
mark-e-deyoung Oct 23, 2026
cfa2fc8
qualification: compose BuildKit upload control with sanitized release…
mark-e-deyoung Oct 23, 2026
9be121a
qualification: update public summary fixture and quiet output in one …
mark-e-deyoung Oct 23, 2026
54f9fcc
qualification: suppress pytest short summary leaks with -rN
mark-e-deyoung Oct 23, 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
5 changes: 5 additions & 0 deletions .github/workflows/base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ permissions:
packages: write
id-token: write

# Public-source security hold: BuildKit history may contain unreviewed build diagnostics.
# Retain normal job logs/explicit artifacts; suppress automatic .dockerbuild upload.
env:
DOCKER_BUILD_RECORD_UPLOAD: 'false'

defaults:
run:
shell: bash -euo pipefail {0}
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ jobs:
if [ -z "$TOKEN" ]; then
TOKEN=$(docker compose -f compose/docker-compose.yml exec -T winebot cat /winebot-shared/winebot_api_token 2>/dev/null || true)
fi
if [ -z "$TOKEN" ]; then
echo "Conformance token unavailable" >&2
exit 1
fi
echo "::add-mask::$TOKEN"
echo "token=$TOKEN" >> "$GITHUB_OUTPUT"
echo "API token read: ${TOKEN:0:8}..." >> "$GITHUB_STEP_SUMMARY"

- name: Run conformance tests
env:
Expand All @@ -109,14 +113,23 @@ jobs:
--api-url "$API_URL" \
--api-token "$API_TOKEN" \
--results-file conformance-results.json \
-v --tb=short
-v --tb=no --show-capture=no -rN

- name: Upload conformance results
- name: Project safe public conformance evidence
id: public-conformance-summary
if: always()
run: |
python3 winebot/scripts/ci/sanitize-conformance-results.py \
--input conformance-results.json \
--output conformance-summary-public.json

- name: Upload conformance results
if: ${{ always() && steps.public-conformance-summary.outcome == 'success' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: conformance-results
path: conformance-results.json
path: conformance-summary-public.json
if-no-files-found: error

- name: Stop services
if: always()
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/nightly-soak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
permissions:
contents: read

# Public-source security hold: BuildKit history may contain unreviewed build diagnostics.
# Retain normal job logs/explicit artifacts; suppress automatic .dockerbuild upload.
env:
DOCKER_BUILD_RECORD_UPLOAD: 'false'

defaults:
run:
shell: bash -euo pipefail {0}
Expand Down
25 changes: 22 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
permissions:
contents: read

# Public-source security hold: BuildKit history may contain unreviewed build diagnostics.
# Retain normal job logs/explicit artifacts; suppress automatic .dockerbuild upload.
env:
DOCKER_BUILD_RECORD_UPLOAD: 'false'

defaults:
run:
shell: bash -euo pipefail {0}
Expand Down Expand Up @@ -140,6 +145,11 @@ jobs:
if [ -z "$TOKEN" ]; then
TOKEN=$(docker compose -f compose/docker-compose.yml exec -T winebot cat /winebot-shared/winebot_api_token 2>/dev/null || true)
fi
if [ -z "$TOKEN" ]; then
echo "Conformance token unavailable" >&2
exit 1
fi
echo "::add-mask::$TOKEN"
echo "token=$TOKEN" >> "$GITHUB_OUTPUT"

- name: Run conformance tests
Expand All @@ -151,14 +161,23 @@ jobs:
--api-url "$API_URL" \
--api-token "$API_TOKEN" \
--results-file conformance-results.json \
-v --tb=short
-v --tb=no --show-capture=no -rN

- name: Upload conformance results
- name: Project safe public conformance evidence
id: public-conformance-summary
if: always()
run: |
python3 winebot/scripts/ci/sanitize-conformance-results.py \
--input conformance-results.json \
--output conformance-summary-public.json

- name: Upload conformance results
if: ${{ always() && steps.public-conformance-summary.outcome == 'success' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: conformance-results-release
path: conformance-results.json
path: conformance-summary-public.json
if-no-files-found: error

- name: Fail on conformance failure
if: failure()
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/reusable-build-smoke-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ on:
permissions:
contents: read

# Public-source security hold: BuildKit history may contain unreviewed build diagnostics.
# Retain normal job logs/explicit artifacts; suppress automatic .dockerbuild upload.
env:
DOCKER_BUILD_RECORD_UPLOAD: 'false'

defaults:
run:
shell: bash -euo pipefail {0}
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ RUN bash /download_tool.sh "Python" \
&& find /opt/winebot/windows-tools -name "*.txt" -delete

FROM tool-base AS builder-winspy
# WinInspect v0.4.0 - UIA-enabled window inspection tool
# Replaces original strobejb/winspy v1.8.4 (no UIA support, 2022 vintage)
# WinInspect v0.4.4 - immutable portable release fixture (release asset SHA-256).
# Preserve checksum verification fail-closed; package promotion is independent.
RUN bash /download_tool.sh "WinInspect" \
"https://github.com/SemperSupra/WinInspect/releases/download/v0.4.0/WinInspectPortable-v0.4.0.zip" \
"83b64999fef9ab01d749ab94193899e3915774d217900ac80c3c34021ff3e416" \
"https://github.com/SemperSupra/WinInspect/releases/download/v0.4.4/WinInspectPortable-v0.4.4.zip" \
"6ac0a65f774ffe69672f1c459254931ebfddb1e52c9fbec14b5db1348ccaad04" \
"/opt/winebot/windows-tools/WinSpy" \
&& find /opt/winebot/windows-tools -name "*.txt" -delete

Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ else
echo "Warning: shellcheck not found, skipping shell script linting."
fi

# Independent, dependency-free check before any Dockerfile-dependent unit-image build.
python3 tests/test_ci_dockerbuild_artifact_policy.py
python3 scripts/ci/verify-capability-matrix.py
python3 scripts/ci/generate-python-sbom.py --output artifacts/ci/python-sbom.cdx.json
python3 scripts/ci/validate-sbom.py --input artifacts/ci/python-sbom.cdx.json
Expand Down
83 changes: 83 additions & 0 deletions scripts/ci/sanitize-conformance-results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env python3
"""Project raw conformance results into a minimal public evidence artifact.

The underlying report may contain runtime responses, host identity, credentials,
or user-facing window titles. Never copy its free-form fields to a public artifact.
"""

from __future__ import annotations

import argparse
import json
import re
from pathlib import Path

MAX_RAW_BYTES = 1_048_576
COUNT_FIELDS = ("total", "passed", "failed", "skipped", "xfailed", "xpassed", "errors")
SAFE_TEST_ID = re.compile(
r"(?:(?:contracts/)?tests/conformance/)?test_[A-Za-z0-9_]+\.py"
r"(?:::\w+)*::test_[A-Za-z0-9_]+"
)


def project_public_result(raw: object) -> dict:
"""Build output solely from validated, bounded, allowlisted fields."""
if not isinstance(raw, dict) or not isinstance(raw.get("summary"), dict):
raise ValueError("missing or invalid conformance summary")

summary = raw["summary"]
counts = {}
for key in COUNT_FIELDS:
value = summary.get(key)
if type(value) is not int or value < 0:
raise ValueError("invalid conformance count")
counts[key] = value
if sum(counts[k] for k in COUNT_FIELDS if k != "total") != counts["total"]:
raise ValueError("inconsistent conformance counts")

failures = raw.get("failures")
if not isinstance(failures, list) or len(failures) != counts["failed"]:
raise ValueError("inconsistent failure inventory")

tests = []
for item in failures:
if not isinstance(item, dict):
raise ValueError("invalid failure entry")
name = item.get("test")
safe_name = (
name
if isinstance(name, str) and len(name) <= 200 and SAFE_TEST_ID.fullmatch(name)
else "redacted"
)
tests.append({"test_id": safe_name})

return {
"schema": "winebot.public-conformance.v1",
"summary": counts,
"failed_tests": tests,
"note": "Raw failure payloads and environment details remain job-local.",
}


def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--input", type=Path, required=True)
parser.add_argument("--output", type=Path, required=True)
args = parser.parse_args()

if not args.input.is_file() or args.input.stat().st_size > MAX_RAW_BYTES:
raise SystemExit("Conformance source unavailable or exceeds the public projection limit")
try:
original = json.loads(args.input.read_text(encoding="utf-8"))
public = project_public_result(original)
except (ValueError, UnicodeError, OSError):
raise SystemExit("Conformance report cannot be safely projected") from None

args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(json.dumps(public, indent=2, sort_keys=True) + "\n", encoding="utf-8")
print("Public conformance report projected without raw failure/environment fields")
return 0


if __name__ == "__main__":
raise SystemExit(main())
54 changes: 54 additions & 0 deletions tests/test_ci_dockerbuild_artifact_policy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Fail closed on automatic Docker BuildKit record publication from public CI."""

from __future__ import annotations

import re
from pathlib import Path

WORKFLOW_DIR = Path(__file__).resolve().parents[1] / ".github" / "workflows"
BUILD_ACTION = "uses: docker/build-push-action@"
WORKFLOW_GUARD = "\nenv:\n DOCKER_BUILD_RECORD_UPLOAD: 'false'\n"
DECLARATION = re.compile(r"(?m)^\s*DOCKER_BUILD_RECORD_UPLOAD:\s*(.*?)\s*$")


def _has_fail_closed_record_policy(source: str) -> bool:
header, boundary, _ = source.partition("\njobs:\n")
if not boundary:
return False
return WORKFLOW_GUARD in (header + "\n") and DECLARATION.findall(source) == ["'false'"]


def test_public_build_workflows_disable_automatic_build_record_upload() -> None:
workflows = sorted(WORKFLOW_DIR.glob("*.yml"))
build_workflows = [p for p in workflows if BUILD_ACTION in p.read_text(encoding="utf-8")]
assert build_workflows, "No Docker build workflows found; re-evaluate policy scope"
missing = [
p.name
for p in build_workflows
if not _has_fail_closed_record_policy(p.read_text(encoding="utf-8"))
]
assert not missing, f"Automatic unreviewed .dockerbuild publication enabled: {missing}"


def test_record_policy_fails_closed_on_missing_or_overridden_guard() -> None:
protected = (
"name: Build\n"
"env:\n"
" DOCKER_BUILD_RECORD_UPLOAD: 'false'\n"
"jobs:\n"
" build:\n"
" steps:\n"
" - uses: docker/build-push-action@v6\n"
)
assert _has_fail_closed_record_policy(protected)
assert not _has_fail_closed_record_policy(protected.replace("env:\n", "not-env:\n"))
assert not _has_fail_closed_record_policy(
protected.replace("'false'\n", "'true'\n")
)
assert not _has_fail_closed_record_policy(
protected + " - env:\n DOCKER_BUILD_RECORD_UPLOAD: 'true'\n"
)

if __name__ == "__main__":
test_public_build_workflows_disable_automatic_build_record_upload()
test_record_policy_fails_closed_on_missing_or_overridden_guard()
Loading
Loading