Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
b4111d78
Commit
b4111d78
authored
Sep 21, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(security): fixed login issue that was a potential for social engineering, fixes #6014
parent
4a169319
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
pkg/api/login_oauth.go
+3
-4
public/app/core/controllers/login_ctrl.js
+8
-2
No files found.
pkg/api/login_oauth.go
View file @
b4111d78
...
@@ -3,7 +3,6 @@ package api
...
@@ -3,7 +3,6 @@ package api
import
(
import
(
"errors"
"errors"
"fmt"
"fmt"
"net/url"
"golang.org/x/oauth2"
"golang.org/x/oauth2"
...
@@ -46,9 +45,9 @@ func OAuthLogin(ctx *middleware.Context) {
...
@@ -46,9 +45,9 @@ func OAuthLogin(ctx *middleware.Context) {
userInfo
,
err
:=
connect
.
UserInfo
(
token
)
userInfo
,
err
:=
connect
.
UserInfo
(
token
)
if
err
!=
nil
{
if
err
!=
nil
{
if
err
==
social
.
ErrMissingTeamMembership
{
if
err
==
social
.
ErrMissingTeamMembership
{
ctx
.
Redirect
(
setting
.
AppSubUrl
+
"/login?fail
edMsg="
+
url
.
QueryEscape
(
"Required Github team membership not fulfilled"
)
)
ctx
.
Redirect
(
setting
.
AppSubUrl
+
"/login?fail
Code=1000"
)
}
else
if
err
==
social
.
ErrMissingOrganizationMembership
{
}
else
if
err
==
social
.
ErrMissingOrganizationMembership
{
ctx
.
Redirect
(
setting
.
AppSubUrl
+
"/login?fail
edMsg="
+
url
.
QueryEscape
(
"Required Github organization membership not fulfilled"
)
)
ctx
.
Redirect
(
setting
.
AppSubUrl
+
"/login?fail
Code=1001"
)
}
else
{
}
else
{
ctx
.
Handle
(
500
,
fmt
.
Sprintf
(
"login.OAuthLogin(get info from %s)"
,
name
),
err
)
ctx
.
Handle
(
500
,
fmt
.
Sprintf
(
"login.OAuthLogin(get info from %s)"
,
name
),
err
)
}
}
...
@@ -60,7 +59,7 @@ func OAuthLogin(ctx *middleware.Context) {
...
@@ -60,7 +59,7 @@ func OAuthLogin(ctx *middleware.Context) {
// validate that the email is allowed to login to grafana
// validate that the email is allowed to login to grafana
if
!
connect
.
IsEmailAllowed
(
userInfo
.
Email
)
{
if
!
connect
.
IsEmailAllowed
(
userInfo
.
Email
)
{
ctx
.
Logger
.
Info
(
"OAuth login attempt with unallowed email"
,
"email"
,
userInfo
.
Email
)
ctx
.
Logger
.
Info
(
"OAuth login attempt with unallowed email"
,
"email"
,
userInfo
.
Email
)
ctx
.
Redirect
(
setting
.
AppSubUrl
+
"/login?fail
edMsg="
+
url
.
QueryEscape
(
"Required email domain not fulfilled"
)
)
ctx
.
Redirect
(
setting
.
AppSubUrl
+
"/login?fail
Code=1002"
)
return
return
}
}
...
...
public/app/core/controllers/login_ctrl.js
View file @
b4111d78
...
@@ -6,6 +6,12 @@ define([
...
@@ -6,6 +6,12 @@ define([
function
(
angular
,
coreModule
,
config
)
{
function
(
angular
,
coreModule
,
config
)
{
'use strict'
;
'use strict'
;
var
failCodes
=
{
"1000"
:
"Required Github team membership not fulfilled"
,
"1001"
:
"Required Github organization membership not fulfilled"
,
"1002"
:
"Required email domain not fulfilled"
,
};
coreModule
.
default
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
backendSrv
,
contextSrv
,
$location
)
{
coreModule
.
default
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
backendSrv
,
contextSrv
,
$location
)
{
$scope
.
formModel
=
{
$scope
.
formModel
=
{
user
:
''
,
user
:
''
,
...
@@ -31,8 +37,8 @@ function (angular, coreModule, config) {
...
@@ -31,8 +37,8 @@ function (angular, coreModule, config) {
$scope
.
$watch
(
"loginMode"
,
$scope
.
loginModeChanged
);
$scope
.
$watch
(
"loginMode"
,
$scope
.
loginModeChanged
);
var
params
=
$location
.
search
();
var
params
=
$location
.
search
();
if
(
params
.
fail
edMsg
)
{
if
(
params
.
fail
Code
)
{
$scope
.
appEvent
(
'alert-warning'
,
[
'Login Failed'
,
params
.
failedMsg
]);
$scope
.
appEvent
(
'alert-warning'
,
[
'Login Failed'
,
failCodes
[
params
.
failCode
]
]);
delete
params
.
failedMsg
;
delete
params
.
failedMsg
;
$location
.
search
(
params
);
$location
.
search
(
params
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment