Skip to content

Expose SecretRef on the author surface for custom sandbox secrets #701

Description

@czpython

Problem

An app workspace can give its sandbox a custom secret by overriding Workspace.get_secret_refs(). For example, a per-rep OAuth service connection that the secrets proxy swaps in on one host:

from druks.sandbox.models import SecretRef  # internal module

class SalesforceWorkspace(Workspace):
    @classmethod
    async def get_secret_refs(cls, subject):
        return [SecretRef(name="sf_access_token", secret_id=subject.connection_id, host="org.my.salesforce.com")]

The hook works, but its return type is not public. druks.sandbox exports only Sandbox, so apps must import druks.sandbox.models. software_factory does the same. The author guide does not document get_secret_refs(), custom host entries, or the variable name, which is name.upper().

Tried

Adding SecretRef to druks/sandbox/__init__.py causes a circular import: druks.sandbox.client → druks.sandbox.host.

Proposal

  • Make the type importable from a public namespace without the import cycle. This could be a lazy export, or a small datastructure like RequiredMcpServer that the workspace maps to the ORM row.
  • Document get_secret_refs() in "Customize the workspace": the vault row, host, the derived variable, and the bearer header.
  • Add it to the "Stable author imports" table.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions