Skip to content

fix(bundler): reject non-UTF-8 zipped manifests consistently - #3958

Open
marcelsafin wants to merge 1 commit into
github:mainfrom
marcelsafin:fix/bundle-zip-manifest-yaml
Open

fix(bundler): reject non-UTF-8 zipped manifests consistently#3958
marcelsafin wants to merge 1 commit into
github:mainfrom
marcelsafin:fix/bundle-zip-manifest-yaml

Conversation

@marcelsafin

@marcelsafin marcelsafin commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

A local bundle directory or plain bundle.yml is decoded strictly as UTF-8 through yamlio.load_yaml, but the .zip path feeds raw bytes to PyYAML. PyYAML auto-detects a UTF-16 BOM, so a UTF-16 manifest rejected by the other two local-source paths is silently accepted from a zip. Other undecodable bytes also surface through PyYAML instead of the shared Could not read ... contract.

Fix: decode the bounded zip member explicitly as UTF-8 before parsing. Decode failures now raise BundlerError with the same Could not read wording as yamlio; YAML parse handling remains from #4013.

This PR originally also wrapped malformed YAML. #4013 merged that independently, so the branch was rebased and that overlapping commit/test was dropped. The remaining one-commit diff only covers the still-missing encoding consistency.

Testing

  • Full suite on rebased head: 6,462 passed, 177 skipped
  • Two regression tests: invalid UTF-8 bytes and well-formed UTF-16 manifest
  • uvx ruff@0.15.0 check src tests
  • git diff --check

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

Implemented autonomously by GitHub Copilot CLI (model: Claude Fable 5) under human direction; TDD, full suite, lint, rebase, and final diff review completed locally. Commit includes Assisted-by/Co-authored-by trailers.

Copilot AI balanced review requested due to automatic review settings August 3, 2026 19:55
@marcelsafin
marcelsafin requested a review from mnriem as a code owner August 3, 2026 19:55

Copilot AI 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.

Pull request overview

Wraps ZIP bundle-manifest YAML parsing failures in BundlerError.

Changes:

  • Handles malformed or undecodable ZIP manifest data.
  • Adds regression tests for malformed YAML and invalid encoding.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/specify_cli/commands/bundle/__init__.py Wraps ZIP manifest parsing errors.
tests/integration/test_bundler_local_install.py Tests YAML and decoding failures.

馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/specify_cli/commands/bundle/__init__.py
Copilot AI review requested due to automatic review settings August 3, 2026 20:13

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@mnriem
mnriem requested a balanced review from Copilot August 5, 2026 13:46

Copilot AI 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.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Review follow-up: feeding PyYAML the byte stream let its Reader honour
a UTF-16 BOM and accept a manifest yamlio.load_yaml rejects, so zip and
directory sources diverged. Decode raw as UTF-8 (UnicodeError ->
BundlerError 'Could not read ...') then parse, and cover a well-formed
UTF-16 manifest in the regression tests.

Assisted-by: GitHub Copilot (model: claude-fable-5, autonomous)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@marcelsafin
marcelsafin force-pushed the fix/bundle-zip-manifest-yaml branch from e1898e5 to a3c07a1 Compare August 7, 2026 21:21
Copilot AI review requested due to automatic review settings August 7, 2026 21:21
@marcelsafin marcelsafin changed the title fix(bundler): wrap invalid YAML from a zipped bundle manifest fix(bundler): reject non-UTF-8 zipped manifests consistently Aug 7, 2026

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

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.

3 participants