gravitee-api-management icon indicating copy to clipboard operation
gravitee-api-management copied to clipboard

fix: debug mode - encrypted api properties are not interpreted

Open ytvnr opened this issue 2 years ago • 1 comments

Issue

https://github.com/gravitee-io/issues/issues/7629

💥 Cause of the bug

ApiManagerImpl was not only responsible of managing the lifecycle of the api (deploy/undeploy) but also of transforming it on two aspects:

  • filters plans matching gateway configuration tags
  • loop over api properties to decrypt them if their were encrypted

Debug Mode is not relying on ApiManagerImpl to deploy an api, so we lose the api preparation step.

🛠 How is it resolved

In this fix, I extracted the api preparation logic into a dedicated class: ApiDeploymentPreProcessor (if you have a better name, do not hesitate)

This allow to move the responsibility in this class, which is now used by ApiManagerImpl and DebugReactor. So now, all the new "pre-transformation" of the api will be done in this dedicated class

🎁 Bonus

It also fixes the plan filtering on sharding tag criteria

⁉️ Why not moving the call to api preparation method away from ApiManagerImpl ?

I decided to let the call to the preparation step at this place because it makes sense to me to do this kind of processing just before the deployment (moreover for decrypting data)

🚀 CI was able to deploy the build of this PR, so you can now try it directly here Notes: The deployed app is linked to the management API of APIM master. (Same login and password as APIM master)

ytvnr avatar May 06 '22 20:05 ytvnr

We should stand by for now on this, we don't want to get encrypted properties cleared out in debug mode. I'll add some info in the documentation and we may adapt once we got users feedbacks on this.

mouligno avatar May 09 '22 09:05 mouligno

Closing for now per @mouligno's feedback

gaetanmaisse avatar Feb 07 '23 07:02 gaetanmaisse