mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-07-09 16:09:13 +00:00
fix(SKY-11914): require auth for pylon email hash (#7142)
This commit is contained in:
parent
3c2c44c11a
commit
af2a0ffcbd
2 changed files with 0 additions and 35 deletions
|
|
@ -7,7 +7,6 @@ from skyvern.forge.sdk.routes import credentials # noqa: F401
|
|||
from skyvern.forge.sdk.routes import custom_llms # noqa: F401
|
||||
from skyvern.forge.sdk.routes import debug_sessions # noqa: F401
|
||||
from skyvern.forge.sdk.routes import prompts # noqa: F401
|
||||
from skyvern.forge.sdk.routes import pylon # noqa: F401
|
||||
from skyvern.forge.sdk.routes import run_blocks # noqa: F401
|
||||
from skyvern.forge.sdk.routes import runtime_config # noqa: F401
|
||||
from skyvern.forge.sdk.routes import scripts # noqa: F401
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
import hashlib
|
||||
import hmac
|
||||
|
||||
import structlog
|
||||
from fastapi import Query
|
||||
|
||||
from skyvern.config import settings
|
||||
from skyvern.forge.sdk.routes.routers import base_router
|
||||
from skyvern.forge.sdk.schemas.pylon import PylonHash
|
||||
|
||||
LOG = structlog.get_logger()
|
||||
|
||||
|
||||
@base_router.get(
|
||||
"/pylon/email_hash",
|
||||
include_in_schema=False,
|
||||
response_model=PylonHash,
|
||||
)
|
||||
def get_pylon_email_hash(email: str = Query(...)) -> PylonHash:
|
||||
no_hash = "???-no-hash-???"
|
||||
secret = settings.PYLON_IDENTITY_VERIFICATION_SECRET
|
||||
|
||||
if not secret:
|
||||
LOG.warning("No Pylon identity verification secret", email=email)
|
||||
return PylonHash(hash=no_hash)
|
||||
|
||||
try:
|
||||
secret_bytes = bytes.fromhex(secret)
|
||||
signature = hmac.new(secret_bytes, email.encode(), hashlib.sha256).hexdigest()
|
||||
|
||||
return PylonHash(hash=signature)
|
||||
except Exception:
|
||||
LOG.exception("Failed to generate Pylon email hash", email=email)
|
||||
return PylonHash(hash=no_hash)
|
||||
Loading…
Add table
Add a link
Reference in a new issue