Skip to content

fix(dynamic-agents): constrain curl request arguments - #2366

Open
sriaradhyula wants to merge 2 commits into
mainfrom
prebuild/fix/curl-request-constraints
Open

fix(dynamic-agents): constrain curl request arguments#2366
sriaradhyula wants to merge 2 commits into
mainfrom
prebuild/fix/curl-request-constraints

Conversation

@sriaradhyula

@sriaradhyula sriaradhyula commented Aug 11, 2026

Copy link
Copy Markdown
Member

Description

Make the built-in curl tool use a defined request interface instead of forwarding unrestricted command-line arguments.

  • Validate every request URL against the configured domain and address rules.
  • Allow only the HTTP method, header, inline body, timeout, and response flags used by the tool.
  • Reject local-file input/output options and unsupported schemes.
  • Disable URL glob expansion and automatic redirects.
  • Preserve inline JSON requests and write-method result warnings.

Type of Change

  • Bugfix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Pre-release Helm Charts (Optional)

No chart changes.

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests

Validation

  • 24 focused tests passed, including a real local curl subprocess and HTTP server
  • Rejection cases verify no subprocess starts
  • Ruff passed

Signed-off-by: Sri Aradhyula <sraradhy@cisco.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ No proprietary content detected. This PR is clear for review!

@github-actions github-actions Bot added the dev Normal PR to main; uses dev prerelease versioning label Aug 11, 2026
Signed-off-by: Sri Aradhyula <sraradhy@cisco.com>
@github-actions

Copy link
Copy Markdown
Contributor

ℹ️ Branch is behind main (advisory, non-blocking)

Commit: 8e66195a

This branch does not yet contain the latest main. This does not fail the version-bump check — version files are bumped once the branch is updated, and GitHub branch protection still requires the branch to be up to date before merge. Use the Update branch button on this PR, or run:

git fetch origin main
git checkout prebuild/fix/curl-request-constraints
git merge FETCH_HEAD
git push

This is a prebuild/* branch, so Helm prebuild publishing will still run so you can test the chart changes while the branch is being updated.

@sriaradhyula
sriaradhyula marked this pull request as ready for review August 20, 2026 17:23
Comment on lines +144 to +152
def _validate_curl_option_value(option: str, value: str) -> str | None:
"""Reject curl option values that can make curl read local files."""
if option not in _CURL_FILE_CAPABLE_OPTIONS:
return None

stripped_value = value.lstrip()
if stripped_value.startswith("@") or (option == "--data-urlencode" and "@" in value):
return f"Option '{option}' cannot read request data from a local file"
return None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should return a agent friendly error instead of None
like This curl argument is forbidden for security reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev Normal PR to main; uses dev prerelease versioning

Projects

Development

Successfully merging this pull request may close these issues.

2 participants