Skip to content
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

Unsafe Dictionary access introduced in pr #72? #73

Open
yerald-mora opened this issue Oct 18, 2024 · 3 comments
Open

Unsafe Dictionary access introduced in pr #72? #73

yerald-mora opened this issue Oct 18, 2024 · 3 comments

Comments

@yerald-mora
Copy link

Cnp.Sdk.CnpOnline has the method private cnpOnlineResponse SendToCnp(cnpOnlineRequest request), this class receives a dictionary in the constructor that contains configurations, the changes merged in PR #72 adds a direct access to a new configuration in that method:

            if (_config["encryptOltpPayload"] == "true")
            {
                String payloadTobeEncrypted = ReplaceXMLTxnWithEncryptedPayload(xmlRequest);
                xmlResponse = _communication.HttpPost(payloadTobeEncrypted);
            }

So, if the configuration is not set by the caller a KeyNotFoundException is generated, so an unsafe access is being performed in the dictionary what will led to client's systems to get break when this method gets called.

@VantivSDK
Copy link
Contributor

VantivSDK commented Oct 21, 2024 via email

@PhilRCB
Copy link

PhilRCB commented Nov 15, 2024

I am seeing the same issue (using v40.0.1). The app crashes if these config settings are not present:

  • a new config setting "encryptOltpPayload" referenced in SendToCnp method
  • and also a new config setting "oltpEncryptionKeySequence" referenced in ReplaceXMLTxnWithEncryptedPayload method.
    Is there any documentation on these new settings? I have not been able to find any yet?
    (We set the content of _config programmatically rather than using a config file so I assume we have to modify our code to add these new values -- but I need to know what they should contain.)
    Thanks!

@VantivSDK
Copy link
Contributor

VantivSDK commented Nov 21, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants