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

feat(server): REST API and WS API now use env vars for host and port. #8057

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

twinsant
Copy link

User description
Background

Previous versions used hard-coded settings for the server's host and port, which was inconvenient during development
Changes 🏗️

Added host and port settings to the .env file

@twinsant twinsant requested a review from a team as a code owner September 15, 2024 08:42
@twinsant twinsant requested review from Swiftyos and Pwuts and removed request for a team September 15, 2024 08:42
Copy link

PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 Security concerns

Potential exposure to unauthorized access:
The REST API server is configured to listen on all network interfaces (0.0.0.0) by default. This configuration could potentially expose the server to unauthorized access from any network interface if not properly secured. It's recommended to use a more restrictive default, such as 127.0.0.1, for local development, and only use 0.0.0.0 in controlled environments where it's necessary and secure.

⚡ Key issues to review

Potential Security Risk
The server is set to listen on all network interfaces (0.0.0.0) by default. This might expose the server to unnecessary risks if not properly secured.

Configuration Consistency
The .env.example file sets default values for AP_SERVER_PORT and WS_SERVER_PORT, but these might conflict with the PORT environment variable set in the Dockerfile.

Copy link

netlify bot commented Sep 15, 2024

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 6df1334
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/66e8af8dc030510008bb7151

Comment on lines +17 to +22
AP_SERVER_HOST="0.0.0.0"
AP_SERVER_PORT="8000"

# WS API
WS_SERVER_HOST="0.0.0.0"
WS_SERVER_PORT="8001"
Copy link
Contributor

@kcze kcze Sep 15, 2024

Choose a reason for hiding this comment

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

nit for consistency

Suggested change
AP_SERVER_HOST="0.0.0.0"
AP_SERVER_PORT="8000"
# WS API
WS_SERVER_HOST="0.0.0.0"
WS_SERVER_PORT="8001"
AP_SERVER_HOST=localhost
AP_SERVER_PORT=8000
# WS API
WS_SERVER_HOST=localhost
WS_SERVER_PORT=8001

edit: I realised that 0.0.0.0 is not the same as localhost but quote marks can be removed nonetheless.

@kcze
Copy link
Contributor

kcze commented Sep 17, 2024

I think it would be good if @aarushik93 and @majdyz looked at this as well.

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Sep 18, 2024
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@Pwuts
Copy link
Member

Pwuts commented Sep 19, 2024

Since #8008, the ports are configurable:

execution_manager_port: int = Field(
default=8002,
description="The port for execution manager daemon to run on",
)
execution_scheduler_port: int = Field(
default=8003,
description="The port for execution scheduler daemon to run on",
)
agent_server_port: int = Field(
default=8004,
description="The port for agent server daemon to run on",
)

These settings can be used like AGENT_SERVER_PORT=8123.

Do you really need the host to be separately configurable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Automatically applied to PRs with merge conflicts Review effort [1-5]: 2 Server size/m
Projects
Status: 👍🏼 Mergeable
Development

Successfully merging this pull request may close these issues.

3 participants