keploy / keploy

Test generation for Developers. Generate tests and stubs for your application that actually work!
https://keploy.io
Apache License 2.0
3.37k stars 374 forks source link

Fix bypass rules filter #1837

Closed ChinmayaSharma-hue closed 1 week ago

ChinmayaSharma-hue commented 1 month ago

Related Issue

Closes: #1827

Describe the changes you've made

Type of change

Please let us know if any test cases are added

NA

Checklist:

Testcases Working

For flask-mongo application,

  1. Specifying path and port only in filters,
    filters: [
        {
            path: "/students",
            port: 6000,
        }
    ]

    The following curl requests aren't being recorded,

    curl -k -v http://127.0.0.1:6000/students
    curl -X POST http://localhost:6000/students \
     -H "Content-Type: application/json" \
     -d '{"name": "Working John Doe", "age": 21}'
  2. Specifying GET Url method in filter,
    filters: [
        {
            path: "/students",
            port: 6000,
            urlMethods: ["GET"]
        }
    ]

    The following curl requests aren't being recorded,

    curl -k -v http://127.0.0.1:6000/students

    The following curl request is being recorded,

    curl -X POST http://localhost:6000/students \
     -H "Content-Type: application/json" \
     -d '{"name": "Working John Doe", "age": 21}'
  3. Specifying POST Url method in filter,
    filters: [
        {
            path: "/students",
            port: 6000,
            urlMethods: ["POST"]
        }
    ]

    The following curl requests aren't being recorded,

    curl -X POST http://localhost:6000/students \
     -H "Content-Type: application/json" \
     -d '{"name": "Working John Doe", "age": 21}'

    The following curl request is being recorded,

    curl -k -v http://127.0.0.1:6000/students
  4. Specifying header in filter,

    filters: [
        {
            path: "/students",
            port: 6000,
            urlMethods: ["POST"],
            headers: {
                data: "dummy",
            }
    
        }
    ]

    The following curl requests aren't being recorded,

    curl -X POST http://localhost:6000/students \
     -H "Content-Type: application/json" \
     -H "data: dummy" \
     -d '{"name": "Working John Doe", "age": 21}'

    The following curl requests are being recorded,

    curl -X POST http://localhost:6000/students \
     -H "Content-Type: application/json" \
     -d '{"name": "Working John Doe", "age": 21}'
    curl -k -v http://127.0.0.1:6000/students
  5. Specifying header without URL method in filter,

    filters: [
        {
            path: "/students",
            port: 6000,
            headers: {
                data: "dummy",
            }
    
        }
    ]

    The following curl requests aren't being recorded,

    curl -k -v -H "data: dummy" http://127.0.0.1:6000/students
    curl -X POST http://localhost:6000/students \
     -H "Content-Type: application/json" \
     -H "data: dummy" \
     -d '{"name": "Working John Doe", "age": 21}'

    The following curl requests are being recorded,

    curl -k -v http://127.0.0.1:6000/students
    curl -X POST http://localhost:6000/students \
     -H "Content-Type: application/json" \
     -d '{"name": "Working John Doe", "age": 21}'

Screenshots (if any)

NA