Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
327b3a46
Commit
327b3a46
authored
12 years ago
by
Carlos Andrés Rocha
Browse files
Options
Downloads
Patches
Plain Diff
[34078525] Log openid root_trust validation failures as errors
parent
0a81684a
No related branches found
Branches containing commit
Tags
release-2021-03-23-11.21
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/djangoapps/external_auth/views.py
+9
-12
9 additions, 12 deletions
common/djangoapps/external_auth/views.py
with
9 additions
and
12 deletions
common/djangoapps/external_auth/views.py
+
9
−
12
View file @
327b3a46
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment