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 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 canvasWhat happens when a table is not allowed
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:
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
Default SSL mode (prefer):
Forcing SSL connection:
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?