Skip to content

Fixed theme zip extraction permissions#852

Closed
sagzy wants to merge 2 commits into
mainfrom
file-permissions-issue
Closed

Fixed theme zip extraction permissions#852
sagzy wants to merge 2 commits into
mainfrom
file-permissions-issue

Conversation

@sagzy

@sagzy sagzy commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

ref TryGhost/framework#761
ref https://linear.app/ghost/issue/ONC-1838/timeout-on-theme-upload

Some theme zip files have read-only folder permissions. When an user uploads one of these themes, GScan needs to unzip the archive and create files inside those folders. If the folders are not writable by the owner, extraction can get stuck and the theme upload appears to freeze in the UI without a useful error message.

With this change, GScan opts into the new @tryghost/zip owner-permission normalization while extracting theme uploads. Directories are normalized so the owner can read, write, and traverse them, and files are normalized so the owner can read and write them. The original zip is not modified; only the temporary extracted copy is made usable for validation and installation.

The result is that themes with incorrect folder permissions can still be uploaded successfully instead of leaving the user stuck on a frozen upload.

no issue

GScan validates and installs theme zips from its extracted temp directory. Some customer archives preserve read-only directory modes, which can block validation or later cleanup. Use the new @tryghost/zip owner-permission normalization option so uploaded themes are extracted with writable owner permissions while keeping the source archive unchanged.
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@sagzy, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 29 minutes and 53 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fe7d162d-a76e-430e-bf9a-4f43c384f76f

📥 Commits

Reviewing files that changed from the base of the PR and between ffb87dd and 5a69b0d.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • lib/read-zip.js
  • package.json
  • test/read-zip.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch file-permissions-issue

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

no issue

Resolved the package and lockfile conflicts by keeping the upstream dependency refresh from main while retaining @tryghost/zip 3.5.0 for the theme zip permission fix.

@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: 0f3d1eff1d

ℹ️ 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 thread package.json
"@tryghost/zip": "3.4.1",
"@tryghost/pretty-cli": "3.3.0",
"@tryghost/server": "3.1.0",
"@tryghost/zip": "3.5.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Align zip and app error dependencies

With this bump the lockfile now installs @tryghost/zip with its own @tryghost/errors@3.3.1, while GScan itself still imports @tryghost/errors@3.3.0. In a normal install, zip extraction failures such as symlink or size-limit UnsupportedMediaTypeErrors are created by the nested 3.3.1 copy, so the errors.utils.isGhostError checks in lib/read-zip.js/lib/checker.js no longer recognize them as Ghost errors and wrap them as generic ValidationErrors, dropping the code/errorDetails callers rely on. Please bump the direct @tryghost/errors dependency to the same version as the zip package, or otherwise ensure both modules share the same error classes.

Useful? React with 👍 / 👎.

@sagzy sagzy closed this Jun 25, 2026
@sagzy sagzy deleted the file-permissions-issue branch June 25, 2026 12:53
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.

1 participant