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

App names with double quotes (") not escaped in yabai queries #1489

Closed
wxwern opened this issue Oct 17, 2022 · 2 comments
Closed

App names with double quotes (") not escaped in yabai queries #1489

wxwern opened this issue Oct 17, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@wxwern
Copy link

wxwern commented Oct 17, 2022

I've recently stumbled across an app with an app name containing double quotes, which caused yabai -m query --windows --window to output invalid json. From the source code here, it appears while app window titles are escaped, app names are not.

This has consequences like being able to inject arbitrary data into queries, though I don't think there's much harm that can be done just from that alone.

@koekeishiya
Copy link
Owner

Do you have a sample? The app name is pulled from what is shown in Activity Monitor and I didn't think those could contain quotes and such.

@wxwern
Copy link
Author

wxwern commented Oct 17, 2022

hello_world_poc

This is a fresh macOS app created in Xcode.

This can be reproduced by just setting the Display Name of a macOS app (or CFBundleDisplayName key in Info.plist) to "Hello World", or any other text that includes the double quotes.

Since there's no sanitisation, yabai will thus return:

{
	...
	"app":""Hello World"",
	...
}

koekeishiya added a commit that referenced this issue Oct 20, 2022
@koekeishiya koekeishiya added addressed on master; not released Fixed upstream, but not yet released bug Something isn't working labels Oct 20, 2022
@koekeishiya koekeishiya removed the addressed on master; not released Fixed upstream, but not yet released label Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants