Permissions granted to a wrong app when running Apple Script

Number:rdar://46519167 Date Originated:December 6 2018, 2:11 PM
Status:Open Resolved:No
Product:macOS Product Version:10.14.1
Classification:Security Reproducible:Always
Something not on this list

Start by resetting all permissions by executing:
sudo tccutil reset All in Terminal

1. Run attached script that controls iTunes in Script Editor. Keep it open.
2. Build and Run attached project
3. From the menu select Test -> Test (executes the same script)
4. Dialog will show the app tries to control Script Editor instead of iTunes.
5. Click Don't Allow
6. Try again and now it will fail saying the app doesn't have permission to control System Events
7. Check Preferences -> Security -> Privacy -> Automation and see that Script Editor was added instead of iTunes
8. Close Script Editor
9. Close test project and repeat step #2
10. Now dialog will show you are trying to control iTunes, and if permission granted - it will work


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!