Credential usage limits

Updated at:

Credential injection is subject to network access, HTTPS certificate trust, connection, and configuration limits. Review these limits and the security recommendations before you inject credentials.

Network access

Credential injection does not automatically grant network access. The actual destination must still be allowed by a network policy such as allowOut.

HTTPS certificate trust

The platform must decrypt HTTPS traffic to rewrite headers. After network access is allowed, the egress gateway performs TLS (Transport Layer Security) inspection only on requests whose SNI (Server Name Indication) matches. The SNI matches a regular header rule, a managed STS (Security Token Service) domain, or an effective domain of any bring-your-own credential set. The gateway then uses the platform certificate authority (CA) to dynamically issue a certificate for the destination domain. If no rule matches, the original TLS traffic passes through unchanged. If the traffic must be decrypted but the sandbox client does not trust the platform CA, HTTPS requests return certificate errors.

  • Official templates and supported custom templates for Debian or Ubuntu include the platform CA, so curl, Python requests, and Node.js work by default.

  • Java clients and Firefox (Network Security Services) require manual trust configuration, as do applications that read only the OpenSSL CApath. The same applies to images that are not based on Debian or Ubuntu, and to clients that use a private trust bundle or certificate pinning.

  • If the destination service uses a self-signed certificate or a private CA, you cannot upload a custom upstream CA, and the platform does not skip certificate validation.

  • ECH (Encrypted Client Hello), QUIC (HTTP/3), explicit CONNECT proxies, upstream mTLS (mutual TLS), WebSocket or HTTP Upgrade, and ports other than 80 and 443 are not supported.

Java clients can import /usr/local/share/ca-certificates/e2b-ca.crt into the Java Virtual Machine (JVM) cacerts.

Connection limits

After you configure network.rules, HTTP and HTTPS requests that pass through the egress gateway share the same quota for active TCP connections. Each sandbox supports at most 2000 concurrent connections. After the quota is exhausted, new connections are rejected or reset, and can be established again after existing connections close.

The limit counts TCP connections, not requests or requests per second (RPS). Reusing connections with keep-alive or HTTP/2 reduces the number of connections in use. The quota of 2000 active TCP connections per sandbox is a fixed limit and cannot be adjusted.

Configuration limits

To adjust the destination-domain, regular-header, or replacement quotas, submit an Alibaba Cloud ticket.

Item

Limit

Destination domain

Up to 10. Only exact DNS domain names are supported. Subdomains are not matched, and wildcard subdomains, IP addresses, CIDR (Classless Inter-Domain Routing) blocks, URLs, ports, and paths are not supported. This requirement applies to the keys of regular header rules. The domains of bring-your-own credentials support exact domains, wildcard subdomains, and exact exclusions.

Per domain

Exactly one rule is required.

Regular headers

Up to 20 per rule. The name is 1–64 bytes, and the value is at most 2048 bytes.

All rules

At most 64 KiB after serialization.

replacement

Up to 16 per domain and up to 64 per sandbox.

Bring-your-own re-sign credential value

At most 2048 bytes, including the credential JSON, the AccessKey pair (AK/SK), the optional STS token, and domains.

placeholder

8–128 bytes. Only letters, digits, _, ., and - are allowed. A placeholder cannot be identical to a real credential value, cannot be duplicated, and cannot be a substring of another placeholder.

fc.sandbox.network.resign-credentials occupies one destination-domain slot and is used only for credential mapping. The quantity and size limits in the preceding table apply.

In the preceding table, the exact-DNS-domain requirement and the subdomain restriction apply to the keys of regular header rules. The domains of bring-your-own credentials support exact domains, wildcard subdomains, and exact exclusions. For more information, see Inject your own Alibaba Cloud STS credentials.

The following headers cannot be configured or are not replaced: Host, Content-Length, Transfer-Encoding, Connection, Upgrade, proxy authentication headers, and routing or frame control headers such as x-envoy-* and x-forwarded-*. The restricted set may change in future versions.

Request processing scope

Regular credential injection supports only request headers. AK/SK and STS credentials require a dedicated re-sign configuration. Neither regular credential injection nor re-sign configuration supports arbitrary request body text replacement or response modification.

Managed credentials

  • API keys and OAuth tokens managed by Agent Identity are injected only into requests that are sent to the destination service, and never enter the sandbox. Queries about sandbox information return only reference expressions and non-sensitive options, never the real credentials.

  • The destination service receives the real credentials. Make sure that the destination is trusted, and configure least-privilege permissions for the credentials.

  • Credential provider value changes are also subject to a propagation window. If you delete a managed credential provider and recreate it with the same name, or update its token in place, sandboxes created shortly afterward may still retrieve the old value. To make the change take effect immediately, create a credential provider with a new name and update the rules to reference it.

    The platform automatically refreshes M2M (machine-to-machine) OAuth tokens based on their validity period. 401 and 403 responses from the destination service are passed through unchanged. The platform does not immediately refresh the token or automatically replay the request in response to such an error.

  • In user-delegated OAuth flows, the user JWT (JSON Web Token), UserId, and real token never enter the sandbox and are not returned by query operations. Credentials of different users are isolated from each other. Do not write JWTs into business logs or sandbox code.

Alibaba Cloud request re-signing

  • Re-sign domains only determine which requests can be re-signed, and do not grant network access. The destination domains must still be allowed by a network policy such as allowOut.

  • The ACS3, RPC, ROA, Function Compute (FC) 2.0, Object Storage Service (OSS) V1, and OSS V4 signature protocols are supported. If you use the standard Alibaba Cloud SDK, you typically do not need to sign requests on your own.

  • For the configuration of bring-your-own credentials and the supported scope, see Inject your own Alibaba Cloud STS credentials.

  • Do not include real AK/SK pairs in requests that use unsupported protocols. Such requests are not protected by the platform.

Security recommendations

  • Read and submit real credentials only in a trusted control plane, and never write them to a code repository. Use a secret manager, continuous integration (CI) secrets, or short-lived business credentials.

  • Use HTTPS wherever possible. After HTTP traffic leaves the egress gateway, it travels in plaintext, and credentials may be exposed in transit.

  • Use short-lived, revocable credentials that are granted least privilege and isolated by tenant or session.

  • Configure exact domain names only for real destinations, and make sure that the destination does not echo or log authentication headers.

  • Protect the permissions of the create, update, and query operations, and do not print the full network.rules. A placeholder itself should not contain real credentials.

  • To revoke a credential immediately, update the network configuration to clear the corresponding rules, and then revoke or rotate the credential in the credential system. For scenarios that require strong revocation, in addition to deleting the rules, you must also handle the state uncertainty between established long-lived connections and the control plane.