solspace / craft-freeform

Freeform for Craft: The most reliable form builder that's ready for wherever your project takes you.
https://docs.solspace.com/craft/freeform/v5/
Other
47 stars 59 forks source link

ReCaptcha environment variables parsing not working #1392

Closed valboivin closed 2 months ago

valboivin commented 3 months ago

What happened?

We often have to upsync our database from one environment to another one. However, everytime we do so, we lose the values of our ReCaptcha Site Key and Secret Key in our Captchas settings. We use environment variables to set them in the CMS.

If I look into the database, I can see that the siteKey and secret key values (not the variables keys) are there in the metadata column of our captchas integration row in the freeform_integrations table.

I'm wondering if there's an issue with parsing the value to find the corresponding environment variable.

(We've never had this problem while we were using the Freeform 4 version.)

Screenshot 2024-07-02 at 2 15 40 PM

Screenshot 2024-07-02 at 2 15 52 PM

Screenshot 2024-07-02 at 2 16 08 PM

Errors and Stack Trace (if available)

No response

How can we reproduce this?

  1. Set the ReCaptcha Site Key and Secret Key with an environment variable
  2. Export the database, and reimport it
  3. Site Key and Secret Key are now empty in the CMS

Freeform Edition

Pro

Freeform Version

5.5.1

Craft Version

4.10.2

When did this issue start?

After upgrading from older Craft version

Previous Freeform Version

No response

gustavs-gutmanis commented 3 months ago

Hi @valboivin,

The reason for this is that the CRAFT_SECURITY_KEY in your .env file differs between the environments.

All the sensitive data in the database is encrypted so that if anyone gains access to your database, they would not be able to do API calls to your integrations leaking or destroying data.

This does encrypt env variables as well, but we could make it so that if env variables are used, they are not encrypted. That would make a lot of sense. But meanwhile, you will have to re-enter those, unfortunately.

Thanks for reporting this though, we're adding this to our feature list :)

kjmartens commented 2 months ago

This feature has now been added to Freeform 5.5.3. 🙂

valboivin commented 2 months ago

Thank you so much! It works. 🙂