Skip to content

fix(download): bind portal blob capture and cancellation to the Pack action - #112

Merged
lamemustafa merged 1 commit into
masterfrom
tapish-codex/blob-action-binding
Aug 1, 2026
Merged

fix(download): bind portal blob capture and cancellation to the Pack action#112
lamemustafa merged 1 commit into
masterfrom
tapish-codex/blob-action-binding

Conversation

@lamemustafa

@lamemustafa lamemustafa commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bind portal Blob safety-net cancellation to the exact captured Pack action, not every blob: download in the tab.
  • Derive the SHA-256 correlation value in extension context; the transient Blob URL is neither stored nor emitted in a safe signal.
  • Reject blobs above 25 MiB before MAIN-world arrayBuffer()/base64 serialization.

Root Cause / Decision Record

The old tab-plus-blob: predicate could cancel and erase an unrelated concurrent download. This is the smallest safe fix: hold same-tab Blob creations only in memory, derive the captured URL fingerprint in extension context, and act only on an exact match. Closes #97 and addresses the two portal-blob-shim.ts items in #101.

Scope

  • Runtime: MAIN-world blob capture result, GSTR-2B/GSTR-3B acquisition binding, and safety-net listener.
  • Tests: same-tab unrelated Blob preservation, exact-match cleanup, cancellation race, and pre-serialization oversize rejection.
  • Docs/governance: none.
  • Explicitly out of scope: live-portal QA, release/store copy, manifest permissions, hosts, telemetry, persistence.

Privacy And Data-Flow Impact

  • No new browser permissions or host permissions.
  • No new network calls, analytics, telemetry, ads, or session replay.
  • No credential, OTP, CAPTCHA, cookie, token, GST file, or taxpayer-data capture.
  • The transient Blob URL is immediately hashed in extension context and is not persisted, logged, uploaded, or included in safe signals.
  • No public copy or privacy-declaration change is needed.

Sensitive Surface Review

  • Current tab / portal target binding is intentionally narrowed to an exact captured Blob identity.
  • Download completion remains evidence-backed and fail-closed.
  • An unrelated/ambiguous delivery cannot be cancelled or erased.
  • No new service-worker persistence is introduced; candidates are transient and listener-scoped.
  • Real taxpayer data, local paths, raw URLs/referrers, and portal HTML are absent from the diff.

Chrome Web Store Impact

  • No permissions, hosts, Store listing scope, README, or privacy copy changes.
  • Full fiscal year remains source-build alpha and outside the V0 Store listing.
  • ZIP verification is local package evidence only, not Store submission or release evidence.
  • PR title follows Conventional Commits.

Verification

  • pnpm install --frozen-lockfile
  • dependency audit via node scripts/run-dependency-audit.mjs
  • pnpm exec wxt prepare
  • pnpm exec prettier --check .
  • pnpm exec eslint . --max-warnings 0
  • pnpm exec tsc --noEmit
  • pnpm exec vitest run — 210 files, 1,408 tests passed
  • pnpm exec wxt build
  • node scripts/verify-extension-package.mjs .output/chrome-mv3
  • pnpm exec wxt zip
  • node scripts/verify-extension-zip.mjs
  • Release provenance and Store dry-run: not applicable; this is not a release candidate.
  • git diff --check
  • pnpm review:gate ... --wait-head-review-ms 180000 --allow-missing-head-review: executed; no current-head Codex review was returned, recorded below as an audit gap.

Artifact Evidence

  • CI run: pending.
  • ZIP artifact: local generated verification only; not published.
  • ZIP SHA-256: 71f4d54a717cb6b4448e132ac5f9f7c4c1c9318599ba371dae8bf45afa5f322b.
  • Clean source/tag or head SHA: d1221f7c5fe164e7e1c67e7a7dd3c6decf697ec3.

PR Review Follow-Up

  • GitHub Actions completed: pending.
  • Required reviewer wait completed; no current-head Codex review was returned.
  • No inline review threads exist at this head.
  • Do not treat the missing review as merge approval; re-run the strict gate after CI/reviewer activity.
  • No follow-up PR is currently required.
