Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions plexargod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ RestartSec=5s
[Install]
WantedBy=multi-user.target
UNIT
mkdir -p /etc/plexargod
if [ ! -f /etc/plexargod/plexargod.conf ]; then
echo "# /etc/plexargod/plexargod.conf" > /etc/plexargod/plexargod.conf
fi
if grep -q "^PlexServerURL=" /etc/plexargod/plexargod.conf 2>/dev/null; then
sed -i "s|^PlexServerURL=.*|PlexServerURL=${PLEX_URL}|" /etc/plexargod/plexargod.conf
else
echo "PlexServerURL=${PLEX_URL}" >> /etc/plexargod/plexargod.conf

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Quote PlexServerURL before persisting it to sourced config

When --install is run with a URL containing shell metacharacters (for example $(...), backticks, or & in a query string), these lines write it verbatim into /etc/plexargod/plexargod.conf. Later the script does source "${plexargod_conf}" at plexargod.sh:100-102, so Bash evaluates that text as code/root shell syntax instead of loading it as data. At minimum this breaks legitimate URLs with &, and in the worst case it allows unintended command execution the next time plexargod runs.

Useful? React with 👍 / 👎.

fi
systemctl daemon-reload
systemctl enable plexargod
echo "plexargod.service installed and enabled."
Expand Down