Torii user guide — contents

Docs · Torii

Adding assets

An asset is something Torii watches for you. There are five kinds, and each has its own way of proving that it is yours to connect.

AssetHow you add itWhat proves it is yours
RepositorySettings, Sources, Connect GitHubYou install the Torii app on your code host and pick repositories.
HostSettings, Hosts, Add hostA single-use enrolment token, redeemed with one of your API tokens.
Cloud accountSettings, Cloud accounts, Connect accountA role in your account that trusts Torii and an external id Torii issued to you.
DomainSettings, Verified domains, Add domainA DNS record that only the owner of the domain can publish.
HostnameCannot be added yetIt will sit under a verified domain.

Adding an asset needs the owner, admin or security role. Removing one needs owner or admin. Every role can see them. Organisations and roles has the full table. The console shows the add buttons to everyone; if your role does not allow the change, it is refused when you submit.

Repositories

  1. Open Settings and find the Sources card.
  2. Choose Connect GitHub. The dialog explains the three steps; choose Continue to GitHub to install the Torii app on your organisation there.
  3. Back in Torii, the installation is listed in the Sources card. Choose Manage repositories on its row. A side panel lists every repository the app can see, each with a checkbox. Selection starts at none.
  4. Tick a repository to add it. The console confirms with Repository added — first scan queued. You do not start the first scan by hand.
  5. Untick a repository to stop. The console confirms with Repository removed.

The app has read-only access to the repositories you select. Torii does not use a personal access token of yours, and the short-lived tokens the app works with are created on the server and never reach your browser. Connected repositories are listed under Supply chain.

The Repositories column in the Sources card shows Scanning once at least one repository is selected, None selected otherwise, and Suspended or Removed if the app was suspended or uninstalled on GitHub. On a suspended or removed installation you can still stop scanning a repository, but new selections are refused until the app is reconnected.

Hosts

A host is added by installing the agent on it and enrolling it. That has its own page: Enrolling a host.

Enrolled hosts are listed in Settings under Hosts and in the Runtime view, and through the API:

List hosts
curl -sS "$TORII_CONTROL_PLANE_URL/v1/hosts" \
  -H "Authorization: Bearer $TORII_API_TOKEN"

Cloud accounts

Torii connects to a cloud account by assuming a role that you create in your own account. It never receives or stores a long-lived credential of yours: no access key, no client secret, no service account key file. The table that records the connection has no column that could hold one.

  1. Open Settings, find Cloud accounts and choose Connect account.
  2. Pick the Provider and fill in the two or three identifiers it asks for, then choose Connect account.
  3. The connection is shown as Pending trust, with an External ID — shown once and the trust policy to apply. Copy the external id now.
  4. In your own cloud console, create the role with that trust policy and the read-only permissions.
ProviderAccount identifierRole identifierAlso asked for
AWSAWS account ID, 12 digitsRole ARNNothing
AzureSubscription IDService principal object IDDirectory (tenant) ID, required
Google CloudProject IDService account emailOrganisation ID, optional
Oracle CloudTenancy OCIDGroup OCIDCompartment OCID, optional

Connecting the same account twice is refused with That is already connected to your organisation.

Why Torii chooses the external id

Torii is trusted by many customers through one identity of its own. Your role name and account number are not secrets. Without a second condition, another Torii customer who learned them could ask Torii to scan your account and be shown the result. The external id is that second condition: your trust policy accepts Torii only when it presents the value issued to you. If customers could choose their own value, an attacker would simply choose yours, so Torii generates it and the API has no field for supplying one.

If you lose the external id, rotate it through the API and update your trust policy. Rotating sets the connection back to pending trust. Torii will not display the old one again, and it is not written to the audit log. There is no rotate button in the console.

Rotate the external id
curl -sS -X POST "$TORII_CONTROL_PLANE_URL/v1/cloud-accounts/$ACCOUNT_ID/external-id/rotate" \
  -H "Authorization: Bearer $TORII_API_TOKEN"

What the role lets Torii read

Configuration and metadata: which resources exist, how they are set up and who can reach them. The default permissions exclude anything that returns the contents of something, such as the value of a secret. You can remove the access at any time by deleting the role in your own console, without asking Torii.

Each connected account has a scan schedule: weekly (the default), daily or off. It is read and changed through the API, at /v1/cloud-accounts/ followed by the account id and /schedule; changing it needs a role that may change policy.

Domains

Before Torii scans anything from the outside, you have to prove you own the domain. Without that step the product would be a reconnaissance service that anyone could point at anyone.

  1. Open Settings, find Verified domains and choose Add domain.
  2. Enter a registrable domain such as example.com. Not a URL and not a wildcard. Choose Add domain.
  3. Torii shows a DNS record to create with your DNS provider: a TXT record named _torii-challenge.example.com with a value Torii generated.

The value is a public challenge, not a credential. It is meant to be published, and the API returns it again whenever you list your domains.

Hostnames

A hostname is a single public name, such as app.example.com, that Torii would check from the outside once its domain is verified. The API can list and remove hostnames at /v1/hostnames. There is no way to add one yet, in the console or the API.

Removing an asset

Owners and admins can remove a repository, host, cloud account, hostname or domain through the API. Each path in the table below answers GET for the list, GET with an id for one item, and DELETE with an id to remove it. In the console you can deselect a repository from a connection; there are no remove buttons for the other kinds yet.

Remove a host
curl -sS -X DELETE "$TORII_CONTROL_PLANE_URL/v1/hosts/$HOST_ID" \
  -H "Authorization: Bearer $TORII_API_TOKEN"
AssetAPI path
Repositories/v1/repositories
Hosts/v1/hosts
Cloud accounts/v1/cloud-accounts
Domains/v1/domains
Hostnames/v1/hostnames