You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/04/01 12:12:13 UTC

[GitHub] [incubator-superset] villebro opened a new pull request #9436: Add check for SSL certificate and add form validators

villebro opened a new pull request #9436: Add check for SSL certificate and add form validators
URL: https://github.com/apache/incubator-superset/pull/9436
 
 
   ### CATEGORY
   
   Choose one
   
   - [x] Bug Fix
   - [ ] Enhancement (new features, refinement)
   - [ ] Refactor
   - [ ] Add tests
   - [ ] Build / Development Environment
   - [ ] Documentation
   
   ### SUMMARY
   PR #9396 introduced a regression which caused adding databases to fail. This fixes that regression and adds a form validator to give feedback if the certificate is invalid.
   
   ### SCREENSHOTS
   ![image](https://user-images.githubusercontent.com/33317356/78135533-b6a5f780-742a-11ea-8f61-3a04c7378749.png)
   ![image](https://user-images.githubusercontent.com/33317356/78135740-0b497280-742b-11ea-8fe3-a6015bf65855.png)
   
   
   ### TEST PLAN
   <!--- What steps should be taken to verify the changes -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] Has associated issue: closes #9431 , closes #9434
   - [ ] Changes UI
   - [ ] Requires DB Migration.
   - [ ] Confirm DB Migration upgrade and downgrade tested.
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] dpgaspar commented on a change in pull request #9436: Add check for SSL certificate and add form validators

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on a change in pull request #9436: Add check for SSL certificate and add form validators
URL: https://github.com/apache/incubator-superset/pull/9436#discussion_r401573436
 
 

 ##########
 File path: superset/views/database/validators.py
 ##########
 @@ -53,3 +55,21 @@ def schema_allows_csv_upload(database, schema):
         security_manager.database_access(database)
         or security_manager.all_datasource_access()
     )
+
+
+def certificate_validator(
+    certificate: Optional[str], exception: Type[ValidationError] = ValidationError
+) -> None:
+    if certificate:
+        try:
+            parse_ssl_cert(certificate)
+        except CertificateException:
 
 Review comment:
   I think we could change the `CertificateException` class and add the message property with this, then here just let `parse_ssl_cert` fail

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] dpgaspar commented on a change in pull request #9436: Add check for SSL certificate and add form validators

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on a change in pull request #9436: Add check for SSL certificate and add form validators
URL: https://github.com/apache/incubator-superset/pull/9436#discussion_r401577805
 
 

 ##########
 File path: superset/views/database/validators.py
 ##########
 @@ -53,3 +55,21 @@ def schema_allows_csv_upload(database, schema):
         security_manager.database_access(database)
         or security_manager.all_datasource_access()
     )
+
+
+def certificate_validator(
+    certificate: Optional[str], exception: Type[ValidationError] = ValidationError
+) -> None:
+    if certificate:
+        try:
+            parse_ssl_cert(certificate)
+        except CertificateException:
 
 Review comment:
   forget it just checked and the Exception must be a child of `ValidationError`.  We could make it a child of `ValidationError` and set the message on a constructor override

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] dpgaspar commented on a change in pull request #9436: Add check for SSL certificate and add form validators

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on a change in pull request #9436: Add check for SSL certificate and add form validators
URL: https://github.com/apache/incubator-superset/pull/9436#discussion_r401573436
 
 

 ##########
 File path: superset/views/database/validators.py
 ##########
 @@ -53,3 +55,21 @@ def schema_allows_csv_upload(database, schema):
         security_manager.database_access(database)
         or security_manager.all_datasource_access()
     )
+
+
+def certificate_validator(
+    certificate: Optional[str], exception: Type[ValidationError] = ValidationError
+) -> None:
+    if certificate:
+        try:
+            parse_ssl_cert(certificate)
+        except CertificateException:
 
 Review comment:
   I think we could change the `CertificateException` class and add the message property with the error message, then here just let `parse_ssl_cert` fail

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] villebro merged pull request #9436: Add check for SSL certificate and add form validators

Posted by GitBox <gi...@apache.org>.
villebro merged pull request #9436: Add check for SSL certificate and add form validators
URL: https://github.com/apache/incubator-superset/pull/9436
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org