getlantern / systray

a cross platfrom Go library to place an icon and menu in the notification area
Apache License 2.0
3.28k stars 451 forks source link

MacOS set SUID permissions There will be problems #248

Closed PBK-B closed 7 months ago

PBK-B commented 1 year ago

Use the example code to reproduce. The reproduction steps are as follows

git clone git@github.com:getlantern/systray.git
cd example

go build 
sudo chmod +s ./example
./example

The error message is as follows

xxx:core root$ ./example 
2023-01-28 18:05:16.137 example[38764:379629] The application with bundle ID (null) is running setugid(), which is not allowed. Exiting.
fix this

I think my application needs this permissions, if any suggestions or ideas can help me

renard commented 7 months ago

This is because MacOS AppKit based applications (NSApplication or NSWindow) are forbidden to run as root.

See

I don't really know what you are trying to achieve but you can bypass this limitation running a setuid launcher that call your program.

CAREFUL though about any security issue!

PBK-B commented 7 months ago

@renard Thank you. I think I probably understand.