Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow any origins to pass request to skyvern backend by default; make the ALLOWED_ORIGINS configurable through environment #543

Merged
merged 1 commit into from
Jul 3, 2024
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
1 change: 1 addition & 0 deletions skyvern/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Settings(BaseSettings):
JSON_LOGGING: bool = False
LOG_LEVEL: str = "INFO"
PORT: int = 8000
ALLOWED_ORIGINS: list[str] = ["*"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting ALLOWED_ORIGINS to ['*'] by default can lead to significant security vulnerabilities by allowing any website to interact with your API. Consider restricting this to a more conservative set of origins, or ensure that this setting is appropriately configured in production environments to avoid security risks.


# Secret key for JWT. Please generate your own secret key in production
SECRET_KEY: str = "RX1NvhujcJqBPi8O78-7aSfJEWuT86-fll4CzKc_uek"
Expand Down
12 changes: 1 addition & 11 deletions skyvern/forge/api_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,9 @@ def get_agent_app(router: APIRouter = base_router) -> FastAPI:
app = FastAPI()

# Add CORS middleware
origins = [
"http://localhost:5000",
"http://127.0.0.1:5000",
"http://localhost:8000",
"http://127.0.0.1:8000",
"http://localhost:8080",
"http://127.0.0.1:8080",
# Add any other origins you want to whitelist
]

app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_origins=SettingsManager.get_settings().ALLOWED_ORIGINS,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
Expand Down
Loading