Skip to content

Trigger and notification data can replace PATH and other variables widget commands rely on #5

Closed

Description

@Seb-GRAF

What happens

Variables sent with StableBar --trigger EVENT KEY=VALUE, and string values in a distributed notification's userInfo, are merged over the command environment. Only NAME, CONFIG_DIR and SENDER are protected, so PATH, HOME or ZDOTDIR sent with an event replace the real values for every widget subscribed to that event and for the refresh after its actions.

Steps to reproduce

  1. Add a widget: {"id": "demo", "type": "script", "position": "right", "interval": null, "events": ["demo"], "command": "printf %s \"$PATH\""}.
  2. Run StableBar --trigger demo PATH=/nowhere.

Expected

Event data adds variables such as INFO or STATUS without replacing variables that commands depend on.

Environment

main at 988a005 (after v0.1.1).

Evidence

On a branch that runs commands with zsh -c, the widget printed ~/.cargo/bin:/nowhere (~/.zshenv added the first entry). On main, commands run with zsh -lc, so /etc/zprofile and ~/.zprofile rebuild most of PATH, but HOME and ZDOTDIR still change which startup files zsh reads.

Diagnosis

  • Sources/StableBar/ScriptWidget.swift:8: commandEnvironment merges event values over configured ones.
  • Sources/StableBar/LaunchCommand.swift:81: --trigger accepts any KEY=VALUE.
  • Sources/StableBar/BarStore.swift:208: notification userInfo strings become environment variables.

Only unsandboxed processes running as the same user can send this data (sandboxed apps cannot attach userInfo to distributed notifications), so it does not cross a privilege boundary. The realistic risk is breaking commands by accident.

Related

README "Script events" documents that event data overrides configured variables.

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    bug
    on Oct 15, 2026
  2. github-actions commented on Oct 15, 2026

    @github-actions

    🎉 This issue has been resolved in version 0.2.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions