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

Improve String handling in SIP crate #2198

Open
t4lz opened this issue Jan 24, 2024 · 4 comments · May be fixed by #2490
Open

Improve String handling in SIP crate #2198

t4lz opened this issue Jan 24, 2024 · 4 comments · May be fixed by #2490
Assignees
Labels
enhancement New feature or request

Comments

@t4lz
Copy link
Member

t4lz commented Jan 24, 2024

As pointed out in #2195 (review), we incorrectly use Strings in the SIP crate in places where an OsString or a Vec<u8> would be appropriate.
I think if we do everything correctly, no error handling should be needed for string conversions, and also nothing like to_string_lossy.

There isn't any known issue caused by this yet, but it might be possible to construct an example where this incorrect handling would lead to SIP-sidestepping not working, maybe with some special characters or encoding in file paths or script shebangs.

@t4lz t4lz added the enhancement New feature or request label Jan 24, 2024
@gememma gememma self-assigned this May 20, 2024
@gememma
Copy link
Contributor

gememma commented May 22, 2024

Is there any reason we would need to use OsString instead of keeping everything as PathBuf? They do things like handle trailing slashes which is currently done manually

@aviramha
Copy link
Member

Yes, the SIP crate patches/modifies OS-level strings, so to match layout/compatibility we have to use it too.

@gememma
Copy link
Contributor

gememma commented May 22, 2024

Is PathBuf not just a wrapper around OsString? Keeping everything as Path is still using the underlying OsString but with the guarantee that it's always producing a valid path

@aviramha
Copy link
Member

aviramha commented May 22, 2024

Ah I didn't know that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
3 participants