curl --request PUT \
--url https://app.trustivan.com/api/v1/git-credentials/{id}/secret \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"secret": "<string>",
"name": "<string>",
"username": "<string>"
}
'import requests
url = "https://app.trustivan.com/api/v1/git-credentials/{id}/secret"
payload = {
"secret": "<string>",
"name": "<string>",
"username": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({secret: '<string>', name: '<string>', username: '<string>'})
};
fetch('https://app.trustivan.com/api/v1/git-credentials/{id}/secret', 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/{id}/secret"
payload := strings.NewReader("{\n \"secret\": \"<string>\",\n \"name\": \"<string>\",\n \"username\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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"
}Rotate a repository credential's secret
In place, so everything referring to the credential follows the new
value. The host cannot be changed here. The status resets to
unverified, because the new secret has not been proven.
curl --request PUT \
--url https://app.trustivan.com/api/v1/git-credentials/{id}/secret \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"secret": "<string>",
"name": "<string>",
"username": "<string>"
}
'import requests
url = "https://app.trustivan.com/api/v1/git-credentials/{id}/secret"
payload = {
"secret": "<string>",
"name": "<string>",
"username": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({secret: '<string>', name: '<string>', username: '<string>'})
};
fetch('https://app.trustivan.com/api/v1/git-credentials/{id}/secret', 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/{id}/secret"
payload := strings.NewReader("{\n \"secret\": \"<string>\",\n \"name\": \"<string>\",\n \"username\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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 registry cannot be changed here: rotation replaces a secret, never
the thing it authenticates to. The status resets to unverified,
because the new secret has not been proven.
Response
Rotated.
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.