Replies: 5 comments 9 replies
-
I would keep it in requirements, but I don't think this is a critical decision
In a dev environment I would probably enabled the database-backed vault ? Generally speaking I would prefer to not call it tool secrets, and I wouldn't limit it to tools. You could think of workflow actions that are not tool steps that require secrets, like when you'd interact with an external service e.g. for exports after a workflow has completed. I would maybe make a user_secrets table with uuid as the primary key plus the corresponding CRUD endpoints. You can still filter by tool / tool version in the endpoint, but I wouldn't make it part of the path operation. |
Beta Was this translation helpful? Give feedback.
-
Thank you Marius for the feedback! So, for the XML elements, what do you think about this?: <requirements>
<credentials name="service1" reference="some/unique/reference" required="true" label="My awesome API" description="Please provide credentials for blah…">
<secret name="my_token" inject_as_env="target_env_var_apikey" label="API Key" description="This is the API Key for blah…" />
</credentials>
<credentials name="service2" reference="some/other/unique/reference" required="false">
<secret name="s2_username" inject_as_env="target_env_var_user" label="Your username" />
<secret name="s2_password" inject_as_env="target_env_var_pass" label="Your password" />
</credentials>
</requirements>
For the database schema, what about this?: erDiagram
USER_SECRETS {
uuid id PK
int user_id
string service_reference UK
string secret_name
}
The
This should be generic enough. There's probably no need to store the tool ID and version in the database, as we can get this information from the tool's XML requirements and then check if the user has provided credentials for that service/secret. And finally the API endpoints could look like this:
|
Beta Was this translation helpful? Give feedback.
-
I didn't see any examples of this, but I'd be interested to, since the use case would be relevant for @abretaud and myself. E.g. the suite of Apollo tools would all want to re-use the same credentials because they all talk to the same backend, even across multiple tools. So I'd be looking at writing something like this, yes? <requirements>
<credentials name="Apollo" reference="gmod.org/apollo" required="true">
<secret name="server" inject_as_env="apollo_url" label="Your Apollo server" />
<secret name="username" inject_as_env="apollo_user" label="Your Apollo username" />
<secret name="password" inject_as_env="apollo_pass" label="Your Apollo password" />
</credentials>
</requirements> some questions based on this use case:
That UX I'm not sure if it makes sense for me, given how all of the tools I manage that require credentials, would be used. Apollo and the XNAT tool we're working on all have the built in assumption that they might want to talk to different servers at some point. So I think I expected this to be a tuple, sort of. That the user would be asked for credentials, they would provide a set of secrets for a specific credential, and then save that with a name. Then when the user needs to run the tool, they can select between tuples with their nicknames, to say "I want to use the dev apollo" or "the production apollo". |
Beta Was this translation helpful? Give feedback.
-
My only bit to add would be that it might be cool to have optional credentials, e.g. for services that allow anonymous login. |
Beta Was this translation helpful? Give feedback.
-
Also wanted to add this for ref: #15300 |
Beta Was this translation helpful? Give feedback.
-
After an initial discussion with @bgruening and @arash77, this proposal expands on #1751 to facilitate a team discussion on design and implementation strategies. An initial prototype is underway at #19084.
Overview
The goal is to enable Galaxy tools to securely declare, request, and manage secret tokens or credentials that users can provide. This proposal outlines a way for tool authors to define credential requirements, a user interface (UI) to request and manage credentials, and the backend to store and retrieve them securely.
Declaring Tool Secrets
Some options for declaring tool secrets in the tool’s XML are:
Option A: Within the
<requirements>
sectionTool authors will be able to declare that a tool requires credentials by adding a
<secret>
element within the<requirements>
section, for example:The fields are defined as follows:
type
: Supports “token” for simple API keys and potentially “credentials” for username+password pairs.reference
: A unique path-like string for the Vault key. This will default to a prefixed form of the tool ID and version to avoid accidental sharing but can be overridden for cases where secrets should be shared across tools.inject_as_env
: Specifies the environment variable where the credentials should be injected.label
anddescription
: Provide information to display in the UI when requesting credentials from users.required
: A boolean that indicates if the credential is mandatory or if the tool can run with anonymous access.Option B: Within a dedicated
<secrets>
section supporting multiple service credentialsWe could instead introduce a dedicated
<secrets>
section, making it easier to distinguish credentials from other tool requirements.For tools that require multiple credentials or credentials with multiple parts (e.g., username and password):
Requesting Tool Secrets in the UI
In the Tool Form
When a tool that requires credentials is opened, a warning banner will appear at the top of the Tool Form. This banner will display a button that, when clicked, opens a dialog where users can input the required credentials. If credentials have already been provided, the banner will turn green with a message like “You have already provided credentials for this tool,” along with an option to edit them.
In the Workflow Run Form
When a workflow containing a tool that requires credentials is run, the user will be prompted to provide the necessary credentials before the workflow can be executed. This will be similar to the tool form, with a warning banner at the top of the form and a dialog to input credentials. When requesting credentials for a workflow, the system will check if the user has already provided credentials for all tools in the workflow (and sub-workflows) and only prompt for missing credentials.
Backend: Storing and Managing Tool Secrets
Once provided by the user, credentials will be stored in the user Vault, with references saved in a new table in the Galaxy database called
user_tool_secrets
. This table will contain at the very minimum:This enables the system to check whether the user has provided credentials for a tool and to update the UI accordingly.
Users will manage their credentials in a new section in their user preferences. This section will list all tools for which the user has provided credentials and allow them to edit, delete, or copy credentials between tools if needed.
API Endpoints for Tool Secrets Management
To support these operations, we propose adding the following API endpoints for discussion:
/api/user/{id}/tool_secrets
- Lists all credentials the user has provided (credentials themselves are not included)./api/user/{id}/tool_secrets/{tool_id}/{tool_version}
- Verifies if credentials have been provided for a specific tool (no credential data returned)./api/user/{id}/tool_secrets/{tool_id}/{tool_version}
- Allows users to provide credentials for a tool or copy them from another tool or version./api/user/{id}/tool_secrets/{tool_id}/{tool_version}
- Updates credentials for a specific tool./api/user/{id}/tool_secrets/{tool_id}/{tool_version}
- Deletes credentials for a specific tool.Open Questions
Q1*: Placement of
<secret>
Element. Should we introduce a dedicated section in the tool’s XML instead of including secrets in the section? This might make the code more readable and organized.Q2*: Vault as a Requirement. Since all secrets should be securely stored, we assume the Vault is required. Should we make this a hard requirement or allow configurations that skip the Vault, storing secrets in user preferences instead? This flexibility might benefit testing or smaller Galaxy instances that don’t need a Vault, though it will make it not production-ready.
Other alternatives?
Please share your thoughts on the proposed design and suggest any alternatives or improvements.
Beta Was this translation helpful? Give feedback.
All reactions