curl --request POST \
--url https://app.trustivan.com/api/v1/git-credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"registry": "ghcr.io",
"username": "<string>",
"secret": "<string>"
}
'import requests
url = "https://app.trustivan.com/api/v1/git-credentials"
payload = {
"name": "<string>",
"registry": "ghcr.io",
"username": "<string>",
"secret": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
registry: 'ghcr.io',
username: '<string>',
secret: '<string>'
})
};
fetch('https://app.trustivan.com/api/v1/git-credentials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/git-credentials"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"registry\": \"ghcr.io\",\n \"username\": \"<string>\",\n \"secret\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"kind": "registry",
"registry": "ghcr.io",
"scheme": "basic",
"status": "unverified",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"username": "<string>",
"external_id": "<string>",
"status_reason": "<string>",
"last_verified_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"rotated_at": "2023-11-07T05:31:56Z",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Store a repository credential
registry is the git HOST (github.com, gitlab.example.com:8443),
and it is the matching key: a repository scan presents the credential
stored for the host its URL names, never one selected by the caller.
The token is encrypted with the deployment’s keyring and is injected only into the SSRF-guarded fetch for that host. It is never written to the process environment, never placed in a clone URL, never passed as a command-line argument, and never offered to a redirect target on a different host.
Requires credentials:manage and a human principal.
curl --request POST \
--url https://app.trustivan.com/api/v1/git-credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"registry": "ghcr.io",
"username": "<string>",
"secret": "<string>"
}
'import requests
url = "https://app.trustivan.com/api/v1/git-credentials"
payload = {
"name": "<string>",
"registry": "ghcr.io",
"username": "<string>",
"secret": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
registry: 'ghcr.io',
username: '<string>',
secret: '<string>'
})
};
fetch('https://app.trustivan.com/api/v1/git-credentials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/git-credentials"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"registry\": \"ghcr.io\",\n \"username\": \"<string>\",\n \"secret\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"kind": "registry",
"registry": "ghcr.io",
"scheme": "basic",
"status": "unverified",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"username": "<string>",
"external_id": "<string>",
"status_reason": "<string>",
"last_verified_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"rotated_at": "2023-11-07T05:31:56Z",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Authorizations
Body
The body for both /registry-credentials and /git-credentials. Which
schemes are accepted depends on which surface you POST to, and a scheme
offered to the wrong one is refused:
| scheme | /registry-credentials | /git-credentials | username holds | secret |
|---|---|---|---|---|
basic | yes | yes | the username | the password or token |
token | yes | yes | nothing | the token |
bearer | no | yes | nothing | an Authorization: Bearer token (Bitbucket Data Center HTTP access tokens) |
assume_role | Amazon ECR hosts only | no | the role ARN | not accepted |
aws_access_key | Amazon ECR hosts only | no | the access key id | the secret access key |
azure_service_principal | *.azurecr.io only | no | <tenant-id>/<client-id> | the client secret |
gcp_service_account | Artifact Registry and GCR hosts only | no | nothing | the service-account key JSON |
The last four are exchanged by the server for a short-lived registry
login at scan time; a long-lived registry password is never derived from
them and never stored. assume_role stores no secret at all: the
role's trust policy must require the external_id the response returns,
which is what stops another tenant naming the same role.
A scheme whose host does not match (azure_service_principal against
ghcr.io, say) is refused at save time rather than at scan time, so a
misconfiguration is visible when it is made.
Response
Stored. The response carries status, never the secret.
A stored registry credential, without its secret. There is no read path for the plaintext at any permission, so no response anywhere carries one. A customer who has lost their token rotates it.
registry for a credential served by /registry-credentials,
git for one served by /git-credentials. The listings return
only their own kind, but the routes that take an {id} reach any
credential the organization holds, so rotating the credential
behind a cloud account or a cluster answers with cloud or
kubernetes. The two surfaces share
this schema and are separate stores: github.com serves both a
registry and a repository host, the tokens differ, and they are
rotated on different schedules.
registry, git, cloud, kubernetes The canonicalised host this credential authenticates to, such as
ghcr.io or registry.example.com:5000, or github.com or
bitbucket.example.com:8443 for a git credential. Also the
matching key: a credential is selected for a scan by the host of
the image or repository being scanned, never named by the caller.
"ghcr.io"
unverified has never authenticated, active last did so
successfully, invalid was rejected by the registry, disabled
was switched off by an administrator. A timeout or an unreachable
host leaves the status untouched rather than marking it invalid.
unverified, active, invalid, disabled Stored in plaintext deliberately: it is not a secret, and it is
what makes "which account is this" answerable. What it holds
depends on the scheme: a username for basic, the role ARN for
assume_role, the access key id for aws_access_key,
<tenant-id>/<client-id> for azure_service_principal. Absent for
token, bearer and gcp_service_account.