Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
602c2a3f
Commit
602c2a3f
authored
Aug 31, 2012
by
Carlos Andrés Rocha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[34078525] Log openid root_trust validation failures as errors
parent
0099749a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
common/djangoapps/external_auth/views.py
+9
-12
No files found.
common/djangoapps/external_auth/views.py
View file @
602c2a3f
...
...
@@ -353,39 +353,36 @@ def validate_trust_root(openid_request):
trusted_roots
=
getattr
(
settings
,
'OPENID_PROVIDER_TRUSTED_ROOT'
,
None
)
if
trusted_roots
is
None
:
log
.
debug
(
'not using trusted roots'
)
if
not
trusted_roots
:
# not using trusted roots
return
True
log
.
debug
(
'validating trusted roots'
)
# don't allow empty trust roots
if
(
not
hasattr
(
openid_request
,
'trust_root'
)
or
openid_request
.
trust_root
is
None
):
log
.
debug
(
'no trust_root'
)
not
openid_request
.
trust_root
):
log
.
error
(
'no trust_root'
)
return
False
# ensure trust root parses cleanly (one wildcard, of form *.foo.com, etc.)
trust_root
=
TrustRoot
.
parse
(
openid_request
.
trust_root
)
if
trust_root
is
None
:
log
.
debug
(
'invalid trust_root'
)
if
not
trust_root
:
log
.
error
(
'invalid trust_root'
)
return
False
# don't allow empty return tos
if
(
not
hasattr
(
openid_request
,
'return_to'
)
or
openid_request
.
return_to
is
None
):
log
.
debug
(
'empty return_to'
)
not
openid_request
.
return_to
):
log
.
error
(
'empty return_to'
)
return
False
# ensure return to is within trust root
if
not
trust_root
.
validateURL
(
openid_request
.
return_to
):
log
.
debug
(
'invalid return_to'
)
log
.
error
(
'invalid return_to'
)
return
False
# check that the root matches the ones we trust
if
not
any
(
r
for
r
in
trusted_roots
if
fnmatch
.
fnmatch
(
trust_root
,
r
)):
log
.
debug
(
'non-trusted root'
)
log
.
error
(
'non-trusted root'
)
return
False
return
True
...
...
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