Thread/comment Disposition Commit or evidence
Current-head Codex review audit gap pnpm review:gate waited 180 seconds and reported no review for d1221f7
Local security review fixed and re-reviewed Extension-side fingerprint derivation and cancel-race test
Local privacy review accepted No persistence, logging, upload, or sensitive data exposure found

Screenshots

Not applicable; behavior is background/MAIN-world contract only and tests use synthetic values.

DCO

  • The existing commit has no Signed-off-by trailer. This draft is not ready to merge until repository DCO requirements are resolved.

Pack Workflow Preflight

  • pnpm workflow:preflight was run before editing/push, or the skip reason is documented.
  • This PR was opened from a Pack branch, not master.
  • I checked latest master Pack AGENTS guidance or recorded the stale-guidance warning.
  • PR body keeps the required Pack privacy/review/verification checklist visible.

Sanchika Adoption Gate

  • If this PR consumes @sanchika/* packages or copied Sanchika guidance, I
    read sanchika/docs/adoption-pack.md in the coordinated parent worktree.
    Not applicable: this PR consumes no Sanchika packages or guidance.
  • If this PR consumes Sanchika, it links ComplyEaze and Axal completion evidence
    and records the Sanchika commit or copied guidance used. Not applicable.
  • This PR does not import ../sanchika, sanchika/packages/*/src, or parent
    source paths.

@lamemustafa
lamemustafa marked this pull request as ready for review August 1, 2026 08:27
@lamemustafa
lamemustafa merged commit 22ae918 into master Aug 1, 2026
12 of 13 checks passed
@lamemustafa
lamemustafa deleted the tapish-codex/blob-action-binding branch August 1, 2026 08:36

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1221f7c5f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +117 to +118
} finally {
await browser.downloads.erase({ id: item.id });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep completed portal downloads visible when cancellation fails

When the exact portal download completes before downloads.cancel() runs, cancellation rejects but this finally still erases its DownloadItem. Chrome's downloads.erase() removes only the browser-history entry, not the downloaded file, so a sensitive duplicate remains on disk while the record needed to locate and review it disappears; the listener's outer catch then suppresses the failure. Preserve the entry and route the cancellation failure to explicit review, or delete the confirmed file before erasing it.

AGENTS.md reference: AGENTS.md:L56-L59

Useful? React with 👍 / 👎.

reason: captured?.reason ?? "generation-timeout",
safeSignals: captured?.safeSignals ?? [],
};
await safetyNet.bind(captured.blobUrl);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bind the safety net before requiring shim success

When suppression is actually missed—for example, if portal code invokes a cached native anchor click—the onCreated listener queues the Blob download, but the shim never reaches signal() and eventually returns generation-timeout. Both acquisition functions return from their !captured.ok branch without reaching this binding call, then remove the listener, so the uncontrolled portal file continues downloading; binding only after success covers the case where the shim already suppressed the activation. Preserve the recorded Blob identity on this failure path and bind or route the candidate to review before returning.

AGENTS.md reference: AGENTS.md:L56-L59

Useful? React with 👍 / 👎.

expectedTarget?: { financialYear: string; period: string; returnType: string };
timeoutMs?: number;
};
const MAX_PORTAL_BLOB_BYTES = 25 * 1024 * 1024;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Derive the Blob size cap from the canonical validator

This new 25 MiB constant duplicates MAX_ARTIFACT_BYTES in src/connectors/gst/artifact-validation.ts. When either limit changes, the MAIN-world capture and canonical validation silently diverge: raising the validator limit still rejects otherwise accepted artifacts here, while lowering it permits unnecessary large serialization before rejection. Export the canonical limit and pass it through PortalBlobShimInput rather than maintaining a second numeric fact.

AGENTS.md reference: AGENTS.md:L41-L43

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(download): correlate Blob safety-net cancellation to its Pack action

1 participant