Apply restricted permissions when executing Javascript