Skip to content

fix: ignore invalid unix permissions and setuid bits from zip#1007

Merged
marcospb19 merged 2 commits into
ouch-org:mainfrom
tommady:close-issue-1006
Jun 26, 2026
Merged

fix: ignore invalid unix permissions and setuid bits from zip#1007
marcospb19 merged 2 commits into
ouch-org:mainfrom
tommady:close-issue-1006

Conversation

@tommady

@tommady tommady commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1006

Some zip files created on MS-DOS environments store invalid attributes that zip reads as unix modes missing the file type bits, resulting in unintended setuid permissions.

In the reported issue, stat revealed the file access mode was 0o4032.
In a valid Unix permission mode, the file type bits (S_IFMT, e.g., 0o100000 for a regular file) must be set.

A mode of 0o4032 entirely lacks these file type bits, meaning it is garbage data (likely MS-DOS attributes or arbitrary metadata from the archive generator) being mistakenly interpreted as a Unix mode.

Signed-off-by: tommady <tommady@users.noreply.github.com>
@tommady

tommady commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

hi @marcospb19 please review while you have time.
thanks!

@marcospb19 marcospb19 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking good, can you take a look at the new conflicts?

@marcospb19

Copy link
Copy Markdown
Member

Hey, PR #951 will be merged before this one.

In the description there is this item: Setuid/setgid bits from zip entries are preserved on extraction.

👁️ 👁️ so, maybe it will clash with this PR too and cause more conflicts.

@tommady

tommady commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator Author

Hey, PR #951 will be merged before this one.

In the description there is this item: Setuid/setgid bits from zip entries are preserved on extraction.

👁️ 👁️ so, maybe it will clash with this PR too and cause more conflicts.

not a problem, I can wait then fix after #951 merged~

@marcospb19

Copy link
Copy Markdown
Member

Okay! #951 was merged.

@tommady
tommady requested a review from marcospb19 June 21, 2026 08:20

@marcospb19 marcospb19 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

great!

@marcospb19 marcospb19 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

great! (oops)

@marcospb19
marcospb19 merged commit 6c3c803 into ouch-org:main Jun 26, 2026
18 checks passed
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.

Bandcamp archives are unpacked with setuid

2 participants