#4656·keploy

[bug]: Postman import allows path traversal through collection folder names

Author: Utkarshpandey0001Created Sep 28, 2026Updated Sep 28, 2026
Labelsbug

Is there an existing issue for this?

  • I have searched and didn't find similar issue

Current behavior

When importing a Postman collection containing a folder named ../../escaped, Keploy uses the untrusted folder name directly in the output path. As a result, it writes the generated testcase outside the intended <project>/keploy/ directory:

<project-parent>/escaped/tests/test-1.yaml

###  Steps to Replicate

1. Create an isolated directory:

   ```bash
   mkdir -p /tmp/keploy-path-repro/project
   cd /tmp/keploy-path-repro/project
  1. Create malicious.json:

    json
    {
      "info": {
        "name": "Path traversal reproduction",
        "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
      },
      "item": [
        {
          "name": "../../escaped",
          "item": [
            {
              "name": "Traversal test",
              "request": {
                "method": "GET",
                "header": [],
                "url": "https://example.com"
              },
              "response": [
                {
                  "name": "OK",
                  "status": "OK",
                  "code": 200,
                  "header": [],
                  "body": "{}"
                }
              ]
            }
          ]
        }
      ]
    }
  2. Import the collection:

    bash
    keploy import postman --path malicious.json
  3. Verify that a file was created outside the project directory:

    bash
    test -f /tmp/keploy-path-repro/escaped/tests/test-1.yaml \
      && echo "BUG REPRODUCED: file written outside project"
  4. Confirm that the escaped file contains the imported testcase:

    bash
    cat /tmp/keploy-path-repro/escaped/tests/test-1.yaml

Logs (if any)

ImageImage

Operating system

MacOS

System Info (uname -a)

Darwin Utkarshs-MacBook-Air.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64

OS Release Info (cat /etc/os-release)

ProductName: macOS ProductVersion: 15.1.1 BuildVersion: 24B91

Docker Info (if applicable)

No

Your Environment

Macbook Local machine

Version

I am using latest

Repository

keploy

What use case were you trying? (optional)

I was importing a Postman collection into Keploy to convert its requests and saved responses into Keploy test cases. I expected every generated testcase to be stored inside the project’s keploy/ directory, regardless of the folder names contained in the collection.