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

feat(dgraph): enabling TLS config in http zero (#6691) #6867

Merged
merged 5 commits into from
Nov 12, 2020

Conversation

aman-bansal
Copy link
Contributor

@aman-bansal aman-bansal commented Nov 9, 2020

enabling TLS encryption in zero


This change is Reviewable

Docs Preview: Dgraph Preview

* enabling TLS config in http zero

* making zero https configured

* changing behaviour of cmux + adding test cases

* fixing zero address in test

* fixing docker files

* adding alpha in docker compose

* fixing test generate cert pool

* renaming functions based on review

* making zero https more vigilant with more checks

* changing the enabled to disabled flag

* fixing test case

* fixing zero cmd flag desc and refactoring test cases
Copy link

@codelingo codelingo bot left a comment

Choose a reason for hiding this comment

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

6 issues found. 5 rules errored during the review.

}
}

var testCasesHttps = []testCase{
Copy link

@codelingo codelingo bot Nov 10, 2020

Choose a reason for hiding this comment

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

Avoid global variables to improve readability and reduce complexity

View Rule (ignored by CLAIR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codelingo ignore

Copy link

Choose a reason for hiding this comment

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

This specific issue is being ignored for future reviews of this PR.

CodeLingoBot help

response string
}

var testCasesHttp = []testCase{
Copy link

@codelingo codelingo bot Nov 10, 2020

Choose a reason for hiding this comment

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

Avoid global variables to improve readability and reduce complexity

View Rule (ignored by CLAIR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codelingo ignore

Copy link

Choose a reason for hiding this comment

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

This specific issue is being ignored for future reviews of this PR.

CodeLingoBot help

response string
}

var testCasesHttp = []testCase{
Copy link

@codelingo codelingo bot Nov 10, 2020

Choose a reason for hiding this comment

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

Avoid global variables to improve readability and reduce complexity

View Rule (ignored by CLAIR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codelingo ignore

Copy link

Choose a reason for hiding this comment

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

This specific issue is being ignored for future reviews of this PR.

CodeLingoBot help

return body
}

func generateCertPool(certPath string, useSystemCA bool) (*x509.CertPool, error) {
Copy link

@codelingo codelingo bot Nov 10, 2020

Choose a reason for hiding this comment

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

Boolean arguments can indicate low cohesion. Consider refactoring generateCertPool by using a separate function for each case and helper functions for repeated code. This will make each function clearer and more modular, leading to easier maintainability.

View Rule (ignored by CLAIR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codelingo ignore

Copy link

Choose a reason for hiding this comment

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

This specific issue is being ignored for future reviews of this PR.

CodeLingoBot help

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is test file

pool, err := generateCertPool("../../tls/ca.crt", true)
require.NoError(t, err)

tlsCfg := &tls.Config{RootCAs: pool, ServerName: "localhost", InsecureSkipVerify: true}
Copy link

@codelingo codelingo bot Nov 10, 2020

Choose a reason for hiding this comment

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

Skipping verification exposes the connection to man-in-the-middle attacks. This should only be used for testing.

View Rule (ignored by CLAIR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codelingo ignore

Copy link

Choose a reason for hiding this comment

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

This specific issue is being ignored for future reviews of this PR.

CodeLingoBot help

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is test file

defer cancel()
err = srv.Shutdown(ctx)
glog.Infoln("All http(s) requests finished.")
if err != nil {
Copy link

@codelingo codelingo bot Nov 10, 2020

Choose a reason for hiding this comment

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

Error check should immediately follow err assignment.

View Rule (ignored by CLAIR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codelingo ignore

Copy link

Choose a reason for hiding this comment

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

This specific issue is being ignored for future reviews of this PR.

CodeLingoBot help

@aman-bansal aman-bansal merged commit c66f67f into release/v20.07 Nov 12, 2020
@aman-bansal aman-bansal deleted the aman/zero_tls branch November 12, 2020 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants