diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 399a160..8aeab54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,6 +88,17 @@ jobs: - name: Verify responsive navigation, metadata layouts and accessibility run: node tests/browser/responsive.mjs + - name: Inspect isolated release review artifact + run: node scripts/inspect-release-artifact.mjs + + - name: Retain inspected release review artifact + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: release-review-${{ github.sha }} + path: .ts-build/release-review + if-no-files-found: error + retention-days: 7 + - name: Retain artifact browser diagnostics if: failure() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 diff --git a/CHANGELOG.md b/CHANGELOG.md index ad6b466..7e54d3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,43 @@ # Changelog -## Unreleased +## 2.3.0 — Release candidate, unpublished + +### Security and reliability + +- Bind CI artifacts to the source commit and canonical package version through + `/build-info.json`; live production equality remains a release-time gate. +- Pin all external GitHub Actions to reviewed full SHAs; prepare reviewed weekly + Actions/npm maintenance, whose default-branch activation is still pending. +- Require `%PDF-` at byte zero before original-source PDF parsing. Signature + admission is not a parser safety or resource-budget guarantee. +- Add root SECURITY.md, supported-version boundaries and verified GitHub private + vulnerability reporting. +- Deliver the reviewed HTTP CSP, no-referrer, Permissions-Policy and nosniff policy + in the isolated Pages artifact. Live delivery is not yet signed off. +- Add JS/TS CodeQL and exact lockfile/vendor advisory monitoring. Nested/native + dependency coverage remains incomplete; no-known-advisory results are bounded. +- Retain pdf-lib 1.17.1 and JSZip 3.10.1 following the maintenance assessment; + investigate a pdf-lib successor separately in v2.4, without an automatic upgrade. +- Exclude repository instructions, package manifests and build configs from the + public artifact root; retain license metadata and isolate Cloudflare CNAME removal. + +### UX + +- Compact mobile navigation, language and theme into a native disclosure, with + keyboard/Escape support and usable navigation without JavaScript. +- Reduce category-bar padding, keep one scrollable row and retain touch targets. +- Improve mobile workspace spacing, intended system-font inheritance and narrow + viewport fit without changing the brand or adding a component framework. +- Move both metadata scope cards after results on desktop/mobile, preserving all + supported-scope limitations. +- Theme native selects and supported desktop pickers while retaining mobile + platform pickers and existing form/accessibility behavior. + +Image OCR, PDF OCR/TXT and searchable PDF export are existing v2.2 capabilities, +not newly introduced v2.3 tools. Release notes are a candidate record, not +production GO, audit closure, release publication or deployment authorization. + +## Earlier development history ### Added diff --git a/README.md b/README.md index 3f5be16..685215a 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ See the [privacy model](./docs/privacy-model.md) for exact guarantees and bounda - [PDF Organizer](https://tools.securetools.app/pdf/organize/) — preview, reorder, rotate, remove, and export pages. - [PDF to Images](https://tools.securetools.app/pdf/to-images/) — render pages to PNG, JPEG, or WebP. - [PDF Metadata Inspector & Cleaner](https://tools.securetools.app/pdf/metadata/) — inspect and remove supported document-info fields. +- [PDF to Text OCR](https://tools.securetools.app/pdf/to-text/) — recognize selected pages locally and save text or a searchable PDF. ### Image @@ -32,10 +33,11 @@ See the [privacy model](./docs/privacy-model.md) for exact guarantees and bounda - [Image Resize](https://tools.securetools.app/image/resize/) — resize batches by pixels or percentage. - [Image Compressor](https://tools.securetools.app/image/compress/) — quality-compress images and compare byte results. - [Image Metadata Inspector & Cleaner](https://tools.securetools.app/image/metadata/) — inspect supported metadata and save a verified cleaned copy without pixel re-encoding. +- [Image to Text OCR](https://tools.securetools.app/image/to-text/) — recognize English/Korean text locally and save editable UTF-8 text. ### Privacy -The [Privacy hub](https://tools.securetools.app/privacy/) links to the specialized Image and PDF metadata tools. It is a cross-category navigation surface, not a generic sanitizer. Scan/OCR and Media remain planned. +The [Privacy hub](https://tools.securetools.app/privacy/) links to the specialized Image and PDF metadata tools. It is a cross-category navigation surface, not a generic sanitizer. The Scan & OCR category links to the existing OCR tools; document scanning and Media tools remain planned. Detailed formats, limits, and behavior are listed in [tool status](./docs/tool-status.md). diff --git a/docs/README.md b/docs/README.md index a7e6b91..e33a408 100644 --- a/docs/README.md +++ b/docs/README.md @@ -25,6 +25,10 @@ The root [README](../README.md) introduces Secure Tools. This directory owns det ## Release evidence +- [v2.3 release readiness](./v2.3-release-readiness.md) freezes feature scope, + inventories the integration delta and open findings, and separates candidate + artifact validation from the later [production verification gate](./v2.3-post-deploy-checklist.md). + - [v1.0.0 release QA](./release-qa.md) is a historical Sprint 11 release-candidate snapshot. Its unchecked items remain historical and are not current requirements. - [v2 promotion QA](./v2-release-qa.md) preserves the automated, manual Chrome, Orientation-regression, and promotion evidence for the v2.0.0 pre-release line. - The root [changelog](../CHANGELOG.md) records release and change history; it is not a technical specification. diff --git a/docs/v2.3-post-deploy-checklist.md b/docs/v2.3-post-deploy-checklist.md new file mode 100644 index 0000000..96c2352 --- /dev/null +++ b/docs/v2.3-post-deploy-checklist.md @@ -0,0 +1,135 @@ +# v2.3.0 production verification — later authorization required + +No step here authorizes merging to main, deploying, tagging or publishing. +Use a clean GitHub-hosted Ubuntu runner for authoritative HTTP/browser evidence; +local AdGuard rewriting must fail closed and must not change expected headers. + +## Before authorized promotion + +1. Review/merge the release-readiness PR into `v2.3` only with explicit permission. + Confirm package/lock root version `2.3.0`, frozen feature scope, no new blockers, + and green CI/security checks at the final integration SHA. +2. Open/review the dedicated `v2.3` to `main` release PR. Require separate explicit + merge authorization; never squash/rebase the preserved sprint history. +3. Record the actual resulting **main merge commit** as `RELEASE_SHA`. Do not use + the integration head or the PR's synthetic test merge as production identity. + The current workflow automatically deploys main pushes: authorization to + merge must explicitly account for this deployment trigger. + +## Artifact and deployment identity + +4. Verify main CI and `Deploy Cloudflare bridge` checkout/build source are + `RELEASE_SHA`, version `2.3.0`, Node 24, locked dependency inputs and prepared + asset hashes/licenses. Check the CI-generated record before upload: + + ```text + schemaVersion = 1 + commit = RELEASE_SHA (40 lowercase hex characters) + version = 2.3.0 + build.source = github-actions + ``` + + The reviewed candidate archive/digest identifies its own CI build only. A + later main build has a different source SHA and must be checked again. A ZIP + digest/source record is not a signed attestation or reproducibility proof. +5. Check isolated deployment output contains `_headers`, `_redirects`, license + metadata and the full expected site; no CNAME, test/debug/config/agent files, + TS source/maps, runtime CDN or injected telemetry. Root/generic CNAME must + remain `securetools.app`; strip only the isolated Cloudflare copy. +6. Record the successful deployment run, GitHub deployment, Cloudflare deployment + ID and **new immutable URL** from that run. Confirm the expected project, + canonical custom domain and disabled Web Analytics without changing settings + as part of verification. Never reuse an old immutable URL as release evidence. + +## F-05: live HTTP policy + +7. Check canonical `https://tools.securetools.app` and the new immutable origin on + `/`, `/pdf/merge/`, `/image/to-text/`, `/pdf/to-text/`, `/build-info.json`. + Use real HTTP responses without redirects/fallback HTML. The existing clean + browser smoke calls the shared strict `assertSecurityHeaders` validator. + Require on each document/JSON response: + + - CSP default/script/style/font sources restricted to self; `img-src 'self' + blob: data:`; `worker-src 'self'`; `connect-src 'none'`; `object-src 'none'`; + `frame-src 'none'`; `frame-ancestors 'none'`; `base-uri 'self'`; + `form-action 'self'`. + - `Referrer-Policy: no-referrer`. + - `Permissions-Policy: camera=(), microphone=(), geolocation=()`. + - `X-Content-Type-Options: nosniff`. + + Keep the already-reviewed narrow Tesseract entry-worker header-detach exception; + do not infer that document CSP may be relaxed. PDF.js retains strict policy. + Verify canonical indexing remains allowed and pages.dev aliases retain noindex. + +## F-06 / Issue #112: live provenance equality + +8. Check out `RELEASE_SHA`, then run on the clean runner with the actual immutable + URL (substitute the recorded values, never run literal angle-bracket labels): + + ```sh + node scripts/verify-build-provenance.mjs https://tools.securetools.app "$RELEASE_SHA" + node scripts/verify-build-provenance.mjs "$IMMUTABLE_ORIGIN" "$RELEASE_SHA" + node tests/deployment-smoke.mjs "$IMMUTABLE_ORIGIN" noindex + node tests/deployment-smoke.mjs https://tools.securetools.app indexable + ``` + + Confirm HTTP 200 JSON, strict schema, version `2.3.0`, source `github-actions`: + + ```text + main/release source SHA == CI build-info commit + == immutable build-info commit + == canonical production build-info commit + ``` + + Existing bounded alias retries allow propagation; do not accept stale bytes. + Only after equality and browser checks pass is #112 eligible for closure of + its compact-provenance scope. Full manifests/attestation/reproducible builds + were not implemented and must not be claimed. + +## Production browser gate + +9. Dispatch **Production smoke** at the reviewed main workflow with inputs: + `production_origin=https://tools.securetools.app`, `immutable_origin` equal to + the recorded new URL, and `source_commit=RELEASE_SHA`. Verify checkout uses the + same SHA. Do not dispatch it during preparation. +10. Require all existing production gates: canonical/immutable assets/locales, + strict headers/provenance, English/Korean OCR, exact TXT and searchable PDF + downloads, visible content preservation, cancellation/retry/replacement, + object URL cleanup, zero external requests/analytics, console/page errors or + CSP violations. Record the successful hosted summary; failures mean NO-GO. + +## F-02 / F-04: default-branch activation + +11. Confirm `.github/dependabot.yml` is now present on default branch main, with + Actions/npm weekly entries targeting `v2.3` and reviewed commit prefixes. + Confirm recognition through **Insights → Dependency graph → Dependabot** / + update-job configuration logs showing both ecosystems, or an available API + exposing equivalent recognized jobs. A source file alone is insufficient + evidence of recognition; do not require an immediate dependency PR. + If the token/API cannot expose this, record the specific missing evidence + and request maintainer UI evidence; do not broaden credentials silently. +12. Distinguish version-update configuration from Dependabot alerts/security + updates (observed disabled before promotion). Default-branch placement does + not itself enable these separate settings; no automatic merges or silent + setting changes are approved. Record the actual state and scoped limitation. +13. Confirm **Security monitoring** runs on the actual main SHA and succeeds for + CodeQL JS/TS upload plus exact lockfile/vendor advisories. Read the resulting + default-branch analysis, not only a PR status. Keep nested/native bundle, + unpublished-project and undisclosed-advisory limitations explicit. + +## Closure and remaining manual work + +14. Update #111/#113/#116/#117/#112 only to the extent supported by collected + activation/live evidence; verify implementation issues #114/#115/#128 and + release closing links. A merged implementation is not automatic audit closure. +15. Retain #126 as v2.4 work; keep JSZip deferred. Record physical iOS Safari and + Android Chrome pickers plus VoiceOver/TalkBack header/menu/select checks as + manual follow-up without blocking solely on device access. +16. Declare production GO only after the above gates pass. Tag/release publication + requires new explicit authorization after verification. Update SECURITY.md's + latest stable row when the GitHub release is actually published; do not + advertise an unpublished candidate as supported stable. + +References: [default-branch Dependabot placement](https://docs.github.com/en/code-security/concepts/supply-chain-security/about-the-dependabot-yml-file), +[target-branch/version versus security updates](https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference), +[artifact digests](https://docs.github.com/en/actions/tutorials/store-and-share-data). diff --git a/docs/v2.3-release-pr-draft.md b/docs/v2.3-release-pr-draft.md new file mode 100644 index 0000000..229ec5f --- /dev/null +++ b/docs/v2.3-release-pr-draft.md @@ -0,0 +1,55 @@ +# Staged release PR body — not yet submitted + +Open only after the release-readiness changes are reviewed and integrated and +final integration checks pass. Base `main`, head `v2.3`, title +`🚀[Deploy] Release v2.3.0`. Confirm no existing release PR before creating one. + +## Summary + +Prepare v2.3.0 security/reliability hardening and mobile UX improvements on the +existing v2.2 local-only tool baseline. No new document/media tools or dependency +upgrades are included. Image/PDF OCR and searchable PDF export already existed. + +## Security and reliability changes + +- Compact commit/version CI provenance; strict future canonical/immutable equality. +- Full-SHA Action pins and reviewed weekly maintenance configuration. +- Shared byte-zero PDF signature admission, retaining parser/resource limitations. +- SECURITY.md and private reporting route. +- Reviewed HTTP headers, preserving the existing narrow OCR worker exception. +- CodeQL JS/TS, exact lockfile/vendor/project advisories and unchanged release pins. +- Explicit dependency-maintenance decisions: keep pdf-lib/JSZip; scope v2.4 separately. +- Public artifact root allowlist, isolated CNAME removal and review artifact inspection. + +## UX changes + +Native mobile navigation disclosure, compact category scrolling, shared workspace +spacing, metadata limitations after results, corrected system-font/narrow fit, +and native select theming with mobile system pickers retained. Six locales, +keyboard, reduced motion, local-only processing and CSP remain supported. + +## Known release-time verification still required + +- Live HTTP header enforcement on canonical and new immutable deployment. +- `/build-info.json` equals the **actual main release source SHA**, version 2.3.0, + CI source marker and strict schema on both origins. +- Default-branch Dependabot configuration recognition and actual main CodeQL/ + advisory runs. Nested/native coverage remains incomplete; version-update + recognition does not silently enable separate Dependabot security settings. +- Clean hosted production smoke/browser verification; physical mobile/AT follow-up. + +## Test evidence + +Before submission, link the final approved hardening and integration CI runs, +security/CodeQL/advisory analysis, artifact inspection/digest, real OCR/download/ +cancellation evidence and 441-case responsive matrix. The hardening PR's review +description records candidate evidence; do not reuse old production signoff. +See [readiness record](./v2.3-release-readiness.md) and +[post-deploy checklist](./v2.3-post-deploy-checklist.md). + +## Release boundary + +This PR prepares production promotion. Merge/deployment/tagging require separate +explicit authorization. Main pushes currently trigger the deployment workflow; +review that consequence before authorizing the release merge. This is not +production GO or full audit closure. diff --git a/docs/v2.3-release-readiness.md b/docs/v2.3-release-readiness.md new file mode 100644 index 0000000..690ba22 --- /dev/null +++ b/docs/v2.3-release-readiness.md @@ -0,0 +1,210 @@ +# v2.3.0 release-readiness record + +## Snapshot and scope freeze — 2026-10-15 + +PR #129 was merged normally into `v2.3` at +`4e6adf734876db6f77e601c25c4e13a2c59fcd7f` after clean review/check preflight. +Its expected head was `f4a549cf72b62b8c1336c735ae61afd119d926be`, one commit, +39 files, no blocking review or unresolved thread. No dependency, parser or +production changes were introduced by that UX PR. + +Main remains `4b07f2962e524f4cfa5736de35e0f31ad52aaa15` / published `v2.2.0`. +Integration is **19 commits ahead, zero behind**, with 93 changed files, +2,416 additions and 240 deletions before this hardening proposal. The appendix +inventories the complete proposed release delta, including this PR. + +**Feature scope is frozen.** Only release blockers, regression/build/deployment +fixes, release documentation, required security hardening and production +verification support may enter. No scope exceptions are introduced here. + +## Version and concrete artifact findings + +`scripts/build-provenance.mjs` reads the canonical version from `package.json`. +Integration still reports **0.0.0**, not a release version. This branch proposes +`2.3.0` in package.json and the two root lockfile version fields; dependency +entries, resolved URLs, integrity values and vendored runtime bytes remain unchanged. + +Inspection also found root-page sibling copying published `.gitignore`, AGENTS, +README/changelog/security policy, npm manifests and TypeScript build configs in +dist. This proposal copies public root files explicitly, adds a strict artifact +root allowlist and an injection regression. It retains LICENSE and generic/root +CNAME ownership; only the existing isolated Cloudflare copy strips CNAME. + +The CI review artifact runs the **actual deployment preparation recipe** without +credentials/deployment and retains the resulting site plus inspection record for +seven days. Its GitHub artifact SHA-256 is archive integrity evidence, not a +reproducible-build claim. A PR's synthetic CI merge SHA is a candidate source; +the future main merge and deployment must be verified independently. + +## Open-item inventory + +GitHub snapshot after #129 merge: no open PRs. Open issues below include historical +body text that predates their integrated implementation; classification uses +merged commits, current source and verification, not stale body statuses. + +| Item | Classification | Reason / exit criterion | +| --- | --- | --- | +| Canonical integration version 0.0.0 | BLOCKER | This reviewed metadata proposal must reach v2.3 before a release PR is ready | +| Unexpected public root files | BLOCKER | Integrate the explicit build/validation fix and green candidate inspection | +| New hardening PR | BLOCKER | Separate review/merge authorization required; no direct integration commit or self-merge | +| #111 bootstrap/audit umbrella | RELEASE-VERIFY | Reconcile final findings with actual activation/live evidence; no blanket audit closure | +| #112 / F-06 provenance | RELEASE-VERIFY | Live main/CI/canonical/immutable SHA and version equality required | +| #113 / F-02 Action maintenance | RELEASE-VERIFY | SHA pins implemented; verify default-branch configuration recognition after promotion | +| #114 PDF admission | NOT-APPLICABLE | Required implementation integrated via #122 and regressions pass; not an outstanding blocker | +| #115 disclosure | NOT-APPLICABLE | SECURITY.md integrated via #124; private reporting verified; stable remains v2.2.0 until publication | +| #116 / F-04 monitoring | RELEASE-VERIFY | PR/integration checks exist; verify main analysis/automation; nested/native coverage remains partial | +| #117 / F-05 headers | RELEASE-VERIFY | Policy integrated via #123; live canonical/immutable responses and browser behavior required | +| #128 mobile UX | NOT-APPLICABLE | Integrated via #129 with 441-case clean CI; issue still open because closing linkage targets integration, not default main | +| #126 pdf-lib investigation | POST-RELEASE | Bounded v2.4 prototype only; no new blocker evidence identified | +| Physical iOS/Android + VoiceOver/TalkBack | POST-RELEASE | Browser matrix passes; record manual device/AT results when available | +| JSZip compatibility refresh | POST-RELEASE | DEFER decision retained; no version change or new supported input requirement | + +No known unpatched P0/Critical/High issue requiring action was identified in the +current exact-input advisory evidence. This does not establish comprehensive +coverage or vulnerability absence. No new dependency candidate was adopted. + +F-01 and F-03 are implemented. F-02/F-04/F-05/F-06 retain their explicit limits. +Live checks are release-time gates, not reasons by themselves to block preparation. + +## Toolchain and verification + +Local Node **24.16.0**, npm **11.13.0**; package engine `>=24`; CI uses Node 24. +Pinned TypeScript **7.0.2**, Playwright **1.63.0** and its packaged Chromium. +CI runner OS/browser/tool versions are recorded by the run; Ubuntu latest is a +moving image, not a pinned toolchain/reproducibility guarantee. + +Run pinned install, full tests/typecheck, security/release/Action/monitoring gates, +fresh npm/vendor/project advisories, production build/provenance/artifact/CNAME +inspection, real English/Korean/combined OCR, browser export/cancel gates and +441 responsive cases (seven sizes, seven routes, EN/KO/JA, three themes), plus +six-catalog structural/i18n and native no-JS navigation checks. + +The existing #129 baseline passed [full CI](https://github.com/SecureToolsProject/Secure_Tools/actions/runs/38734095743) +and [CodeQL/advisories](https://github.com/SecureToolsProject/Secure_Tools/actions/runs/38734095741). +Those are baseline evidence, not approval of changed release metadata/build code. +Final hardening CI and retained artifact/digest evidence belong in this PR's +review description. Local AdGuard rewrites headers/injects external scripts; +strict local failures must remain failures. Only clean hosted runs establish the +complete HTTP/CSP/browser security result; no gate is weakened. + +## Release decision and handoff + +**Current integration status: BLOCKED**, specifically by missing 2.3.0 metadata +and the artifact-root fix pending this hardening PR's review/merge. This PR may +have a fully green candidate while v2.3 still lacks the changes. Do not create +a misleading ready promotion PR from an incomplete integration branch. + +The [release PR draft](./v2.3-release-pr-draft.md) and +[exact post-deploy checklist](./v2.3-post-deploy-checklist.md) are prepared. +Once this PR is explicitly approved/merged and final integration CI passes, +reevaluate as `READY_FOR_RELEASE_PR_REVIEW` and open `v2.3` to `main`. +Creating that PR does not authorize its merge, main's push-triggered deployment, +tagging or release publication. No production operation occurs in this pass. + +## Complete proposed file inventory versus main + +Paths below are repository-relative. A = added, M = modified; no removals. + +- A: .github/codeql/config.yml +- A: .github/dependabot.yml +- M: .github/workflows/ci.yml +- M: .github/workflows/deploy-cloudflare-bridge.yml +- M: .github/workflows/production-smoke.yml +- A: .github/workflows/security-monitoring.yml +- M: 404.html +- M: AGENTS.md +- M: CHANGELOG.md +- M: README.md +- A: SECURITY.md +- M: about/index.html +- A: config/cloudflare/_headers +- A: config/security/vendor-dependencies.json +- A: config/security/vendor-release-pins.json +- M: css/base.css +- M: css/categories.css +- M: css/components.css +- M: docs/README.md +- M: docs/development-workflow.md +- M: docs/production-verification.md +- A: docs/v2.3-bootstrap.md +- A: docs/v2.3-dependency-maintenance-assessment.md +- A: docs/v2.3-mobile-ux.md +- A: docs/v2.3-post-deploy-checklist.md +- A: docs/v2.3-release-pr-draft.md +- A: docs/v2.3-release-readiness.md +- M: index.html +- M: js/locales/de.js +- M: js/locales/en.js +- M: js/locales/es.js +- M: js/locales/fr.js +- M: js/locales/ja.js +- M: js/locales/ko.js +- M: js/main.js +- A: js/navigation.js +- M: package-lock.json +- M: package.json +- M: privacy/index.html +- A: scripts/build-provenance.mjs +- M: scripts/build-site.mjs +- A: scripts/check-security-advisories.mjs +- A: scripts/http-security-headers.mjs +- A: scripts/inspect-release-artifact.mjs +- A: scripts/security-inventory.mjs +- A: scripts/validate-action-pins.mjs +- M: scripts/validate-branch-policy.mjs +- M: scripts/validate-build.mjs +- A: scripts/verify-build-provenance.mjs +- A: tests/action-pins.test.mjs +- M: tests/branch-policy.test.mjs +- A: tests/browser/responsive.mjs +- A: tests/build-provenance.test.mjs +- M: tests/ci-foundation.test.mjs +- M: tests/cloudflare-bridge.test.mjs +- M: tests/deployment-smoke.mjs +- M: tests/i18n-quality.test.mjs +- M: tests/pdf-metadata.test.mjs +- M: tests/pdf-ocr-foundation.test.mjs +- A: tests/pdf-signature.test.mjs +- M: tests/pdf-to-text.test.mjs +- A: tests/production/local-smoke.mjs +- M: tests/production/smoke.mjs +- A: tests/release-artifact.test.mjs +- M: tests/release-gate.test.mjs +- M: tests/release-hardening-http.test.mjs +- M: tests/run-all.mjs +- M: tests/searchable-pdf.test.mjs +- M: tests/security-hardening.test.mjs +- A: tests/security-monitoring.test.mjs +- M: tests/serve-ocr-smoke.mjs +- M: tests/typography-i18n-layout.test.mjs +- M: tools/image/compress/index.html +- M: tools/image/converter/index.html +- M: tools/image/index.html +- M: tools/image/metadata/index.html +- M: tools/image/metadata/tool.css +- M: tools/image/resize/index.html +- M: tools/image/to-text/index.html +- M: tools/media/index.html +- M: tools/pdf/images-to-pdf/index.html +- M: tools/pdf/index.html +- M: tools/pdf/merge/app.js +- M: tools/pdf/merge/index.html +- M: tools/pdf/metadata/app.js +- M: tools/pdf/metadata/index.html +- M: tools/pdf/metadata/pdf.js +- M: tools/pdf/metadata/tool.css +- M: tools/pdf/organize/app.js +- M: tools/pdf/organize/index.html +- M: tools/pdf/organize/pdf.js +- M: tools/pdf/split/app.js +- M: tools/pdf/split/index.html +- M: tools/pdf/to-images/app.js +- M: tools/pdf/to-images/index.html +- M: tools/pdf/to-text/index.html +- M: tools/scan/index.html +- M: tools/shared/pdf-ocr.ts +- M: tools/shared/pdf-renderer.js +- M: tools/shared/pdf.d.ts +- M: tools/shared/pdf.js +- M: tools/shared/searchable-pdf.ts +- M: tools/shared/tool.css diff --git a/package-lock.json b/package-lock.json index 81ccc27..cf7c553 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "secure-tools-web-utilities", - "version": "0.0.0", + "version": "2.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "secure-tools-web-utilities", - "version": "0.0.0", + "version": "2.3.0", "dependencies": { "@fontsource/noto-sans-kr": "5.3.0", "@pdf-lib/fontkit": "1.1.1", diff --git a/package.json b/package.json index c107991..0b01aed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "secure-tools-web-utilities", - "version": "0.0.0", + "version": "2.3.0", "private": true, "type": "module", "scripts": { diff --git a/scripts/build-site.mjs b/scripts/build-site.mjs index 1462174..f0c2fca 100644 --- a/scripts/build-site.mjs +++ b/scripts/build-site.mjs @@ -17,7 +17,7 @@ fs.mkdirSync(output, { recursive: true }); for (const directory of ["assets", "css", "js"]) { fs.cpSync(path.join(root, directory), path.join(output, directory), { recursive: true, - filter: (source) => !/\.(?:d\.ts|ts|tsx|map)$/.test(source), + filter: (source) => path.basename(source) !== ".gitkeep" && !/\.(?:d\.ts|ts|tsx|map)$/.test(source), }); } fs.cpSync(path.join(root, "tools", "shared"), path.join(output, "shared"), { @@ -33,6 +33,9 @@ for (const { source, route } of canonicalPages) { fs.copyFileSync(path.join(root, source), destination); const sourceDirectory = path.dirname(path.join(root, source)); + // The root page has no sibling tool assets. Copy its public files explicitly + // below rather than publishing package manifests, agent policy or build config. + if (sourceDirectory === root) continue; for (const entry of fs.readdirSync(sourceDirectory, { withFileTypes: true })) { if (entry.name === "index.html" || entry.isDirectory() || /\.(?:d\.ts|ts|tsx|map)$/.test(entry.name)) continue; fs.copyFileSync(path.join(sourceDirectory, entry.name), path.join(path.dirname(destination), entry.name)); @@ -47,7 +50,7 @@ for (const module of compiledBrowserModules) { fs.copyFileSync(source, destination); } -for (const file of ["404.html", "robots.txt", "sitemap.xml"]) { +for (const file of ["404.html", "robots.txt", "sitemap.xml", "LICENSE", "CNAME"]) { fs.copyFileSync(path.join(root, file), path.join(output, file)); } diff --git a/scripts/inspect-release-artifact.mjs b/scripts/inspect-release-artifact.mjs new file mode 100644 index 0000000..d5a26fc --- /dev/null +++ b/scripts/inspect-release-artifact.mjs @@ -0,0 +1,44 @@ +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import path from 'node:path'; +import { spawnSync } from 'node:child_process'; +import { canonicalVersion, validateBuildProvenance } from './build-provenance.mjs'; + +// Execute the deployed packaging recipe without credentials or any deployment. +const review = path.resolve('.ts-build/release-review'); +assert.equal(path.dirname(review),path.resolve('.ts-build')); +fs.rmSync(review,{recursive:true,force:true}); fs.mkdirSync(review,{recursive:true}); +const artifact = path.join(review,'site'); +const workflow = fs.readFileSync('.github/workflows/deploy-cloudflare-bridge.yml','utf8'); +const preparation = workflow.match(/- name: Prepare isolated bridge artifact[\s\S]*?run: \|\n([\s\S]*?)\n - name:/)?.[1]; +assert.ok(preparation,'Actual isolated deployment recipe must exist'); +const shell = process.platform === 'win32' ? path.join(process.env.ProgramFiles,'Git/bin/bash.exe') : 'bash'; +const target = process.platform === 'win32' ? artifact.replaceAll('\\','/').replace(/^([A-Za-z]):\//,(_,drive)=>`/${drive.toLowerCase()}/`) : artifact; +const result = spawnSync(shell,['-e','-o','pipefail','-c',preparation.replace(/^ /gm,'')],{env:{...process.env,BRIDGE_DIRECTORY:target},stdio:'inherit'}); +assert.equal(result.status,0,'Release review must pass actual deployment packaging'); +const info = validateBuildProvenance(artifact); +assert.match(canonicalVersion,/^[1-9]\d*\.\d+\.\d+$/,'Release version must be intentional, not placeholder 0.0.0'); +assert.equal(info.version,canonicalVersion); +assert.ok(!fs.existsSync(path.join(artifact,'CNAME'))); +assert.equal(fs.readFileSync('CNAME','utf8').trim(),'securetools.app'); +assert.equal(fs.readFileSync('dist/CNAME','utf8').trim(),'securetools.app'); +const files = []; +function visit(directory) { + for (const entry of fs.readdirSync(directory,{withFileTypes:true})) { + const file = path.join(directory,entry.name); + if (entry.isDirectory()) visit(file); + else files.push(path.relative(artifact,file).replaceAll('\\','/')); + } +} +visit(artifact); files.sort(); +for (const file of files) { + assert.doesNotMatch(file,/(^|\/)(?:node_modules|tests|scripts|\.git)(\/|$)|\.(?:ts|tsx|map)$/,'No test/build/debug files'); + if (file.endsWith('.html')) { + const html = fs.readFileSync(path.join(artifact,file),'utf8'); + assert.doesNotMatch(html,/]+src=["']https?:|]+rel=["']stylesheet["'][^>]+href=["']https?:/i,'No runtime CDN'); + assert.doesNotMatch(html,/static\.cloudflareinsights\.com|\/cdn-cgi\/rum|beacon\.min\.js/i,'No telemetry injection'); + } +} +const report = {provenance:info,fileCount:files.length,files,isolatedCnameAbsent:true,headersPresent:fs.existsSync(path.join(artifact,'_headers')),note:'Review candidate only; future main/deployment SHA must be verified separately. Not an attestation or reproducible-build proof.'}; +fs.writeFileSync(path.join(review,'inspection.json'),JSON.stringify(report,null,2)+'\n'); +console.log(JSON.stringify({...report,files:undefined},null,2)); diff --git a/scripts/validate-build.mjs b/scripts/validate-build.mjs index f6ee1e9..f5e4d67 100644 --- a/scripts/validate-build.mjs +++ b/scripts/validate-build.mjs @@ -12,6 +12,12 @@ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); const output = path.resolve(root, process.argv[2] || "dist"); validateBuildProvenance(output); validateHostingHeaders(output, { isolated: Boolean(process.argv[2]) }); +const expectedRootFiles = ["index.html", "404.html", "robots.txt", "sitemap.xml", "LICENSE", "_headers", "_redirects", "build-info.json", ...(process.argv[2] ? [] : ["CNAME"])]; +const expectedRootDirectories = new Set(["assets", "css", "js", "shared", ...canonicalPages.map(({route}) => route.split('/')[1]).filter(Boolean)]); +for (const entry of fs.readdirSync(output, { withFileTypes: true })) { + assert.ok(entry.isDirectory() ? expectedRootDirectories.has(entry.name) : expectedRootFiles.includes(entry.name), `Unexpected artifact root entry: ${entry.name}`); +} +for (const file of expectedRootFiles) assert.ok(fs.statSync(path.join(output, file)).isFile(), `Missing public root file: ${file}`); const htmlFiles = []; const outputFiles = []; @@ -27,6 +33,7 @@ function visit(directory) { } visit(output); +assert.ok(outputFiles.every(file => path.basename(file) !== ".gitkeep"), "Production output excludes repository scaffolding"); assert.equal(htmlFiles.length, canonicalPages.length, "build output canonical page count matches the route manifest"); for (const { route } of canonicalPages) { const target = route === "/" ? path.join(output, "index.html") : path.join(output, route.slice(1), "index.html"); diff --git a/tests/release-artifact.test.mjs b/tests/release-artifact.test.mjs new file mode 100644 index 0000000..42f9a1b --- /dev/null +++ b/tests/release-artifact.test.mjs @@ -0,0 +1,21 @@ +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import path from 'node:path'; +import { spawnSync } from 'node:child_process'; + +// cloudflare-bridge.test has just exercised the real build and isolated packaging. +for (const file of ['AGENTS.md','package.json','package-lock.json','tsconfig.json','tsconfig.build.json','.gitignore','README.md','CHANGELOG.md','SECURITY.md']) { + assert.ok(!fs.existsSync(path.join('dist',file)), `${file} is not a public root asset`); +} +assert.equal(fs.readFileSync('dist/CNAME','utf8').trim(),'securetools.app'); +assert.ok(fs.existsSync('dist/LICENSE')); +for (const file of ['assets/icons/.gitkeep','assets/images/.gitkeep']) assert.ok(!fs.existsSync(path.join('dist',file)), 'No repository scaffolding'); +const probe = path.resolve('dist','unexpected-release-file.txt'); +assert.equal(path.dirname(probe), path.resolve('dist')); +try { + fs.writeFileSync(probe,'synthetic artifact inventory regression'); + const result = spawnSync(process.execPath,['scripts/validate-build.mjs'],{encoding:'utf8'}); + assert.notEqual(result.status,0,'Unexpected output must fail artifact validation'); + assert.match(result.stderr,/Unexpected artifact root entry/); +} finally { fs.unlinkSync(probe); } +console.log('Release artifact root allowlist rejects accidental repository/config files; license and generic CNAME preserved.'); diff --git a/tests/run-all.mjs b/tests/run-all.mjs index e5034be..b95802f 100644 --- a/tests/run-all.mjs +++ b/tests/run-all.mjs @@ -60,6 +60,7 @@ for (const test of [ "tests/commit-message.test.mjs", "tests/build-provenance.test.mjs", "tests/cloudflare-bridge.test.mjs", + "tests/release-artifact.test.mjs", "tests/release-hardening-http.test.mjs", "tests/verify-browser-export-artifacts.mjs", ]) {