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

Add unpack size limit to mitigate zip bomb? #745

Open
NobodyXu opened this issue Jan 27, 2023 · 2 comments
Open

Add unpack size limit to mitigate zip bomb? #745

NobodyXu opened this issue Jan 27, 2023 · 2 comments

Comments

@NobodyXu
Copy link
Member

cargo has recently added size limit to unpacking to migrate against zip bomb rust-lang/cargo#11337

I wonder shall we also do the same in binstalk-downloader?

@passcod passcod changed the title Add unpack size limit to migrate zip bumb? Add unpack size limit to mitigate zip bomb? Jan 27, 2023
@passcod
Copy link
Member

passcod commented Jan 27, 2023

I don't see how we can easily do that. crates have a fairly predictable compression ratio and that maximum size looks reasonable for it, but we could be downloading archives that are legitimately gigabytes large. i guess we could set a default limit with a cli flag to increase it?

@NobodyXu
Copy link
Member Author

I don't see how we can easily do that. crates have a fairly predictable compression ratio and that maximum size looks reasonable for it, but we could be downloading archives that are legitimately gigabytes large.

Perhaps we could add that for downloading from crates.io

For downloading binaries, I was thinking about applying different limit for each compression methods, based on the max compression rate.

Though now I think of it again, it doesn't sound like that useful except for preventing bugs in the implementation.

i guess we could set a default limit with a cli flag to increase it?

Yes I think a flag to limit ratio/max data to write can be useful, as many bins are actually quite small.

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

No branches or pull requests

2 participants