Whitelisting routes not working with other plugins enabled

Since now one responds to the github issue (whitelisting endpoint routes does not work with other plugins enabled · Issue #1705 · TykTechnologies/tyk · GitHub) i thought i try my luck with the community:

If an API has next to whitelisting other endpoint plugins enabled (like modify headers) the whitelisting is not working correctly and it lets through not whitelisted endpoint calls.

Bug is in gateway version 2.6.1. In the version 2.2.0.21 this combinations seemed to work

For the following definition one can call e.g. the route /sessions/username_password with the method PUT even this Method is not whielisted.

"id": "57fba841160e5713fb000005",
"name": "myapi",
"slug": "myapi",
"api_id": "736f085f69d346f87d998931055ed5a5",
"org_id": "57fba34d160e5713fb000001",
"use_keyless": true,
"use_oauth2": false,
"use_openid": false,
"openid_options": {
    "providers": [],
    "segregate_by_client": false
},
"oauth_meta": {
    "allowed_access_types": [],
    "allowed_authorize_types": [],
    "auth_login_redirect": ""
},
"auth": {
    "use_param": false,
    "param_name": "",
    "use_cookie": false,
    "cookie_name": "",
    "auth_header_name": "",
    "use_certificate": false
},
"use_basic_auth": false,
"use_mutual_tls_auth": false,
"client_certificates": [],
"upstream_certificates": {},
"pinned_public_keys": {},
"enable_jwt": false,
"use_standard_auth": false,
"enable_coprocess_auth": false,
"jwt_signing_method": "",
"jwt_source": "",
"jwt_identity_base_field": "",
"jwt_client_base_field": "",
"jwt_policy_field_name": "",
"notifications": {
    "shared_secret": "",
    "oauth_on_keychange_url": ""
},
"enable_signature_checking": false,
"hmac_allowed_clock_skew": -1,
"base_identity_provided_by": "",
"definition": {
    "location": "header",
    "key": "x-api-version"
},
"version_data": {
    "not_versioned": true,
    "default_version": "",
    "versions": {
        "Default": {
            "name": "Default",
            "expires": "",
            "paths": {
                "ignored": [],
                "white_list": [],
                "black_list": []
            },
            "use_extended_paths": true,
            "extended_paths": {
                "white_list": [
                    {
                        "path": "/sessions/access_token",
                        "method_actions": {
                            "POST": {
                                "action": "no_action",
                                "code": 200,
                                "data": "",
                                "headers": {}
                            }
                        }
                    },
                    {
                        "path": "/sessions/cookie",
                        "method_actions": {
                            "POST": {
                                "action": "no_action",
                                "code": 200,
                                "data": "",
                                "headers": {}
                            }
                        }
                    },
                    {
                        "path": "/sessions/auto_login_token",
                        "method_actions": {
                            "POST": {
                                "action": "no_action",
                                "code": 200,
                                "data": "",
                                "headers": {}
                            }
                        }
                    },
                    {
                        "path": "/sessions/username_password",
                        "method_actions": {
                            "POST": {
                                "action": "no_action",
                                "code": 200,
                                "data": "",
                                "headers": {}
                            }
                        }
                    }
                ],
                "transform_response_headers": [
                    {
                        "delete_headers": [
                            "Access-Control-Allow-Origin",
                            "Access-Control-Allow-Credentials"
                        ],
                        "add_headers": {},
                        "path": "/sessions/access_token",
                        "method": "POST",
                        "act_on": false
                    },
                    {
                        "delete_headers": [
                            "Access-Control-Allow-Origin",
                            "Access-Control-Allow-Credentials"
                        ],
                        "add_headers": {},
                        "path": "/sessions/cookie",
                        "method": "POST",
                        "act_on": false
                    },
                    {
                        "delete_headers": [
                            "Access-Control-Allow-Credentials",
                            "Access-Control-Allow-Origin"
                        ],
                        "add_headers": {},
                        "path": "/sessions/auto_login_token",
                        "method": "POST",
                        "act_on": false
                    },
                    {
                        "delete_headers": [
                            "Access-Control-Allow-Origin",
                            "Access-Control-Allow-Credentials"
                        ],
                        "add_headers": {},
                        "path": "/sessions/username_password",
                        "method": "POST",
                        "act_on": false
                    }
                ]
            },
            "global_headers": {},
            "global_headers_remove": [],
            "global_size_limit": 0,
            "override_target": ""
        }
    }
},
"uptime_tests": {
    "check_list": [],
    "config": {
        "expire_utime_after": 0,
        "service_discovery": {
            "use_discovery_service": false,
            "query_endpoint": "",
            "use_nested_query": false,
            "parent_data_path": "",
            "data_path": "",
            "port_data_path": "",
            "target_path": "",
            "use_target_list": false,
            "cache_timeout": 60,
            "endpoint_returns_list": false
        },
        "recheck_wait": 0
    }
},
"proxy": {
    "preserve_host_header": false,
    "listen_path": "/myapi/",
    "target_url": "http://someUpstreamService",
    "strip_listen_path": true,
    "enable_load_balancing": false,
    "target_list": [],
    "check_host_against_uptime_tests": false,
    "service_discovery": {
        "use_discovery_service": false,
        "query_endpoint": "",
        "use_nested_query": false,
        "parent_data_path": "",
        "data_path": "",
        "port_data_path": "",
        "target_path": "",
        "use_target_list": false,
        "cache_timeout": 0,
        "endpoint_returns_list": false
    },
    "transport": {
        "ssl_ciphers": [],
        "ssl_min_version": 0,
        "proxy_url": ""
    }
},
"disable_rate_limit": false,
"disable_quota": false,
"custom_middleware": {
    "pre": [],
    "post": [],
    "post_key_auth": [],
    "auth_check": {
        "name": "",
        "path": "",
        "require_session": false
    },
    "response": [],
    "driver": "",
    "id_extractor": {
        "extract_from": "",
        "extract_with": "",
        "extractor_config": {}
    }
},
"custom_middleware_bundle": "",
"cache_options": {
    "cache_timeout": 60,
    "enable_cache": false,
    "cache_all_safe_requests": false,
    "cache_response_codes": [],
    "enable_upstream_cache_control": false,
    "cache_control_ttl_header": ""
},
"session_lifetime": 0,
"active": true,
"auth_provider": {
    "name": "",
    "storage_engine": "",
    "meta": {}
},
"session_provider": {
    "name": "",
    "storage_engine": "",
    "meta": {}
},
"event_handlers": {
    "events": {}
},
"enable_batch_request_support": false,
"enable_ip_whitelisting": false,
"allowed_ips": [],
"enable_ip_blacklisting": false,
"blacklisted_ips": [],
"dont_set_quota_on_create": false,
"expire_analytics_after": 0,
"response_processors": [
    {
        "name": "header_injector",
        "options": {}
    }
],
"CORS": {
    "enable": true,
    "allowed_origins": [
        "https://myOrigin"
    ],
    "allowed_methods": [
        "GET",
        "POST",
        "OPTIONS"
    ],
    "allowed_headers": [
        "X-Requested-With",
        "Content-Type",
        "Accept",
        "Authentication",
        "X-App-Id",
        "Authorization"
    ],
    "exposed_headers": [],
    "allow_credentials": true,
    "max_age": 24,
    "options_passthrough": false,
    "debug": false
},
"domain": "",
"do_not_track": false,
"tags": [],
"enable_context_vars": false,
"config_data": {},
"tag_headers": [],
"global_rate_limit": {
    "rate": 0,
    "per": 0
},
"strip_auth_data": false

Hi, thanks for the report - i’ll check if I can replicate the bug and if so we’ll get it on our bug tracker.

Hi I have confirmed this on my setup and made an issue for you to track here: Whitelists let through unwhitelisted methods when used with other middleware · Issue #1732 · TykTechnologies/tyk · GitHub

Thanks
Josh

1 Like