You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/08/18 15:02:17 UTC

[GitHub] [apisix] hesamhamdarsi opened a new issue, #7738: bug: Restrictions for users(consumers) who are defined in namespaces that include hyphen(-) in their name do not work

hesamhamdarsi opened a new issue, #7738:
URL: https://github.com/apache/apisix/issues/7738

   ### Current Behavior
   
   let's say we define the "consumer1" in namespace "aaa" . the restriction rules (method, apikey) in apisixRoute CRD  like the following works as expected:
   ```yml
   - name: consumer-restriction
         enable: true
         config:
           allowed_by_methods:
           - user: "aaa_consumer1"
             methods:
             - "GET"
   
    ```
   user is able to send the GET request, but not other methods (as expected)
   ```sh
   GET:
   curl https://httpbin.apisix.<DOMAIN>/anything -H 'apikey: <consumer1_key>' -i
   HTTP/2 200
   Post:
   curl https://httpbin.apisix.<DOMAIN>/anything -H 'apikey: <consumer1_key>' -d ' ' -i
   HTTP/2 403
   ```
   but as soon as we define the consumer in a namespace like "aaa-bbb" that includes hyphen symbol in it's name, the rule doesn't work as we expect:
   ```yml
   - name: consumer-restriction
         enable: true
         config:
           allowed_by_methods:
           - user: "aaa-bbb_consumer1"
             methods:
             - "GET"
   
    ```
   user has full access on any method:
   ```sh
   GET:
   curl https://httpbin.apisix.<DOMAIN>/anything -H 'apikey: <consumer1_key>' -i
   HTTP/2 200
   Post:
   curl https://httpbin.apisix.<DOMAIN>/anything -H 'apikey: <consumer1_key>' -d ' ' -i
   HTTP/2 200
   ```
   
   
   
   ### Expected Behavior
   
   _No response_
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   1. Run apisix-ingress-controller using helm chart (chart version: 0.9.3, appVersion: 1.4.1) --> latest version on helm repo
   2. create the same consumer once in <aaa> and once in <aaa-bbb> namespaces
   3. create a route to httpbin service and enable <consumer-restriction> plugin
   4. add restriction rules like allowed_by_methods, whitelist and blacklist for the specific user
   5. check the behaviour of consumer in namespace with hyphen include with the other one 
   
   ### Environment
   
   - APISIX version : 2.14.1 , Image: 2.15.0-alpine
   - Operating system : Linux
   - OpenResty / Nginx version : openresty/1.19.9.1
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tokers commented on issue #7738: bug: Restrictions for users(consumers) who are defined in namespaces that include hyphen(-) in their name do not work

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #7738:
URL: https://github.com/apache/apisix/issues/7738#issuecomment-1220152558

   That's a bug of Apache APISIX Ingress Controller. cc @tao12345666333 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org