Skip to content

Potential fix for code scanning alert no. 44: Server-side request forgery#3

Draft
cindiekinzz-coder wants to merge 1 commit into
masterfrom
alert-autofix-44
Draft

Potential fix for code scanning alert no. 44: Server-side request forgery#3
cindiekinzz-coder wants to merge 1 commit into
masterfrom
alert-autofix-44

Conversation

@cindiekinzz-coder
Copy link
Copy Markdown
Owner

Potential fix for https://github.com/cindiekinzz-coder/NESTstack/security/code-scanning/44

General fix: never concatenate user-controlled full URLs (or raw request URLs) into outbound request targets. Instead, construct the target with new URL() from a trusted base URL, and append only validated route/path/query components.

Best fix here (without changing intended functionality): in the /v1/{*path} proxy block, replace const target = \${openclawUrl}${req.originalUrl}`;` with URL-safe construction:

  • Use req.params.path (route-captured wildcard) instead of req.originalUrl.
  • Normalize and strip leading slashes from the captured path.
  • Build URL via new URL(base) and set pathname and search explicitly.
  • Keep method/body behavior as-is.

This change is in NESTdesktop/local-agent.js, around lines 440–445.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…gery

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant