#119

Reject empty path parameters before URL substitution

Opensdivyanshu90opened 20d ago

What is the issue?

An empty string supplied for a URL path placeholder is accepted and substituted into the request URL. This creates an empty path segment instead of rejecting invalid caller input.

For example, an endpoint whose compiled URL is /v1/items/{id}/sub produces /v1/items//sub when pathParams.id is an empty string. That URL can identify a different vendor route, such as a list route, and is sent with the endpoint's credentials.

How to reproduce

  1. Use an endpoint document with this request URL:

    https://api.example.test/v1/items/{id}/sub
  2. Call substituteUrl or run the endpoint with:

    { "pathParams": { "id": "" } }
  3. Inspect the resulting request URL.

Observed behavior

The request URL becomes:

https://api.example.test/v1/items//sub

Expected behavior

The call should fail with INVALID_INPUT because a path placeholder must resolve to a non-empty string.

Root cause

substituteUrl checks only whether a placeholder value is undefined. The base RunInput path-parameter shape accepts strings, including the empty string, and individual endpoint schemas do not consistently add a minimum length.

Proposed resolution

Treat an empty placeholder value like a missing value in substituteUrl, return INVALID_INPUT, and add a regression test proving that no request is constructed with an empty path segment.

Activity

0

No activity yet.