In order to be able to pass arguments to my executable (and avoid using a problematic script) I have adopted the "Trampoline" approach as suggested here:
https://developer.apple.com/forums/thread/720057?answerId=736527022#736527022
After resetting the Privacy permissions using tccutil, and running the app by double clicking it, the trampoline invokes the target executable using execve, as described:
"Execve() overwrites the current process so that it executes the file in path with the arguments in argv, and the environment variables in envp. Execve() does not return unless it encounters an error, such as the file in "path" not existing, or not being an executable file."
The app launches as expected - it appears in the Activity Monitor correctly, however once the User Accessibility prompt is encountered and the Security settings opened, the newly created entry is the Trampline executable, not the .app. (along with an Exec icon, not the app icon). It still works fine, though.
Confusingly, responding to the Apple Event prompt, which is also presented, creates an entry with the app name and Icon, as expected.
I'm wondering if this can be explained, and perhaps remedied so that the app and Icon appear as expected in the Accessibility section of S&P settings?