From 1e2cd31aefc5cd8425e44624a96095d40c917223 Mon Sep 17 00:00:00 2001 From: Md Nurnobi Date: Mon, 23 Nov 2026 19:35:53 +0000 Subject: [PATCH] ci(wf-01): Gitea-first trusted candidate gating [skip ci] Gitea CI #107 terminal 7/7 PASS at 89ba8a70; exact 4 file scope, security review and dedicated runners verified. No production changes. --- .gitea/workflows/datastack-ci.yml | 41 +++++++++++++++++++----- notes/002-PRODUCTION-UPDATE-ROADMAP.md | 12 +++++++ notes/003-PHASE-STATUS-LOG.md | 12 +++++++ notes/006-BASELINE-AND-PATCH-EVIDENCE.md | 12 +++++++ 4 files changed, 69 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/datastack-ci.yml b/.gitea/workflows/datastack-ci.yml index ccf1162..e4baf14 100644 --- a/.gitea/workflows/datastack-ci.yml +++ b/.gitea/workflows/datastack-ci.yml @@ -4,6 +4,13 @@ on: branches: [main] paths: - '.gitea/workflows/datastack-ci.yml' + # Base-owned PR workflow; never run fork-controlled code on self-hosted runners. + pull_request_target: + branches: [main] + types: [opened, reopened, synchronize] + paths-ignore: + - 'notes/**' + - '**/*.md' workflow_dispatch: inputs: p01_only: @@ -22,15 +29,21 @@ on: type: boolean default: false +# CI needs repository read only; it never publishes artifacts or edits remotes. +permissions: + contents: read + jobs: node-regression: - if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.quality_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true') }} + if: ${{ (github.event_name != 'pull_request_target' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.base.ref == 'main')) && (github.event_name != 'workflow_dispatch' || github.event.inputs.quality_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true')) }} runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v4 with: github-server-url: https://dev.ivib.cc + persist-credentials: false + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} - name: Install dependencies run: npm ci --no-audit --no-fund - name: Build Node SDK @@ -55,7 +68,7 @@ jobs: test "$failed" -eq 0 python-regression: - if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.p01_only != 'true' }} + if: ${{ (github.event_name != 'pull_request_target' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.base.ref == 'main')) && (github.event_name != 'workflow_dispatch' || github.event.inputs.p01_only != 'true') }} runs-on: ubuntu-latest container: node:22-bookworm-slim timeout-minutes: 20 @@ -68,6 +81,8 @@ jobs: - uses: actions/checkout@v4 with: github-server-url: https://dev.ivib.cc + persist-credentials: false + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} - name: CI-06 Python 3.11 isolated virtual environment run: | set -eu @@ -86,13 +101,15 @@ jobs: echo DATASTACK_PYTHON_14_OF_14_PASS quality: - if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true' }} + if: ${{ (github.event_name != 'pull_request_target' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.base.ref == 'main')) && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true') }} runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v4 with: github-server-url: https://dev.ivib.cc + persist-credentials: false + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} - name: Install dependencies run: npm ci --no-audit --no-fund - name: TypeScript type check @@ -101,13 +118,15 @@ jobs: run: npm run lint production-build: - if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.quality_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true') }} + if: ${{ (github.event_name != 'pull_request_target' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.base.ref == 'main')) && (github.event_name != 'workflow_dispatch' || github.event.inputs.quality_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true')) }} runs-on: ubuntu-latest timeout-minutes: 25 steps: - uses: actions/checkout@v4 with: github-server-url: https://dev.ivib.cc + persist-credentials: false + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} - name: Install dependencies run: npm ci --no-audit --no-fund - name: Next.js production build @@ -117,7 +136,7 @@ jobs: test -f .next/standalone/server.js docker-image-build: - if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.p01_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true') }} + if: ${{ (github.event_name != 'pull_request_target' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.base.ref == 'main')) && (github.event_name != 'workflow_dispatch' || github.event.inputs.p01_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true')) }} runs-on: ubuntu-latest container: node:22-alpine timeout-minutes: 45 @@ -132,6 +151,8 @@ jobs: - uses: actions/checkout@v4 with: github-server-url: https://dev.ivib.cc + persist-credentials: false + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} - name: CI-07 inspect daemon and validate Compose without starting services run: | set -eu @@ -155,13 +176,15 @@ jobs: echo DATASTACK_THREE_IMAGES_BUILD_PASS windows-compatibility: - if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.quality_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true') }} + if: ${{ (github.event_name != 'pull_request_target' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.base.ref == 'main')) && (github.event_name != 'workflow_dispatch' || github.event.inputs.quality_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true')) }} runs-on: windows-latest timeout-minutes: 25 steps: - uses: actions/checkout@v4 with: github-server-url: https://dev.ivib.cc + persist-credentials: false + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} - name: Verify native Windows toolchain shell: powershell run: | @@ -183,7 +206,7 @@ jobs: if ($LASTEXITCODE -ne 0) { throw 'SDK compilation failed' } security-audit: - if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.p01_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true') }} + if: ${{ (github.event_name != 'pull_request_target' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.base.ref == 'main')) && (github.event_name != 'workflow_dispatch' || github.event.inputs.p01_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true')) }} runs-on: ubuntu-latest container: node:22-alpine timeout-minutes: 15 @@ -193,6 +216,8 @@ jobs: - uses: actions/checkout@v4 with: github-server-url: https://dev.ivib.cc + persist-credentials: false + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} - name: CI-08 read-only full and runtime npm advisory inventory run: | set -eu @@ -230,4 +255,4 @@ jobs: } NODE git diff --exit-code -- package.json package-lock.json - echo DATASTACK_SECURITY_TRIAGE_INVENTORY_PASS + echo DATASTACK_SECURITY_TRIAGE_INVENTORY_PASS \ No newline at end of file diff --git a/notes/002-PRODUCTION-UPDATE-ROADMAP.md b/notes/002-PRODUCTION-UPDATE-ROADMAP.md index f55057c..2f34fd6 100644 --- a/notes/002-PRODUCTION-UPDATE-ROADMAP.md +++ b/notes/002-PRODUCTION-UPDATE-ROADMAP.md @@ -230,3 +230,15 @@ Next proposed P04-S07 (REQUIRES SEPARATE USER APPROVAL): isolated Windows File M P04-S06 forensic reachability/disposition COMPLETE but compatible security remediation BLOCKED: P04-S04's latest upstream parent contracts do not accept patched leaf majors, and no publisher-authenticated, vetted, API-compatible older-major backport with exact published integrity and verified regression evidence was established. No unverified override, package or lock patch, npm audit fix --force, app/SDK/test/CI/Docker/Compose/UI/DB/prod change. No new broad Gitea CI because no approved dependency candidate. Only approved notes/001–006 may be committed and mirrored; no deployment, migration, prune, tag, release. Production remains NO-GO; 20 runtime Moderate package entries unresolved. Do not claim full dynamic reachability verification, File Manager compatibility PASS, fixed advisories, or zero exposure. +## WF-01 — Gitea-first / PC backup-only (2026-11-23; candidate, CI pending) + +Approved baseline Gitea `d9d1c2f4b2b102599c687090ea56345d58e00d14`, tracked Git tree `98a7e07b1cbc8b6669ffc728b3d68a87f602bfa4` (420 entries); previous P04-S06 PR #10 closed, last accepted CI #92 7/7 PASS on earlier P04-S02 source. Exact WF-01 write allowlist: `.gitea/workflows/datastack-ci.yml`, `notes/002-PRODUCTION-UPDATE-ROADMAP.md`, `notes/003-PHASE-STATUS-LOG.md`, `notes/006-BASELINE-AND-PATCH-EVIDENCE.md`; all other tracked paths read-only. No P04-S07 application defect fix authorized in WF-01. + +Runner read-only preflight: Gitea CI #92 logged `coolify-linux-runner` on `ubuntu-latest` and `windows-rdp-runner` on `windows-latest`. An independent remote inventory found online RDP host `WIN-IK7N6SD2UBU`, `C:\gitea-runner\act_runner.exe` and running `act_runner.exe` (PID 6708), matching prior verified dedicated Windows runner identification rather than the user's personal PC. No runner config, service, label or location modified. Linux production-host isolation / Docker socket remains a separately documented operational risk; no cleanup or destructive daemon operation authorized. + +CI trigger design: retain manual `workflow_dispatch` and existing main-workflow-file push trigger; add `pull_request_target` for opened/reopened/synchronize targeting main with notes-only/Markdown-only filtering. The workflow is read from the trusted base branch; every heavy job is fail-closed unless `head.repo.full_name == github.repository` and PR base is main. Fork PR code is never checked out or executed on self-hosted runners by this workflow. Same-repo PR jobs explicitly checkout their head SHA with `persist-credentials: false`; GITEA_TOKEN permission reduced to `contents: read`. This is a trusted internal PR/candidate acceptance gate, not an authorization to execute arbitrary untrusted forks. Docs-only changes are manual review without redundant broad CI. No changes to the seven job scripts or existing tests/build behavior. + +Gitea API version reported `28.4.0` during preflight. `main` branch unprotected at baseline; branch protection is proposed only, not applied: require verified full CI and human approval before merge, disable unreviewed direct main writes after separately approved protection configuration. Existing unmerged WIP P02 PR #4 must not be merged. Personal PC stays fetch/pull backup-only; no local npm, Python, tests, Docker, builds, resets, cleans or packages. + +Candidate state: no acceptance PASS or mirror sync claimed yet. Next gate: one focused Gitea workflow dispatch on this exact candidate after remote runner safety confirmation, inspect terminal seven-job result and exact four-path patch, then squash once into Gitea main with `[skip ci]` to avoid duplicate full-CI trigger, sync GitHub/GitLab and compare 420 tracked objects. If acceptance fails or remote isolation becomes uncertain, STOP without main merge. Production NO-GO: Windows File Manager PUT 404, 20 runtime Moderate dependency entries and live acceptance remain unresolved. + diff --git a/notes/003-PHASE-STATUS-LOG.md b/notes/003-PHASE-STATUS-LOG.md index 7a7829c..e9943d7 100644 --- a/notes/003-PHASE-STATUS-LOG.md +++ b/notes/003-PHASE-STATUS-LOG.md @@ -252,3 +252,15 @@ Phase status: static baseline verified; disposable real clean npm ci PASS; depen P04-S06 forensic reachability/disposition COMPLETE but compatible security remediation BLOCKED: P04-S04's latest upstream parent contracts do not accept patched leaf majors, and no publisher-authenticated, vetted, API-compatible older-major backport with exact published integrity and verified regression evidence was established. No unverified override, package or lock patch, npm audit fix --force, app/SDK/test/CI/Docker/Compose/UI/DB/prod change. No new broad Gitea CI because no approved dependency candidate. Only approved notes/001–006 may be committed and mirrored; no deployment, migration, prune, tag, release. Production remains NO-GO; 20 runtime Moderate package entries unresolved. Do not claim full dynamic reachability verification, File Manager compatibility PASS, fixed advisories, or zero exposure. +## WF-01 — Gitea-first / PC backup-only (2026-11-23; candidate, CI pending) + +Approved baseline Gitea `d9d1c2f4b2b102599c687090ea56345d58e00d14`, tracked Git tree `98a7e07b1cbc8b6669ffc728b3d68a87f602bfa4` (420 entries); previous P04-S06 PR #10 closed, last accepted CI #92 7/7 PASS on earlier P04-S02 source. Exact WF-01 write allowlist: `.gitea/workflows/datastack-ci.yml`, `notes/002-PRODUCTION-UPDATE-ROADMAP.md`, `notes/003-PHASE-STATUS-LOG.md`, `notes/006-BASELINE-AND-PATCH-EVIDENCE.md`; all other tracked paths read-only. No P04-S07 application defect fix authorized in WF-01. + +Runner read-only preflight: Gitea CI #92 logged `coolify-linux-runner` on `ubuntu-latest` and `windows-rdp-runner` on `windows-latest`. An independent remote inventory found online RDP host `WIN-IK7N6SD2UBU`, `C:\gitea-runner\act_runner.exe` and running `act_runner.exe` (PID 6708), matching prior verified dedicated Windows runner identification rather than the user's personal PC. No runner config, service, label or location modified. Linux production-host isolation / Docker socket remains a separately documented operational risk; no cleanup or destructive daemon operation authorized. + +CI trigger design: retain manual `workflow_dispatch` and existing main-workflow-file push trigger; add `pull_request_target` for opened/reopened/synchronize targeting main with notes-only/Markdown-only filtering. The workflow is read from the trusted base branch; every heavy job is fail-closed unless `head.repo.full_name == github.repository` and PR base is main. Fork PR code is never checked out or executed on self-hosted runners by this workflow. Same-repo PR jobs explicitly checkout their head SHA with `persist-credentials: false`; GITEA_TOKEN permission reduced to `contents: read`. This is a trusted internal PR/candidate acceptance gate, not an authorization to execute arbitrary untrusted forks. Docs-only changes are manual review without redundant broad CI. No changes to the seven job scripts or existing tests/build behavior. + +Gitea API version reported `28.4.0` during preflight. `main` branch unprotected at baseline; branch protection is proposed only, not applied: require verified full CI and human approval before merge, disable unreviewed direct main writes after separately approved protection configuration. Existing unmerged WIP P02 PR #4 must not be merged. Personal PC stays fetch/pull backup-only; no local npm, Python, tests, Docker, builds, resets, cleans or packages. + +Candidate state: no acceptance PASS or mirror sync claimed yet. Next gate: one focused Gitea workflow dispatch on this exact candidate after remote runner safety confirmation, inspect terminal seven-job result and exact four-path patch, then squash once into Gitea main with `[skip ci]` to avoid duplicate full-CI trigger, sync GitHub/GitLab and compare 420 tracked objects. If acceptance fails or remote isolation becomes uncertain, STOP without main merge. Production NO-GO: Windows File Manager PUT 404, 20 runtime Moderate dependency entries and live acceptance remain unresolved. + diff --git a/notes/006-BASELINE-AND-PATCH-EVIDENCE.md b/notes/006-BASELINE-AND-PATCH-EVIDENCE.md index 660cf5c..e8fb7e2 100644 --- a/notes/006-BASELINE-AND-PATCH-EVIDENCE.md +++ b/notes/006-BASELINE-AND-PATCH-EVIDENCE.md @@ -403,3 +403,15 @@ Exact proof artifacts (kept only in authorized disposable TEMP, not committed): P04-S06 forensic reachability/disposition COMPLETE but compatible security remediation BLOCKED: P04-S04's latest upstream parent contracts do not accept patched leaf majors, and no publisher-authenticated, vetted, API-compatible older-major backport with exact published integrity and verified regression evidence was established. No unverified override, package or lock patch, npm audit fix --force, app/SDK/test/CI/Docker/Compose/UI/DB/prod change. No new broad Gitea CI because no approved dependency candidate. Only approved notes/001–006 may be committed and mirrored; no deployment, migration, prune, tag, release. Production remains NO-GO; 20 runtime Moderate package entries unresolved. Do not claim full dynamic reachability verification, File Manager compatibility PASS, fixed advisories, or zero exposure. +## WF-01 — Gitea-first / PC backup-only (2026-11-23; candidate, CI pending) + +Approved baseline Gitea `d9d1c2f4b2b102599c687090ea56345d58e00d14`, tracked Git tree `98a7e07b1cbc8b6669ffc728b3d68a87f602bfa4` (420 entries); previous P04-S06 PR #10 closed, last accepted CI #92 7/7 PASS on earlier P04-S02 source. Exact WF-01 write allowlist: `.gitea/workflows/datastack-ci.yml`, `notes/002-PRODUCTION-UPDATE-ROADMAP.md`, `notes/003-PHASE-STATUS-LOG.md`, `notes/006-BASELINE-AND-PATCH-EVIDENCE.md`; all other tracked paths read-only. No P04-S07 application defect fix authorized in WF-01. + +Runner read-only preflight: Gitea CI #92 logged `coolify-linux-runner` on `ubuntu-latest` and `windows-rdp-runner` on `windows-latest`. An independent remote inventory found online RDP host `WIN-IK7N6SD2UBU`, `C:\gitea-runner\act_runner.exe` and running `act_runner.exe` (PID 6708), matching prior verified dedicated Windows runner identification rather than the user's personal PC. No runner config, service, label or location modified. Linux production-host isolation / Docker socket remains a separately documented operational risk; no cleanup or destructive daemon operation authorized. + +CI trigger design: retain manual `workflow_dispatch` and existing main-workflow-file push trigger; add `pull_request_target` for opened/reopened/synchronize targeting main with notes-only/Markdown-only filtering. The workflow is read from the trusted base branch; every heavy job is fail-closed unless `head.repo.full_name == github.repository` and PR base is main. Fork PR code is never checked out or executed on self-hosted runners by this workflow. Same-repo PR jobs explicitly checkout their head SHA with `persist-credentials: false`; GITEA_TOKEN permission reduced to `contents: read`. This is a trusted internal PR/candidate acceptance gate, not an authorization to execute arbitrary untrusted forks. Docs-only changes are manual review without redundant broad CI. No changes to the seven job scripts or existing tests/build behavior. + +Gitea API version reported `28.4.0` during preflight. `main` branch unprotected at baseline; branch protection is proposed only, not applied: require verified full CI and human approval before merge, disable unreviewed direct main writes after separately approved protection configuration. Existing unmerged WIP P02 PR #4 must not be merged. Personal PC stays fetch/pull backup-only; no local npm, Python, tests, Docker, builds, resets, cleans or packages. + +Candidate state: no acceptance PASS or mirror sync claimed yet. Next gate: one focused Gitea workflow dispatch on this exact candidate after remote runner safety confirmation, inspect terminal seven-job result and exact four-path patch, then squash once into Gitea main with `[skip ci]` to avoid duplicate full-CI trigger, sync GitHub/GitLab and compare 420 tracked objects. If acceptance fails or remote isolation becomes uncertain, STOP without main merge. Production NO-GO: Windows File Manager PUT 404, 20 runtime Moderate dependency entries and live acceptance remain unresolved. +