Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
57b27945
Commit
57b27945
authored
13 years ago
by
Austin King
Browse files
Options
Downloads
Patches
Plain Diff
Adding X-Frame-Options detection and 200 check for auth and provisioning urls
parent
14ac65bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/check_primary_support
+47
-2
47 additions, 2 deletions
scripts/check_primary_support
with
47 additions
and
2 deletions
scripts/check_primary_support
+
47
−
2
View file @
57b27945
...
...
@@ -5,6 +5,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const
https
=
require
(
'
https
'
),
und
=
require
(
'
underscore
'
),
primary
=
require
(
'
../lib/primary
'
),
logging
=
require
(
'
../lib/logging.js
'
);
...
...
@@ -15,11 +18,53 @@ if (process.argv.length !== 3) {
console
.
log
(
'
Usage:
'
,
process
.
argv
[
1
],
'
<domain>
'
);
process
.
exit
(
1
);
}
var
domain
=
process
.
argv
[
2
];
primary
.
checkSupport
(
process
.
argv
[
2
]
,
function
(
err
,
urls
,
publicKey
)
{
primary
.
checkSupport
(
domain
,
function
(
err
,
urls
,
publicKey
)
{
if
(
err
)
{
process
.
stderr
.
write
(
"
error:
"
+
err
+
"
\n
"
);
process
.
exit
(
1
);
}
console
.
log
(
urls
,
publicKey
);
console
.
log
(
'
Priary domain:
'
,
domain
);
console
.
log
(
'
Public Key:
'
,
publicKey
);
getResource
(
urls
.
auth
,
urls
);
getResource
(
urls
.
prov
,
urls
);
});
/**
* Retrieve one of their urls and examine aspects of it for issues
*/
function
getResource
(
url
,
urls
)
{
console
.
log
(
'
Checking
'
,
urls
.
auth
);
var
r
=
https
.
request
({
host
:
domain
,
path
:
url
,
method
:
'
GET
'
},
checkResource
(
urls
));
r
.
on
(
'
error
'
,
function
(
e
)
{
console
.
log
(
"
ERROR:
"
,
e
.
message
);
});
r
.
end
();
};
/**
* Called once we have a response.
*
* Do the provisioning and signin resources look kosher?
*/
function
checkResource
(
urls
)
{
return
function
(
resp
)
{
// Their are no X-Frame options
if
(
resp
.
statusCode
!=
200
)
{
console
.
log
(
"
ERROR: HTTP status code=
"
,
resp
.
statusCode
);
}
else
{
var
xframe
=
und
.
filter
(
Object
.
keys
(
resp
.
headers
),
function
(
header
)
{
return
header
.
toLowerCase
()
==
'
x-frame-options
'
;
});
if
(
xframe
.
length
==
1
)
{
console
.
log
(
"
ERROR: X-Frame-Options=
"
,
resp
.
headers
[
xframe
[
0
]],
"
, BrowserID will not be able to communicate with your site.
"
+
"
Suppress X-Frame-Options for /.well-known/browserid,
"
+
urls
.
auth
+
'
and
'
+
urls
.
prov
);
}
}
};
};
\ No newline at end of file
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