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.
Secret
Section titled “Secret”The team’s secrets: Secret.create(name, value), update, get_info, exists, list and destroy.
create()
Section titled “create()”def create(cls, name: str, value: str, description: str | None=None, *, metadata: dict[str, str] | None=None, client: 'SandboxClient | None'=None) -> SecretInfoStore 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
sdk/python/svm/secrets.py:87static async create(name: string, value: string, options: SecretOptions = {}, client: SandboxClient = new SandboxClient()): Promise<SecretInfo>Store a new secret; rejects with ConflictError (ALREADY_EXISTS) when the team already has one named name.
| Parameter | Type | Default |
|---|---|---|
name |
string |
|
value |
string |
|
options |
SecretOptions |
{} |
client |
SandboxClient |
new SandboxClient() |
Returns Promise<SecretInfo>
Raises ConflictError
sdk/typescript/src/secret.ts:89func (ss *Secrets) Create(ctx context.Context, name, value string, options SecretOptions) (SecretInfo, error)Create stores a new secret; an existing name is an ALREADY_EXISTS error (errors.Is ErrConflict).
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
|
value |
string |
|
options |
SecretOptions |
Returns (SecretInfo, error)
Raises ErrConflict
sdk/go/secret.go:56def create(name, value, description: nil, metadata: nil, client: Client.new)Stores 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 |
||
value |
||
description |
nil |
|
metadata |
nil |
|
client |
Client.new |
Raises ConflictError
sdk/ruby/lib/svm/secret.rb:82public static Info create(Client client, String name, String value, String description, Map<String, String> metadata)public static Info create(Client client, String name, String value, String description)public static Info create(Client client, String name, String value)Stores a new secret (description and metadata may be null; metadata is up to 16 string pairs); throws ApiException.Conflict (ALREADY_EXISTS) when the name is taken.
| Parameter | Type | Default |
|---|---|---|
client |
Client |
|
name |
String |
|
value |
String |
|
description |
String |
optional |
metadata |
Map<String, String> |
optional |
Returns Info
sdk/java/src/main/java/dev/svm/sandbox/Secret.java:107list()
Section titled “list()”def list(cls, *, page_size: int | None=None, page_token: str | None=None, client: 'SandboxClient | None'=None) -> 'SandboxPage[SecretInfo]'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]'
sdk/python/svm/secrets.py:122static async list(options: { pageSize?: number; pageToken?: string } = {}, client: SandboxClient = new SandboxClient()): Promise<SandboxPage<SecretInfo>>One page of the team’s secrets, by name; pass its nextPageToken as pageToken for the next page (absent on the last one).
| Parameter | Type | Default |
|---|---|---|
options |
{ pageSize?: number; pageToken?: string } |
{} |
client |
SandboxClient |
new SandboxClient() |
Returns Promise<SandboxPage<SecretInfo>>
sdk/typescript/src/secret.ts:117func (ss *Secrets) List(ctx context.Context, options ListSecretsOptions) (SecretPage, error)List returns one page of the team’s secrets, by name; pass its NextPageToken as PageToken for the next page.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
options |
ListSecretsOptions |
Returns (SecretPage, error)
sdk/go/secret.go:104def list(page_size: nil, page_token: nil, client: Client.new)One page of the team’s secrets, by name: <tt>{ items:, next_page_token: }</tt>; pass next_page_token back as page_token for the next page (nil on the last).
| Parameter | Type | Default |
|---|---|---|
page_size |
nil |
|
page_token |
nil |
|
client |
Client.new |
sdk/ruby/lib/svm/secret.rb:107public static SandboxPage<Info> list(Client client)public static SandboxPage<Info> list(Client client, int pageSize, String pageToken)The first page of the team’s secrets, by name; see list(Client, int, String).
| Parameter | Type | Default |
|---|---|---|
client |
Client |
|
pageSize |
int |
optional |
pageToken |
String |
optional |
Returns SandboxPage<Info>
sdk/java/src/main/java/dev/svm/sandbox/Secret.java:138build_inject()
Section titled “build_inject()”Not in the Python SDK’s Secret.
Not in the TypeScript SDK’s Secret.
Not in the Go SDK’s Secrets.
def build_inject(source, headers, placeholder):nodoc:
| Parameter | Type | Default |
|---|---|---|
source |
||
headers |
||
placeholder |
sdk/ruby/lib/svm/secret.rb:70Not in the Java SDK’s Secret.
destroy()
Section titled “destroy()”def destroy(cls, name: str, *, client: 'SandboxClient | None'=None) -> NoneDelete the secret named name; the API’s NotFoundError when there is none.
| Parameter | Type | Default |
|---|---|---|
name |
str |
|
client |
'SandboxClient | None' |
None |
Raises NotFoundError
sdk/python/svm/secrets.py:133static async destroy(name: string, client: SandboxClient = new SandboxClient()): Promise<void>Delete the secret named name; the API’s NotFoundError when there is none.
| Parameter | Type | Default |
|---|---|---|
name |
string |
|
client |
SandboxClient |
new SandboxClient() |
Raises NotFoundError
sdk/typescript/src/secret.ts:126func (ss *Secrets) Destroy(ctx context.Context, name string) errorDestroy deletes the secret named name; the API’s NOT_FOUND error when there is none.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
Returns error
sdk/go/secret.go:130def destroy(name, client: Client.new)Deletes the secret named name; the API’s NotFoundError when there is none.
| Parameter | Type | Default |
|---|---|---|
name |
||
client |
Client.new |
Raises NotFoundError
sdk/ruby/lib/svm/secret.rb:115public static void destroy(Client client, String name)Deletes the secret named name; the API’s ApiException.NotFound when there is none.
| Parameter | Type | Default |
|---|---|---|
client |
Client |
|
name |
String |
sdk/java/src/main/java/dev/svm/sandbox/Secret.java:158exists()
Section titled “exists()”def exists(cls, name: str, *, client: 'SandboxClient | None'=None) -> bool| Parameter | Type | Default |
|---|---|---|
name |
str |
|
client |
'SandboxClient | None' |
None |
Returns bool
sdk/python/svm/secrets.py:118static async exists(name: string, client: SandboxClient = new SandboxClient()): Promise<boolean>| Parameter | Type | Default |
|---|---|---|
name |
string |
|
client |
SandboxClient |
new SandboxClient() |
Returns Promise<boolean>
sdk/typescript/src/secret.ts:112func (ss *Secrets) Exists(ctx context.Context, name string) (bool, error)Exists reports whether the team has a secret named name.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
Returns (bool, error)
sdk/go/secret.go:98def exists?(name, client: Client.new)| Parameter | Type | Default |
|---|---|---|
name |
||
client |
Client.new |
sdk/ruby/lib/svm/secret.rb:101public static boolean exists(Client client, String name)| Parameter | Type | Default |
|---|---|---|
client |
Client |
|
name |
String |
Returns boolean
sdk/java/src/main/java/dev/svm/sandbox/Secret.java:135fill()
Section titled “fill()”def fill(name: str) -> strThe 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
sdk/python/svm/secrets.py:140static fill(name: string): stringThe 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 (updateEgress). Nothing is sent to the API, and the value never reaches the sandbox.
| Parameter | Type | Default |
|---|---|---|
name |
string |
Returns string
sdk/typescript/src/secret.ts:133Not in the Go SDK’s Secrets.
def fill(name)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 allows (Sandbox#update_egress). Nothing is sent to the API, and the value never reaches the sandbox.
| Parameter | Type | Default |
|---|---|---|
name |
sdk/ruby/lib/svm/secret.rb:49public static String fill(String name)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 inject allows (Sandbox.updateEgress). Nothing is sent to the API, and the value never reaches the sandbox.
| Parameter | Type | Default |
|---|---|---|
name |
String |
Returns String
sdk/java/src/main/java/dev/svm/sandbox/Secret.java:29get_info()
Section titled “get_info()”def get_info(cls, name: str, *, client: 'SandboxClient | None'=None) -> SecretInfoThe 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
sdk/python/svm/secrets.py:111static async getInfo(name: string, client: SandboxClient = new SandboxClient()): Promise<SecretInfo>The secret named name (GET /v2/secrets/{name}); rejects with NotFoundError when there is none.
| Parameter | Type | Default |
|---|---|---|
name |
string |
|
client |
SandboxClient |
new SandboxClient() |
Returns Promise<SecretInfo>
Raises NotFoundError
sdk/typescript/src/secret.ts:108func (ss *Secrets) GetInfo(ctx context.Context, name string) (SecretInfo, error)GetInfo returns the secret named name (GET /v2/secrets/{name}); a missing one is a NOT_FOUND error (errors.Is ErrNotFound).
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
Returns (SecretInfo, error)
Raises ErrNotFound
sdk/go/secret.go:86def get_info(name, client: Client.new)The secret named name (GET /v2/secrets/{name}); raises NotFoundError when there is none.
| Parameter | Type | Default |
|---|---|---|
name |
||
client |
Client.new |
Raises NotFoundError
sdk/ruby/lib/svm/secret.rb:97public static Info getInfo(Client client, String name)The secret named name (GET /v2/secrets/{name}); throws ApiException.NotFound when there is none.
| Parameter | Type | Default |
|---|---|---|
client |
Client |
|
name |
String |
Returns Info
sdk/java/src/main/java/dev/svm/sandbox/Secret.java:133iam_token()
Section titled “iam_token()”def iam_token(audience: str, token_type: str='jwt') -> IamTokenA 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
sdk/python/svm/secrets.py:160static iamToken(audience: string, tokenType: "jwt" = "jwt"): IamTokenA workload identity token for audience (an OIDC token of the sandbox; jwt is the only type).
| Parameter | Type | Default |
|---|---|---|
audience |
string |
|
tokenType |
"jwt" |
"jwt" |
Returns IamToken
sdk/typescript/src/secret.ts:147Not in the Go SDK’s Secrets.
def iam_token(audience, token_type = "jwt")A workload identity token for audience (an OIDC token of the sandbox; “jwt” is the only type).
| Parameter | Type | Default |
|---|---|---|
audience |
||
token_type |
"jwt" |
sdk/ruby/lib/svm/secret.rb:65public static IamToken iamToken(String audience, String tokenType)A workload identity token for audience (an OIDC token of the sandbox); tokenType null means "jwt", the only type.
| Parameter | Type | Default |
|---|---|---|
audience |
String |
|
tokenType |
String |
Returns IamToken
sdk/java/src/main/java/dev/svm/sandbox/Secret.java:45inject()
Section titled “inject()”def inject(name: str, headers: 'list[str]', *, placeholder: str | None=None) -> dict[str, Any]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]
sdk/python/svm/secrets.py:150static inject(name: string, headers: string[], placeholder?: string): EgressInjectThe 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. 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 |
string |
|
headers |
string[] |
|
placeholder |
string |
optional |
Returns EgressInject
sdk/typescript/src/secret.ts:141Not in the Go SDK’s Secrets.
def inject(name, headers, placeholder: nil)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, e.g. <tt>{ action: “allow”, domain: “api.github.com”, inject: Secret.inject(“GH_TOKEN”, [“Authorization”]) }</tt>. 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 |
||
headers |
||
placeholder |
nil |
sdk/ruby/lib/svm/secret.rb:59public static Map<String, Object> inject(String name, List<String> headers, String placeholder)The inject object for an egress rule that allows the hosts a secret may go to: replace placeholder (null means fill) in headers with the secret name. 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 |
String |
|
headers |
List<String> |
|
placeholder |
String |
Returns Map<String, Object>
sdk/java/src/main/java/dev/svm/sandbox/Secret.java:39update()
Section titled “update()”def update(cls, name: str, value: str, description: str | None=None, *, metadata: dict[str, str] | None=None, client: 'SandboxClient | None'=None) -> SecretInfoReplace 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
sdk/python/svm/secrets.py:98static async update(name: string, value: string, options: SecretOptions = {}, client: SandboxClient = new SandboxClient()): Promise<SecretInfo>Replace the value of an existing secret (a new version); rejects with NotFoundError when there is none named name. The description and metadata stay as they are unless options has new ones (metadata: {} clears the metadata). Running sandboxes see the new value on their next use of it.
| Parameter | Type | Default |
|---|---|---|
name |
string |
|
value |
string |
|
options |
SecretOptions |
{} |
client |
SandboxClient |
new SandboxClient() |
Returns Promise<SecretInfo>
Raises NotFoundError, SecretNotFoundError
sdk/typescript/src/secret.ts:98func (ss *Secrets) Update(ctx context.Context, name, value string, options SecretOptions) (SecretInfo, error)Update replaces the value of an existing secret (a new version); a missing name is a NOT_FOUND error (errors.Is ErrNotFound). The description and metadata stay as they are unless options has new ones: an empty Description keeps the current one, a nil Metadata keeps the current pairs and an empty non-nil map clears them. Running sandboxes see the new value on their next use of it.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
|
value |
string |
|
options |
SecretOptions |
Returns (SecretInfo, error)
Raises ErrNotFound
sdk/go/secret.go:68def update(name, value, description: nil, metadata: nil, client: Client.new)Replaces the value of an existing secret (a new version); raises NotFoundError 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 |
||
value |
||
description |
nil |
|
metadata |
nil |
|
client |
Client.new |
Raises NotFoundError
sdk/ruby/lib/svm/secret.rb:91public static Info update(Client client, String name, String value, String description, Map<String, String> metadata)public static Info update(Client client, String name, String value, String description)public static Info update(Client client, String name, String value)Replaces the value of an existing secret (a new version); throws ApiException.NotFound when there is none. A null description or metadata keeps the current one (an empty map clears the metadata). Running sandboxes see the new value on their next use of it.
| Parameter | Type | Default |
|---|---|---|
client |
Client |
|
name |
String |
|
value |
String |
|
description |
String |
optional |
metadata |
Map<String, String> |
optional |
Returns Info
sdk/java/src/main/java/dev/svm/sandbox/Secret.java:122SecretInfo
Section titled “SecretInfo”One secret as the API reports it; never its value.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
created_at |
str |
|
description |
str | None |
|
metadata |
dict[str, str] |
|
name |
str |
|
updated_at |
str | None |
|
version |
int | None |
| Property | Type | Description |
|---|---|---|
created_at |
string |
|
description |
string |
|
metadata |
Record<string, string> |
The caller’s own string pairs about the secret (never the value). |
name |
string |
|
updated_at |
string |
|
version |
number |
1, then +1 each time the value is put. |
| Property | Type | Description |
|---|---|---|
CreatedAt |
string |
|
Description |
string |
|
Metadata |
map[string]string |
Metadata are the caller’s own string pairs about the secret (never the value). |
Name |
string |
|
UpdatedAt |
string |
|
Version |
int |
Version is 1, then +1 each time the value is put. |
| Property | Type | Description |
|---|---|---|
created_at |
||
description |
||
metadata |
||
name |
||
updated_at |
||
version |
Not in the Java SDK.
from_hash()
Section titled “from_hash()”Not in the Python SDK’s SecretInfo.
Not in the TypeScript SDK’s SecretInfo.
Not in the Go SDK’s SecretInfo.
def self.from_hash(h)| Parameter | Type | Default |
|---|---|---|
h |
sdk/ruby/lib/svm/secret.rb:8Not in the Java SDK.
from_json()
Section titled “from_json()”def from_json(cls, value: dict[str, Any]) -> 'SecretInfo'| Parameter | Type | Default |
|---|---|---|
value |
dict[str, Any] |
Returns 'SecretInfo'
sdk/python/svm/secrets.py:39Not in the TypeScript SDK’s SecretInfo.
Not in the Go SDK’s SecretInfo.
Not in the Ruby SDK’s SecretInfo.
Not in the Java SDK.
IamToken
Section titled “IamToken”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.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
audience |
str |
|
token_type |
str |
| Property | Type | Description |
|---|---|---|
audience |
string |
|
tokenType |
"jwt" |
| Property | Type | Description |
|---|---|---|
Audience |
string |
|
TokenType |
string |
“jwt”, the only type |
| Property | Type | Description |
|---|---|---|
audience |
||
token_type |
| Property | Type | Description |
|---|---|---|
audience |
String |
|
tokenType |
String |
"jwt", the only type. |
constructor()
Section titled “constructor()”Not in the Python SDK’s IamToken.
constructor(audience: string)| Parameter | Type | Default |
|---|---|---|
audience |
string |
sdk/typescript/src/secret.ts:63Not in the Go SDK’s IamToken.
Not in the Ruby SDK’s IamToken.
Not in the Java SDK’s IamToken.
initialize()
Section titled “initialize()”Not in the Python SDK’s IamToken.
Not in the TypeScript SDK’s IamToken.
Not in the Go SDK’s IamToken.
def initialize(audience, token_type = "jwt")| Parameter | Type | Default |
|---|---|---|
audience |
||
token_type |
"jwt" |
sdk/ruby/lib/svm/secret.rb:19Not in the Java SDK’s IamToken.
inject()
Section titled “inject()”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]
sdk/python/svm/secrets.py:72inject(headers: string[], placeholder?: string): EgressInjectThe inject object for an egress rule: replace placeholder (default this.placeholder) in headers with a fresh token.
| Parameter | Type | Default |
|---|---|---|
headers |
string[] |
|
placeholder |
string |
optional |
Returns EgressInject
sdk/typescript/src/secret.ts:75func (t IamToken) Inject(headers []string, placeholder string) (*EgressInject, error)Inject returns the inject object for an egress rule: replace placeholder (empty means t.Placeholder()) in headers with a fresh token of the sandbox.
| Parameter | Type | Default |
|---|---|---|
headers |
[]string |
|
placeholder |
string |
Returns (*EgressInject, error)
sdk/go/secret_inject.go:100def inject(headers, placeholder: nil)The inject object for an egress rule: replace placeholder (default #placeholder) in headers with a fresh token of the sandbox.
| Parameter | Type | Default |
|---|---|---|
headers |
||
placeholder |
nil |
sdk/ruby/lib/svm/secret.rb:30public Map<String, Object> inject(List<String> headers, String placeholder)The inject object for an egress rule: replace placeholder (null means placeholder()) in headers with a fresh token of the sandbox.
| Parameter | Type | Default |
|---|---|---|
headers |
List<String> |
|
placeholder |
String |
Returns Map<String, Object>
sdk/java/src/main/java/dev/svm/sandbox/IamToken.java:42placeholder()
Section titled “placeholder()”placeholder: strProperty (read-only).
placeholder: stringProperty (read-only).
func (t IamToken) Placeholder() stringPlaceholder is what the guest sends in place of the token.
Returns string
sdk/go/secret_inject.go:93def placeholdersdk/ruby/lib/svm/secret.rb:25public String placeholder()What the guest sends in place of the token: svmph.iam. and the first 16 hex digits of the audience’s SHA-256, then a dot.
Returns String
sdk/java/src/main/java/dev/svm/sandbox/IamToken.java:29