Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fix(SKY-11177): harden element-tree scrape against undefined className and isElementVisible recursion (#6697)
Trevor Cheungada154bd18ae
diff --git a/docs/api-reference/openapi.json b/docs/api-reference/openapi.jsonindex d841bd60a..b3c1f2403 100644--- a/docs/api-reference/openapi.json+++ b/docs/api-reference/openapi.json@@ -1519,6 +1519,24 @@"title": "Key"},"description": "Tag key to delete"+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."}],"responses": {@@ -3270,7 +3288,7 @@},{"sdk": "python",- "code": "from skyvern import Skyvern\n\nskyvern = Skyvern(api_key=\"YOUR_API_KEY\")\nawait skyvern.create_credential(\n name=\"My Credit Card\",\n credential_type=\"credit_card\",\n credential={\n \"card_number\": \"4242424242424242\",\n \"card_cvv\": \"424\",\n \"card_exp_month\": \"12\",\n \"card_exp_year\": \"2028\",\n \"card_brand\": \"visa\",\n \"card_holder_name\": \"John Doe\",\n },\n)\n"+ "code": "from skyvern import Skyvern\n\nskyvern = Skyvern(api_key=\"YOUR_API_KEY\")\nawait skyvern.create_credential(\n name=\"My Credit Card\",\n credential_type=\"credit_card\",\n credential={\n \"card_number\": \"4242424242424242\",\n \"card_cvv\": \"424\",\n \"card_exp_month\": \"12\",\n \"card_exp_year\": \"2028\",\n \"card_brand\": \"visa\",\n \"card_holder_name\": \"John Doe\",\n \"billing_address\": {\n \"line1\": \"123 Main St\",\n \"city\": \"San Francisco\",\n \"state_code\": \"CA\",\n \"postal_code\": \"94105\",\n \"country_code\": \"US\",\n },\n \"billing_email\": \"[email protected]\",\n \"metadata\": {\"checkout_profile\": \"default\"},\n },\n)\n"},{"sdk": "typescript",@@ -3278,7 +3296,7 @@},{"sdk": "typescript",- "code": "import { SkyvernClient } from \"@skyvern/client\";\n\nconst skyvern = new SkyvernClient({ apiKey: \"YOUR_API_KEY\" });\nawait skyvern.createCredential({\n name: \"My Credit Card\",\n credential_type: \"credit_card\",\n credential: {\n card_number: \"4242424242424242\",\n card_cvv: \"424\",\n card_exp_month: \"12\",\n card_exp_year: \"2028\",\n card_brand: \"visa\",\n card_holder_name: \"John Doe\"\n }\n});\n"+ "code": "import { SkyvernClient } from \"@skyvern/client\";\n\nconst skyvern = new SkyvernClient({ apiKey: \"YOUR_API_KEY\" });\nawait skyvern.createCredential({\n name: \"My Credit Card\",\n credential_type: \"credit_card\",\n credential: {\n card_number: \"4242424242424242\",\n card_cvv: \"424\",\n card_exp_month: \"12\",\n card_exp_year: \"2028\",\n card_brand: \"visa\",\n card_holder_name: \"John Doe\",\n billing_address: {\n line1: \"123 Main St\",\n city: \"San Francisco\",\n state_code: \"CA\",\n postal_code: \"94105\",\n country_code: \"US\",\n },\n billing_email: \"[email protected]\",\n metadata: { checkout_profile: \"default\" }\n }\n});\n"}]}@@ -4563,6 +4581,24 @@"title": "Workflow Permanent Id"},"description": "Workflow permanent ID"+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."}],"requestBody": {@@ -4700,6 +4736,24 @@"title": "Key"},"description": "Tag key to delete"+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."}],"responses": {@@ -8108,7 +8162,8 @@"print_page","workflow_trigger","google_sheets_read",- "google_sheets_write"+ "google_sheets_write",+ "pdf_fill"],"title": "BlockType"},@@ -8848,6 +8903,31 @@"type": "array","title": "Parameters","default": []+ },+ "prompt": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Prompt"+ },+ "steps": {+ "anyOf": [+ {+ "items": {+ "$ref": "#/components/schemas/CodeBlockStep"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "title": "Steps"}},"type": "object",@@ -8858,6 +8938,115 @@],"title": "CodeBlock"},+ "CodeBlockStep": {+ "properties": {+ "title": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Title"+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description"+ },+ "action_type": {+ "$ref": "#/components/schemas/ActionType",+ "default": "null_action"+ },+ "line_start": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "title": "Line Start"+ },+ "line_end": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "title": "Line End"+ }+ },+ "type": "object",+ "title": "CodeBlockStep"+ },+ "CodeBlockStepYAML": {+ "properties": {+ "title": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Title"+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description"+ },+ "action_type": {+ "type": "string",+ "title": "Action Type",+ "default": "null_action"+ },+ "line_start": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "title": "Line Start"+ },+ "line_end": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "title": "Line End"+ }+ },+ "type": "object",+ "title": "CodeBlockStepYAML"+ },"CodeBlockYAML": {"properties": {"block_type": {@@ -8927,6 +9116,31 @@}],"title": "Parameter Keys"+ },+ "prompt": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Prompt"+ },+ "steps": {+ "anyOf": [+ {+ "items": {+ "$ref": "#/components/schemas/CodeBlockStepYAML"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "title": "Steps"}},"type": "object",@@ -9772,64 +9986,191 @@],"title": "CredentialVaultType"},- "CreditCardCredentialResponse": {+ "CreditCardBillingAddress": {"properties": {- "last_four": {- "type": "string",- "title": "Last Four",- "description": "Last four digits of the credit card number",+ "line1": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Line1",+ "description": "Billing address line 1","examples": [- "1234"+ "123 Main St"]},- "brand": {- "type": "string",- "title": "Brand",- "description": "Brand of the credit card",- "examples": [- "visa"- ]- }- },- "type": "object",- "required": [- "last_four",- "brand"- ],- "title": "CreditCardCredentialResponse",- "description": "Response model for credit card credentials — non-sensitive fields only.\n\nSECURITY: Must NEVER include full card number, CVV, expiration date, or card holder name."- },- "DeleteScheduleResponse": {- "properties": {- "ok": {- "type": "boolean",- "title": "Ok"- }- },- "type": "object",- "required": [- "ok"- ],- "title": "DeleteScheduleResponse"- },- "DeployScriptRequest": {- "properties": {- "files": {- "items": {- "$ref": "#/components/schemas/ScriptFileCreate"- },- "type": "array",- "title": "Files",- "description": "Array of files to include in the script",- "examples": [+ "line2": {+ "anyOf": [{- "content": "cHJpbnQoIkhlbGxvLCBXb3JsZCEiKQ==",- "encoding": "base64",- "mime_type": "text/x-python",- "path": "src/main.py"+ "type": "string"+ },+ {+ "type": "null"}+ ],+ "title": "Line2",+ "description": "Billing address line 2",+ "examples": [+ "Apt 4B"]- }+ },+ "city": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "City",+ "description": "Billing city",+ "examples": [+ "San Francisco"+ ]+ },+ "state": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "State",+ "description": "Billing state or region",+ "examples": [+ "California"+ ]+ },+ "state_code": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "State Code",+ "description": "Billing state or region code",+ "examples": [+ "CA"+ ]+ },+ "postal_code": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Postal Code",+ "description": "Billing postal code",+ "examples": [+ "94105"+ ]+ },+ "country": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Country",+ "description": "Billing country",+ "examples": [+ "United States"+ ]+ },+ "country_code": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Country Code",+ "description": "ISO 3166-1 alpha-2 billing country code",+ "examples": [+ "US"+ ]+ }+ },+ "type": "object",+ "title": "CreditCardBillingAddress",+ "description": "Optional billing address fields associated with a credit card credential."+ },+ "CreditCardCredentialResponse": {+ "properties": {+ "last_four": {+ "type": "string",+ "title": "Last Four",+ "description": "Last four digits of the credit card number",+ "examples": [+ "1234"+ ]+ },+ "brand": {+ "type": "string",+ "title": "Brand",+ "description": "Brand of the credit card",+ "examples": [+ "visa"+ ]+ }+ },+ "type": "object",+ "required": [+ "last_four",+ "brand"+ ],+ "title": "CreditCardCredentialResponse",+ "description": "Response model for credit card credentials — non-sensitive fields only.\n\nSECURITY: Must NEVER include full card number, CVV, expiration date, card holder name,\nbilling fields, or metadata."+ },+ "DeleteScheduleResponse": {+ "properties": {+ "ok": {+ "type": "boolean",+ "title": "Ok"+ }+ },+ "type": "object",+ "required": [+ "ok"+ ],+ "title": "DeleteScheduleResponse"+ },+ "DeployScriptRequest": {+ "properties": {+ "files": {+ "items": {+ "$ref": "#/components/schemas/ScriptFileCreate"+ },+ "type": "array",+ "title": "Files",+ "description": "Array of files to include in the script",+ "examples": [+ {+ "content": "cHJpbnQoIkhlbGxvLCBXb3JsZCEiKQ==",+ "encoding": "base64",+ "mime_type": "text/x-python",+ "path": "src/main.py"+ }+ ]+ }},"type": "object","required": [@@ -11682,6 +12023,12 @@}],"title": "Path"+ },+ "continue_on_empty": {+ "type": "boolean",+ "title": "Continue On Empty",+ "description": "When the run download directory has no files, fail the block (False, default) instead of reporting success. Set True to allow an empty upload (success with no files uploaded).",+ "default": false}},"type": "object",@@ -12115,6 +12462,9 @@},{"$ref": "#/components/schemas/GoogleSheetsWriteBlock"+ },+ {+ "$ref": "#/components/schemas/PdfFillBlock"}],"discriminator": {@@ -12136,6 +12486,7 @@"human_interaction": "#/components/schemas/HumanInteractionBlock","login": "#/components/schemas/LoginBlock","navigation": "#/components/schemas/NavigationBlock",+ "pdf_fill": "#/components/schemas/PdfFillBlock","pdf_parser": "#/components/schemas/PDFParserBlock","print_page": "#/components/schemas/PrintPageBlock","send_email": "#/components/schemas/SendEmailBlock",@@ -12381,6 +12732,9 @@{"$ref": "#/components/schemas/PrintPageBlockYAML"},+ {+ "$ref": "#/components/schemas/PdfFillBlockYAML"+ },{"$ref": "#/components/schemas/WorkflowTriggerBlockYAML"},@@ -15537,6 +15891,56 @@"examples": ["John Doe"]+ },+ "billing_address": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/CreditCardBillingAddress"+ },+ {+ "type": "null"+ }+ ],+ "description": "Optional billing address associated with the card"+ },+ "billing_email": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Billing Email",+ "description": "Optional billing email address"+ },+ "billing_phone": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Billing Phone",+ "description": "Optional billing phone number"+ },+ "metadata": {+ "anyOf": [+ {+ "additionalProperties": {+ "type": "string"+ },+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "title": "Metadata",+ "description": "Optional additional credit card metadata fields"}},"type": "object",@@ -16182,6 +16586,285 @@"title": "PasswordCredentialResponse","description": "Response model for password credentials — non-sensitive fields only.\n\nSECURITY: Must NEVER include password or TOTP secret."},+ "PdfFillBlock": {+ "properties": {+ "label": {+ "type": "string",+ "title": "Label",+ "description": "Author-facing identifier for a block; unique within a workflow."+ },+ "next_block_label": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Next Block Label",+ "description": "Optional pointer to the next block label when constructing a DAG. Defaults to sequential order when omitted."+ },+ "block_type": {+ "type": "string",+ "const": "pdf_fill",+ "title": "Block Type",+ "default": "pdf_fill"+ },+ "output_parameter": {+ "$ref": "#/components/schemas/OutputParameter"+ },+ "continue_on_failure": {+ "type": "boolean",+ "title": "Continue On Failure",+ "default": false+ },+ "model": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "title": "Model"+ },+ "disable_cache": {+ "type": "boolean",+ "title": "Disable Cache",+ "default": false+ },+ "ignore_workflow_system_prompt": {+ "type": "boolean",+ "title": "Ignore Workflow System Prompt",+ "default": false+ },+ "next_loop_on_failure": {+ "type": "boolean",+ "title": "Next Loop On Failure",+ "default": false+ },+ "file_url": {+ "type": "string",+ "title": "File Url"+ },+ "prompt": {+ "type": "string",+ "title": "Prompt"+ },+ "payload": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "items": {},+ "type": "array"+ },+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Payload"+ },+ "llm_key": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Llm Key"+ },+ "parameters": {+ "items": {+ "oneOf": [+ {+ "$ref": "#/components/schemas/WorkflowParameter"+ },+ {+ "$ref": "#/components/schemas/ContextParameter"+ },+ {+ "$ref": "#/components/schemas/AWSSecretParameter"+ },+ {+ "$ref": "#/components/schemas/AzureSecretParameter"+ },+ {+ "$ref": "#/components/schemas/BitwardenLoginCredentialParameter"+ },+ {+ "$ref": "#/components/schemas/BitwardenSensitiveInformationParameter"+ },+ {+ "$ref": "#/components/schemas/BitwardenCreditCardDataParameter"+ },+ {+ "$ref": "#/components/schemas/OnePasswordCredentialParameter"+ },+ {+ "$ref": "#/components/schemas/AzureVaultCredentialParameter"+ },+ {+ "$ref": "#/components/schemas/OutputParameter"+ },+ {+ "$ref": "#/components/schemas/CredentialParameter"+ }+ ],+ "discriminator": {+ "propertyName": "parameter_type",+ "mapping": {+ "aws_secret": "#/components/schemas/AWSSecretParameter",+ "azure_secret": "#/components/schemas/AzureSecretParameter",+ "azure_vault_credential": "#/components/schemas/AzureVaultCredentialParameter",+ "bitwarden_credit_card_data": "#/components/schemas/BitwardenCreditCardDataParameter",+ "bitwarden_login_credential": "#/components/schemas/BitwardenLoginCredentialParameter",+ "bitwarden_sensitive_information": "#/components/schemas/BitwardenSensitiveInformationParameter",+ "context": "#/components/schemas/ContextParameter",+ "credential": "#/components/schemas/CredentialParameter",+ "onepassword": "#/components/schemas/OnePasswordCredentialParameter",+ "output": "#/components/schemas/OutputParameter",+ "workflow": "#/components/schemas/WorkflowParameter"+ }+ }+ },+ "type": "array",+ "title": "Parameters",+ "default": []+ }+ },+ "type": "object",+ "required": [+ "label",+ "output_parameter",+ "file_url",+ "prompt"+ ],+ "title": "PdfFillBlock"+ },+ "PdfFillBlockYAML": {+ "properties": {+ "block_type": {+ "type": "string",+ "const": "pdf_fill",+ "title": "Block Type",+ "default": "pdf_fill"+ },+ "label": {+ "type": "string",+ "title": "Label",+ "description": "Author-facing identifier; must be unique per workflow."+ },+ "next_block_label": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Next Block Label",+ "description": "Optional pointer to the label of the next block. When omitted, it will default to sequential order. See [[s-4bnl]]."+ },+ "continue_on_failure": {+ "type": "boolean",+ "title": "Continue On Failure",+ "default": false+ },+ "model": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "title": "Model"+ },+ "ignore_workflow_system_prompt": {+ "type": "boolean",+ "title": "Ignore Workflow System Prompt",+ "default": false+ },+ "next_loop_on_failure": {+ "type": "boolean",+ "title": "Next Loop On Failure",+ "default": false+ },+ "file_url": {+ "type": "string",+ "title": "File Url"+ },+ "prompt": {+ "type": "string",+ "title": "Prompt"+ },+ "payload": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "items": {},+ "type": "array"+ },+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Payload"+ },+ "llm_key": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Llm Key"+ },+ "parameter_keys": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "title": "Parameter Keys"+ }+ },+ "type": "object",+ "required": [+ "label",+ "file_url",+ "prompt"+ ],+ "title": "PdfFillBlockYAML"+ },"PersistentBrowserType": {"type": "string","enum": [@@ -21797,6 +22480,9 @@},{"$ref": "#/components/schemas/GoogleSheetsWriteBlock"+ },+ {+ "$ref": "#/components/schemas/PdfFillBlock"}],"discriminator": {@@ -21818,6 +22504,7 @@"human_interaction": "#/components/schemas/HumanInteractionBlock","login": "#/components/schemas/LoginBlock","navigation": "#/components/schemas/NavigationBlock",+ "pdf_fill": "#/components/schemas/PdfFillBlock","pdf_parser": "#/components/schemas/PDFParserBlock","print_page": "#/components/schemas/PrintPageBlock","send_email": "#/components/schemas/SendEmailBlock",@@ -21991,6 +22678,9 @@{"$ref": "#/components/schemas/PrintPageBlockYAML"},+ {+ "$ref": "#/components/schemas/PdfFillBlockYAML"+ },{"$ref": "#/components/schemas/WorkflowTriggerBlockYAML"},@@ -22734,6 +23424,9 @@},{"$ref": "#/components/schemas/GoogleSheetsWriteBlock"+ },+ {+ "$ref": "#/components/schemas/PdfFillBlock"}],"discriminator": {@@ -22755,6 +23448,7 @@"human_interaction": "#/components/schemas/HumanInteractionBlock","login": "#/components/schemas/LoginBlock","navigation": "#/components/schemas/NavigationBlock",+ "pdf_fill": "#/components/schemas/PdfFillBlock","pdf_parser": "#/components/schemas/PDFParserBlock","print_page": "#/components/schemas/PrintPageBlock","send_email": "#/components/schemas/SendEmailBlock",@@ -22951,6 +23645,9 @@{"$ref": "#/components/schemas/PrintPageBlockYAML"},+ {+ "$ref": "#/components/schemas/PdfFillBlockYAML"+ },{"$ref": "#/components/schemas/WorkflowTriggerBlockYAML"},@@ -22980,6 +23677,7 @@"human_interaction": "#/components/schemas/HumanInteractionBlockYAML","login": "#/components/schemas/LoginBlockYAML","navigation": "#/components/schemas/NavigationBlockYAML",+ "pdf_fill": "#/components/schemas/PdfFillBlockYAML","pdf_parser": "#/components/schemas/PDFParserBlockYAML","print_page": "#/components/schemas/PrintPageBlockYAML","send_email": "#/components/schemas/SendEmailBlockYAML",diff --git a/pyproject.toml b/pyproject.tomlindex e1a9f88c2..7e279f1ef 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -1,6 +1,6 @@[project]name = "skyvern"-version = "1.0.42"+version = "1.0.41"description = ""authors = [{ name = "Skyvern AI", email = "[email protected]" }]requires-python = ">=3.11,<3.14"diff --git a/skyvern-frontend/src/api/types.ts b/skyvern-frontend/src/api/types.tsindex ff130d6db..c34390cbf 100644--- a/skyvern-frontend/src/api/types.ts+++ b/skyvern-frontend/src/api/types.ts@@ -854,6 +854,21 @@ export type CreditCardCredential = {card_exp_year: string;card_brand: string;card_holder_name: string;+ billing_address?: CreditCardBillingAddress | null;+ billing_email?: string | null;+ billing_phone?: string | null;+ metadata?: Record<string, string> | null;+};++export type CreditCardBillingAddress = {+ line1?: string | null;+ line2?: string | null;+ city?: string | null;+ state?: string | null;+ state_code?: string | null;+ postal_code?: string | null;+ country?: string | null;+ country_code?: string | null;};export type SecretCredential = {diff --git a/skyvern-frontend/src/routes/credentials/CredentialsModal.tsx b/skyvern-frontend/src/routes/credentials/CredentialsModal.tsxindex 7dc7c59be..777d7525a 100644--- a/skyvern-frontend/src/routes/credentials/CredentialsModal.tsx+++ b/skyvern-frontend/src/routes/credentials/CredentialsModal.tsx@@ -14,16 +14,21 @@ import { PasswordCredentialContent } from "./PasswordCredentialContent";import { SecretCredentialContent } from "./SecretCredentialContent";import { useState, useEffect, useCallback, useRef } from "react";import { Button } from "@/components/ui/button";-import { CreditCardCredentialContent } from "./CreditCardCredentialContent";+import {+ CreditCardCredentialContent,+ type CreditCardCredentialValues,+} from "./CreditCardCredentialContent";import { useMutation, useQueryClient } from "@tanstack/react-query";import {- CreateCredentialRequest,- CredentialApiResponse,+ type CreateCredentialRequest,+ type CreditCardBillingAddress,+ type CreditCardCredential,+ type CredentialApiResponse,isPasswordCredential,isCreditCardCredential,isSecretCredential,- TestCredentialStatusResponse,- TestLoginResponse,+ type TestCredentialStatusResponse,+ type TestLoginResponse,} from "@/api/types";import { getClient } from "@/api/AxiosClient";import { useCredentialGetter } from "@/hooks/useCredentialGetter";@@ -54,14 +59,27 @@ const PASSWORD_CREDENTIAL_INITIAL_VALUES = {totp_identifier: "",};-const CREDIT_CARD_CREDENTIAL_INITIAL_VALUES = {- name: "",- cardNumber: "",- cardExpirationDate: "",- cardCode: "",- cardBrand: "",- cardHolderName: "",-};+function createCreditCardCredentialInitialValues(): CreditCardCredentialValues {+ return {+ name: "",+ cardNumber: "",+ cardExpirationDate: "",+ cardCode: "",+ cardBrand: "",+ cardHolderName: "",+ billingAddressLine1: "",+ billingAddressLine2: "",+ billingCity: "",+ billingState: "",+ billingStateCode: "",+ billingPostalCode: "",+ billingCountry: "",+ billingCountryCode: "",+ billingEmail: "",+ billingPhone: "",+ metadata: [{ key: "", value: "" }],+ };+}const SECRET_CREDENTIAL_INITIAL_VALUES = {name: "",@@ -101,6 +119,60 @@ function generateDefaultCredentialName(existingNames: string[]): string {return `${baseName}_${counter}`;}+function trimmedOrNull(value: string) {+ const trimmed = value.trim();+ return trimmed === "" ? null : trimmed;+}++function buildBillingAddress(+ values: CreditCardCredentialValues,+): CreditCardBillingAddress | null {+ const billingAddress: CreditCardBillingAddress = {};++ const line1 = trimmedOrNull(values.billingAddressLine1);+ const line2 = trimmedOrNull(values.billingAddressLine2);+ const city = trimmedOrNull(values.billingCity);+ const state = trimmedOrNull(values.billingState);+ const stateCode = trimmedOrNull(values.billingStateCode);+ const postalCode = trimmedOrNull(values.billingPostalCode);+ const country = trimmedOrNull(values.billingCountry);+ const countryCode = trimmedOrNull(values.billingCountryCode);++ if (line1) billingAddress.line1 = line1;+ if (line2) billingAddress.line2 = line2;+ if (city) billingAddress.city = city;+ if (state) billingAddress.state = state;+ if (stateCode) billingAddress.state_code = stateCode;+ if (postalCode) billingAddress.postal_code = postalCode;+ if (country) billingAddress.country = country;+ if (countryCode) billingAddress.country_code = countryCode;++ return Object.keys(billingAddress).length > 0 ? billingAddress : null;+}++function buildMetadata(values: CreditCardCredentialValues) {+ const metadata: Record<string, string> = {};+ let hasIncompleteEntry = false;++ for (const entry of values.metadata) {+ const key = entry.key.trim();+ const value = entry.value.trim();+ if (!key && !value) {+ continue;+ }+ if (!key || !value) {+ hasIncompleteEntry = true;+ continue;+ }+ metadata[key] = value;+ }++ return {+ metadata: Object.keys(metadata).length > 0 ? metadata : null,+ hasIncompleteEntry,+ };+}+type Props = {onCredentialCreated?: (id: string) => void;/** Optional controlled mode: pass isOpen and onOpenChange to control modal state locally */@@ -151,7 +223,7 @@ function CredentialsModal({PASSWORD_CREDENTIAL_INITIAL_VALUES,);const [creditCardCredentialValues, setCreditCardCredentialValues] = useState(- CREDIT_CARD_CREDENTIAL_INITIAL_VALUES,+ createCreditCardCredentialInitialValues,);const [secretCredentialValues, setSecretCredentialValues] = useState(SECRET_CREDENTIAL_INITIAL_VALUES,@@ -290,6 +362,7 @@ function CredentialsModal({});} else if (isCreditCardCredential(cred)) {setCreditCardCredentialValues({+ ...createCreditCardCredentialInitialValues(),name: editingCredential.name,cardNumber: "",cardExpirationDate: "",@@ -330,7 +403,7 @@ function CredentialsModal({function reset() {setVaultType("default");setPasswordCredentialValues(PASSWORD_CREDENTIAL_INITIAL_VALUES);- setCreditCardCredentialValues(CREDIT_CARD_CREDENTIAL_INITIAL_VALUES);+ setCreditCardCredentialValues(createCreditCardCredentialInitialValues());setSecretCredentialValues(SECRET_CREDENTIAL_INITIAL_VALUES);setEditingGroups({ name: false, values: false });setTestAndSave(false);@@ -909,17 +982,40 @@ function CredentialsModal({}// remove all spaces from the card numberconst number = creditCardCredentialValues.cardNumber.replace(/\s/g, "");+ const billingAddress = buildBillingAddress(creditCardCredentialValues);+ const billingEmail = trimmedOrNull(+ creditCardCredentialValues.billingEmail,+ );+ const billingPhone = trimmedOrNull(+ creditCardCredentialValues.billingPhone,+ );+ const { metadata, hasIncompleteEntry } = buildMetadata(+ creditCardCredentialValues,+ );+ if (hasIncompleteEntry) {+ toast({+ title: "Error",+ description: "Metadata rows need both a key and a value",+ variant: "destructive",+ });+ return;+ }+ const credentialPayload: CreditCardCredential = {+ card_number: number,+ card_cvv: cardCode,+ card_exp_month: cardExpirationMonth,+ card_exp_year: cardExpirationYear,+ card_brand: cardBrand,+ card_holder_name: cardHolderName,+ ...(billingAddress ? { billing_address: billingAddress } : {}),+ ...(billingEmail ? { billing_email: billingEmail } : {}),+ ...(billingPhone ? { billing_phone: billingPhone } : {}),+ ...(metadata ? { metadata } : {}),+ };activeMutation.mutate({name,credential_type: "credit_card",- credential: {- card_number: number,- card_cvv: cardCode,- card_exp_month: cardExpirationMonth,- card_exp_year: cardExpirationYear,- card_brand: cardBrand,- card_holder_name: cardHolderName,- },+ credential: credentialPayload,...(vaultType === "custom" ? { vault_type: "custom" } : {}),});} else if (type === CredentialModalTypes.SECRET) {diff --git a/skyvern-frontend/src/routes/credentials/CreditCardCredentialContent.test.tsx b/skyvern-frontend/src/routes/credentials/CreditCardCredentialContent.test.tsxnew file mode 100644index 000000000..c41161258--- /dev/null+++ b/skyvern-frontend/src/routes/credentials/CreditCardCredentialContent.test.tsx@@ -0,0 +1,94 @@+// @vitest-environment jsdom++import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { useState } from "react";+import { afterEach, describe, expect, it, vi } from "vitest";++vi.mock("@/components/DropdownWithOptions", () => ({+ DropdownWithOptions: ({+ value,+ onChange,+ }: {+ value: string;+ onChange: (value: string) => void;+ }) => (+ <input+ aria-label="Brand"+ value={value}+ onChange={(event) => onChange(event.target.value)}+ />+ ),+}));++import {+ CreditCardCredentialContent,+ type CreditCardCredentialValues,+} from "./CreditCardCredentialContent";++const INITIAL_VALUES: CreditCardCredentialValues = {+ name: "card",+ cardNumber: "",+ cardExpirationDate: "",+ cardCode: "",+ cardBrand: "",+ cardHolderName: "",+ billingAddressLine1: "",+ billingAddressLine2: "",+ billingCity: "",+ billingState: "",+ billingStateCode: "",+ billingPostalCode: "",+ billingCountry: "",+ billingCountryCode: "",+ billingEmail: "",+ billingPhone: "",+ metadata: [{ key: "", value: "" }],+};++function Harness({+ onChangeSpy,+}: {+ onChangeSpy: (next: CreditCardCredentialValues) => void;+}) {+ const [values, setValues] =+ useState<CreditCardCredentialValues>(INITIAL_VALUES);++ return (+ <CreditCardCredentialContent+ values={values}+ onChange={(next) => {+ onChangeSpy(next);+ setValues(next);+ }}+ />+ );+}++describe("CreditCardCredentialContent", () => {+ afterEach(() => cleanup());++ it("collects optional metadata key-value rows", () => {+ const onChangeSpy = vi.fn();+ render(<Harness onChangeSpy={onChangeSpy} />);++ fireEvent.change(screen.getByLabelText("Metadata key 1"), {+ target: { value: "customer_id" },+ });+ fireEvent.change(screen.getByLabelText("Metadata value 1"), {+ target: { value: "cus_123" },+ });+ fireEvent.click(screen.getByText("Add"));+ fireEvent.change(screen.getByLabelText("Metadata key 2"), {+ target: { value: "checkout_profile" },+ });+ fireEvent.change(screen.getByLabelText("Metadata value 2"), {+ target: { value: "default" },+ });++ const lastCall = onChangeSpy.mock.calls[onChangeSpy.mock.calls.length - 1];+ expect(lastCall?.[0].metadata).toEqual([+ { key: "customer_id", value: "cus_123" },+ { key: "checkout_profile", value: "default" },+ ]);+ });+});diff --git a/skyvern-frontend/src/routes/credentials/CreditCardCredentialContent.tsx b/skyvern-frontend/src/routes/credentials/CreditCardCredentialContent.tsxindex 86289c91e..28adb2e13 100644--- a/skyvern-frontend/src/routes/credentials/CreditCardCredentialContent.tsx+++ b/skyvern-frontend/src/routes/credentials/CreditCardCredentialContent.tsx@@ -1,27 +1,51 @@import { DropdownWithOptions } from "@/components/DropdownWithOptions";+import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";import { Separator } from "@/components/ui/separator";import { cn } from "@/util/utils";-import { Pencil1Icon } from "@radix-ui/react-icons";+import { Pencil1Icon, PlusIcon, TrashIcon } from "@radix-ui/react-icons";++export type CreditCardMetadataEntry = {+ key: string;+ value: string;+};++export type CreditCardCredentialValues = {+ name: string;+ cardNumber: string;+ cardExpirationDate: string;+ cardCode: string;+ cardBrand: string;+ cardHolderName: string;+ billingAddressLine1: string;+ billingAddressLine2: string;+ billingCity: string;+ billingState: string;+ billingStateCode: string;+ billingPostalCode: string;+ billingCountry: string;+ billingCountryCode: string;+ billingEmail: string;+ billingPhone: string;+ metadata: CreditCardMetadataEntry[];+};++type BillingFieldKey =+ | "billingAddressLine1"+ | "billingAddressLine2"+ | "billingCity"+ | "billingState"+ | "billingStateCode"+ | "billingPostalCode"+ | "billingCountry"+ | "billingCountryCode"+ | "billingEmail"+ | "billingPhone";type Props = {- values: {- name: string;- cardNumber: string;- cardExpirationDate: string;- cardCode: string;- cardBrand: string;- cardHolderName: string;- };- onChange: (values: {- name: string;- cardNumber: string;- cardExpirationDate: string;- cardCode: string;- cardBrand: string;- cardHolderName: string;- }) => void;+ values: CreditCardCredentialValues;+ onChange: (values: CreditCardCredentialValues) => void;/** Slot rendered right after Name, before the separator */beforeCredentialFields?: React.ReactNode;editMode?: boolean;@@ -43,6 +67,54 @@ const brandOptions = ["Other",];+const billingFields: Array<{+ label: string;+ key: BillingFieldKey;+ autoComplete?: string;+ className?: string;+}> = [+ {+ label: "Address Line 1",+ key: "billingAddressLine1",+ autoComplete: "billing address-line1",+ className: "md:col-span-3",+ },+ {+ label: "Address Line 2",+ key: "billingAddressLine2",+ autoComplete: "billing address-line2",+ className: "md:col-span-3",+ },+ { label: "City", key: "billingCity", autoComplete: "billing address-level2" },+ {+ label: "State",+ key: "billingState",+ autoComplete: "billing address-level1",+ },+ { label: "State Code", key: "billingStateCode" },+ {+ label: "Postal Code",+ key: "billingPostalCode",+ autoComplete: "billing postal-code",+ },+ {+ label: "Country",+ key: "billingCountry",+ autoComplete: "billing country-name",+ },+ {+ label: "Country Code",+ key: "billingCountryCode",+ autoComplete: "billing country",+ },+ {+ label: "Billing Email",+ key: "billingEmail",+ autoComplete: "billing email",+ },+ { label: "Billing Phone", key: "billingPhone", autoComplete: "billing tel" },+];+function formatCardNumber(cardNumber: string) {// put spaces every 4 digitsreturn cardNumber.replace(/(\d{4})(?=\d)/g, "$1 ");@@ -53,6 +125,27 @@ function formatCardExpirationDate(cardExpirationDate: string) {return cardExpirationDate.replace(/(\d{2})(?=\d)/g, "$1/");}+function updateMetadataEntry(+ entries: CreditCardMetadataEntry[],+ index: number,+ field: keyof CreditCardMetadataEntry,+ value: string,+) {+ return entries.map((entry, entryIndex) =>+ entryIndex === index ? { ...entry, [field]: value } : entry,+ );+}++function removeMetadataEntry(+ entries: CreditCardMetadataEntry[],+ index: number,+) {+ if (entries.length <= 1) {+ return [{ key: "", value: "" }];+ }+ return entries.filter((_, entryIndex) => entryIndex !== index);+}+function CreditCardCredentialContent({values,onChange,@@ -64,6 +157,7 @@ function CreditCardCredentialContent({}: Props) {const nameReadOnly = editMode && !editingGroups?.name;const valuesReadOnly = editMode && !editingGroups?.values;+ const optionalFieldClassName = cn({ "opacity-70": valuesReadOnly });return (<div className="space-y-4">@@ -221,6 +315,106 @@ function CreditCardCredentialContent({)}</div></div>+ <Separator />+ <div className="space-y-3">+ <div className="text-sm font-medium">Billing Details</div>+ <div className="grid grid-cols-1 gap-2 md:grid-cols-3">+ {billingFields.map((field) => (+ <div className={cn("space-y-2", field.className)} key={field.key}>+ <Label>{field.label}</Label>+ <Input+ value={values[field.key]}+ onChange={(e) =>+ onChange({ ...values, [field.key]: e.target.value })+ }+ readOnly={valuesReadOnly}+ className={optionalFieldClassName}+ autoComplete={field.autoComplete}+ />+ </div>+ ))}+ </div>+ </div>+ <div className="space-y-3">+ <div className="flex items-center justify-between gap-3">+ <div className="text-sm font-medium">Metadata</div>+ <Button+ type="button"+ size="sm"+ variant="ghost"+ disabled={valuesReadOnly}+ onClick={() =>+ onChange({+ ...values,+ metadata: [...values.metadata, { key: "", value: "" }],+ })+ }+ >+ <PlusIcon className="mr-1.5 size-4" />+ Add+ </Button>+ </div>+ <div className="space-y-2">+ {values.metadata.map((entry, index) => (+ <div+ className="grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.25rem] gap-2"+ key={index}+ >+ <Input+ value={entry.key}+ onChange={(e) =>+ onChange({+ ...values,+ metadata: updateMetadataEntry(+ values.metadata,+ index,+ "key",+ e.target.value,+ ),+ })+ }+ readOnly={valuesReadOnly}+ className={optionalFieldClassName}+ placeholder="Key"+ aria-label={`Metadata key ${index + 1}`}+ />+ <Input+ value={entry.value}+ onChange={(e) =>+ onChange({+ ...values,+ metadata: updateMetadataEntry(+ values.metadata,+ index,+ "value",+ e.target.value,+ ),+ })+ }+ readOnly={valuesReadOnly}+ className={optionalFieldClassName}+ placeholder="Value"+ aria-label={`Metadata value ${index + 1}`}+ />+ <Button+ type="button"+ size="icon"+ variant="ghost"+ disabled={valuesReadOnly}+ onClick={() =>+ onChange({+ ...values,+ metadata: removeMetadataEntry(values.metadata, index),+ })+ }+ aria-label={`Remove metadata row ${index + 1}`}+ >+ <TrashIcon className="size-4" />+ </Button>+ </div>+ ))}+ </div>+ </div></div>);}diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.test.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.test.tsxindex 9284ba720..961af57b0 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.test.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.test.tsx@@ -158,6 +158,35 @@ describe("WorkflowRunBlockDetail router", () => {);});+ it("renders actions for a file_download block", () => {+ const action: ActionsApiResponse = {+ action_id: "act_download",+ action_type: ActionTypes.Click,+ status: Status.Completed,+ task_id: null,+ step_id: null,+ step_order: null,+ action_order: null,+ reasoning: "Click the invoice download link",+ description: null,+ intention: null,+ response: null,+ text: null,+ created_by: null,+ confidence_float: 1,+ };+ const block = buildBlock({+ block_type: "file_download",+ label: "download_invoice",+ actions: [action],+ });++ render(<WorkflowRunBlockDetail activeItem={block} timeline={[]} />);++ expect(screen.getByText("Actions (1)")).toBeDefined();+ expect(screen.getByText("Click the invoice download link")).toBeDefined();+ });+it("renders the conditional detail (branch evaluation) for a conditional block", () => {const block = buildBlock({block_type: "conditional",diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.tsxindex 6f8e5fdcb..f03642b33 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunBlockDetail.tsx@@ -107,6 +107,7 @@ function renderBodyForBlock(case "login":case "validation":case "extraction":+ case "file_download":return (<BlockDetailTaskblock={block}diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.test.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.test.tsxindex 1af97e6a1..1f9c0c5ef 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.test.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.test.tsx@@ -204,7 +204,7 @@ describe("WorkflowRunTimelineBlockItem", () => {});});- it("renders child blocks but not action rows under a non-code container block", () => {+ it("renders child blocks and action rows under a non-code container block", () => {const block = buildBlock({workflow_run_block_id: "wrb_container_with_actions",block_type: "conditional",@@ -236,15 +236,13 @@ describe("WorkflowRunTimelineBlockItem", () => {/>,);- // The nested child block is still revealed...expect(screen.getByText("Next step")).toBeDefined();- // ...but a non-code block never surfaces its own actions as rows.expect(- screen.queryByText(/Extract the condition result from the page/),- ).toBeNull();+ screen.getByText(/Extract the condition result from the page/),+ ).toBeDefined();});- it("does not render action rows under a non-code leaf block but keeps the count badge", () => {+ it("renders action rows under a non-code leaf block and lets the user select an action", () => {const onActionClick = vi.fn();const block = buildBlock({workflow_run_block_id: "wrb_login_actions",@@ -272,13 +270,17 @@ describe("WorkflowRunTimelineBlockItem", () => {/>,);- // The block still advertises how many actions it ran...expect(screen.getByText("1 action")).toBeDefined();- // ...but those actions are not surfaced as rows in the timeline rail.expect(- screen.queryByText(/Click the login link in the top navigation/),- ).toBeNull();- expect(onActionClick).not.toHaveBeenCalled();+ screen.getByText(/Click the login link in the top navigation/),+ ).toBeDefined();++ fireEvent.click(screen.getByRole("button", { name: /#1/i }));++ expect(onActionClick).toHaveBeenCalledWith({+ block,+ action: expect.objectContaining({ action_id: "act_login_click" }),+ });});it("renders loop iterations from first to last", () => {@@ -505,7 +507,7 @@ describe("WorkflowRunTimelineBlockItem", () => {expect(screen.getByText(/ValueError: boom · line 7/)).toBeDefined();});- it("does not render action rows for a non-code block even when output carries line metadata", () => {+ it("renders non-code action rows without code line metadata", () => {const block = buildBlock({workflow_run_block_id: "wrb_task_null_action",block_type: "task_v2",@@ -533,9 +535,9 @@ describe("WorkflowRunTimelineBlockItem", () => {/>,);- expect(screen.queryByText("Screenshot")).toBeNull();+ expect(screen.getByText("Screenshot")).toBeDefined();expect(screen.queryByText("Error")).toBeNull();- expect(screen.queryByText(/Capture failed/)).toBeNull();+ expect(screen.getByText(/Capture failed/)).toBeDefined();expect(screen.queryByText(/line 5/)).toBeNull();});diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsxindex ffa8c9f1e..47ca7b526 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx@@ -629,12 +629,8 @@ function WorkflowRunTimelineBlockItem({const actionCount = actions.length;const hasActions = actionCount > 0;- // Only code blocks break their execution down into action/step rows inside the- // timeline rail. Agent blocks (login, task, navigation, ...) expose their- // actions through the detail panel instead, so the rail stays a high-level- // block outline for them.const isCodeBlock = block.block_type === WorkflowBlockTypes.Code;- const showsActionRows = isCodeBlock && hasActions;+ const showsActionRows = hasActions;// Code blocks without recorded actions fall back to their definition step// outline so the timeline still reflects what the block was meant to do.const codeSteps =diff --git a/skyvern/client/types/non_empty_credit_card_credential.py b/skyvern/client/types/non_empty_credit_card_credential.pyindex 6f8ee4c95..f27f35046 100644--- a/skyvern/client/types/non_empty_credit_card_credential.py+++ b/skyvern/client/types/non_empty_credit_card_credential.py@@ -41,6 +41,26 @@ class NonEmptyCreditCardCredential(UniversalBaseModel):The name of the card holder (must not be empty)"""+ billing_address: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)+ """+ Optional billing address associated with the card+ """++ billing_email: typing.Optional[str] = pydantic.Field(default=None)+ """+ Optional billing email address+ """++ billing_phone: typing.Optional[str] = pydantic.Field(default=None)+ """+ Optional billing phone number+ """++ metadata: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None)+ """+ Optional additional credit card metadata fields+ """+if IS_PYDANTIC_V2:model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2else:diff --git a/skyvern/forge/sdk/api/custom_credential_client.py b/skyvern/forge/sdk/api/custom_credential_client.pyindex 1093f47af..87048a59b 100644--- a/skyvern/forge/sdk/api/custom_credential_client.py+++ b/skyvern/forge/sdk/api/custom_credential_client.py@@ -49,7 +49,7 @@ class CustomCredentialAPIClient:"totp_type": credential.totp_type,}elif isinstance(credential, CreditCardCredential):- return {+ payload: dict[str, Any] = {"type": "credit_card","card_holder_name": credential.card_holder_name,"card_number": credential.card_number,@@ -58,6 +58,17 @@ class CustomCredentialAPIClient:"card_cvv": credential.card_cvv,"card_brand": credential.card_brand,}+ if credential.billing_address is not None:+ billing_address = credential.billing_address.model_dump(exclude_none=True)+ if billing_address:+ payload["billing_address"] = billing_address+ if credential.billing_email is not None:+ payload["billing_email"] = credential.billing_email+ if credential.billing_phone is not None:+ payload["billing_phone"] = credential.billing_phone+ if credential.metadata:+ payload["metadata"] = credential.metadata+ return payloadelif isinstance(credential, SecretCredential):payload = {"type": "secret",@@ -123,6 +134,10 @@ class CustomCredentialAPIClient:card_exp_year=credential_data["card_exp_year"],card_cvv=credential_data["card_cvv"],card_brand=credential_data["card_brand"],+ billing_address=credential_data.get("billing_address"),+ billing_email=credential_data.get("billing_email"),+ billing_phone=credential_data.get("billing_phone"),+ metadata=credential_data.get("metadata"),)return CredentialItem(item_id=item_id,diff --git a/skyvern/forge/sdk/routes/code_samples.py b/skyvern/forge/sdk/routes/code_samples.pyindex 43df0a27a..7d4b61655 100644--- a/skyvern/forge/sdk/routes/code_samples.py+++ b/skyvern/forge/sdk/routes/code_samples.py@@ -759,6 +759,15 @@ await skyvern.create_credential("card_exp_year": "2028","card_brand": "visa","card_holder_name": "John Doe",+ "billing_address": {+ "line1": "123 Main St",+ "city": "San Francisco",+ "state_code": "CA",+ "postal_code": "94105",+ "country_code": "US",+ },+ "billing_email": "[email protected]",+ "metadata": {"checkout_profile": "default"},},)"""@@ -774,7 +783,16 @@ await skyvern.createCredential({card_exp_month: "12",card_exp_year: "2028",card_brand: "visa",- card_holder_name: "John Doe"+ card_holder_name: "John Doe",+ billing_address: {+ line1: "123 Main St",+ city: "San Francisco",+ state_code: "CA",+ postal_code: "94105",+ country_code: "US",+ },+ billing_email: "[email protected]",+ metadata: { checkout_profile: "default" }}});"""diff --git a/skyvern/forge/sdk/routes/credentials.py b/skyvern/forge/sdk/routes/credentials.pyindex 57209e931..153192d9e 100644--- a/skyvern/forge/sdk/routes/credentials.py+++ b/skyvern/forge/sdk/routes/credentials.py@@ -4,8 +4,9 @@ SECURITY INVARIANT — NO RAW CREDENTIAL RETRIEVAL=================================================Credential endpoints must NEVER return sensitive credential data (passwords,TOTP secrets, full card numbers, CVVs, expiration dates, card holder names,-or secret values) in any API response. The only fields that may be returned-are non-sensitive metadata:+credit card billing/contact fields, credit card metadata, or secret values)+in any API response. The only fields that may be returned are non-sensitive+metadata:- Password credentials: ``username``, ``totp_type``, ``totp_identifier``- Credit card credentials: ``last_four``, ``brand``@@ -2438,7 +2439,8 @@ def _convert_to_response(credential: Credential) -> CredentialResponse:SECURITY: This function must ONLY copy non-sensitive metadata into theresponse. Never include passwords, TOTP secrets, full card numbers, CVVs,- expiration dates, card holder names, or secret values. See the module+ expiration dates, card holder names, credit card billing/contact fields,+ credit card metadata, or secret values. See the moduledocstring for the full security invariant."""if credential.credential_type == CredentialType.PASSWORD:diff --git a/skyvern/forge/sdk/schemas/credentials.py b/skyvern/forge/sdk/schemas/credentials.pyindex 45292743e..02f10ae29 100644--- a/skyvern/forge/sdk/schemas/credentials.py+++ b/skyvern/forge/sdk/schemas/credentials.py@@ -55,13 +55,29 @@ class PasswordCredentialResponse(BaseModel):class CreditCardCredentialResponse(BaseModel):"""Response model for credit card credentials — non-sensitive fields only.- SECURITY: Must NEVER include full card number, CVV, expiration date, or card holder name.+ SECURITY: Must NEVER include full card number, CVV, expiration date, card holder name,+ billing fields, or metadata."""last_four: str = Field(..., description="Last four digits of the credit card number", examples=["1234"])brand: str = Field(..., description="Brand of the credit card", examples=["visa"])+class CreditCardBillingAddress(BaseModel):+ """Optional billing address fields associated with a credit card credential."""++ line1: str | None = Field(default=None, description="Billing address line 1", examples=["123 Main St"])+ line2: str | None = Field(default=None, description="Billing address line 2", examples=["Apt 4B"])+ city: str | None = Field(default=None, description="Billing city", examples=["San Francisco"])+ state: str | None = Field(default=None, description="Billing state or region", examples=["California"])+ state_code: str | None = Field(default=None, description="Billing state or region code", examples=["CA"])+ postal_code: str | None = Field(default=None, description="Billing postal code", examples=["94105"])+ country: str | None = Field(default=None, description="Billing country", examples=["United States"])+ country_code: str | None = Field(+ default=None, description="ISO 3166-1 alpha-2 billing country code", examples=["US"]+ )++class SecretCredentialResponse(BaseModel):"""Response model for secret credentials — non-sensitive fields only.@@ -116,6 +132,24 @@ class CreditCardCredential(BaseModel):card_exp_year: str = Field(..., description="The card's expiration year", examples=["2025"])card_brand: str = Field(..., description="The card's brand", examples=["visa"])card_holder_name: str = Field(..., description="The name of the card holder", examples=["John Doe"])+ billing_address: CreditCardBillingAddress | None = Field(+ default=None,+ description="Optional billing address associated with the card",+ )+ billing_email: str | None = Field(default=None, description="Optional billing email address")+ billing_phone: str | None = Field(default=None, description="Optional billing phone number")+ metadata: dict[str, str] | None = Field(+ default=None,+ description="Optional additional credit card metadata fields",+ )++ @model_validator(mode="after")+ def normalize_empty_optional_fields(self) -> Self:+ if self.billing_address is not None and not self.billing_address.model_dump(exclude_none=True):+ self.billing_address = None+ if self.metadata == {}:+ self.metadata = None+ return selfclass NonEmptyCreditCardCredential(CreditCardCredential):diff --git a/skyvern/forge/sdk/services/bitwarden.py b/skyvern/forge/sdk/services/bitwarden.pyindex c9b9e79a0..c42ac7461 100644--- a/skyvern/forge/sdk/services/bitwarden.py+++ b/skyvern/forge/sdk/services/bitwarden.py@@ -29,6 +29,7 @@ from skyvern.forge.sdk.core.aiohttp_helper import aiohttp_delete, aiohttp_get_jsfrom skyvern.forge.sdk.schemas.credentials import (CredentialItem,CredentialType,+ CreditCardBillingAddress,CreditCardCredential,PasswordCredential,SecretCredential,@@ -47,6 +48,87 @@ class BitwardenItemType(IntEnum):IDENTITY = 4+BITWARDEN_CUSTOM_FIELD_TYPE_HIDDEN = 1+CREDIT_CARD_BILLING_ADDRESS_FIELDS = (+ "line1",+ "line2",+ "city",+ "state",+ "state_code",+ "postal_code",+ "country",+ "country_code",+)+++def _credit_card_extra_custom_field_values(credential: CreditCardCredential) -> dict[str, str]:+ values: dict[str, str] = {}+ if credential.billing_address is not None:+ for key, value in credential.billing_address.model_dump(exclude_none=True).items():+ if value:+ values[f"billing_address_{key}"] = value+ if credential.billing_email:+ values["billing_email"] = credential.billing_email+ if credential.billing_phone:+ values["billing_phone"] = credential.billing_phone+ if credential.metadata:+ for key, value in credential.metadata.items():+ if key and value:+ values[f"metadata_{key}"] = value+ return values+++def _build_bitwarden_custom_fields(credential: CreditCardCredential) -> list[dict[str, str | int | None]]:+ return [+ {+ "name": name,+ "value": value,+ "type": BITWARDEN_CUSTOM_FIELD_TYPE_HIDDEN,+ "linkedId": None,+ }+ for name, value in _credit_card_extra_custom_field_values(credential).items()+ ]+++def _extract_credit_card_extra_custom_field_values(item: dict) -> dict[str, str]:+ values: dict[str, str] = {}+ for field in item.get("fields") or []:+ name = field.get("name")+ value = field.get("value")+ if not isinstance(name, str) or not isinstance(value, str) or not value:+ continue+ if name == "billing_email" or name == "billing_phone" or name.startswith("billing_address_"):+ values[name] = value+ elif name.startswith("metadata_"):+ values[name] = value+ return values+++def _credit_card_credential_from_bitwarden_item(item: dict) -> CreditCardCredential:+ card = item["card"]+ extra_values = _extract_credit_card_extra_custom_field_values(item)+ address_values = {+ key: extra_values[f"billing_address_{key}"]+ for key in CREDIT_CARD_BILLING_ADDRESS_FIELDS+ if f"billing_address_{key}" in extra_values+ }+ metadata = {+ key.removeprefix("metadata_"): value for key, value in extra_values.items() if key.startswith("metadata_")+ }+ return CreditCardCredential(+ card_holder_name=card["cardholderName"],+ card_number=card["number"],+ card_exp_month=card["expMonth"],+ card_exp_year=card["expYear"],+ card_cvv=card["code"],+ card_brand=card["brand"],+ billing_address=CreditCardBillingAddress(**address_values) if address_values else None,+ billing_email=extra_values.get("billing_email"),+ billing_phone=extra_values.get("billing_phone"),+ metadata=metadata or None,+ )++def get_bitwarden_item_type_code(item_type: BitwardenItemType) -> int:if item_type == BitwardenItemType.LOGIN:return 1@@ -73,17 +155,9 @@ def get_list_response_item_from_bitwarden_item(item: dict) -> CredentialItem:credential_type=CredentialType.PASSWORD,)elif item["type"] == BitwardenItemType.CREDIT_CARD:- card = item["card"]return CredentialItem(item_id=item["id"],- credential=CreditCardCredential(- card_holder_name=card["cardholderName"],- card_number=card["number"],- card_exp_month=card["expMonth"],- card_exp_year=card["expYear"],- card_cvv=card["code"],- card_brand=card["brand"],- ),+ credential=_credit_card_credential_from_bitwarden_item(item),name=item["name"],credential_type=CredentialType.CREDIT_CARD,)@@ -748,6 +822,7 @@ class BitwardenService:BitwardenConstants.CREDIT_CARD_CVV: credit_card_data["code"],BitwardenConstants.CREDIT_CARD_BRAND: credit_card_data["brand"],}+ mapped_credit_card_data.update(_extract_credit_card_extra_custom_field_values(item))return mapped_credit_card_datafinally:@@ -894,6 +969,7 @@ class BitwardenService:item_template["type"] = get_bitwarden_item_type_code(BitwardenItemType.CREDIT_CARD)item_template["name"] = nameitem_template["card"] = credit_card_template+ item_template["fields"] = _build_bitwarden_custom_fields(credential)item_template["collectionIds"] = [collection_id]item_template["organizationId"] = bw_organization_id@@ -1145,20 +1221,12 @@ class BitwardenService:),)elif response["data"]["type"] == BitwardenItemType.CREDIT_CARD:- credit_card_item = response["data"]["card"]name = response["data"]["name"]return CredentialItem(item_id=item_id,credential_type=CredentialType.CREDIT_CARD,name=name,- credential=CreditCardCredential(- card_holder_name=credit_card_item["cardholderName"],- card_number=credit_card_item["number"],- card_exp_month=credit_card_item["expMonth"],- card_exp_year=credit_card_item["expYear"],- card_cvv=credit_card_item["code"],- card_brand=credit_card_item["brand"],- ),+ credential=_credit_card_credential_from_bitwarden_item(response["data"]),)elif response["data"]["type"] == BitwardenItemType.SECURE_NOTE:name = response["data"]["name"]diff --git a/skyvern/forge/sdk/services/credential/azure_credential_vault_service.py b/skyvern/forge/sdk/services/credential/azure_credential_vault_service.pyindex ffadaf710..59b4b3c61 100644--- a/skyvern/forge/sdk/services/credential/azure_credential_vault_service.py+++ b/skyvern/forge/sdk/services/credential/azure_credential_vault_service.py@@ -12,6 +12,7 @@ from skyvern.forge.sdk.schemas.credentials import (CredentialItem,CredentialType,CredentialVaultType,+ CreditCardBillingAddress,CreditCardCredential,PasswordCredential,SecretCredential,@@ -36,6 +37,10 @@ class AzureCredentialVaultService(CredentialVaultService):card_exp_year: strcard_brand: strcard_holder_name: str+ billing_address: CreditCardBillingAddress | None = None+ billing_email: str | None = None+ billing_phone: str | None = None+ metadata: dict[str, str] | None = Noneclass _SecretCredentialDataImage(BaseModel):type: Literal["secret"]@@ -67,6 +72,13 @@ class AzureCredentialVaultService(CredentialVaultService):return credentialasync def update_credential(self, credential: Credential, data: CreateCredentialRequest) -> Credential:+ credential_data = data.credential+ if data.credential_type == CredentialType.CREDIT_CARD and isinstance(credential_data, CreditCardCredential):+ credential_data = await self._preserve_omitted_credit_card_fields(+ credential=credential,+ updated_credential=credential_data,+ )+# Azure supports in-place secret updates, so we reuse the same item_id.# NOTE: If the DB update below fails, the vault will contain the new data# while DB metadata (name, type, username) remains stale. The actual credential@@ -74,7 +86,7 @@ class AzureCredentialVaultService(CredentialVaultService):# of the update call will reconcile the DB metadata.await self._update_azure_secret_item(item_id=credential.item_id,- credential=data.credential,+ credential=credential_data,)try:@@ -160,6 +172,10 @@ class AzureCredentialVaultService(CredentialVaultService):card_exp_year=data.card_exp_year,card_cvv=data.card_cvv,card_brand=data.card_brand,+ billing_address=data.billing_address,+ billing_email=data.billing_email,+ billing_phone=data.billing_phone,+ metadata=data.metadata,),name=db_credential.name,credential_type=CredentialType.CREDIT_CARD,@@ -195,6 +211,10 @@ class AzureCredentialVaultService(CredentialVaultService):card_exp_year=credential.card_exp_year,card_brand=credential.card_brand,card_holder_name=credential.card_holder_name,+ billing_address=credential.billing_address,+ billing_email=credential.billing_email,+ billing_phone=credential.billing_phone,+ metadata=credential.metadata,)elif isinstance(credential, SecretCredential):data = AzureCredentialVaultService._SecretCredentialDataImage(@@ -235,6 +255,10 @@ class AzureCredentialVaultService(CredentialVaultService):card_exp_year=credential.card_exp_year,card_brand=credential.card_brand,card_holder_name=credential.card_holder_name,+ billing_address=credential.billing_address,+ billing_email=credential.billing_email,+ billing_phone=credential.billing_phone,+ metadata=credential.metadata,)elif isinstance(credential, SecretCredential):data = AzureCredentialVaultService._SecretCredentialDataImage(diff --git a/skyvern/forge/sdk/services/credential/bitwarden_credential_service.py b/skyvern/forge/sdk/services/credential/bitwarden_credential_service.pyindex a6ea3ce73..0efc7ef84 100644--- a/skyvern/forge/sdk/services/credential/bitwarden_credential_service.py+++ b/skyvern/forge/sdk/services/credential/bitwarden_credential_service.py@@ -6,7 +6,9 @@ from skyvern.forge.sdk.schemas.credentials import (CreateCredentialRequest,Credential,CredentialItem,+ CredentialType,CredentialVaultType,+ CreditCardCredential,)from skyvern.forge.sdk.services.bitwarden import BitwardenServicefrom skyvern.forge.sdk.services.credential.credential_vault_service import CredentialVaultService@@ -54,11 +56,18 @@ class BitwardenCredentialVaultService(CredentialVaultService):if not org_collection:raise HTTPException(status_code=404, detail="Credential account not found. It might have been deleted.")+ credential_data = data.credential+ if data.credential_type == CredentialType.CREDIT_CARD and isinstance(credential_data, CreditCardCredential):+ credential_data = await self._preserve_omitted_credit_card_fields(+ credential=credential,+ updated_credential=credential_data,+ )+# Create new vault item with the updated datanew_item_id = await BitwardenService.create_credential_item(collection_id=org_collection.collection_id,name=data.name,- credential=data.credential,+ credential=credential_data,)# Update DB record to point to the new vault itemdiff --git a/skyvern/forge/sdk/services/credential/credential_vault_service.py b/skyvern/forge/sdk/services/credential/credential_vault_service.pyindex b4d3ee38a..2a32e428e 100644--- a/skyvern/forge/sdk/services/credential/credential_vault_service.py+++ b/skyvern/forge/sdk/services/credential/credential_vault_service.py@@ -7,6 +7,8 @@ from skyvern.forge.sdk.schemas.credentials import (CredentialItem,CredentialType,CredentialVaultType,+ CreditCardBillingAddress,+ CreditCardCredential,)@@ -39,6 +41,64 @@ class CredentialVaultService(ABC):async def get_credential_item(self, db_credential: Credential) -> CredentialItem:"""Retrieve the full credential data from the vault."""+ async def _preserve_omitted_credit_card_fields(+ self,+ credential: Credential,+ updated_credential: CreditCardCredential,+ ) -> CreditCardCredential:+ updated_fields = updated_credential.model_fields_set+ if {+ "billing_address",+ "billing_email",+ "billing_phone",+ "metadata",+ }.issubset(updated_fields):+ return updated_credential++ existing_item = await self.get_credential_item(credential)+ if not isinstance(existing_item.credential, CreditCardCredential):+ return updated_credential++ preserved_fields: dict[str, object] = {}+ existing_credential = existing_item.credential+ if "billing_address" not in updated_fields:+ preserved_fields["billing_address"] = existing_credential.billing_address+ elif updated_credential.billing_address and existing_credential.billing_address:+ preserved_fields["billing_address"] = self._preserve_omitted_billing_address_fields(+ existing_address=existing_credential.billing_address,+ updated_address=updated_credential.billing_address,+ )++ for field_name in ("billing_email", "billing_phone", "metadata"):+ if field_name not in updated_fields:+ preserved_fields[field_name] = getattr(existing_credential, field_name)++ return updated_credential.model_copy(update=preserved_fields)++ @staticmethod+ def _preserve_omitted_billing_address_fields(+ existing_address: CreditCardBillingAddress,+ updated_address: CreditCardBillingAddress,+ ) -> CreditCardBillingAddress:+ preserved_fields = {}+ updated_fields = updated_address.model_fields_set+ for field_name in (+ "line1",+ "line2",+ "city",+ "state",+ "state_code",+ "postal_code",+ "country",+ "country_code",+ ):+ preserved_fields[field_name] = (+ getattr(updated_address, field_name)+ if field_name in updated_fields+ else getattr(existing_address, field_name)+ )+ return updated_address.model_copy(update=preserved_fields)+@staticmethodasync def _create_db_credential(organization_id: str,diff --git a/skyvern/forge/sdk/services/credential/custom_credential_vault_service.py b/skyvern/forge/sdk/services/credential/custom_credential_vault_service.pyindex 0e74ae7c1..a6cbd1931 100644--- a/skyvern/forge/sdk/services/credential/custom_credential_vault_service.py+++ b/skyvern/forge/sdk/services/credential/custom_credential_vault_service.py@@ -10,7 +10,9 @@ from skyvern.forge.sdk.schemas.credentials import (CreateCredentialRequest,Credential,CredentialItem,+ CredentialType,CredentialVaultType,+ CreditCardCredential,)from skyvern.forge.sdk.services.credential.credential_vault_service import CredentialVaultService@@ -171,11 +173,17 @@ class CustomCredentialVaultService(CredentialVaultService):try:client = await self._get_client_for_organization(credential.organization_id)+ credential_data = data.credential+ if data.credential_type == CredentialType.CREDIT_CARD and isinstance(credential_data, CreditCardCredential):+ credential_data = await self._preserve_omitted_credit_card_fields(+ credential=credential,+ updated_credential=credential_data,+ )# Create new credential in the external APInew_item_id = await client.create_credential(name=data.name,- credential=data.credential,+ credential=credential_data,)# Update DB record to point to the new vault itemdiff --git a/skyvern/forge/sdk/services/credential/gcp_credential_vault_service.py b/skyvern/forge/sdk/services/credential/gcp_credential_vault_service.pyindex 708d8d048..9209a5818 100644--- a/skyvern/forge/sdk/services/credential/gcp_credential_vault_service.py+++ b/skyvern/forge/sdk/services/credential/gcp_credential_vault_service.py@@ -14,6 +14,7 @@ from skyvern.forge.sdk.schemas.credentials import (CredentialItem,CredentialType,CredentialVaultType,+ CreditCardBillingAddress,CreditCardCredential,PasswordCredential,SecretCredential,@@ -38,6 +39,10 @@ class GcpCredentialVaultService(CredentialVaultService):card_exp_year: strcard_brand: strcard_holder_name: str+ billing_address: CreditCardBillingAddress | None = None+ billing_email: str | None = None+ billing_phone: str | None = None+ metadata: dict[str, str] | None = Noneclass _SecretCredentialDataImage(BaseModel):type: Literal["secret"]@@ -77,6 +82,13 @@ class GcpCredentialVaultService(CredentialVaultService):return credentialasync def update_credential(self, credential: Credential, data: CreateCredentialRequest) -> Credential:+ credential_data = data.credential+ if data.credential_type == CredentialType.CREDIT_CARD and isinstance(credential_data, CreditCardCredential):+ credential_data = await self._preserve_omitted_credit_card_fields(+ credential=credential,+ updated_credential=credential_data,+ )+# Updating a Secret Manager secret adds a new version under the same# secret id, so we reuse item_id. NOTE: if the DB update below fails the# vault holds the new value while DB metadata (name, type, username) is@@ -84,7 +96,7 @@ class GcpCredentialVaultService(CredentialVaultService):# the metadata.await self._update_gcp_secret_item(item_id=credential.item_id,- credential=data.credential,+ credential=credential_data,)try:@@ -144,6 +156,10 @@ class GcpCredentialVaultService(CredentialVaultService):card_exp_year=data.card_exp_year,card_cvv=data.card_cvv,card_brand=data.card_brand,+ billing_address=data.billing_address,+ billing_email=data.billing_email,+ billing_phone=data.billing_phone,+ metadata=data.metadata,),name=db_credential.name,credential_type=CredentialType.CREDIT_CARD,@@ -175,6 +191,10 @@ class GcpCredentialVaultService(CredentialVaultService):card_exp_year=credential.card_exp_year,card_brand=credential.card_brand,card_holder_name=credential.card_holder_name,+ billing_address=credential.billing_address,+ billing_email=credential.billing_email,+ billing_phone=credential.billing_phone,+ metadata=credential.metadata,)elif isinstance(credential, SecretCredential):return GcpCredentialVaultService._SecretCredentialDataImage(diff --git a/skyvern/forge/sdk/workflow/context_manager.py b/skyvern/forge/sdk/workflow/context_manager.pyindex ee77da171..56d077c76 100644--- a/skyvern/forge/sdk/workflow/context_manager.py+++ b/skyvern/forge/sdk/workflow/context_manager.py@@ -83,6 +83,7 @@ _ONEPASSWORD_5XX_PATTERN = re.compile(r"|"r"(?:\b(5\d{2})\s+(?:service\s+unavailable|bad\s+gateway|gateway\s+timeout|internal\s+server\s+error)\b)")+_SECRET_FIELD_KEY_PATTERN = re.compile(r"[^A-Za-z0-9_]+")class WorkflowRunContext:@@ -639,17 +640,20 @@ class WorkflowRunContext:self.values[parameter.key] = {"context": "These values are placeholders. When you type this in, the real value gets inserted (For security reasons)",}- credential_dict: dict[str, str | None] = credential.model_dump()+ credential_dict: dict[str, Any] = credential.model_dump(exclude_none=True)+ used_secret_field_keys = set(self.values[parameter.key])for key, value in credential_dict.items():# totp_type is metadata; totp is registered as a TOTP seed below, not as a plain field.if key in ("totp_type", "totp"):continueif not value:continue- random_secret_id = self.generate_random_secret_id()- secret_id = f"{random_secret_id}_{key}"- self.secrets[secret_id] = value- self.values[parameter.key][key] = secret_id+ for field_key, field_value in self._flatten_credential_secret_field(key, value):+ field_key = self._dedupe_secret_field_key(field_key, used_secret_field_keys)+ random_secret_id = self.generate_random_secret_id()+ secret_id = f"{random_secret_id}_{field_key}"+ self.secrets[secret_id] = field_value+ self.values[parameter.key][field_key] = secret_idif isinstance(credential, PasswordCredential) and credential.totp:random_secret_id = self.generate_random_secret_id()@@ -1236,6 +1240,25 @@ class WorkflowRunContext:self.secrets[secret_id] = credit_card_data[data_key]parameter_value[secret_suffix] = secret_id+ extra_field_keys = [+ key+ for key in credit_card_data+ if key == "billing_email"+ or key == "billing_phone"+ or key.startswith("billing_address_")+ or key.startswith("metadata_")+ ]+ used_secret_field_keys = set(parameter_value)+ for data_key in extra_field_keys:+ field_key = self._normalize_secret_field_key(data_key)+ if not field_key:+ continue+ field_key = self._dedupe_secret_field_key(field_key, used_secret_field_keys)+ random_secret_id = self.generate_random_secret_id()+ secret_id = f"{random_secret_id}_{field_key}"+ self.secrets[secret_id] = credit_card_data[data_key]+ parameter_value[field_key] = secret_id+self.values[parameter.key] = parameter_valueself.parameters[parameter.key] = parameter@@ -1508,6 +1531,39 @@ class WorkflowRunContext:self.secrets[secret_id] = valueself.values[parameter.key][key] = secret_id+ @staticmethod+ def _normalize_secret_field_key(key: str) -> str:+ return _SECRET_FIELD_KEY_PATTERN.sub("_", key).strip("_").lower()++ @staticmethod+ def _dedupe_secret_field_key(field_key: str, used_field_keys: set[str]) -> str:+ if field_key not in used_field_keys:+ used_field_keys.add(field_key)+ return field_key++ index = 2+ while f"{field_key}_{index}" in used_field_keys:+ index += 1+ deduped_field_key = f"{field_key}_{index}"+ used_field_keys.add(deduped_field_key)+ return deduped_field_key++ @classmethod+ def _flatten_credential_secret_field(cls, key: str, value: Any) -> list[tuple[str, str]]:+ if isinstance(value, str):+ field_key = cls._normalize_secret_field_key(key)+ return [(field_key, value)] if field_key else []+ if isinstance(value, dict):+ fields: list[tuple[str, str]] = []+ for nested_key, nested_value in value.items():+ if not nested_value:+ continue+ field_key = cls._normalize_secret_field_key(f"{key}_{nested_key}")+ if field_key:+ fields.append((field_key, str(nested_value)))+ return fields+ return []+class WorkflowContextManager:aws_client: AsyncAWSClientdiff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.jsindex 5d983a80e..fe842be19 100644--- a/skyvern/webeye/scraper/domUtils.js+++ b/skyvern/webeye/scraper/domUtils.js@@ -451,7 +451,12 @@ function isHoverOnlyElement(element) {// from playwright: https://github.com/microsoft/playwright/blob/1b65f26f0287c0352e76673bc5f85bc36c934b55/packages/playwright-core/src/server/injected/domUtils.ts#L100-L119// NOTE: According this logic, some elements with aria-hidden won't be considered as invisible. And the result shows they are indeed interactable.-function isElementVisible(element) {+function isElementVisible(element, seen) {+ // Break the option/checkbox→parent ↔ display:contents→child recursion cycle+ // that would otherwise overflow the call stack.+ if (seen && seen.has(element)) {+ return false;+ }const tagLower = element.tagName.toLowerCase();// Web Component libraries often hide native form inputs inside shadow DOM@@ -489,8 +494,14 @@ function isElementVisible(element) {tagLower === "option" ||(tagLower === "input" &&(element.type === "radio" || element.type === "checkbox"))- )- return element.parentElement && isElementVisible(element.parentElement);+ ) {+ if (!element.parentElement) {+ return false;+ }+ const pathSeen = seen ? new Set(seen) : new Set();+ pathSeen.add(element);+ return isElementVisible(element.parentElement, pathSeen);+ }const className = element.className ? element.className.toString() : "";if (@@ -505,10 +516,13 @@ function isElementVisible(element) {if (!style) return true;if (style.display === "contents") {// display:contents is not rendered itself, but its child nodes are.+ const pathSeen = seen ? new Set(seen) : new Set();+ pathSeen.add(element);+ // pathSeen is shared across siblings; safe because each recursion copies it.for (let child = element.firstChild; child; child = child.nextSibling) {if (child.nodeType === 1 /* Node.ELEMENT_NODE */ &&- isElementVisible(child)+ isElementVisible(child, pathSeen))return true;if (child.nodeType === 3 /* Node.TEXT_NODE */ && isVisibleTextNode(child))@@ -827,7 +841,13 @@ function isDOMNodeRepresentDiv(element) {function isHoverPointerElement(element, hoverStylesMap) {const tagName = element.tagName.toLowerCase();- const elementClassName = element.className.toString();+ // SVG className is an SVGAnimatedString; read .baseVal so class matching works+ // for SVG targets (its toString() is "[object SVGAnimatedString]", not the classes).+ const rawClassName = element.className;+ const elementClassName =+ typeof rawClassName === "string"+ ? rawClassName+ : (rawClassName?.baseVal ?? "");const elementCursor = getElementComputedStyle(element)?.cursor;if (elementCursor === "pointer") {return true;@@ -1186,7 +1206,7 @@ const isDropdownButton = (element) => {const isSelect2Dropdown = (element) => {const tagName = element.tagName.toLowerCase();- const className = element.className.toString();+ const className = element.className?.toString() ?? "";const role = element.getAttribute("role")? element.getAttribute("role").toLowerCase(): "";@@ -1205,14 +1225,14 @@ const isSelect2Dropdown = (element) => {const isSelect2MultiChoice = (element) => {return (element.tagName.toLowerCase() === "input" &&- element.className.toString().includes("select2-input")+ (element.className?.toString() ?? "").includes("select2-input"));};const isReactSelectDropdown = (element) => {return (element.tagName.toLowerCase() === "input" &&- element.className.toString().includes("select__input") &&+ (element.className?.toString() ?? "").includes("select__input") &&element.getAttribute("role") === "combobox");};@@ -1413,7 +1433,7 @@ const checkRequiredFromStyle = (element) => {};function checkDisabledFromStyle(element) {- const className = element.className.toString().toLowerCase();+ const className = (element.className?.toString() ?? "").toLowerCase();if (className.includes("react-datepicker__day--disabled")) {return true;}diff --git a/tests/unit/test_bitwarden_null_credentials.py b/tests/unit/test_bitwarden_null_credentials.pyindex 2ec50dd2b..5d19fe988 100644--- a/tests/unit/test_bitwarden_null_credentials.py+++ b/tests/unit/test_bitwarden_null_credentials.py@@ -144,3 +144,50 @@ async def test_get_secret_value_by_item_id_preserves_real_values(assert result[BitwardenConstants.USERNAME] == "[email protected]"assert result[BitwardenConstants.PASSWORD] == "hunter2"assert result[BitwardenConstants.TOTP] == ""+++async def test_get_credit_card_data_includes_billing_custom_fields(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ item_payload = {+ "id": "44444444-4444-4444-4444-444444444444",+ "type": 3,+ "organizationId": "org-id",+ "collectionIds": ["collection-id"],+ "card": {+ "cardholderName": "Jane Doe",+ "number": "4111111111111111",+ "expMonth": "12",+ "expYear": "2030",+ "code": "123",+ "brand": "visa",+ },+ "fields": [+ {"name": "billing_address_line1", "value": "123 Main St"},+ {"name": "billing_address_country_code", "value": "US"},+ {"name": "billing_email", "value": "[email protected]"},+ {"name": "metadata_customer_id", "value": "cus_123"},+ ],+ }++ async def fake_run_command(command: list[str], **_: object) -> RunCommandResult:+ return RunCommandResult(stdout=json.dumps(item_payload), stderr="", returncode=0)++ monkeypatch.setattr(BitwardenService, "run_command", fake_run_command)++ result = await BitwardenService.get_credit_card_data(+ client_id="client-id",+ client_secret="client-secret",+ master_password="master-password",+ bw_organization_id="org-id",+ bw_collection_ids=["collection-id"],+ collection_id="collection-id",+ item_id="44444444-4444-4444-4444-444444444444",+ )++ assert result[BitwardenConstants.CREDIT_CARD_NUMBER] == "4111111111111111"+ assert result["billing_address_line1"] == "123 Main St"+ assert result["billing_address_country_code"] == "US"+ assert result["billing_email"] == "[email protected]"+ assert result["metadata_customer_id"] == "cus_123"diff --git a/tests/unit/test_css_pseudo_control_visibility.js b/tests/unit/test_css_pseudo_control_visibility.jsindex 6b8a5552b..d2c6c6e5d 100644--- a/tests/unit/test_css_pseudo_control_visibility.js+++ b/tests/unit/test_css_pseudo_control_visibility.js@@ -20,7 +20,7 @@ const src = fs.readFileSync(path.join(__dirname, "../../skyvern/webeye/scraper/domUtils.js"),"utf8",);-const fnStart = src.indexOf("function isElementVisible(element) {");+const fnStart = src.indexOf("function isElementVisible(");if (fnStart === -1) throw new Error("isElementVisible not found");const bodyStart = src.indexOf("{", fnStart);let depth = 0,diff --git a/tests/unit/test_dom_scrape_crash_guards.js b/tests/unit/test_dom_scrape_crash_guards.jsnew file mode 100644index 000000000..1e782faa8--- /dev/null+++ b/tests/unit/test_dom_scrape_crash_guards.js@@ -0,0 +1,200 @@+/**+ * Regression tests for two domUtils.js scraper crash paths: undefined className+ * in isHoverPointerElement (TypeError) and the isElementVisible display:contents+ * recursion cycle (RangeError). Exit 0 = pass, exit 1 = failures on stderr.+ */++const fs = require("fs");+const path = require("path");++const src = fs.readFileSync(+ path.join(__dirname, "../../skyvern/webeye/scraper/domUtils.js"),+ "utf8",+);++function extract(name) {+ const fnStart = src.indexOf(`function ${name}(`);+ if (fnStart === -1) throw new Error(`${name} not found`);+ const bodyStart = src.indexOf("{", fnStart);+ let depth = 0,+ fnEnd = -1;+ for (let i = bodyStart; i < src.length; i++) {+ if (src[i] === "{") depth++;+ else if (src[i] === "}") {+ depth--;+ if (depth === 0) {+ fnEnd = i + 1;+ break;+ }+ }+ }+ return src.substring(fnStart, fnEnd);+}++global.ShadowRoot = class {};++function getElementComputedStyle(el) {+ return {+ display: "block",+ visibility: "visible",+ opacity: "1",+ cursor: (el._style && el._style.cursor) || "auto",+ ...(el._style || {}),+ };+}++const isElementVisible = new Function(+ "getElementComputedStyle",+ "isElementStyleVisibilityVisible",+ "isHoverOnlyElement",+ "isHidden",+ "isScriptOrStyle",+ "hasBeforeOrAfterPseudoContent",+ "getPseudoContent",+ "isVisibleTextNode",+ "ShadowRoot",+ `${extract("isElementVisible")}\nreturn isElementVisible;`,+)(+ getElementComputedStyle,+ () => true,+ () => false,+ () => false,+ () => false,+ () => false,+ () => null,+ () => false,+ global.ShadowRoot,+);++const isHoverPointerElement = new Function(+ "getElementComputedStyle",+ `${extract("isHoverPointerElement")}\nreturn isHoverPointerElement;`,+)(getElementComputedStyle);++function el(opts) {+ return {+ tagName: (opts.tagName || "DIV").toUpperCase(),+ type: opts.type || "",+ disabled: false,+ className: "className" in opts ? opts.className : "",+ classList: opts.classList || [],+ parentElement: opts.parentElement || null,+ previousElementSibling: null,+ nodeType: 1,+ firstChild: null,+ nextSibling: null,+ _style: opts.style || {},+ _rect: opts.rect || { width: 100, height: 30, left: 10, top: 10 },+ _attributes: opts.attributes || {},+ getAttribute(n) {+ return this._attributes[n] || null;+ },+ getBoundingClientRect() {+ return this._rect;+ },+ getRootNode() {+ return { host: null };+ },+ hasAttribute(n) {+ return n in this._attributes;+ },+ matches() {+ return false;+ },+ closest() {+ return null;+ },+ };+}++let passed = 0,+ failed = 0;+function test(name, fn) {+ try {+ fn();+ passed++;+ process.stdout.write(` PASS: ${name}\n`);+ } catch (e) {+ failed++;+ process.stderr.write(` FAIL: ${name}\n ${e.message}\n`);+ }+}+function assert(c, m) {+ if (!c) throw new Error(m);+}++// --- className === undefined must not throw ---+test("isHoverPointerElement: undefined className does not throw", () => {+ const e = el({+ tagName: "DIV",+ className: undefined,+ style: { cursor: "auto" },+ });+ // Throws on the unguarded version; caught by test() and reported as FAIL.+ const result = isHoverPointerElement(e, new Map());+ assert(+ result === false,+ "undefined className + cursor:auto => not hover-pointer",+ );+});++test("isHoverPointerElement: normal className still detected", () => {+ const e = el({+ tagName: "DIV",+ className: "btn hover:cursor-pointer",+ style: { cursor: "auto" },+ });+ assert(+ isHoverPointerElement(e, new Map()) === true,+ "hover:cursor-pointer class => true",+ );+});++test("isHoverPointerElement: SVG className (SVGAnimatedString) matched via baseVal", () => {+ // SVG className is an object; toString() => "[object SVGAnimatedString]", so the+ // class match must read baseVal or the hover class is missed.+ const e = el({+ tagName: "svg",+ className: {+ baseVal: "icon hover:cursor-pointer",+ toString: () => "[object SVGAnimatedString]",+ },+ style: { cursor: "auto" },+ });+ assert(+ isHoverPointerElement(e, new Map()) === true,+ "SVG hover:cursor-pointer (in baseVal) should be detected",+ );+});++// --- display:contents + form control must not overflow the stack ---+test("isElementVisible: display:contents parent containing a checkbox does not overflow", () => {+ const parent = el({ tagName: "DIV", style: { display: "contents" } });+ const checkbox = el({+ tagName: "INPUT",+ type: "checkbox",+ parentElement: parent,+ });+ parent.firstChild = checkbox;+ // Both directions overflow the stack on the unguarded version.+ const fromChild = isElementVisible(checkbox);+ const fromParent = isElementVisible(parent);+ assert(+ typeof fromChild === "boolean" && typeof fromParent === "boolean",+ "both evaluations terminate and return a boolean",+ );+});++test("isElementVisible: display:contents parent containing an option does not overflow", () => {+ const parent = el({ tagName: "SPAN", style: { display: "contents" } });+ const option = el({ tagName: "OPTION", parentElement: parent });+ parent.firstChild = option;+ const result = isElementVisible(option);+ assert(+ typeof result === "boolean",+ "evaluation terminates and returns a boolean",+ );+});++console.log(`\n${passed + failed} tests: ${passed} passed, ${failed} failed`);+process.exit(failed > 0 ? 1 : 0);diff --git a/tests/unit/test_dom_scrape_crash_guards.py b/tests/unit/test_dom_scrape_crash_guards.pynew file mode 100644index 000000000..5658315ce--- /dev/null+++ b/tests/unit/test_dom_scrape_crash_guards.py@@ -0,0 +1,39 @@+"""+Element-tree scraper crash-guard regression tests.++Runs a behavioral Node.js test that exercises the two domUtils.js crash paths:+undefined `className` in isHoverPointerElement, and the isElementVisible+recursion cycle on a display:contents element holding a checkbox/radio/option.+"""++import shutil+import subprocess+from pathlib import Path++import pytest++_REPO_ROOT = Path(__file__).parent.parent.parent+_DOMUTILS = _REPO_ROOT / "skyvern" / "webeye" / "scraper" / "domUtils.js"+_NODE = shutil.which("node")++[email protected](_NODE is None, reason="node not on PATH")+class TestDomScrapeCrashGuards:+ def test_js_syntax(self):+ result = subprocess.run(+ [_NODE, "--check", str(_DOMUTILS)],+ capture_output=True,+ text=True,+ )+ assert result.returncode == 0, f"JS syntax error: {result.stderr}"++ def test_behavioral(self):+ script = Path(__file__).parent / "test_dom_scrape_crash_guards.js"+ assert script.exists(), f"Missing {script}"+ result = subprocess.run(+ [_NODE, str(script)],+ capture_output=True,+ text=True,+ timeout=30,+ )+ assert result.returncode == 0, f"Failed:\n{result.stdout}\n{result.stderr}"diff --git a/tests/unit/test_gcp_credential_vault_service.py b/tests/unit/test_gcp_credential_vault_service.pyindex 42e004cf8..4ef705939 100644--- a/tests/unit/test_gcp_credential_vault_service.py+++ b/tests/unit/test_gcp_credential_vault_service.py@@ -14,6 +14,7 @@ from skyvern.forge.sdk.schemas.credentials import (Credential,CredentialType,CredentialVaultType,+ CreditCardBillingAddress,CreditCardCredential,PasswordCredential,SecretCredential,@@ -76,6 +77,14 @@ class TestGcpSecretItemCreation:card_exp_year="2030",card_brand="visa",card_holder_name="John Doe",+ billing_address=CreditCardBillingAddress(+ line1="123 Main St",+ city="San Francisco",+ state_code="CA",+ postal_code="94105",+ country_code="US",+ ),+ billing_email="[email protected]",),)@@ -83,6 +92,8 @@ class TestGcpSecretItemCreation:assert payload["type"] == "credit_card"assert payload["card_number"] == "4111111111111111"assert payload["card_holder_name"] == "John Doe"+ assert payload["billing_address"]["line1"] == "123 Main St"+ assert payload["billing_email"] == "[email protected]"async def test_create_secret_item_excludes_none_label(self) -> None:svc, client = _service()@@ -150,6 +161,14 @@ class TestGetCredentialItem:"card_exp_year": "2030","card_brand": "visa","card_holder_name": "John Doe",+ "billing_address": {+ "line1": "123 Main St",+ "city": "San Francisco",+ "state_code": "CA",+ "postal_code": "94105",+ "country_code": "US",+ },+ "billing_phone": "+14155550123",}))@@ -160,6 +179,9 @@ class TestGetCredentialItem:assert item.credential_type == CredentialType.CREDIT_CARDassert isinstance(item.credential, CreditCardCredential)assert item.credential.card_number == "4111111111111111"+ assert item.credential.billing_address+ assert item.credential.billing_address.country_code == "US"+ assert item.credential.billing_phone == "+14155550123"async def test_get_secret_credential(self) -> None:svc, client = _service()diff --git a/tests/unit/test_sdf_select_filter_visibility.js b/tests/unit/test_sdf_select_filter_visibility.jsindex 7771db326..dcd8a2562 100644--- a/tests/unit/test_sdf_select_filter_visibility.js+++ b/tests/unit/test_sdf_select_filter_visibility.js@@ -21,7 +21,7 @@ const src = fs.readFileSync(path.join(__dirname, "../../skyvern/webeye/scraper/domUtils.js"),"utf8",);-const fnStart = src.indexOf("function isElementVisible(element) {");+const fnStart = src.indexOf("function isElementVisible(");if (fnStart === -1) throw new Error("isElementVisible not found");const bodyStart = src.indexOf("{", fnStart);let depth = 0,diff --git a/tests/unit/test_totp_identifier_fallback.py b/tests/unit/test_totp_identifier_fallback.pyindex 7cf119a75..40d3c531d 100644--- a/tests/unit/test_totp_identifier_fallback.py+++ b/tests/unit/test_totp_identifier_fallback.py@@ -2,7 +2,12 @@ from types import SimpleNamespaceimport pytest-from skyvern.forge.sdk.schemas.credentials import CredentialVaultType, PasswordCredential+from skyvern.forge.sdk.schemas.credentials import (+ CredentialVaultType,+ CreditCardBillingAddress,+ CreditCardCredential,+ PasswordCredential,+)from skyvern.forge.sdk.workflow import context_manager as cmfrom skyvern.forge.sdk.workflow.context_manager import WorkflowRunContextfrom skyvern.forge.sdk.workflow.models.block import TaskV2Block@@ -23,7 +28,7 @@ async def test_register_credential_parameter_uses_db_totp_identifier(monkeypatchself.totp_identifier = Noneself.totp = None- def model_dump(self) -> dict:+ def model_dump(self, exclude_none: bool = False) -> dict:return {}class FakeCredentialItem:@@ -66,9 +71,7 @@ async def test_register_credential_parameter_uses_db_totp_identifier(monkeypatchassert context.get_credential_totp_identifier("credential_param") == "[email protected]"-async def _register_with_credential(- monkeypatch: pytest.MonkeyPatch, credential: PasswordCredential-) -> WorkflowRunContext:+async def _register_with_credential(monkeypatch: pytest.MonkeyPatch, credential: object) -> WorkflowRunContext:db_credential = SimpleNamespace(credential_id="cred-1",organization_id="org-1",@@ -160,6 +163,58 @@ async def test_find_credential_parameter_key_for_secret_round_trip(assert context.find_credential_parameter_key_for_secret("nonexistent") is None+async def test_register_credit_card_flattens_billing_fields(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ credential = CreditCardCredential(+ card_number="4111111111111111",+ card_cvv="123",+ card_exp_month="12",+ card_exp_year="2030",+ card_brand="visa",+ card_holder_name="Jane Doe",+ billing_address=CreditCardBillingAddress(+ line1="123 Main St",+ state_code="CA",+ country_code="US",+ ),+ billing_email="[email protected]",+ metadata={"customer_id": "cus_123"},+ )+ context = await _register_with_credential(monkeypatch, credential)++ values = context.values["credential_param"]+ assert context.secrets[values["billing_address_line1"]] == "123 Main St"+ assert context.secrets[values["billing_address_state_code"]] == "CA"+ assert context.secrets[values["billing_address_country_code"]] == "US"+ assert context.secrets[values["billing_email"]] == "[email protected]"+ assert context.secrets[values["metadata_customer_id"]] == "cus_123"+++async def test_register_credit_card_preserves_colliding_metadata_keys(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ credential = CreditCardCredential(+ card_number="4111111111111111",+ card_cvv="123",+ card_exp_month="12",+ card_exp_year="2030",+ card_brand="visa",+ card_holder_name="Jane Doe",+ metadata={+ "Customer ID": "cus_upper",+ "customer-id": "cus_dash",+ },+ )+ context = await _register_with_credential(monkeypatch, credential)++ values = context.values["credential_param"]+ assert context.secrets[values["metadata_customer_id"]] == "cus_upper"+ assert context.secrets[values["metadata_customer_id_2"]] == "cus_dash"++def test_task_v2_block_resolves_totp_identifier_from_context() -> None:block = TaskV2Block.model_construct(totp_identifier=None)workflow_run_context = SimpleNamespace(credential_totp_identifiers={"credential_param": "[email protected]"})diff --git a/uv.lock b/uv.lockindex fb9b2c914..f5cc0deb1 100644--- a/uv.lock+++ b/uv.lock@@ -5776,7 +5776,7 @@ wheels = [[[package]]name = "skyvern"-version = "1.0.42"+version = "1.0.41"source = { editable = "." }dependencies = [{ name = "cachetools" },