Skip to content

Appimage ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT protection is bypassed #1581

@Daeraxa

Description

@Daeraxa

Due to how the AppImage is executed, it is possible to bypass the check for ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT.

As designed, we should be able to tell if Pulsar is executed from a terminal shell vs a desktop shell by the presence or absence of ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT. This is because it is meant to be set by the .desktop file EXEC:

Exec=env ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=false usr/bin/pulsar --no-sandbox %F

So when run from the desktop shell via the .desktop file, we will set this to false. If executing directly from $PATH` via a terminal shell then this will not be set.

This then feeds into pulsar.sh which detects whether this has been set:

pulsar/pulsar.sh

Lines 28 to 33 in 9142197

# Only set the ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT env var if it hasn't
# been set.
if [ -z "$ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT" ]
then
export ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=true
fi

So unless you explicitly set this beforehand, this should always be true when launching from a terminal and false when launching from the desktop.

The problem is that with the AppImage, we never use the desktop file (it is only provided for manual integration or by other AppImage helpers such as AppImageLauncher or AM). Instead the AppRun script runs for both terminal and desktop before handing off to pulsar.sh. As we never set the variable this will always end up evaluating to true before launching Pulsar with it set.

What we need to be able to do here is have some other mechanism to determine if the Pulsar AppImage has been launched by terminal or desktop.

Interesting note

This also relates to #1580 in an odd way. Usually that variable is set to be false on a desktop launched pulsar because the variable is set via the desktop file.

However because of a quirk or historical decision with our packaging, we don't actually set it. Yet this doesn't cause an issue because we actually launch Pulsar's binary directly without using pulsar.sh which is what will automatically set the variable to true if the variable was missing.

Pulsar version

1.132.1

Additional Information:

Pulsar team members can find a thread on Discord at https://discord.com/channels/992103415163396136/1508277521966301264/1508277534100295691 that goes into my initial findings and discussion with @savetheclocktower about them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions