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

Return network error when logging in and the network connection fails #3432

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marktheunissen
Copy link

Displays "unable to login due to network error" to the user when a network error is encountered.

  • Works with scenarios where the DNS does not resolve, or the port is closed or there is a timeout, etc.
  • We have InsecureSkipVerify set on the http.Client now, so certificate errors are no longer detected by our http client as errors.

@harshavardhana Up to you, I know MINIO_SERVER_URL is deprecated but it looks like people still use it and get into trouble with DNS.

Fixes: #3427

@harshavardhana
Copy link
Member

=== NAME  Test_PolicyListGroupsAPI
    policy_test.go:740: 
        	Error Trace:	/home/runner/work/console/console/integration/policy_test.go:740
        	Error:      	Not equal: 
        	            	expected: "[\"testgroup12345\"]\n"
        	            	actual  : "[\"testgroup12345\",\"testgroup12345\"]\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,2 +1,2 @@
        	            	-["testgroup12345"]
        	            	+["testgroup12345","testgroup12345"]
        	            	 
        	Test:       	Test_PolicyListGroupsAPI
=== RUN   Test_PolicyListGroupsAPI/List_Users_for_Policy_-_Invalid
--- FAIL: Test_PolicyListGroupsAPI (0.05s)

This looks like some duplicate groups are being listed @marktheunissen - needs a fix on the minio upstream side.

@marktheunissen marktheunissen force-pushed the neterrorlogin branch 2 times, most recently from ab4ea95 to 56f4c9e Compare September 5, 2024 03:01
@marktheunissen
Copy link
Author

@harshavardhana I've tracked this error down to a specific location, this integration test is adding groups and then when getting them back, the duplicates are being introduced.

The group name testgroup12345 is appended here: https://github.com/minio/minio/blob/master/cmd/iam-store.go#L995

And then the same group name testgroup12345 is appended again here: https://github.com/minio/minio/blob/master/cmd/iam-store.go#L1005

The function was modified and no longer does if store.getUsersSysType() == LDAPUsersSysType { so I wonder if that would be the issue?

I can keep working on it but I thought you might be able to find the issue faster than me since it's the first time I've looked at this.

@marktheunissen
Copy link
Author

Made a simpler test that is easy to work with and reached out to a few people here: https://github.com/minio/minio/pull/20388/files

@@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.5
go-version: 1.22
Copy link
Author

Choose a reason for hiding this comment

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

Changing this to 1.22 instead of 1.22.7, as I think the rest of the build pipelines all use the latest go patch version... correct me if I'm wrong.

api/errors.go Outdated
@@ -111,6 +112,11 @@ func ErrorWithContext(ctx context.Context, err ...interface{}) *CodedAPIError {
errorCode = 401
errorMessage = ErrInvalidLogin.Error()
}
if errors.Is(err1, ErrNetworkError) {
detailedMessage = ""
errorCode = 401
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we report 503 Service Unavailable instead?

Copy link
Author

Choose a reason for hiding this comment

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

Yep will change it

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