Skip to content
GlxymeshDocs
glxymesh.com
Select theme
Open console
Reading time 4 min

Keys and network access

How Glxymesh tools reach external APIs, how new hosts are approved, and how API keys are added on the way out so tool code never holds them.

A tool can reach only the hosts it lists, and a key only ever travels to the hosts it’s bound to. Both are declared in tool.yml, so every change shows up in review and in the push’s approval.

tool.yml
network:
allow: [api.github.com, "ec2.*.amazonaws.com", 203.0.113.0/24]

Each entry is one of these, with no scheme or port:

Entry Covers
api.github.com That host and every name under it, like uploads.api.github.com
*.example.com Every name under example.com, but not example.com itself
ec2.*.amazonaws.com * stands for one whole label: ec2.us-east-1.amazonaws.com, ec2.ap-south-1.amazonaws.com and every other region
203.0.113.7, 2001:db8::7 One IPv4 or IPv6 address
203.0.113.0/24, 2001:db8::/32 A range of addresses, at most /8 for IPv4 and /16 for IPv6
{NAME} An address kept in the project’s secrets (below)
  • Quote an entry that starts with * in YAML: "*.example.com".
  • * stands for a whole label (api-*.example.com is refused), and can’t stand for a whole public suffix (*.com, *.co.uk).
  • Private addresses (10.0.0.0/8, 192.168.0.0/16, loopback) work in gxmesh dev against your own machine, and are refused in production whatever tool.yml says.
  • Any other host is refused, and the error names the host and tells you to add it to network.allow.
  • A push that adds a host waits for a person to approve it. See Approvals. An agent can propose a host, but can’t approve one.
  • Only https:// requests leave a tool, plus TCP connections to the host:port pairs in network.connect, for databases. See Connect to a database.
  • Private addresses (10.x, 192.168.x, 169.254.x and others) are always refused, including via redirects.

For an http tool, list the host of request.url too.

Open the console’s Secrets page and choose New secret. Name it as tool.yml does, such as GITHUB_TOKEN, and paste the value. Values are encrypted in your project’s vault, never shown again, and never sent to agents. When a tool names a key the project doesn’t have yet, the page lists it with an Add button, and calls to that tool fail until it’s added.

To change a key, edit it on the same page. The next call uses the new value; nothing is redeployed.

Bind it to its hosts in tool.yml and say where it goes:

tool.yml
secrets:
GITHUB_TOKEN:
hosts: [api.github.com]
header: "Authorization: Bearer {value}"

Every request the tool makes to api.github.com gets the header, added by the egress gateway on the way out. A request anywhere else doesn’t, and your code never holds the key.

For an API that takes the key as a query parameter, name the parameter instead:

tool.yml
secrets:
WEATHER_KEY:
hosts: [api.weatherapi.com]
query: key

For a key in an unusual place, such as a JSON body, use a placeholder in your code. Leave out header and query:

TypeScript
import { secret } from '@glxymesh/sdk';
await ctx.fetch('https://api.example.com/v1/run', {
method: 'POST',
body: JSON.stringify({ api_key: secret('EXAMPLE_KEY') }),
});
Go
body := strings.NewReader(`{"api_key": "` + glxy.Secret("EXAMPLE_KEY") + `"}`)
ctx.HTTP().Post("https://api.example.com/v1/run", "application/json", body)

secret() returns a placeholder, not the key. The egress gateway swaps in the real value only on the key’s bound hosts, and refuses to send the placeholder anywhere else.

Some APIs have no public address you could write down, such as a self-hosted GitLab or Proxmox. Write the host as a name in capitals and braces, and store the address on the Secrets page like a key:

tool.yml
request:
method: GET
url: https://{PROXMOX_HOST}:8006/api2/json/nodes
network:
allow: ["{PROXMOX_HOST}"]
secrets:
PROXMOX_TOKEN:
hosts: ["{PROXMOX_HOST}"]
header: "Authorization: PVEAPIToken={value}"

Glxymesh fills in the address on each call. The address must be reachable from the internet; private addresses are refused here too.

A self-hosted server often has a certificate it made itself, for a name like pve3a-01 that isn’t the address a tool calls. Glxymesh refuses those, because anyone between it and your server could answer in its place. Either fix is fine:

  • Give the server a public certificate. Point a DNS name at it and get a certificate from Let’s Encrypt (Proxmox has this built in under Certificates → ACME), then call it by that name.
  • Trust its exact certificate. The refusal gives the certificate’s fingerprint. Put it under network.trust for the same host you wrote in network.allow:
tool.yml
network:
allow: ["{PROXMOX_HOST}"]
trust:
"{PROXMOX_HOST}": "3F:9A:1C:D2:7E:40:B8:65:0D:E1:5A:93:C4:2F:78:B6:11:AE:0C:5D:F3:92:67:4B:E8:D0:1A:7C:39:B5:62:F4"

A person approves the certificate before it is used, like a new host. From then on Glxymesh accepts that one certificate from the server and no other, so check the fingerprint against the server’s own (on Proxmox: the node’s System → Certificates, or openssl x509 -in /etc/pve/local/pve-ssl.pem -noout -fingerprint -sha256). When the server’s certificate is renewed or replaced, calls fail until the new fingerprint is in tool.yml and approved.

Some keys can’t be added on the way out: a database password travels inside the database’s own protocol, and some SDKs sign requests themselves. Bind those with mode: pass-in:

tool.yml
secrets:
PG_URL:
hosts: [db.example.com]
mode: pass-in

The code reads the value for one call with ctx.SecretValue("PG_URL") in Go, ctx.secretValue('PG_URL') in TypeScript or ctx.secret_value("PG_URL") in Python. Because the code sees it, a person approves each passed-in key before the tool goes live, and the value is fetched per call, never kept in the function’s configuration.

gxmesh dev, call and test read keys from .env.local, never from the vault. See Develop locally.

Every request from every tool leaves from the same public IP address. Add it to your firewall or API allow-list to accept calls from your tools; contact support for the address.