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

Applications: Properly parse desktop exec keys and stop shelling out #207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sents
Copy link

@sents sents commented Jan 16, 2025

https://specifications.freedesktop.org/desktop-entry-spec/latest/exec-variables.html describes how commands and their arguments are stored in the exec key. As the exec key is a string type as defined in
https://specifications.freedesktop.org/desktop-entry-spec/latest/value-types.html escapes code for certain characters have to be respected. After this there are rules which characters necessitate a quoted string and which characters need to be escaped in a quoted string. To use the exec key for executing we then need to unescape these characters and can collect the args in a vector. This enables us to stop shelling out when executing desktop files and instead call Command directly with the specified program and arguments.

https://specifications.freedesktop.org/desktop-entry-spec/latest/exec-variables.html
describes how commands and their arguments are stored in the exec key.
As the exec key is a string type as defined in
https://specifications.freedesktop.org/desktop-entry-spec/latest/value-types.html
escapes code for certain characters have to be respected. After this
there are rules which characters necessitate a quoted string and which
characters need to be escaped in a quoted string. To use the exec
key for executing we then need to unescape these characters and can
collect the args in a vector. This enables us to stop shelling out
when executing desktop files and instead call `Command` directly with
the specified program and arguments.
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.

1 participant