cybersec-jochenarnold opened a new issue, #12801:
URL: https://github.com/apache/apisix/issues/12801

   ### Description
   
   Hi,
   
   I am having problems combining authz-casbin with auth-key or mTLS. In both 
cases, the header is not set to be read by authz-casbin. If I set the header 
manually in the request, the problem does not occur.
   
   Have I overlooked something?
   
   Here are two examples. In the case of auth-key, the username 
(X-Consumer-Username) should be checked; in the case of mTLS, the fingerprint 
(X-Ssl-Client-Fingerprint) should be checked. With mTLS, I set the headers with 
proxy-rewrite. According to the configuration, the priority is correct and the 
proxy-rewrite plugin should be executed before the authz-casbin plugin.
   
   Best
   
   
   ```
   curl http://127.0.0.1:9180/apisix/admin/plugin_metadata/authz-casbin -i -X 
PUT -d '
   {
   "model": "[request_definition]
   r = sub, obj, act
   
   [policy_definition]
   p = sub, obj, act
   
   [role_definition]
   g = _, _
   
   [policy_effect]
   e = some(where (p.eft == allow))
   
   [matchers]
   m = (g(r.sub, p.sub) || keyMatch(r.sub, p.sub)) && keyMatch(r.obj, p.obj) && 
keyMatch(r.act, p.act)",
   
   "policy": "p, reader, *, GET
   p, writer, *, PUT
   g, alice, reader
   g, e8c55395d60bd73983cc12e95f92dc416414322a, reader"
   }'
   ```
   
   **Example for mTLS:**
   ```
   curl -X PUT 'http://127.0.0.1:9180/apisix/admin/routes/1' \
   --header 'Content-Type: application/json' \
   --data-raw '{
       "uri": "/anything",
       "plugins": {
           "proxy-rewrite": {
               "headers": {
                   "X-Ssl-Client-Fingerprint": "$ssl_client_fingerprint",
                   "X-Ssl-Client-Serial": "$ssl_client_serial",
                   "X-Ssl-Client-S-DN": "$ssl_client_s_dn"
               }
           },
           "authz-casbin": {
               "username": "X-Ssl-Client-Fingerprint"
           }
       },
       "upstream": {
           "nodes": {
               "httpbin.org":1
           },
           "type":"roundrobin"
       }
   }'
   ```
   
   **Example for auth-key:**
   
   ```
   curl "http://127.0.0.1:9180/apisix/admin/consumers"; -X PUT \
     -d '{
       "username": "alice"
     }'
   ```
   
   ```
   curl -i "http://127.0.0.1:9180/apisix/admin/routes"; -X PUT -d '
   {
     "plugins": {
         "authz-casbin": {
           "username": "X-Consumer-Username"
         },    
         "key-auth": {}
     },
     "id": "getting-started-httpbindev",
     "uri": "/ip",
     "upstream": {
       "type": "roundrobin",
       "nodes": {
         "httpbin.org:80": 1
       }
     }
   }'
   ```
   
   
   
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.14.1
   - Operating system (run `uname -a`): Linux 1b699ac125c4 6.10.14-linuxkit #1 
SMP Tue Oct 14 07:32:13 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): 
openresty/1.27.1.2
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`): 3.5.7
   - APISIX Dashboard version, if relevant: -
   - Plugin runner version, for issues related to plugin runners: -
   - LuaRocks version, for installation issues (run `luarocks --version`): -
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to