Language: Go
Label: vulnerable
CWE: CWE-287 \u2014 Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.

Code:
func TestPlainSplit_UserPass(t *testing.T) {
	a := Auth{
		userTbls: []module.Table{
			mockTable{
				db: map[string]string{
					"user1": "user2",
				},
			},
		},
		passwd: []module.PlainAuth{
			mockAuth{
				db: map[string][]string{
					"user2": []string{"user2a", "user2b"},
				},
			},
			mockAuth{
				db: map[string][]string{
					"user1": []string{"user1a", "user1b"},
				},
			},
		},
	}

	ids, err := a.AuthPlain("user1", "aaa")
	if err != nil {
		t.Fatal("Unexpected error:", err)
	}
	if !reflect.DeepEqual(ids, []string{"user2"}) {
		t.Fatal("Wrong ids returned:", ids)
	}
}