• Applicable Software: MokoGIT
  • Min Version Number: 02.89.01
  • Max Version Number: Not Applicable

Why this matters

The single most damaging thing a leaked credential can do is make itself permanent. If an API token can create more tokens, then revoking the original is not enough - the attacker simply mints a new key, with a new secret, a new name, and its own expiration, before you cut off the first, and your clean-up never ends. The token_management scope exists to break that chain. By making token creation a distinct, non-inheritable permission, MokoGIT guarantees that a token obtained by automation or leaked from a CI job cannot bootstrap itself into a persistent foothold.

This is the anti-self-replication property: the authority to create tokens is held only by a human acting through the signed-in web UI, or an equivalent session or basic-auth context, never by a bearer token acting on its own.

How it works

There are three independent mechanisms that together enforce the guarantee. Each one on its own would help; together they are belt and suspenders.

1. Excluded from the all scope and from every umbrella

Most MokoGIT scopes roll up. Granting write repository access implicitly grants its children (contents, actions, wiki, secrets, releases, and so on), and the all scope is the union of every write scope. The token_management scope is deliberately left out of all of that. It is not part of all, it is not a child of any umbrella, and no other scope implies it. The only way a token can carry token_management is if a human explicitly selects it when creating that token in the web UI. Granting a token everything (all) still does not let it manage tokens.

2. Stripped from API-issued tokens (the privilege ceiling)

When one token is used to create another through the API, MokoGIT enforces a strict privilege ceiling: the new token's scopes must be a subset of the creating token's scopes. There is no path to escalation. Because token_management is never part of all and is never granted implicitly, an API caller's token cannot itself hold token_management in the first place; that scope is only grantable in the UI. And even if it could, the subset rule means it could only pass along a permission it already has, never add one. The practical effect is that an API-issued token can never hold the token-management permission, so it can never create a further token. The replication chain stops at the first API-created token.

3. UI-only grant surface

In the Access Tokens settings page, scopes are shown grouped. The token-management permission appears in its own clearly labelled group - Token Management (grant with care) - separate from the normal Repository, Organization, and User groups and separate from the general Administration group. It is shown so a human can consciously grant it, but it is never pre-selected, never part of a preset, and never bundled into a broader choice. You have to deliberately tick it.

What a token with this scope can do

Token management maps to the token CRUD endpoints under your account:

  • read:token_management - list your existing access tokens and their metadata (name, scopes, last-used, expiration).
  • write:token_management - create, edit scopes in place, rotate the secret of, and delete access tokens.

As with every scope, write implies read. Even with this scope, the privilege ceiling still applies to anything it creates: a newly minted token can never exceed the scopes, or the repository allow-list, of the token or session that created it.

Step-by-step: granting token management in the web UI

  1. Sign in to MokoGIT and open User Settings (your avatar, top right, then Settings).
  2. Go to Applications, then Access Tokens.
  3. Enter a clear Token Name that says where the token will be used.
  4. Under Scopes, find the Token Management (grant with care) group and tick read or write as needed. Grant write only to a tool that genuinely must create or rotate tokens.
  5. Click Generate Token and copy the value immediately - it is shown only once.

Creating a token via the API

The token-create endpoint lives under your account, at the path /api/v1/users/{username}/tokens. The creating identity must be self or admin and must carry the user scope; write routes additionally require a real token (not a public-only one). Send a JSON body naming the token and listing only scopes the creating identity already holds, for example:

{
  "name": "ci-deploy",
  "scopes": ["write:contents", "write:actions"]
}

If you include token_management in that scopes list from an API call, it cannot take effect: an API-issued token can never hold it, and the subset ceiling rejects any request for scopes the caller does not already have. In practice the only way to obtain a token-management-capable token is to create it in the web UI as a signed-in human.

Caveats

  • Grant with care. A token with write:token_management is powerful - it can create and rotate keys. Give it only to trusted, well-audited automation, and prefer the UI-created, human-held key for day-to-day administration.
  • It is not an admin substitute. Token management governs token CRUD only; it does not grant site administration, repository, or organization access. Those remain separate scopes.
  • The subset ceiling is always in force. Even a token-management-capable identity cannot create a token broader than itself, nor broaden a repository-scoped allow-list.
  • Revocation is immediate. Deleting a token takes effect at once; any tool using it starts receiving authentication errors and must be updated.

Get help

Open a support ticket or call (931) 820-0265.