Skip to content

M2.3.2 - Node <payment><payflow_advanced><user> is declared twice in Paypal module so it still use MCrypt #23880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Linek opened this issue Jul 25, 2019 · 15 comments
Assignees
Labels
Component: Backend Component: Framework/Encryption Event: mm19pl Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@Linek
Copy link
Contributor

Linek commented Jul 25, 2019

Preconditions

  1. Magento 2.3.2 Open Source & Enterprise

Steps to reproduce

  1. Flush cache
  2. Add breakpoint in \Magento\Framework\Encryption\Encryptor::decrypt in line 437 (can be var_dump or die method). Just to make sure it won't go inside, as this is not supported method
  3. Run the homepage

Expected result

  1. Website should run correctly without going inside of unsupported method

Actual result

  1. Website is stopping (die) on breakpoint because unsupported crypt is used

The reason is probably that in config.php for Magento_Paypal we have node twice under <payflow_advanced> node.

<payflow_advanced>
        <model>Magento\Paypal\Model\Payflowadvanced</model>
        <payment_action>Authorization</payment_action>
        <verbosity>HIGH</verbosity>
            <user backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
        <pwd backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
        <group>paypal</group>
        <title>Credit Card</title>
        <partner>PayPal</partner>
        <vendor>PayPal</vendor>
            <user>PayPal</user>
        <csc_required>1</csc_required>
        <csc_editable>1</csc_editable>
        <url_method>GET</url_method>
        <email_confirmation>0</email_confirmation>
        <verify_peer>1</verify_peer>
        <transaction_url_test_mode>https://pilot-payflowpro.paypal.com</transaction_url_test_mode>
        <transaction_url>https://payflowpro.paypal.com</transaction_url>
        <cgi_url_test_mode>https://pilot-payflowlink.paypal.com</cgi_url_test_mode>
        <cgi_url>https://payflowlink.paypal.com</cgi_url>
</payflow_advanced>

And it tries to decrypt "PayPal" value.

@m2-assistant
Copy link

m2-assistant bot commented Jul 25, 2019

Hi @Linek. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@Linek do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Jul 25, 2019
@engcom-Charlie engcom-Charlie self-assigned this Jul 25, 2019
@m2-assistant
Copy link

m2-assistant bot commented Jul 25, 2019

Hi @engcom-Charlie. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Charlie engcom-Charlie added Component: Backend Component: Framework/Encryption Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Jul 26, 2019
@ghost ghost unassigned engcom-Charlie Jul 26, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Charlie
Thank you for verifying the issue. Based on the provided information internal tickets MC-18656 were created

Issue Available: @engcom-Charlie, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jul 26, 2019
@Yupik
Copy link
Contributor

Yupik commented Sep 15, 2019

#mm19pl

@m2-assistant
Copy link

m2-assistant bot commented Sep 15, 2019

Hi @Yupik. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


@Yupik
Copy link
Contributor

Yupik commented Sep 15, 2019

Hello @Linek - as far as i can see, method \Magento\Framework\Encryption\Encryptor::decrypt() on branch 2.3-develop is fully supported (there's not any deprecated content). It's true, that Magento uses this method after clearing cache, but there's nothing wrong (it decrypt's username and password stored in database).

Right now Magento should go inside this method until PayPal module is active. Please correct me if i'm wrong here. Additional details could be helpful too - until providing i'll close this issue

@Yupik Yupik closed this as completed Sep 15, 2019
@Linek
Copy link
Contributor Author

Linek commented Sep 19, 2019

Hi @Yupik

Maybe I was not fully clear on my first description but in my opinion problem still exists.

So if you will review \Magento\Framework\Encryption\Encryptor::decrypt method there is this part:

           } elseif (1 === $partsCount) {
                $keyVersion = 0;
                $cryptVersion = self::CIPHER_BLOWFISH;
                // not supported format
            } else {

Normally the execution should never go into this condition. But because of configuration in config.xml from Magento_Paypal module, there is an execution of \Magento\Framework\Encryption\Encryptor::decrypt with String parameter "PayPal".

In my opinion it's wrong and there shouldn't be double xml node under <payflow_advanced> node, but if in your opinion it's correct, then we can close it, but please mind that because of this the default BlackFire profile for Magento Cloud is displaying error that mcrypt is used while it shouldn't be anymore in 2.3

@Linek Linek reopened this Sep 19, 2019
@ghost ghost unassigned Yupik Sep 19, 2019
@ghost ghost removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Sep 19, 2019
@Yupik
Copy link
Contributor

Yupik commented Sep 19, 2019

Hello @Linek,

What do you exacly mean by:

double xml node under <payflow_advanced> node

I don't see any double xml node under <payflow_advanced> node. I've tried to debug this, and on fresh Magento 2.3 install it goes to decrypt() method with empty string, not PayPal (maybe you've provided this string to username or password field?).

@Linek
Copy link
Contributor Author

Linek commented Sep 19, 2019

Hi @Yupik

Could you please verify that your <payflow_advanced> looks like this:

            <payflow_advanced>
                <model>Magento\Paypal\Model\Payflowadvanced</model>
                <payment_action>Authorization</payment_action>
                <verbosity>HIGH</verbosity>
                <user backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
                <pwd backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
                <group>paypal</group>
                <title>Credit Card</title>
                <partner>PayPal</partner>
                <vendor>PayPal</vendor>
                <user>PayPal</user>
                <csc_required>1</csc_required>
                <csc_editable>1</csc_editable>
                <url_method>GET</url_method>
                <email_confirmation>0</email_confirmation>
                <verify_peer>1</verify_peer>
                <transaction_url_test_mode>https://pilot-payflowpro.paypal.com</transaction_url_test_mode>
                <transaction_url>https://payflowpro.paypal.com</transaction_url>
                <cgi_url_test_mode>https://pilot-payflowlink.paypal.com</cgi_url_test_mode>
                <cgi_url>https://payflowlink.paypal.com</cgi_url>
            </payflow_advanced>

So the node is first defined with backend_model and then by string "PayPal".

BR

@Yupik
Copy link
Contributor

Yupik commented Sep 19, 2019

@Linek Yes, it looks exacly like this, but still don't get this:

the node is first defined with backend_model and then by string "PayPal".

If you're talking about:
<user backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
<pwd backend_model="Magento\Config\Model\Config\Backend\Encrypted" />

It's not defined twice. backend_model determines class which will handle value under user and pwd fields. It can be added to additional fields here, but we wan't to encrypt only username and password.

Could you please explain "So the node is first defined with backend_model and then by string "PayPal"." with code examples from this xml file?

@hostep
Copy link
Contributor

hostep commented Sep 19, 2019

@Yupik, just read the title of the issue, the <user> node is defined twice 😉

Screenshot 2019-09-19 at 13 24 40

@Yupik
Copy link
Contributor

Yupik commented Sep 19, 2019

@hostep Ah, that's right, thought in different way about this title :) So i'll take care about this, but after fixing doubled node <user> and filling PayPal secret's - it still will go through decrypt method

@Yupik Yupik self-assigned this Sep 19, 2019
@m2-assistant
Copy link

m2-assistant bot commented Sep 19, 2019

Hi @Yupik. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!


@Linek
Copy link
Contributor Author

Linek commented Sep 19, 2019

Hi @Yupik

There is nothing wrong with going through decrypt method. The problem is when parameter is of decrypt is "PayPal" because in this case it will use fallback and run Mcrypt method instead of Sodium.

Yupik added a commit to Yupik/magento2 that referenced this issue Sep 22, 2019
…ayflow_advanced><user> is declared twice in Paypal module
@magento-engcom-team
Copy link
Contributor

Hi @Linek. Thank you for your report.
The issue has been fixed in #24694 by @Yupik in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.4 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Sep 27, 2019
magento-engcom-team added a commit that referenced this issue Sep 27, 2019
 - Merge Pull Request #24694 from Yupik/magento2:fix/doubled-paypal-xml-node
 - Merged commits:
   1. 998cd74
   2. f1e225d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Backend Component: Framework/Encryption Event: mm19pl Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests

5 participants