Permission denied to extract specific files from a zipTree under OSX/Linux

I need to extract only some folders from a zip file inside a directory, the task is this one. But when doing it in OSX this error shows up:

* What went wrong:
Execution failed for task ':extractFirebaseIosZip'.
> Could not copy zip entry /Users/lambertobasti/IdeaProjects/firebase-ios-kotlin-native/build/firebaseIosSetup/Firebase-6.14.0.zip!Firebase/FirebaseFirestore/leveldb-library.framework/Headers/leveldb/c.h to '/Users/lambertobasti/IdeaProjects/firebase-ios-kotlin-native/build/firebaseIosSetup/Firebase-6.14.0/leveldb-library.framework/Headers/leveldb/c.h'.
   > /Users/lambertobasti/IdeaProjects/firebase-ios-kotlin-native/build/firebaseIosSetup/Firebase-6.14.0/leveldb-library.framework/Headers/leveldb/c.h (Permission denied)

If you go sudo (which f up the build since I need environmental variables) it extracts just fine.

I ensured to have read and write permissions in the working folder with normal user. It happens on Travis as well.

The Finder built in app extracts just fine the entire zip as is.

I have no clue why this happens, I googled around and found that some zip engines may store the permissions as well, so maybe some files inside the zip have sudo only permissions (if it even make sense to keep permission from one PC to another). Indeed when extracting them as sudo, Intellij IDEA shows a little lock over the icon of some folders.

I have little experience with UNIX systems so i’m kind of drowning in here :sob: