Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mutualAuth not working as expected #620

Open
jbackman opened this issue May 24, 2021 · 5 comments
Open

mutualAuth not working as expected #620

jbackman opened this issue May 24, 2021 · 5 comments
Projects

Comments

@jbackman
Copy link

Expected behaviour

connection missing a client certificate should be rejected

Actual behaviour

requester gets the response without presenting a certificate

Steps to reproduce

use following config:

{
  "port": 443,
  "protocol": "https",
  "name": "test",
  "mutualAuth": true,
  "defaultResponse": {
    "statusCode": 400,
    "body": "Bad Request",
    "headers": {}
  },
  "stubs": [
    {
      "predicates": [
        {
          "matches": {
            "path": "/API/ID/\\d+/"
          }
        }
      ],
      "responses": [
        {
          "is": {
            "body": {
              "password": [
                "password123"
              ],
              "id": "$ID[1]",
              "success": true
            }
          },
          "headers": {
            "Content-Type": "application/json"
          },
          "behaviors": [
            {
              "copy": {
                "from": "path",
                "into": "$ID",
                "using": {
                  "method": "regex",
                  "selector": "(\\d+)/?$"
                }
              }
            }
          ]
        }
      ]
    }
  ]
}

Software versions used

OS         : RHEL 7.6
mountebank : 2.4.0
node.js    :  14.17
Installation method : npm

Log contents in mb.log when running mb --loglevel debug

test_1         | debug: [https:443 test-env] ::ffff:10.1.0.3:52492 ESTABLISHED
test_1         | info: [https:443 test-env] ::ffff:10.1.0.3:52492 => GET /API/ID/123456/
test_1         | debug: [https:443 test-env] ::ffff:10.1.0.3:52492 => {"requestFrom":"::ffff:10.1.0.3:52492","method":"GET","path":"/API/ID/123456/","query":{},"headers":{"User-Agent":"curl/7.29.0","Host":"test-env","Accept":"*/*"},"body":"","ip":"::ffff:10.1.0.3"}
test_1         | debug: [https:443 test-env] using predicate match: [{"matches":{"path":"/API/ID/\\d+/"}}]
test_1         | debug: [https:443 test-env] generating response from {"is":{"body":{"password":["password123"],"id":"$ID[1]","success":true}},"headers":{"Content-Type":"application/json"},"behaviors":[{"copy":{"from":"path","into":"$ID","using":{"method":"regex","selector":"(\\d+)/?$"}}}]}
test_1         | debug: [https:443 test-env] using stub response behavior [{"copy":{"from":"path","into":"$ID","using":{"method":"regex","selector":"(\\d+)/?$"}}}]
test_1         | debug: [https:443 test-env] Replacing "$ID[0]" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[1]" with "123456"
test_1         | debug: [https:443 test-env] Replacing "$ID" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[0]" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[1]" with "123456"
test_1         | debug: [https:443 test-env] Replacing "$ID" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[0]" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[1]" with "123456"
test_1         | debug: [https:443 test-env] Replacing "$ID" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[0]" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[1]" with "123456"
test_1         | debug: [https:443 test-env] Replacing "$ID" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[0]" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[1]" with "123456"
test_1         | debug: [https:443 test-env] Replacing "$ID" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[0]" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[1]" with "123456"
test_1         | debug: [https:443 test-env] Replacing "$ID" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[0]" with "123456/"
test_1         | debug: [https:443 test-env] Replacing "$ID[1]" with "123456"
test_1         | debug: [https:443 test-env] Replacing "$ID" with "123456/"
test_1         | debug: [https:443 test-env] ::ffff:10.1.0.3:52492 <= {"statusCode":400,"headers":{"Connection":"close"},"body":"{\n    \"password\": [\n        \"password123\"\n    ],\n    \"id\": \"123456\",\n    \"success\": true\n}","_mode":"text"}
test_1         | debug: [https:443 test-env] ::ffff:10.1.0.3:52492 CLOSED
@bbyars
Copy link
Owner

bbyars commented Mar 15, 2022

@bbyars bbyars added this to Wishlist in Roadmap Mar 20, 2022
@everettcomstock
Copy link

@bbyars, do you have any recommendations regarding a path forward with this issue? My organization absolutely must have this feature in place... I'm happy to contribute if I can, but I wanted to see if you're aware of any work arounds or working configurations? Thanks vey much!

@bbyars
Copy link
Owner

bbyars commented Aug 26, 2022 via email

@everettcomstock
Copy link

Thanks for the quick reply. I'm going to discuss with my team and see if we can carve out some time.

@everettcomstock
Copy link

@bbyars , one of my guys submitted a PR to start chipping away at some updates. We'd appreciate any guidance or feedback:

#694

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Roadmap
Wishlist
Development

No branches or pull requests

3 participants