Skip to content

refactor(apps): route the papyrus and pptx_maker archive downloads through asset_downloader - #21683

Merged
chenmingwei23 merged 1 commit into
mainfrom
fix/10018-route-archive-downloads
Oct 20, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
fix/10018-route-archive-downloads

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The Papyrus (Tectonic) and PPTX Maker (engine) installs fetch their pinned archives through the shared asset_downloader.download_to, so one piece of code decides whether downloaded bytes are verified before anything uses them.

Both app installers still carry their own copy of the transfer: their own opener, their own redirect handler, their own stream-and-hash loop and their own error wording. The embedding model and feature videos already use asset_downloader.download_to (#9972). Issue #10018 asks for the last two.

Why it matters

"Did we verify this before installing it?" has one answer only if one function answers it. With three copies, a fix to one (redaction, redirect policy, a size bound, a staging-file check) has to be repeated by hand in the others, and the copies already drifted: the app copies wrote the archive straight to its final name, while the shared one stages it, opens it without following links, and renames it only after the digest matches.

Not a goal

  • stt/models.py and platform/wheel_engine.py. The issue body lists them as other private downloaders, but its "done" criteria name only these two app call sites. wheel_engine.py also has an open PR (feat(session): bound owner-session recursion with lineage quotas #21132) touching it.
  • Changing what either app fetches, its pin, its retry policy or its archive-shape checks.
  • The memory.embed_model_url config knob from the issue thread; the comment there says it belongs in its own change.

What changed (motivation → approach → change)

Papyrus _download_to and PPTX Maker download_archive now call asset_downloader.download_to with their existing sha256 pin, timeout and chunk size. PPTX Maker passes its size floor as min_bytes; Papyrus passes its progress and "verifying" callbacks. The archive lands at its path only after the digest matches, so extraction still never sees unverified bytes.

Both pass allow_cross_host_redirects=True. Their pinned GitHub URLs redirect to another GitHub host, and their old handlers already allowed any https hop. The docstrings in src/kiro_crew/asset_downloader.py now name a source constant as the second shape that option is for, next to an operator's environment override. No code there changes.

Deleted: both private redirect handlers and both private redact_url copies; their tests now call asset_downloader.redact_url. Two security_posture allowlist entries go with them, because neither module calls a redactor any more.

Download error text now reads Tectonic <asset>: HTTPS download failed: <Type> from <host> and REFUSING the engine archive for <commit>: <reason>. Nothing was extracted, built or run. Archive-shape refusals (archive rejected: …, engine archive rejected: …) are unchanged.

Backwards compatibility

Compatible: same URLs, same pins, same redirect policy, same archive checks. Only the wording of a download failure changes, and nothing parses it.

Reader: src/kiro_crew/apps/builtins/pptx_maker/backend/engine_source.py:_HttpsOnlyRedirectHandler -- app -- removed; its only reader was test_a_non_https_redirect_is_refused, replaced by test_redirects_may_change_host_but_never_leave_https against the shared handler
Reader: src/kiro_crew/apps/builtins/papyrus/backend/tectonic.py:_HttpsOnlyRedirectHandler -- app -- removed; no reader outside the module on origin/main
Reader: src/kiro_crew/apps/builtins//backend/:redact_url -- app -- removed; no reader under src/, website/ or scripts/ on origin/main. Its only readers were six test lines, which now call asset_downloader.redact_url (same host+port output) with the same assertions
Reader: src/kiro_crew/security_posture.py:NON_EGRESS_REDACTION_MODULES -- release -- two entries removed; test_allowlist_has_no_stale_entries requires it, and test_every_redactor_call_site_is_a_registered_sink_or_allowlisted still passes
Reader: "implausibly small" (pptx download message) -- app -- now "downloaded file too small"; read only by test_a_truncated_transfer_is_refused_even_if_it_hashed, updated

Tests

  • test/test_papyrus_tectonic.py and test/test_pptx_maker_engine_source.py, new:
    • a sha256 mismatch is refused BEFORE extraction (the extractor is a spy and is never called);
    • a corrupt archive whose digest matches its pin is still refused with the same message (Papyrus: tar.gz and zip; PPTX Maker: tar.gz), through the real download path with only the socket mocked;
    • each app calls asset_downloader.download_to with its pin and allow_cross_host_redirects=True;
    • PPTX Maker's opener carries the shared https-only redirect handler, which refuses an http:// hop.
  • test/test_asset_downloader.py, new: download_to's returned reason, which both apps put on the dashboard, carries the exception type and host but no credential from the url, for InvalidURL and HTTPError (userinfo, path token and signed query all checked).
  • Existing download tests now mock urllib.request directly instead of reaching it through the app module. The credential-redaction tests (InvalidURL, OSError, TimeoutError, ValueError with a secret in the url) pass unchanged against the shared path.
  • Determinism: the new tests passed 20 repeats in a row. The two app test files passed under three shuffled orders (seeds 1, 2, 3: 208 passed, 1 skipped each), and test_asset_downloader.py under two (seeds 1, 2: 61 passed each). They use no sleeps, clocks or network.
  • Local gates: run_scoped_tests.py --surface backend (36 related files, 3893 passed), test_flake_pattern_ratchet.py, isort, flake8, mypy on the four changed modules, the black ratchet, comment-history, docs-lint, and the repo semgrep rules on the diff.

Manual verification

N/A — unit coverage sufficient: the change swaps the transfer under two callers, and every branch (success, mismatch, too small, transport error, corrupt archive) runs through the real shared function with only the socket mocked. No real download was made.

Related Issues

Closes #10018

Follow-up: #22230 moves stt/models.py and platform/wheel_engine_transfer.py onto the same shared downloader.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security_posture.py

  • @iamwhatever posted a complete reasoning template for a15b0b4.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision a15b0b4cc8a3c763178eae6d3c843cde87731c89 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of a15b0b4cc8a3c763178eae6d3c843cde87731c89 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Before merge, check one thing: tectonic.py has left the egress-sink registry, but its dashboard-bound reason now comes from asset_downloader.py, which is still filed as non-egress.

What this change ships

Inventory (8 items) — 8 justified

Intent: let one function decide whether the Papyrus and PPTX Maker install archives are verified before anything uses them. This is a refactor that consolidates code (closes #10018).

  1. Papyrus's Tectonic install fetches through asset_downloader.download_to, so the archive is staged and renamed onto its path only after the digest matches — justified
  2. PPTX Maker's engine install fetches through the same shared function, with its size floor passed as min_bytes — justified
  3. The download-failure text on the install banner and in the provision log has new wording — justified
  4. The allow_cross_host_redirects docs now name a second permitted URL shape, a URL written into the source as a constant — justified
  5. Both private https-only redirect handlers are deleted — justified
  6. Both private redact_url copies are deleted, and their tests now call the shared one — justified
  7. Two security_posture registry entries are removed: tectonic.py (sink) and engine_source.py (non-egress) — justified
  8. The Papyrus and PPTX Maker specs now describe the shared transfer, and the Papyrus spec's redaction wording is corrected to scheme+host — justified

[FIRST-PRINCIPLES-REVIEWED] a15b0b4

Description read

[DESCRIPTION-READ] 642ad339d850844676db3d8d881242761ae9816b2d775eb339c619bcaa163fcd

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of a15b0b4cc8a3c763178eae6d3c843cde87731c89 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify that the shared opener's TLS context (CA-discovery fallback) and its default DEFAULT_MAX_BYTES ceiling suit both apps' real GitHub downloads; no live download was run.

[DESIGN-REVIEWED] a15b0b4

Description read

[DESCRIPTION-READ] b792d5f6fd348107f392626cf1f917e0302f44e13ab53b262b9ee3427705d110

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed a15b0b4cc8a3c763178eae6d3c843cde87731c89 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] a15b0b4

Verdict parsed from the review's SHA-scoped output markers for commit a15b0b4cc8a3c763178eae6d3c843cde87731c89.

False positive or not applicable? A repository writer can comment:
/ai-review override fable a15b0b4cc8a3c763178eae6d3c843cde87731c89: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of a15b0b4cc8a3c763178eae6d3c843cde87731c89 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] a15b0b4

False positive or not applicable? A repository writer can comment:
/ai-review override gpt a15b0b4cc8a3c763178eae6d3c843cde87731c89: <one-sentence reason>

@iamwhatever
iamwhatever force-pushed the fix/10018-route-archive-downloads branch from 3c692d3 to 59083aa Compare October 17, 2026 19:53
@iamwhatever

iamwhatever commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: per-app redact_url names bound to asset_downloader.redact_url

  • span=04782bf10c6e Both redact_url aliases have zero production consumers

fixed in 59083aa: both aliases are deleted from tectonic.py and engine_source.py.
No reader exists under src/, website/src or scripts/ (git grep for tectonic.redact_url / engine_source.redact_url returns nothing).
The six test lines that used them now call asset_downloader.redact_url, the function the aliases pointed at; assertions unchanged.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 59083aa
  • What rule changed: src/kiro_crew/security_posture.py NON_EGRESS_REDACTION_MODULES drops two entries, apps/builtins/papyrus/backend/tectonic.py and apps/builtins/pptx_maker/backend/engine_source.py, and the asset_downloader.py entry's comment now says its returned error string reaches these apps' install state. No sink, pattern or family changes.
  • Before -> after (what was allowed/blocked, now): before, the two app modules called a redactor themselves and were classified non-egress. After, they call no redactor (their downloads go through asset_downloader.download_to, which redacts to scheme+host and reduces exceptions to their type), so the drift guard's stale-entry test requires removing them. Nothing becomes allowed or blocked at runtime.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a future edit in either app module that starts formatting an exception into its install error would not be flagged by this allowlist. Today neither module formats one; the credential-redaction tests (InvalidURL / OSError / TimeoutError / ValueError with a secret in the url) pin that the returned strings carry no credential.
  • Evidence checked (which sandbox result proves it): N/A for a sandbox: this change touches no sandbox or permission rule. Evidence is test/test_security_posture.py (test_allowlist_has_no_stale_entries, test_every_redactor_call_site_is_a_registered_sink_or_allowlisted, test_a_module_cannot_be_in_both_buckets), passing locally on this head.
  • No regression:
    • Tools still work (which tools/commands were run, result): N/A for agent tools, none touched. run_scoped_tests.py --surface backend (36 related files, 3893 passed) and the papyrus/pptx/posture/asset_downloader tests (323 passed) on this change.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same URLs, pins, env overrides and redirect policy; no config or stored data read differently. Checked by the unchanged override and skip-download tests.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_papyrus_tectonic.py, test_pptx_maker_engine_source.py, test_asset_downloader*.py: 323 passed, 1 skipped; isort, flake8, mypy, black ratchet, comment-history gates green.
  • How to undo: revert this PR's single commit; the two allowlist entries and the per-app download code come back together.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 17, 2026
@iamwhatever
iamwhatever force-pushed the fix/10018-route-archive-downloads branch from 59083aa to afbd6c6 Compare October 18, 2026 05:00
@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: tectonic.py sink entry removed when its redaction moved into asset_downloader.download_to

  • span=880873d3472f The sink registration was dropped instead of moved

fixed in afbd6c6 via the finding's second clearing condition: test_asset_downloader.py::TestRedaction::test_returned_reason_never_carries_the_credentialed_url calls the real download_to.
It raises InvalidURL and HTTPError for https://user:sup3rsecret@mirror.example/tok-9f3b2c/a.bin?X-Amz-Signature=sig123 and asserts no userinfo, path token or signed query is in the returned reason.
A mutation replacing redact_url with identity makes both cases fail, so a change that starts returning {exc} or the raw url is caught.
asset_downloader.py stays non-egress: it returns the string; the dashboard surfaces that render it are the apps' registered route sinks.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Confirm the shared download_to return path is what the guard covers

Confirmed and pinned in afbd6c6: test_asset_downloader.py::TestRedaction::test_returned_reason_never_carries_the_credentialed_url asserts download_to's returned reason carries no credential for InvalidURL and HTTPError.
The posture drift guard keeps asset_downloader.py classified (it calls redact_url), and the two app modules call no redactor, so test_allowlist_has_no_stale_entries requires them off the list.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: afbd6c6
  • What rule changed: src/kiro_crew/security_posture.py NON_EGRESS_REDACTION_MODULES drops apps/builtins/pptx_maker/backend/engine_source.py, the sink list drops apps/builtins/papyrus/backend/tectonic.py, and the asset_downloader.py entry's comment says its returned error string reaches these apps' install state. No sink pattern or credential family changes.
  • Before -> after (what was allowed/blocked, now): before, both app modules called a redactor themselves. After, they call none: their downloads go through asset_downloader.download_to, which returns the exception type and a scheme+host url. The drift guard's stale-entry test requires removing them. Nothing becomes allowed or blocked at runtime.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a credentialed mirror url could reach the dashboard install banner. Pinned against: test_asset_downloader.py::TestRedaction::test_returned_reason_never_carries_the_credentialed_url (InvalidURL, HTTPError) and the app-level credential tests all assert no userinfo, path token or signed query in the returned string.
  • Evidence checked (which sandbox result proves it): N/A for a sandbox: no sandbox or permission rule is touched. Evidence is test/test_security_posture.py (test_allowlist_has_no_stale_entries, test_every_redactor_call_site_is_a_registered_sink_or_allowlisted, test_a_module_cannot_be_in_both_buckets) passing locally on this head.
  • No regression:
    • Tools still work (which tools/commands were run, result): N/A for agent tools, none touched. Papyrus, PPTX Maker, posture and asset_downloader tests: 325 passed, 1 skipped on this head.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same URLs, pins, env overrides and redirect policy; checked by the unchanged override and skip-download tests.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_papyrus_tectonic.py, test_pptx_maker_engine_source.py, test_asset_downloader*.py, test_flake_pattern_ratchet.py; isort, flake8, black, comment-history green.
  • How to undo: revert this PR's single commit; the allowlist entries and the per-app download code come back together.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/security_posture.py (plus same-directory docs) since this head went green (ccb5d34 -> 2e50054); CI re-running. The new head afbd6c6 also adds the download_to redaction test for the Design finding.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 18, 2026
buluoray
buluoray previously approved these changes Oct 18, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving at afbd6c6. Apart from the rebase, the only change since 59083aa is the new test TestRedaction::test_returned_reason_never_carries_the_credentialed_url, so the earlier check stands: both apps go through download_to with their sha256 pins and extract only when ok is true, extraction filters are unchanged, redirects stay https-only, and every failure path is fail-closed.

The new test closes the gap on the returned reason: putting the raw url or the exception text back into either download_to failure return makes the InvalidURL or HTTPError case fail. asset_downloader.py is still filed as non-egress, with a comment saying the callers carry the string to the dashboard; the behaviour test now pins that boundary, which is acceptable, though moving the module to the sinks list would let the drift guard catch it too. Related tests pass on this head (269 passed). CI was still running with 0 failed when I checked.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • allow_cross_host_redirects now covers any url written into the source as a constant

Intended and bounded: a source constant is chosen in code review, never at runtime, so no agent, config file or manifest can steer it.
The relaxed handler still refuses any hop off https, and download_to still installs nothing whose sha256 does not match the caller's pin.
A url from a config file, CDN or signed manifest keeps the same-host default; the docstrings in asset_downloader.py say so in all three places that describe the option.
Maintainer check before merge: a future caller passing a constant url with this flag is visible in its diff, where review decides it.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 18, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready at afbd6c6.

  • PR Readiness passed: 104 checks, 0 failing; readiness label is readiness: passed.
  • GPT and Opus lanes: no findings. Design and First Principles: PASS, each ask answered on the PR. Sensitive Change Review: passed.
  • Approved by @buluoray at this head.
  • Main has moved 3 commits since the last rebase (2e50054 -> db35858), only in same-directory files (src/kiro_crew/cron.py and three spec docs). None of this PR's own files changed, so I did not rebase again.

This Crew will not merge, approve, or enable auto-merge; merging is the maintainer's call.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased to clear a merge conflict (afbd6c6 -> d89419e, base 88914fd). The conflict was one hunk in src/kiro_crew/security_posture.py: main renamed the embeddings.py allowlist entry to embeddings_download.py right above the engine_source.py entry this PR removes. Resolution keeps main's new name and still removes the engine_source.py entry and its note; no other change. Related tests (325 passed) and the backend gates are green locally; CI re-running.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: d89419e
  • What rule changed: src/kiro_crew/security_posture.py NON_EGRESS_REDACTION_MODULES drops apps/builtins/pptx_maker/backend/engine_source.py, the sink list drops apps/builtins/papyrus/backend/tectonic.py, and the asset_downloader.py entry's comment says its returned error string reaches these apps' install state. Same content as the approved head afbd6c6; the rebase only kept main's embeddings_download.py rename next to it.
  • Before -> after (what was allowed/blocked, now): before, both app modules called a redactor themselves. After, they call none; their downloads go through asset_downloader.download_to, which returns the exception type and a scheme+host url. Nothing becomes allowed or blocked at runtime.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a credentialed mirror url could reach the dashboard install banner. Pinned by test_asset_downloader.py::TestRedaction::test_returned_reason_never_carries_the_credentialed_url and the app-level credential tests.
  • Evidence checked (which sandbox result proves it): N/A for a sandbox: no sandbox or permission rule is touched. test/test_security_posture.py (test_allowlist_has_no_stale_entries, test_every_redactor_call_site_is_a_registered_sink_or_allowlisted, test_a_module_cannot_be_in_both_buckets) passes locally on this head.
  • No regression:
    • Tools still work (which tools/commands were run, result): N/A for agent tools, none touched. Papyrus, PPTX Maker, posture and asset_downloader tests: 325 passed, 1 skipped on this head.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same URLs, pins, env overrides and redirect policy; checked by the unchanged override and skip-download tests.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_papyrus_tectonic.py, test_pptx_maker_engine_source.py, test_asset_downloader*.py; isort, flake8, mypy, black, comment-history, docs-lint green.
  • How to undo: revert this PR's single commit.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 19, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

CI note for d89419e: Harness Parity Gate (and Await Fast Gate / Coverage Gate, which wait on it) are red on main too, not from this PR.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Run one real install of Tectonic and one of the PPTX Maker engine through the shared opener

Done at d89419e on a Linux aarch64 host, no mocks, no URL override: tectonic._download_to fetched tectonic-0.17.0-aarch64-unknown-linux-musl.tar.gz (9926834 bytes) and engine_source.download_archive fetched the b7c7fcf0972b archive (3159833 bytes).
Both returned (True, ''), both followed GitHub's cross-host redirects (release asset host, codeload.github.com) under the shared https-only handler, and both files' sha256 equal their pins.
Files were written to a private temp dir and removed afterwards.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • The two-shapes contract must not become a precedent for config urls

It excludes them in words: all three places in asset_downloader.py that describe allow_cross_host_redirects say a url from a config file is NOT either shape and keeps the same-host policy, because config is agent-writable.
Both callers here pass it only for a source constant or the operator's process-environment override; neither reads a config key.
Follow-up #22230 restates the rule for the next two callers: same-host by default, cross-host only for an env or constant url.

@iamwhatever
iamwhatever force-pushed the fix/10018-route-archive-downloads branch from d89419e to a15b0b4 Compare October 19, 2026 17:27
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased: main's Fast Gate is green again at 3e39e7a (#22178 cleared the harness-parity red). d89419e -> a15b0b4, clean rebase, no conflict and no code change. Related tests (325 passed) and check_harness_parity.py pass locally; CI re-running.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: a15b0b4
  • What rule changed: src/kiro_crew/security_posture.py NON_EGRESS_REDACTION_MODULES drops apps/builtins/pptx_maker/backend/engine_source.py, the sink list drops apps/builtins/papyrus/backend/tectonic.py, and the asset_downloader.py entry's comment says its returned error string reaches these apps' install state. Same content as d89419e; this head is a clean rebase onto 3e39e7a.
  • Before -> after (what was allowed/blocked, now): before, both app modules called a redactor themselves. After, they call none; their downloads go through asset_downloader.download_to, which returns the exception type and a scheme+host url. Nothing becomes allowed or blocked at runtime.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a credentialed mirror url could reach the dashboard install banner. Pinned by test_asset_downloader.py::TestRedaction::test_returned_reason_never_carries_the_credentialed_url and the app-level credential tests.
  • Evidence checked (which sandbox result proves it): N/A for a sandbox: no sandbox or permission rule is touched. test/test_security_posture.py (test_allowlist_has_no_stale_entries, test_every_redactor_call_site_is_a_registered_sink_or_allowlisted, test_a_module_cannot_be_in_both_buckets) passes locally on this head.
  • No regression:
    • Tools still work (which tools/commands were run, result): N/A for agent tools, none touched. Papyrus, PPTX Maker, posture and asset_downloader tests: 325 passed, 1 skipped on this head. A real Tectonic and PPTX Maker engine download through the shared opener both succeeded with matching pins (see the Design reply).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same URLs, pins, env overrides and redirect policy; checked by the unchanged override and skip-download tests.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_papyrus_tectonic.py, test_pptx_maker_engine_source.py, test_asset_downloader*.py; flake8 and check_harness_parity.py green.
  • How to undo: revert this PR's single commit.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 19, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Verify the shared TLS context and DEFAULT_MAX_BYTES suit both apps' real GitHub downloads

A live download WAS run through the shared opener on d89419e (same code as this head; this head only rebases): #21683 (comment)
Both used make_ssl_context() on the HTTPSHandler and verified TLS to github.com and its redirect hosts; Tectonic 9926834 bytes and the engine archive 3159833 bytes both matched their pins.
DEFAULT_MAX_BYTES is 8 GiB, three orders of magnitude above the largest pinned artifact (~22 MB), so the ceiling cannot cut a real transfer.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • tectonic.py left the sink registry while its dashboard-bound reason now comes from asset_downloader.py, filed non-egress

Settled on an earlier head with the Design lane, which cleared via its own stated condition: #21683 (comment)
test_asset_downloader.py::TestRedaction::test_returned_reason_never_carries_the_credentialed_url calls the real download_to with InvalidURL and HTTPError and asserts no credential is in the returned reason; an identity redact_url makes it fail.
asset_downloader.py returns the string and egresses nothing; the routes that render it (papyrus/backend/routes.py, pptx_maker/backend/routes.py) are registered sinks.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 19, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready at a15b0b4.

This Crew will not merge, approve, or enable auto-merge; merging is the maintainer's call.

@chenmingwei23
chenmingwei23 merged commit aa71296 into main Oct 20, 2026
104 checks passed
@chenmingwei23
chenmingwei23 deleted the fix/10018-route-archive-downloads branch October 20, 2026 00:35
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 20, 2026
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.

Route the papyrus and pptx_maker archive downloads through asset_downloader.download_to

3 participants