As needed, secure your app projects, app deployments, and app data to ensure that security and privacy requirements for your apps are met.
Also consider whether apps run as the user or the developer (the execution identity).
Secure app projects
An app project is the app that you develop, share, and deploy in App Maker. An app project describes how an app is constructed.
Consider who owns app projects
The app project owner is, initially, the person who creates the project. Project owners are powerful. A project owner has full control over the app project and app deployments. As a project admin, they also have full access to the data in all deployments of the app, no matter what the security settings are. You can change app project ownership in two ways:
- The owner of an app project can transfer ownership of the app project to someone else, as they would any other Drive file.
- A G Suite administrator can transfer ownership.
Restrict edit access to app projects
Don’t share your app project with someone unless you fully trust that person. An app editor can change:
- the app UI
- data access permissions
You can share app projects with specific users (Google Accounts) and groups (Google Groups) in the same way you share files in Drive, Docs, and Sheets. You can share a project with the following access levels:
- Can edit—Users with Can edit access can develop the app and publish app deployments. They also have full access to all data in all deployments of the app.
- Can view—Users with Can view access have read-only access to the app project. They can't preview apps or publish app deployments, but they have read access to all data in all deployments of the app.
|Action||Project owner||Edit permission||View permission|
|View a list of deployments|
|Publish a deployment|
|Edit a deployment||if deployment owner||if deployment owner|
|Republish a deployment||if deployment owner||if deployment owner|
|Delete a deployment||if deployment owner|
|Import data to a deployment||if deployment owner||if deployment owner|
|Export deployment data||if deployment owner||if deployment owner|
Safely export, share, and import app project files
You can export an app project into an app project file. App project files can be shared and imported.
An app project file is a complete record of how an app is constructed. It contains:
- data models
- the user interface
- information about roles (but not the membership of the roles, which is defined in deployments)
- the instance name, if the app uses a custom Cloud SQL database
It doesn’t contain app data (which is in deployments).
An app project file doesn’t present as many possible security concerns as a shared app project. When a developer imports an app project file, they create a new app that is visually and functionally identical to the original app project. However, the imported app doesn't have any connection to the original database and doesn't contain user or group names in the security settings.
Recommendations for app project security
- Consider who should own the project before you start development.
- Restrict app access based on developer and user access requirments.
- Only share app projects and app project files with those you trust.
- Sharing an app project file can be a more secure way of sharing an app than sharing the project file.
- Only import app project files from those you trust.
- Make sure you understand what you import. App projects define some aspects of app security and data access.
Securing apps is a core part of security.
Run an app as the user or developer
App Maker uses a specific account when it runs the server part of an app—the app user’s account or the account of the developer who publishes the app. App Maker uses the account when the app runs server scripts and when it makes API calls to Google Apps Script Services (G Suite Services, Script Services, and Advanced Google Services).
For more information, see Run as user or developer.
Use the built-in Admins role
The built-in Admins role differs from roles that you can create:
|Aspect||Admins role||Other roles|
You add other roles in the app project.
|Default data security when you create a model||
App Maker sets model permissions for all operations on records to Admins Only.
This default also applies for associating records (through the Inherited access permission).
Model permissions remain Admins Only until you set up different model permissions.
You can change the access permission to Roles and add other roles.
|Default page security||
The default access permission is Everyone.
|Add role-based security to models, relations, and pages
(in the App Maker model and page editors)
|Add role-based security to models, relations, and pages
(in scripts and binding expressions)
|Useful for job-role and job-task administrators
(for example, administrators in different departments who have different job tasks)
|Possibly, but only if the different administrators should access all app features and data in the same way|
|Preview an app||App Maker adds you to the Admins role.
Previews only have the Admins role and the app owner is the only member of that role.
To test permissions, you must publish a deployment of your application and specify role membership.
|Publish an app||The first time you publish a deployment of an app, App Maker adds the publisher of the app to the Admins role.
You can change the membership of the Admins role while publishing a deployment or afterward.
|You can specify the membership of other roles while publishing the deployment or afterward.|
Define and use roles
Roles are sets of users that you can use to implement role-based access control. The sets can include individual Google Accounts and Google Groups.
You can use roles:
- To specify which users can access the app deployment’s data. See Secure data for more information.
- To specify which sets of people can access specific pages and view specific UI elements. See Secure the UI for more information.
- To control access to data through server scripts. Roles are one of three approaches for using access permissions to control user access. The other approaches are Script permissions and Owner permissions. If you don’t use role permissions, you don’t need to add roles.
- Open App Maker and navigate to your app project.
- Click Settings App settings.
- Under Security Access Roles, enter role names.
How to use roles
Define roles and add users and groups to them based on:
- Job roles
- Which tasks people in your organization can perform
- Which data people in your organization should have access to
For example, as an employee, you might edit your contact information. As a manager, you might approve vacation requests. As a member of the Finance department, you might view accounts receivable and accounts payable.
You create roles in the app project, but specify their members in app deployments. This lets you publish multiple versions of your app, for example testing and production versions, with different role memberships. You can modify role membership for a published app without republishing the app.
To use roles to control app security:
- Decide which roles make sense for your app, based on job roles, tasks that people perform, and requirements regarding data access.
- Add roles.
- Secure operations on records.
- Secure relations between models.
- Secure pages.
- Secure server scripts.
- (Optional) Control the visibility of UI elements.
- Publish your app and add members to roles.
Set access permissions
You must set access permissions to give specific users access to specific data and to specific parts of an app’s UI. You can set access permissions to control:
- The data users can access and the types of access they have
- The pages users can view
- The visibility of widgets (for example, a link from a user page to a page for managers could test for the Managers role)
Where you can apply access permissions
- Record access for a data model, for Create, Load, Save, and Delete operations. By checking the Advanced box, you can set access permissions for Create, Load, Save, and Delete operations separately. By unchecking the Advanced box, you can set the access permission for all operations.
- Ability to associate records in the data models (or model) on both ends of a relation
- Access to a page in the app’s UI
Access permission types
Access permissions give specific users who can run an app access to specific data and to specific pages in an app’s UI. You can limit who can run an app under Application access in the settings for a deployment.
Except as noted, you can choose among all of these access permissions for record operations (Create, Load, Save, and Delete), for relations (specifically for associating records governed by relations), and for pages.
|Admins Only||Only users who are added to the Admins role in an app’s deployment settings have access.
When you create a data model, App Maker uses Admins Only as the default permission for record operations and relations. This provides some data security until you implement the data security that is appropriate for your app.
|Everyone||If everyone in an organization can run the app, then everyone has access. Otherwise, only users who can run the app deployment have access. Specify who can run the app under Application access in the settings for a deployment.|
|Roles||Only members of the specified roles have access. You add roles in an app project. You add users to the roles in an app’s deployment settings.|
|Script||Only users that are given access by a server authorization script have access. You write the script in a script editor that appears when you choose this access permission type.|
|Owner or Roles||For record operations, only owners of records or members of the specified roles have access. App Maker decides whether a user is the owner of a record by matching the user’s email address with the contents of a field in the record. You specify which field to use.|
|Inherited||For relations, users who can save records in the data models on both ends of the relation can associate records.|
You can use more than one permission type in an app, and even for separate instances of the same type of thing. For example, a data model that contains data that can be widely known could use Everyone permission for all record operations, while a data model in the same app that contains personally identifiable information could use Roles or Script permissions.
Use default access permissions
When you create these parts of an app, App Maker gives them default permissions:
- Models—Admins Only. Restricts access to model records through the datasource to members of the Admins role.
- Relations—Inherited. Restricts the ability to associate records governed by the relation to users who can save records in the data models (or model) on both ends of the relation.
- Pages—Everyone. Everyone can view the page.
Examples of access permissions
Templates and samples use access permissions:
Access based on record ownership—The Forum Sample lets users create forums and post messages to the forums. A user who creates a forum is the owner of that forum. The
onCreateevent for a record in the Forum data model sets the value of the Owner field in the record to the user’s email address. Owner access permissions for the Save and Delete actions specify that only the owner can edit the forum or delete it.
Page for administrators—The Starter App and Material Gallery templates have a page called Admin. The page uses Admins Only permission to restrict access to the page to members of the Admins role. Role membership is defined by editing deployments.
As a core part of app security, you can secure data for all apps, even if some apps don’t contain sensitive or confidential data; for example personally identifiable information (PII).
Use these security measures to secure data
Run the app as the user or as the developer (the person who publishes an app deployment)—Choose the appropriate execution identity for the app’s use case, which determines:
Which files in Google Drive users can access—the app publisher’s files and data, or their own files and data
Which G Suite data users can access—the app publisher’s files and data, or their own files and data
The identity for API calls to Google Apps Script services; for example, to send mail and make entries in a calendar
Secure operations on records in models—Use Roles, Script, and Owner access permissions for operations on records (Create, Save, Load, and Delete). This allows specific users to perform specific types of operations on records in models. You can use one access permission type for all types of operations on records, or different access permission types.
Secure relations between models—Use Inherited, Roles, or Script access permissions for relations (or some combination). This allows specific users to associate records on both ends of the relations.
- Don’t rely on UI security for data security—UI security measures (page security and controlling the visibility of UI elements) do not secure data. UI security only controls who can do what through the UI.
- Don’t use client scripts or an application startup script for data security—Client scripts are inherently insecure. Script-based security must run on the server. Find more information and procedures for securing data here.
Secure the UI
As a part of app security, you can secure pages and UI elements—widgets or parts of widgets. Security for the UI determines whether a user can see something (or hear it with a screen reader).
Using App Maker, you can use one or both of these approaches to secure your app’s UI:
- Secure pages—Use page security to control which pages users can see. In the Property Editor , under Security, apply Roles or Script access permissions to each page.
- Secure UI elements—Use the
visibleproperty to control which elements on a page users can see. The visible property is available for widgets and for parts of compound widgets. In the Property Editor , under Display, define a binding expression for the UI element that resolves to
Find more information and procedures for securing the UI here.
Secure server scripts
If your app accesses sensitive data, you must secure server scripts. For example, a server script could ensure that the user for which data is requested is the active user in the session. App Maker doesn’t automatically check access permissions when running server scripts.
Use one or both of these measures to secure server scripts:
- Hide server scripts—Any function you define in a server script is available for all users of an app, even if you don't call the function from the UI. To write a utility function that can only be called from server scripts, append an underscore to the function name.
- Implement security in server scripts that aren't hidden—In server scripts that you don't hide, implement access permission checks.
App deployments are the apps that users run. App deployments inherit some security measures from app projects.
To secure deployments, you specify:
- Who can run the deployment
- Membership of the Admins role, and of other roles if Roles access permissions are used
- Consider who owns a deployment of an app—For a deployed app, only the app publisher is an owner of the deployment, not the app owner. An app owner can take ownership of a deployment.
- Ensure that you publish or republish the correct revision of an app—Tag app revisions so you know what revision is what.
- Thoroughly test an app before you publish it, and after you publish it—Testing should include running the app as different users with different permissions. It should also include bypassing UI security.
Specify who can run an app deployment
By default, all users in your organization can run an app deployment.
You can create a whitelist of specific users who can run an app deployment (identified directly by Google Accounts or by groups through Google Groups). Users who can't run the app see a message that informs them that they don't have access to the app.
To allow specific users to run an app deployment:
- Open App Maker and navigate to your app project.
- Click Settings Deployments.
- On the row for the deployment, click Edit.
- Under Application access, select Only allow access to specific users.
- Enter the email addresses of specific users (Google Accounts), groups (Google Groups), or both.
- Click Save. App Maker automatically republishes the deployment.
Add members to roles
If you use Roles access permissions to secure data or pages, you must add members to the roles. Specify the email addresses of individuals (Google Accounts), groups (Google Groups), or both.
To add members to a role:
- Open App Maker and navigate to the app for which you want to export data from a deployment into a Google spreadsheet.
- Click Settings Deployments.
- In the table entry for the deployment for which you want to add members to a role, click Edit.
- Under the Users with role access sections, enter the email addresses of specific users (Google Accounts) or groups (Google Groups).
- Click Save. App Maker republishes the app deployment. The republished deployment has the changes in role membership.
Previews include these security features:
- Preview URLs are private—Only the developer who previews an app can see that preview. The URL for the preview doesn’t allow anyone else to run the preview deployment.
- Preview-resident data—Data in Cloud SQL is in the preview. Multiple developers who preview a shared app project create different previews, each with its own data (or with no data if the developer hasn't added any data).
Publishing an app allows other users to run the app, subject to restrictions on who can run the app. What users can do in the app and what data users can see depend on which security measures the app developers add.
As a security precaution, in published apps for which data security has not been set up, the initial access permission for operations on records is Admins Only.
Import and export data
App Maker allows the person who published a deployment to import data into the deployment and to export data from the deployment. Both of these actions might create security risks; for example, if the data includes sensitive or confidential data, such as personally identifiable information (PII):
- Importing data—Importing data from a Google spreadsheet into a model in a deployment of an App Maker app imports all of the data into the deployment. If the Google spreadsheet contains sensitive or confidential data, then the deployment of the app also contains that information.
- Exporting data—Exporting data from models in an App Maker app exports all of the data to a Google spreadsheet. If the model contains sensitive or confidential data, then the spreadsheet also contains that information.