Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use tar instead of 7zip to preserve file permissions in tar.gz packages #6791

Merged

Conversation

devinbinnie
Copy link
Contributor

@devinbinnie devinbinnie commented Apr 13, 2022

7zip on UNIX-based systems does not support conserving permissions when creating tarballs (see Backup and limitations: https://linux.die.net/man/1/7za), so tarballs created by 7zip were always world-writable (permissions on files were set to 777 for all files added to the archive).

This is generally considered bad practice since it can lead to privilege escalation. This PR replaces the use of 7zip with tar when creating the initial tarball, which preserves the permissions from the unpackaged folder. It also allows the user to change the permissions (in afterPack, if they want to) before creating the archive.

I couldn't find an issue created for this, so I'm not sure if this approach is correct, but I'd like to offer it as a solution to the issue described above. Open to feedback/changes as always :)

@changeset-bot
Copy link

changeset-bot bot commented Apr 13, 2022

🦋 Changeset detected

Latest commit: 6587a14

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
app-builder-lib Patch
dmg-builder Patch
electron-builder-squirrel-windows Patch
electron-builder Patch
electron-forge-maker-appimage Patch
electron-forge-maker-nsis-web Patch
electron-forge-maker-nsis Patch
electron-forge-maker-snap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Apr 13, 2022

Deploy Preview for car-park-attendant-cleat-11576 ready!

Name Link
🔨 Latest commit 6587a14
🔍 Latest deploy log https://app.netlify.com/sites/car-park-attendant-cleat-11576/deploys/6258562780786a0008428ee8
😎 Deploy Preview https://deploy-preview-6791--car-park-attendant-cleat-11576.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@devinbinnie devinbinnie changed the title Use tar instead of 7zip to preserve file permissions in tar.gz packages fix: Use tar instead of 7zip to preserve file permissions in tar.gz packages Apr 13, 2022
@mmaietta
Copy link
Collaborator

I love the idea. I'd target this as a feature though. Could you please update the changeset?

@devinbinnie devinbinnie changed the title fix: Use tar instead of 7zip to preserve file permissions in tar.gz packages feat: Use tar instead of 7zip to preserve file permissions in tar.gz packages Apr 14, 2022
@devinbinnie
Copy link
Contributor Author

I love the idea. I'd target this as a feature though. Could you please update the changeset?

Done!

@mmaietta mmaietta merged commit 95910f8 into electron-userland:master Apr 15, 2022
@github-actions github-actions bot mentioned this pull request Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants