Hi,
Thanks for the detailed explanation. I have been looking into a very similar architecture, and I think there are a few important distinctions worth making.
My understanding is that removing script.external_request does not, by itself, remove the CASA requirement if the application continues to request restricted Gmail scopes. The CASA requirement is tied primarily to the restricted OAuth scopes and how restricted data is handled, rather than specifically to the use of UrlFetchApp.
The move from UrlFetchApp to the Vertex AI advanced service does, however, materially change the architecture. In that case the script is calling Google's Vertex AI API directly rather than making an arbitrary external HTTP request. I would therefore distinguish between the absence of script.external_request and the separate question of whether Gmail data is being transmitted to Vertex AI.
Regarding cloud-platform, I would also be cautious about treating it as simply a replacement for script.external_request. It is a broad Google Cloud OAuth scope, so it is worth minimizing permissions and understanding exactly what the Vertex AI advanced service requires. However, I don't believe that the mere presence of cloud-platform means that CASA automatically applies in the same way as it would because of script.external_request.
The question of which Google Cloud project is used is also important. If each user can use their own Google Cloud project and billing account for Vertex AI, the data-flow and contractual arrangement are considerably cleaner from a privacy perspective than having all users' Gemini requests go through a Cloud project controlled and billed by the application developer. That said, I would not assume that this arrangement by itself creates an exemption from Google's OAuth verification or CASA requirements.
I also agree with your plan to replace mail.google.com with the narrowest Gmail scope actually required. For example, gmail.send is substantially different from gmail.modify or gmail.compose from Google's scope-classification perspective. If the application only needs to generate and send email, it may be possible to use gmail.send, which is classified as sensitive rather than restricted. On the other hand, gmail.modify, gmail.compose, and the full mail.google.com scope remain restricted.
One thing I would also check is whether you actually need both:
cloud-platform
and
cloud-platform.read-only
If the Vertex AI service works with the broader scope, requesting both would not provide additional security and could make the permission set look broader than necessary.
For a published application, I would therefore aim for the smallest possible scope set and explicitly declare those scopes in the Apps Script manifest.
The most useful test would probably be to create three small proof-of-concept projects:
gmail.send + Vertex AI
gmail.compose + Vertex AI
gmail.modify + Vertex AI
with no UrlFetchApp at all, and then see how Google's current OAuth verification process treats each configuration.
In particular, the first case could be interesting if your application's functionality can be designed so that it does not need to read or modify existing Gmail content.
Overall, I think your move away from UrlFetchApp is sensible, but I would separate three questions when discussing this with Google:
whether script.external_request is present;
which Gmail scopes are requested and whether they are restricted; and
where Gmail data is actually sent when Gemini is invoked.
Those three issues appear to be related but are not interchangeable.
Best regards,
Ryan
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/63d3a7c5-93a4-4f8c-a1c0-ecddf63c47b8n%40googlegroups.com.
Hi Bong,
I think your distinction is important. The 2019 Google Apps Script Community thread does document a case where removing script.external_request reportedly resulted in approval without a security assessment, even though the app retained the https://mail.google.com/ scope.
However, I would be cautious about assuming that this outcome still applies under the current CASA framework.
Google's current documentation ties the security assessment requirement to apps that access restricted user data from or through a third-party server. That suggests the key question is the app's architecture and actual data flows, rather than simply whether a particular OAuth scope is present.
Removing script.external_request may support the argument that the application operates entirely on the client side, but it does not, by itself, establish that Google will accept the exemption.
I haven't been able to confirm a recent case involving restricted Gmail scopes, no script.external_request, and successful verification without a CASA assessment.
The safest approach would be to document the architecture and data flows clearly, then ask Google's OAuth verification team to confirm in writing whether the proposed implementation qualifies for an exemption before investing in the assessment process.
It would be particularly useful to hear from anyone who has completed this process recently.
Best regards
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/ed86f119-0f3a-4f53-b8eb-7f6f7e83688cn%40googlegroups.com.