Skip to content

Set SSL certificate verification to enabled by default with possible override from configuration#3

Open
cmenguy wants to merge 1 commit intomainfrom
ssl-verification
Open

Set SSL certificate verification to enabled by default with possible override from configuration#3
cmenguy wants to merge 1 commit intomainfrom
ssl-verification

Conversation

@cmenguy
Copy link
Contributor

@cmenguy cmenguy commented May 3, 2023

This PR sets the SSL certificate verification to true by default, with the possibility to override it in the configure method or in the JSON configuration file directly. Also includes some details in the README to explain when it is appropriate to use that and how to use it.

Description

  • Added in the aepp.config object a new field called sslVerification
  • Added a new field in configure method called ssl_verification to let the user control that.
  • Changed all the HTTP calls to use verify option with value coming from the configured value.
  • Integrated with the connect instance to also support this parameter
  • Added that as well in ingestion module to have the verification come from config
  • Re-enabled the warnings when SSL verification is disabled
  • Included some comments in the getting started readme to explain when it is appropriate to use and how

Related Issue

#2

Motivation and Context

Makes the library secure by default and gives user control over SSL configuration

How Has This Been Tested?

Tested on several orgs

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@@ -298,20 +300,20 @@ def getData(
f"Start GET request to {endpoint} with header: {json.dumps(headers)}"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just set verify up top once and just use it in the requests.get workflow, feels cleaner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't clear what you meant - the verify=... parameter has to be passed in every type of HTTP call. Or are you saying just for getting the value in the config object once?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter

- Development workloads might not need the same strong guarantees you would want in production workloads.
- If you are behind a proxy / VPN you might under certain scenarios get a `SSLCertVerificationError` when trying to connect to AEP APIs.

If you are in one of these situation where disabling SSL certificate verification is appropriate, you can tell `aepp` to do that by using:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: replace situation with situations, also one thought/question, how would the customer know if they have to do this or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good question, but I would expect in most cases if someone is behind a proxy or on a VPN with special rules they will be aware of it. From what I could see there's only very few situations where SSL certificate verification can fail. If you know other cases let me know I can add more, otherwise we can stick to that for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I heard for other packages that I developed that it prevented network operation (so the package cannot be used). That would be one possible scenario to test if that is the case.

Maybe we can ask the customer to provide a screenshot of the error and place it in a FAQ page.
I am thinking that we may want to document the frequent question that people ask about this package there.
Example of questions I receive:

  • Does there is an SLA?
  • Do I need to pay to use it ?
  • Is it billed against AEP consumption ?
  • How can I request assistance in case of issue ?
    etc...

config_object["private_key"] = private_key
config_object["auth_code"] = auth_code
config_object["sandbox"] = sandbox
config_object["sslVerification"] = ssl_verification
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add that in the connectInstance class.
It is used to save the configuration loaded into an instance in order to re-use it later on with all the sub module.

I would imagine we need to add it in 3 places:

  • as an attrbute (line 319)
  • in the dictionary definition saved internally self.__configObject__ (starting line 320)
  • you may want to create a setter function to change this value, the way I did for sandbox.(up to you)

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

Successfully merging this pull request may close these issues.

3 participants