3scale / APIcast

3scale API Gateway
Apache License 2.0
305 stars 171 forks source link

[3scale_batcher] Update regrex to match app_id with special characters #1457

Closed tkan145 closed 5 months ago

tkan145 commented 5 months ago

What

A user reported similar error in #1453 but they have app_id with special chars instead. I also think that user with access_token will have similar problem

From the portal code, app_id allows the following:

Allowed characters: 
A-Z a-z 0-9 ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ # Spaces are not allowed

I'm not sure if porta ever validate access_token but from the RFC the format is as follow

b64token    = 1*( ALPHA / DIGIT /
                       "-" / "." / "_" / "~" / "+" / "/" ) *"="
credentials = "Bearer" 1*SP b64token

Verification steps

{ "name" : "apicast.policy.3scale_batcher", "configuration" : { "batch_report_seconds" : 1 } }


capture access token

ACCESS_TOKEN=eyJhb...


* Send a query to Product B with a valid access token

curl -i -k -H "Host: example.com" -H "Authorization: Bearer ${ACCESS_TOKEN}" "http://${APICAST_IP}:8080/"



* Check that credentials not found error does not appear in the log. For example: