For the complete documentation index, see llms.txt. This page is also available as Markdown.

Security

Table access controls for API keys, and securing the database connection.

Table access

An API key is restricted to a set of tables: the namespaces and tables that key is allowed to read. Whoever generates the key picks those tables, and the DAP API enforces the restriction on every request for table data. Listing namespaces and tables, and fetching schemas, are not restricted by table.

The DAP CLI requests an access token per table it is about to read, naming that table, and checks the access the Identity Service actually granted before using the token. A table the key is not allowed to read is reported as an error rather than silently returning no data.

Table access is not an OAuth scope. An OAuth scope describes what an access token may do; table access describes which tables it may do it to. The two are separate, and the DAP API expresses table access through the OAuth 2.0 Rich Authorization Requests field (authorization_details), not through the scope parameter. Table access is also unlike Canvas developer key scopes: it is fixed when the key is generated and cannot be edited, and there is nothing to select at token request time.

Table access is fixed when the key is generated

The tables are chosen when the key is generated and cannot be edited afterwards. Two consequences:

  • A table added to a namespace later does not become readable by an existing key.

  • Widening access means generating a new key for the wider set of tables.

Discovering namespaces and tables

Use dap list to see what exists:

dap list namespaces                     # every namespace
dap list tables --namespace canvas      # every table in canvas

dap list is not filtered by table access. Both subcommands return every namespace and table the DAP API exposes, regardless of what your key may read — the names themselves carry no sensitive data and are also published in the dataset reference. A name appearing here does not mean your key can read that table's data.

What happens when a table is not allowed

Command
Behavior

Unaffected — lists every namespace and table regardless of table access

Succeeds — schemas are metadata and are not restricted per table

Data commands on a single table

Fail with an error naming the table

Data commands on several tables

The disallowed table fails; the remaining tables still run. The command exits non-zero

Data commands are snapshot, incremental, initdb and syncdb.

The error for a table the key was not granted reads:

When several tables are requested and some fail, the CLI reports a summary and exits with code 5:

Regional API base URL

The DAP CLI requires the base URL of your regional API Gateway, set through --base-url or the DAP_API_URL environment variable. There is no default. The Identity Service shows the correct regional URL for your key when you generate it. The region must match your Canvas instance's region:

Region
API base URL

us-east-1 (iad)

https://us-east-1.api-gateway.instructure.com

us-west-2 (pdx)

https://us-west-2.api-gateway.instructure.com

ca-central-1 (yul)

https://ca-central-1.api-gateway.instructure.com

eu-west-1 (dub)

https://eu-west-1.api-gateway.instructure.com

eu-central-1 (fra)

https://eu-central-1.api-gateway.instructure.com

ap-southeast-1 (sin)

https://ap-southeast-1.api-gateway.instructure.com

ap-southeast-2 (syd)

https://ap-southeast-2.api-gateway.instructure.com

Omitting both the flag and the environment variable fails with:

Secure Database Connection

The DAP client library supports secure connections to databases using SSL/TLS. You can specify the SSL mode by using the ssl parameter in the connection string.

Supported SSL modes

  • disable: SSL is disabled.

  • prefer (default): Attempts an SSL connection first; falls back to a non-SSL connection if SSL fails.

  • allow: Attempts a non-SSL connection first; retries with SSL if the first attempt fails.

  • require: Forces an SSL connection, but certificate verification errors are ignored.

  • verify-ca: Forces an SSL connection and verifies that the server certificate is issued by a trusted certificate authority (CA).

  • verify-full: Forces an SSL connection, verifies that the server certificate is issued by a trusted CA, and ensures the server's hostname matches the certificate.

Examples

  1. Default SSL mode (prefer):

  2. Forcing SSL connection:

  3. Forcing SSL connection and verifying the server certificate:

Important Notes

verify-ca and verify-full modes require the CA certificate to be installed on your system to verify the server certificate. If the CA certificate is not installed, the connection will fail.

The location of CA certificates depends on the operating system:

  • Linux: CA certificates are typically stored in /etc/ssl/certs/ or similar directories.

  • Windows: CA certificates are managed in the Windows Certificate Store.

  • macOS: CA certificates are stored in the Keychain.

Last updated

Was this helpful?