Skip to content

Secrets and identity

Team secrets by name, secret injection into outbound requests, and identity tokens.

Every method shows the same operation in each SDK; pick a language once and every tab on the site follows it.

Python TypeScript Go: Secrets Ruby Java

The team’s secrets: Secret.create(name, value), update, get_info, exists, list and destroy.

def create(cls, name: str, value: str, description: str | None=None, *, metadata: dict[str, str] | None=None, client: 'SandboxClient | None'=None) -> SecretInfo
static

Store a new secret, with an optional description and metadata (up to 16 string pairs); raises ConflictError (ALREADY_EXISTS) when the team already has one named name.

Parameter Type Default
name str
value str
description str | None None
metadata dict[str, str] | None None
client 'SandboxClient | None' None

Returns SecretInfo

Raises ConflictError

Source: sdk/python/svm/secrets.py:87
def list(cls, *, page_size: int | None=None, page_token: str | None=None, client: 'SandboxClient | None'=None) -> 'SandboxPage[SecretInfo]'
static

One page of the team’s secrets, by name; pass its next_page_token as page_token for the next page (None on the last one).

Parameter Type Default
page_size int | None None
page_token str | None None
client 'SandboxClient | None' None

Returns 'SandboxPage[SecretInfo]'

Source: sdk/python/svm/secrets.py:122

Not in the Python SDK’s Secret.

def destroy(cls, name: str, *, client: 'SandboxClient | None'=None) -> None
static

Delete the secret named name; the API’s NotFoundError when there is none.

Parameter Type Default
name str
client 'SandboxClient | None' None

Raises NotFoundError

Source: sdk/python/svm/secrets.py:133
def exists(cls, name: str, *, client: 'SandboxClient | None'=None) -> bool
static
Parameter Type Default
name str
client 'SandboxClient | None' None

Returns bool

Source: sdk/python/svm/secrets.py:118
def fill(name: str) -> str
static

The placeholder for the secret name: put it in a sandbox’s environment or a request header, and the egress proxy replaces it with the secret’s current value in HTTPS requests to the hosts an egress rule with Secret.inject(name, headers) allows (update_egress). Nothing is sent to the API, and the value never reaches the sandbox.

Parameter Type Default
name str

Returns str

Source: sdk/python/svm/secrets.py:140
def get_info(cls, name: str, *, client: 'SandboxClient | None'=None) -> SecretInfo
static

The secret named name (GET /v2/secrets/{name}); raises NotFoundError when there is none.

Parameter Type Default
name str
client 'SandboxClient | None' None

Returns SecretInfo

Raises NotFoundError

Source: sdk/python/svm/secrets.py:111
def iam_token(audience: str, token_type: str='jwt') -> IamToken
static

A workload identity token for audience (an OIDC token of the sandbox, jwt is the only type); its placeholder and inject(headers) work like fill and Secret.inject.

Parameter Type Default
audience str
token_type str 'jwt'

Returns IamToken

Source: sdk/python/svm/secrets.py:160
def inject(name: str, headers: 'list[str]', *, placeholder: str | None=None) -> dict[str, Any]
static

The inject object for an egress rule that allows the hosts a secret may go to: replace placeholder (default Secret.fill(name)) in headers with the secret name. Example: {"action": "allow", "domain": "api.github.com", "inject": Secret.inject("GH_TOKEN", ["Authorization"])}. One injection per rule: only the first rule that matches a request injects, so a second inject rule for the same host is ignored and its placeholder reaches the server.

Parameter Type Default
name str
headers 'list[str]'
placeholder str | None None

Returns dict[str, Any]

Source: sdk/python/svm/secrets.py:150
def update(cls, name: str, value: str, description: str | None=None, *, metadata: dict[str, str] | None=None, client: 'SandboxClient | None'=None) -> SecretInfo
static

Replace the value of an existing secret (a new version); raises SecretNotFoundError when there is none named name. The description and metadata stay as they are unless you pass new ones (metadata={} clears the metadata). Running sandboxes see the new value on their next use of it.

Parameter Type Default
name str
value str
description str | None None
metadata dict[str, str] | None None
client 'SandboxClient | None' None

Returns SecretInfo

Raises SecretNotFoundError

Source: sdk/python/svm/secrets.py:98
Python TypeScript Go Ruby Java

One secret as the API reports it; never its value.

Property Type Description
created_at str
description str | None
metadata dict[str, str]
name str
updated_at str | None
version int | None

Not in the Python SDK’s SecretInfo.

def from_json(cls, value: dict[str, Any]) -> 'SecretInfo'
static
Parameter Type Default
value dict[str, Any]

Returns 'SecretInfo'

Source: sdk/python/svm/secrets.py:39
Python TypeScript Go Ruby Java

A workload identity token the egress proxy can put into requests (Secret.iam_token): an OIDC token of the sandbox for audience. placeholder is what the guest sends; inject(headers) is the inject object of an egress rule.

Property Type Description
audience str
token_type str

Not in the Python SDK’s IamToken.

Not in the Python SDK’s IamToken.

def inject(self, headers: 'list[str]', *, placeholder: str | None=None) -> dict[str, Any]

The inject object for an egress rule: replace placeholder (default self.placeholder) in headers with a fresh token of the sandbox.

Parameter Type Default
headers 'list[str]'
placeholder str | None None

Returns dict[str, Any]

Source: sdk/python/svm/secrets.py:72
placeholder: str

Property (read-only).