Personal Telegram developer console for GitHub

docs: record ingress hardening and concrete G0 acceptance path

Codex committed Oct 25, 2026 at 17:26 UTC cc7772db4608679f88f00232994fe46d297ba6d8
5 files changed +34 -4
PROJECT_MEMORY.md
+2 -1
@@ -1,6 +1,7 @@
1 # PROJECT_MEMORY.md
2
3 ## Latest implementation checkpoint — 2026-10-25
4 +- Follow-up code head `515333d224a5cd9133023a479512fa0a458f9f25`: C-30 token deletion/revocation warning (new/edited text/captions), no Telegram Paste/upload source input, durable one-use TOTP steps across distinct Approvals, validated own-environment Editor links. Full Node22 suite **390 passed**, zero failures/skips; lint zero errors/13 existing warnings, formatting/dry-run pass. Actual local workerd/SQLite full Phase1 + signed Approval against outbound stubs passed across restart; not real owner/provider evidence. See latest section of the hardening report. Wrong-TOTP attempt increments remain an explicitly recorded P2 follow-up.
5 - Owner requested continued implementation in this environment. Delivery branch remains `feat/studio-g0-foundation`, PR #65; main baseline remains `5d1c083d326db327cc3973a9d3adecc1d8092c91`.
6 - Code head `e02e9fb976f11167aa04a842f881dedb3e11a3ef`: bounded exact Diff, durable Automation claims/CAS, transactional Incident updates, active-runtime/SHA correlation and workflow tagging, metadata-only Telegram source views plus authenticated read-only Mini App file/Diff reading.
7 - Full local Node 22 suite: 353 pass, zero fail/skip/cancel; lint zero errors (13 existing warnings), formatting and Worker dry-run pass. Actual local workerd/SQLite concurrency/restart smoke and jsdom read-only rendering smoke pass.
@@ -11,7 +12,7 @@
12 - Name: Nexa Dev Bot
13 - Repository: `davoodmehraban89/nexa-dev-bot`
14 - Canonical branch: `main`
14 -- Visibility: private
15 +- Visibility: public (live API confirmed 2026-10-25; historical private/billing notes below are stale)
16 - Purpose: owner-only Telegram developer console for GitHub visibility and controlled developer operations.
17 - This file is the continuity source of truth; live repository/runtime evidence overrides stale text.
18
README.md
+3 -1
@@ -25,7 +25,9 @@ V2.1 شامل Workspace Editor، Ops Console، Security Center، Configuration C
25
26 ## Workspace Editor
27
28 -مرجع سقف‌های فعلی `WORKSPACE_EDITOR_LIMITS` در `src/core/workspace-policy.js` است: هر فایل حداکثر **۲۰٬۰۰۰ نویسهٔ Unicode و ۶۵٬۵۳۶ بایت UTF-8**، هر Change Set حداکثر **۸ فایل و ۱۳۱٬۰۷۲ بایت**. صفحهٔ Editor، API، پیام راهنما و ورودی فایل تلگرام از همین مرجع استفاده می‌کنند. محدودیت ۳٬۰۰۰/۱۲٬۰۰۰ در طرح‌های تاریخی Phase 1 دیگر مقدار جاری نیست.
28 +مرجع سقف‌های فعلی `WORKSPACE_EDITOR_LIMITS` در `src/core/workspace-policy.js` است: هر فایل حداکثر **۲۰٬۰۰۰ نویسهٔ Unicode و ۶۵٬۵۳۶ بایت UTF-8**، هر Change Set حداکثر **۸ فایل و ۱۳۱٬۰۷۲ بایت**. صفحهٔ Editor، API و پیام راهنما از همین مرجع استفاده می‌کنند. ورودی کد از Paste یا فایل تلگرام غیرفعال است؛ متن منبع فقط در Mini App احراز هویت‌شده ویرایش می‌شود. محدودیت ۳٬۰۰۰/۱۲٬۰۰۰ در طرح‌های تاریخی Phase 1 دیگر مقدار جاری نیست.
29 +
30 +لینک Editor در webhook به همان دامنهٔ Worker اشاره می‌کند. برای دامنهٔ سفارشی، `WORKSPACE_EDITOR_URL` را روی آدرس HTTPS با مسیر دقیق `/workspace/editor` قرار دهید؛ وجود نام کاربری، رمز، query یا fragment پیکربندی را نامعتبر و لینک‌ها را غیرفعال می‌کند. مقدار این متغیر عمومی است و نباید توکن داشته باشد.
31
32 قرارداد توسعهٔ Nexa Studio نسخهٔ ۳ در [docs/contract/NEXA_STUDIO_V3.md](docs/contract/NEXA_STUDIO_V3.md) و فایل Word اصلی کنار آن نگهداری می‌شود. برچسب محصول V2.1 مربوط به بات موجود است؛ نسخهٔ انتشار کد از `package.json` خوانده می‌شود و با شمارهٔ قرارداد یکی نیست.
33
docs/handoff/START_HERE.md
+1 -1
@@ -2,7 +2,7 @@
2
3 هدف این تحویل: کارهای عادی و محدود در یک چت دیگر انجام شود؛ تغییرهای حساس به امنیت و داده با بازبینی متمرکز انجام شوند. از نو ممیزی کامل یا بازنویسی پروژه شروع نکن.
4
5 -**تصمیم جدید مالک — ۲۰۲۶/۱۰/۲۵:** ادامهٔ پیاده‌سازی در همین محیط اجرایی انجام می‌شود. این راهنما فقط حافظهٔ ادامه است؛ تحویل دوبارهٔ پرامپت جای کار واقعی را نمی‌گیرد. آخرین تغییرات و محدودیت‌ها در [گزارش ادامهٔ G0](../roadmap/G0_HARDENING_2026_10_25.md) ثبت شده‌اند: ۳۵۳ تست محلی موفق، Diff محدود، claim پایدار Automation، Incident اتمیک، شواهد SHA نسخهٔ فعال و نمایش محتوا در Mini App.
5 +**تصمیم جدید مالک — ۲۰۲۶/۱۰/۲۵:** ادامهٔ پیاده‌سازی در همین محیط اجرایی انجام می‌شود. این راهنما فقط حافظهٔ ادامه است؛ تحویل دوبارهٔ پرامپت جای کار واقعی را نمی‌گیرد. آخرین تغییرات و محدودیت‌ها در [گزارش ادامهٔ G0](../roadmap/G0_HARDENING_2026_10_25.md) ثبت شده‌اند: ۳۹۰ تست محلی موفق، حذف ورودی کد تلگرام، رهگیری توکن پیام/ویرایش، مصرف پایدار یک‌بارهٔ TOTP و لینک Editor در محیط درست، همراه با اصلاحات Diff، Automation و Incident. آزمون کامل Phase1 با Approval امضاشده روی workerd/SQLite و سرویس‌های شبیه‌سازی‌شده موفق بود؛ شاهد دستگاه و ارائه‌دهندهٔ واقعی نیست.
6
7 ## منابع به ترتیب اعتبار
8 1. دستورهای مستقیم و جدید مالک؛ تغییر الزام‌های قرارداد باید به‌صورت مکتوب ثبت شود.
docs/roadmap/G0_HARDENING_2026_10_25.md
+18 -1
@@ -39,6 +39,23 @@ GitHub and Cloudflare exact-head results are linked in PR #65 after pushing the
39 - Very complex valid edits can be refused with `DIFF_COMPLEXITY_LIMIT` (Mini App HTTP 422 with a Persian next step). No approximate diff/counts or silent success is returned. Splitting changes may be necessary; editor content ceilings are unchanged.
40 - An interrupted automation effect leaves **step_unresolved** indefinitely. No expiring automatic claim/retry is allowed because a provider effect may already have happened. Cancellation/reset PUTs while unresolved return conflict instead of pretending the effect was revoked. Manual reconciliation is still needed; exactly-once external execution is not claimed.
41 - Runtime commit markers are authenticated Cloudflare metadata, not cryptographic source attestations. Untagged or ambiguous deployments remain unverified. A latest-list entry carrying only a non-SHA human tag may cause a conservative UNKNOWN until metadata is enriched.
42 -- The known outbound source-bearing fields are covered by sentinel regression tests. Legacy owner-initiated Telegram Paste/upload compatibility and arbitrary user-entered metadata still exist. Do not claim the full contract's source/token lifecycle or C-30 token interception is implemented; those need the remaining migration/security work.
42 +- The known outbound source-bearing fields are covered by sentinel regression tests. The follow-up below also disables Telegram Paste/upload input and implements C-30 interception. Arbitrary user-entered metadata and the later-gate credential/session lifecycle still prevent a claim of full R-07 compliance.
43 - R-26 still needs fresh owner-produced device/Approval/GitHub/Cloudflare evidence. No recording, owner click, human review or provider test commit was fabricated. Existing main/production revision has not been merged or deployed by this continuation.
44 - G0 acceptance and permission to cross into G1 remain pending the contract's evidence and written owner decision.
45 +
46 +## Next-step implementation on code head 515333d224a5cd9133023a479512fa0a458f9f25
47 +
48 +- `a4329e5`: fixed reuse of a TOTP across distinct destructive Approvals. The verifier returns its matching counter and the end of its full acceptance window; the bot validates the signed Approval, durably claims owner/counter, then consumes the action Approval. Concurrent requests, bot/DO recreation and storage outages are covered. No raw OTP/secret is stored, no namespace added and no unlock enabled. Five new expected failures were reproduced before correction.
49 +- `515333d`: token-prefixed owner text/captions, including edited messages, are intercepted before bot processing. Telegram deletion precedes a fixed Persian GitHub-revocation warning. Failures expose only deleted/warned metadata; deletion is best effort and a failed delete is explicitly disclosed. Existing durable webhook claims still precede all effects, so guard outage/crash limitations remain. Fourteen token-regression failures were observed before correction.
50 +- `515333d`: retired Paste/upload controls and handlers. Stale source callbacks do not arm input; existing source-input modes send pending metadata only and redirect to the authenticated Mini App without reading/downloading/storing the submitted body. Existing commit-message input remains. Nine migration regressions and three bot regressions were reproduced before correction; old upload-success tests now require rejection/redirection rather than silently retaining the removed feature.
51 +- `515333d`: corrected the hard-coded production editor link that prevented isolated acceptance. Webhooks default to their own Worker origin; `WORKSPACE_EDITOR_URL` explicitly overrides it after HTTPS/exact-path/no-credentials/query/fragment validation. Invalid explicit values disable links, and Ops configuration shows the validated URL. Three initial wiring failures plus the Ops display regression were reproduced before correction.
52 +
53 +Final integrated Node **22.23.4** verification: **390 tests passed; zero failed/cancelled/skipped/todo**. ESLint zero errors / 13 existing warnings; Prettier and Wrangler 4.152.0 dry-run pass. Two focused independent AI reviews found no blockers in ingress/source boundaries or TOTP/environment wiring.
54 +
55 +Actual local workerd/SQLite acceptance-path smoke passed on bundle SHA-256 `c5feb68ff196aba1dfb45568f18fa38b2fed9962055ac22d43ec50252b550493`: owner-authenticated Mini App GET/PUT → Diff → message → Ready → signed Approval → real GitHubService against local outbound stubs. Zero stub writes before approval; exactly four requests create one local branch-only commit. Local default branch unchanged. Duplicate updates and signed Approval replay were rejected before and after full runtime restart. Source sentinel absent from Telegram. **No real provider commit, deployment or owner-device evidence** was produced by this smoke.
56 +
57 +Independent review also identified an unchanged **P2** follow-up: wrong-TOTP attempt counts use read/increment/write and Approval callbacks reset attempts. Concurrent invalid submissions can lose increments. This does not bypass the owner boundary or new one-time-step claims; a separate owner/challenge-bound atomic attempt/rate-limit change is still needed. Do not describe the existing attempt counter as a complete brute-force defense.
58 +
59 +Read-only Cloudflare observation after these changes still showed deployment `0f5655b0-4ea8-4b46-8332-d8a21cdbfba9`, version `94d93413-e25e-4e27-8e83-7926125ce98f`, 100% traffic, created 2026-10-07. Main still `5d1c083d326db327cc3973a9d3adecc1d8092c91`. Fresh final-head CI/build links belong in PR65 without another self-recording commit.
60 +
61 +The remaining R-26 action is concrete: authorize an acceptance runtime for the candidate, perform one owner-confirmed Telegram Approval creating a harmless `nexa/edit-*` test commit, record Android/iOS evidence, reconcile GitHub/Cloudflare/Telegram identifiers, and supply written G0 acceptance. The current no-deploy-before-acceptance instruction in AGENTS.md requires an explicit narrow exception for that acceptance deployment; passing local/CI tests cannot supply it. Do not mislabel the G3 human security review as a G0 prerequisite.
docs/superpowers/plans/2026-10-25-g0-ingress-and-acceptance.md new
+10
@@ -0,0 +1,10 @@
1 +# G0 ingress and acceptance readiness
2 +
3 +Owner request: complete the next steps here; use the existing v3 contract and implementation without another approval/planning loop. This continuation addresses existing security and acceptance-path defects; it does not accept G0 or start G1.
4 +
5 +1. Telegram secrets: reproduce token processing before pending input, then intercept new/edited token-prefixed text/captions before bot dispatch. Delete the original and send a fixed Persian revocation warning. Retain owner checks, durable metadata-only update claims, and truthful deletion-failure handling.
6 +2. Telegram source ingress: reproduce Paste/upload source persistence and remove those controls/handlers. Stale callbacks and pending modes redirect to the authenticated Mini App without downloading or storing submitted source. Keep commit-message input and the existing editor API.
7 +3. TOTP replay: reproduce reuse across distinct destructive approvals. Match the TOTP time step, validate the signed approval, durably claim an owner/step marker until the entire acceptance window expires, then consume approval and dispatch. Reject reuse/storage outages before provider effects. Leave unsafe unlock disabled.
8 +4. Acceptance environment links: reproduce hard-coded production editor links. Wire a validated HTTPS editor URL through bot/plugin construction; webhook defaults derive from its own origin. Invalid explicit configuration disables editor links. Test default/custom origins and hostile URL fields without credentials.
9 +5. Verify focused RED/GREEN for each change, review sensitive boundaries, then run Node22 lint/format/full tests/dry-run once on the integrated tree. Run an actual local workerd/SQLite Phase1 + signed Approval smoke against local provider stubs, explicitly separate from real owner-device/provider evidence.
10 +6. Commit and push to existing draft PR65, preserve concurrent incoming changes, and verify GitHub plus Cloudflare checks on the exact final SHA. Record remaining R26/device/gate blockers; no main merge, real provider test commit, secret change or deployment in this continuation.