Shared Workspace Secret (share0) for SOPS Age Key¶
Previously, AGE_PRIVATE_KEY was expected inside each repository's --secret-collection, duplicating the master Age private key across multiple secret collections and coupling repository cloning credentials with organizational encryption keys. We decided to decouple secret resolution: repository secret collections passed via --secret-collection provide only repository-scoped variables (GH_REPO, GH_TOKEN, DOTENV_PRIVATE_KEY), while a dedicated Modal secret collection named share0 provides shared workspace credentials, specifically AGE_PRIVATE_KEY. Sandbox runners conditionally mount modal.Secret.from_name("share0") whenever credentials decryption is requested (--agy, --modal, or --opencode).
Considered Options¶
- Require
AGE_PRIVATE_KEYin every repository secret collection: Continue expecting each repository's Modal secret collection to containAGE_PRIVATE_KEY. Rejected because it creates operational overhead and key duplication across dozens of repository secret collections. - Unconditionally mount
share0across all sandboxes: Mountmodal.Secret.from_name("share0")on every sandbox launch alongside--secret-collection. Rejected because bare sandbox runs (which only clone and run public or basic repos without agent/tooling credentials) should not fail ifshare0is absent from the Modal workspace. - Configurable CLI secret flag
--shared-secret: Add an optional CLI flag defaulting to"share0". Rejected to keep CLI invocation clean and concise, standardizing on"share0"as the workspace convention. - Decoupled conditional mounting of
share0: DefineSHARED_SECRET_NAME = "share0"inshared/image.pyand conditionally appendmodal.Secret.from_name(SHARED_SECRET_NAME)tosandbox_secretswhen--agy,--modal, or--opencodeis requested. Accepted because it isolates repository credentials from shared master keys, avoids unnecessary dependencies for bare sandboxes, and guarantees consistent secret resolution across both Standard and VM sandboxes.
Consequences¶
shared/image.pyexportsSHARED_SECRET_NAME = "share0".standard_sandbox/main.pyandvm_sandbox/main.pyconditionally appendmodal.Secret.from_name(SHARED_SECRET_NAME)tosandbox_secretswhenargs.agy or args.modal or args.opencodeis true.--secret-collectionis strictly scoped to repository credentials (GH_REPO,GH_TOKEN, and optionalDOTENV_PRIVATE_KEY).shared/startup.shprovides explicit diagnostics whenAGE_PRIVATE_KEYis missing, informing users to configureAGE_PRIVATE_KEYin Modal secret'share0'.- Running sandboxes with
--agy,--modal, or--opencoderequires Modal secret'share0'to exist in the target Modal workspace.