Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion backend/routes/webhooks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
from typing import Any
from urllib.parse import urlparse

import httpx
from fastapi import APIRouter, Depends, HTTPException
Expand Down Expand Up @@ -37,9 +38,14 @@ async def create_webhook(data: dict[str, Any], current_user: User = Depends(get_
if current_user.role not in ("admin", "instructor"):
raise HTTPException(status_code=403, detail="Insufficient permissions")

url = data.get("url", "")
parsed = urlparse(url)
if parsed.scheme not in ("http", "https") or not parsed.netloc:
raise HTTPException(status_code=400, detail="Webhook URL must be http(s) with a host")

webhook = WebhookConfig(
name=data["name"],
url=data["url"],
url=url,
events=data.get("events", ["simulation_complete"]),
secret=data.get("secret"),
organization_id=current_user.organization_id,
Expand Down
2 changes: 1 addition & 1 deletion backend/services/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from models.schemas import User
from services.database import db

JWT_SECRET = os.environ.get("JWT_SECRET", "soceng-lab-secret-key-change-in-production")
JWT_SECRET = os.environ.get("JWT_SECRET", "change-this-secret-key-in-production")
JWT_ALGORITHM = "HS256"
JWT_EXPIRATION_HOURS = 24

Expand Down
2 changes: 1 addition & 1 deletion frontend/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# REACT_APP_BACKEND_URL
REACT_APP_BACKEND_URL="http://localhost:8001"
REACT_APP_BACKEND_URL="http://localhost:9442"
Loading