feat: encrypt org auth tokens with AES (#3104)

This commit is contained in:
LawyZheng
2025-08-05 12:36:24 +08:00
committed by GitHub
parent 977c9d4f13
commit 02576e5be3
8 changed files with 192 additions and 9 deletions

View File

@@ -26,6 +26,8 @@ from skyvern.forge.sdk.db.models import (
WorkflowRunOutputParameterModel,
WorkflowRunParameterModel,
)
from skyvern.forge.sdk.encrypt import encryptor
from skyvern.forge.sdk.encrypt.base import EncryptMethod
from skyvern.forge.sdk.models import Step, StepStatus
from skyvern.forge.sdk.schemas.organizations import Organization, OrganizationAuthToken
from skyvern.forge.sdk.schemas.tasks import Task, TaskStatus
@@ -190,14 +192,18 @@ def convert_to_organization(org_model: OrganizationModel) -> Organization:
)
def convert_to_organization_auth_token(
async def convert_to_organization_auth_token(
org_auth_token: OrganizationAuthTokenModel,
) -> OrganizationAuthToken:
token = org_auth_token.token
if org_auth_token.encrypted_token and org_auth_token.encrypted_method:
token = await encryptor.decrypt(org_auth_token.encrypted_token, EncryptMethod(org_auth_token.encrypted_method))
return OrganizationAuthToken(
id=org_auth_token.id,
organization_id=org_auth_token.organization_id,
token_type=OrganizationAuthTokenType(org_auth_token.token_type),
token=org_auth_token.token,
token=token,
valid=org_auth_token.valid,
created_at=org_auth_token.created_at,
modified_at=org_auth_token.modified_at,