sanitize nul char in totp content (#2186)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from pydantic import BaseModel, ConfigDict, field_validator
|
||||
|
||||
from skyvern.forge.sdk.utils.sanitization import sanitize_postgres_text
|
||||
|
||||
|
||||
class TOTPCodeBase(BaseModel):
|
||||
@@ -19,6 +21,12 @@ class TOTPCodeCreate(TOTPCodeBase):
|
||||
totp_identifier: str
|
||||
content: str
|
||||
|
||||
@field_validator("content")
|
||||
@classmethod
|
||||
def sanitize_content(cls, value: str) -> str:
|
||||
"""Remove NUL (0x00) bytes from content to avoid PostgreSQL DataError."""
|
||||
return sanitize_postgres_text(value)
|
||||
|
||||
|
||||
class TOTPCode(TOTPCodeCreate):
|
||||
totp_code_id: str
|
||||
|
||||
Reference in New Issue
Block a user