Skip to content

Commit aca42f5

Browse files
author
Agent-Planner
committed
Fix security and validation issues
- Add DuckDNS domain validation in scripts/deploy.sh - Add project directory existence check in server/routers/cicd.py - Remove internal error details from client responses (security fix)
1 parent f72b076 commit aca42f5

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

deploy.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ post_checks() {
372372
}
373373

374374
print_notes() {
375-
cat <<'EOF'
375+
cat <<EOF
376376
377377
Deployment complete.
378378
@@ -382,17 +382,17 @@ If the domain does not come up immediately:
382382
3. Check logs:
383383
docker compose -f docker-compose.yml -f docker-compose.traefik.yml logs -f
384384
4. Confirm backend health locally:
385-
curl -fsS http://127.0.0.1:8888/api/health || true
385+
curl -fsS http://127.0.0.1:${APP_PORT:-8888}/api/health || true
386386
387387
To update later, rerun this script. It will git pull and restart.
388388
EOF
389389
}
390390

391391
ensure_packages
392392
configure_duckdns
393+
preserve_env_file
393394
clone_repo
394395
assert_compose_files
395-
preserve_env_file
396396
write_env
397397
prepare_ssl_storage
398398
run_compose

scripts/deploy.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ prompt_required LETSENCRYPT_EMAIL "Enter email for Let's Encrypt notifications"
3434
if [[ "${DOMAIN}" == *.duckdns.org ]]; then
3535
DUCKDNS_SUBDOMAIN="${DOMAIN%.duckdns.org}"
3636
else
37-
DUCKDNS_SUBDOMAIN="${DOMAIN}"
37+
echo "WARNING: Domain '${DOMAIN}' does not end with .duckdns.org."
38+
echo "DuckDNS API requires a duckdns.org subdomain."
39+
read -r -p "Enter just the DuckDNS subdomain (without .duckdns.org): " DUCKDNS_SUBDOMAIN
40+
if [[ -z "$DUCKDNS_SUBDOMAIN" ]]; then
41+
echo "DuckDNS subdomain cannot be empty." >&2
42+
exit 1
43+
fi
3844
fi
3945

4046
read -r -p "Git repo URL [https://github.com/heidi-dang/autocoder.git]: " REPO_URL

server/routers/cicd.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ async def preview_workflow(request: PreviewRequest):
163163
if not project_dir:
164164
raise HTTPException(status_code=404, detail="Project not found")
165165

166+
if not project_dir.exists():
167+
raise HTTPException(status_code=404, detail="Project directory not found")
168+
166169
if request.workflow_type not in ["ci", "security", "deploy"]:
167170
raise HTTPException(
168171
status_code=400,
@@ -253,4 +256,5 @@ async def get_workflow_content(project_name: str, filename: str):
253256
"content": content,
254257
}
255258
except Exception as e:
256-
raise HTTPException(status_code=500, detail=f"Error reading workflow: {str(e)}")
259+
logger.exception(f"Error reading workflow {filename}: {e}")
260+
raise HTTPException(status_code=500, detail="Error reading workflow")

0 commit comments

Comments
 (0)