Skip to content

Conversation

@Ark-kun
Copy link
Contributor

@Ark-kun Ark-kun commented Jan 20, 2026

API changes

List secrets: GET /api/secrets/.
Create a secret: POST /api/secrets/.
Update a secret: PUT /api/secrets/{secret_id}.
Delete a secret: DELETE /api/secrets/{secret_id}.

DB changes

class Secret(_TableBase):
    __tablename__ = "secret"
    user_id: orm.Mapped[str] = orm.mapped_column(primary_key=True, index=True)
    secret_id: orm.Mapped[str] = orm.mapped_column(primary_key=True)
    secret_value: orm.Mapped[str]
    created_at: orm.Mapped[datetime.datetime | None] = orm.mapped_column(default=None)
    updated_at: orm.Mapped[datetime.datetime | None] = orm.mapped_column(default=None)
    extra_data: orm.Mapped[dict[str, Any] | None] = orm.mapped_column(default=None)

TaskSpec changes

componentRef: ...
  spec:
    inputs:
    - {name: input4, type: Secret}
arguments:
  input1: "constant value"
  input2:
    taskOutput:
      taskId: "task1"
      outputName: "output1"
  input3:
    graphInput:
      inputName: "graph_input_1"
  # New:
  input4:
    secret:
      id: "OPENAI_TOKEN"

Fixes: #51

@Ark-kun Ark-kun added the enhancement New feature or request label Jan 20, 2026
Copy link

@yuechao-qin yuechao-qin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions/comments. Great work getting secrets working quickly!

current_time = _get_current_time()
secret = session.get(bts.Secret, (user_id, secret_id))
if secret:
if not raise_if_exists:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not raise_if_exists:
if raise_if_exists:

I believe you don't want the not here?

# This hash is not used, so we're using a dummy value here that makes it possible to identify the secret arguments in the following code.
hash=secret_hash,
)
session.rollback()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why is there a rollback here? I didn't notice any session changes.

Comment on lines +1068 to +1069
secret_id=secret_id,
secret_value=secret_value,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious is there any validation needed for secret id/value? For example, what if they were empty strings?

session: orm.Session,
user_id: str,
secret_id: str,
):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
):
) -> None:

secret_value: str,
raise_if_not_exists: bool = False,
raise_if_exists: bool = False,
):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
):
) -> None:

Comment on lines +1017 to +1018
):
return self._set_secret_value(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
):
return self._set_secret_value(
) -> None:
self._set_secret_value(

_set_secret_value doesn't return anything, so a return is not necessary here?

Comment on lines +1033 to +1034
):
return self._set_secret_value(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
):
return self._set_secret_value(
) -> None:
self._set_secret_value(

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

epic: Secrets

3 participants