简体   繁体   中英

Google app script installable trigger using wrong permission on protected spreadsheet

According to Google's documentation regarding container-specific installable triggers, the trigger will "run as the user who installed the trigger, not as the user triggering the event."

This seems to mean that a trigger could update a protected sheet in Google Docs, because although the user may not be able to edit the protected sheet, the trigger could if it was installed by a user with write privileges.

To test this idea in the simplest way possible, I tried using an onOpen event that triggers a script that edits the value of a cell on a protected sheet. This was installed by a user that can edit the sheet. Although it works if the user opening the sheet has write access, it fails to update the sheet if the user does not.

Is this due to my misunderstanding of how it is supposed to work, or is it a bug? It seems like Google was pretty clear that the script runs with the authority of the user that uploaded the script.

It's a bug.

In March I [posted][1] on the old GAS forum about it. Anton Soradoi from Google replied to me privately by email because I was unable to share the spreadsheet publicly. I shared it with him and got this reply via email on Tue Apr 3rd:

"The issue you are running into appears to be a bug. We are currently investigating it. I will get back to you with more info once I have it."

I didn't raise an issue because they were already on the case but I haven't heard any more since.

it's interesting. if you did this for onEdit, you would have to manually add a trigger to run "On Edit" and call onEdit function and it would run under your name whenever anybody edited something, but I think for onOpen it will run only if you are the user opening the spreadsheet, you can try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM