Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
security
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
libs
security
Commits
92fd4c89
Commit
92fd4c89
authored
4 years ago
by
Sigmund, Dominik
Committed by
Sigmund, Dominik
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fixed expect-ct
parent
f95accdb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+3
-1
3 additions, 1 deletion
.gitignore
docs/test-report.html
+1
-1
1 addition, 1 deletion
docs/test-report.html
examples/default/index.js
+25
-3
25 additions, 3 deletions
examples/default/index.js
index.js
+1
-1
1 addition, 1 deletion
index.js
index.test.js
+2
-2
2 additions, 2 deletions
index.test.js
with
32 additions
and
8 deletions
.gitignore
+
3
−
1
View file @
92fd4c89
...
...
@@ -3,4 +3,6 @@ coverage/
stryker.log
*.DS_Store
# stryker temp files
.stryker-tmp
\ No newline at end of file
.stryker-tmp
examples/default/private.key
examples/default/certificate.crt
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/test-report.html
+
1
−
1
View file @
92fd4c89
This diff is collapsed.
Click to expand it.
examples/default/index.js
+
25
−
3
View file @
92fd4c89
const
express
=
require
(
'
express
'
)
const
fs
=
require
(
'
fs
'
)
const
http
=
require
(
'
http
'
)
const
https
=
require
(
'
https
'
)
const
security
=
require
(
'
../../index
'
)
const
app
=
express
()
app
.
use
(
security
())
...
...
@@ -9,6 +14,23 @@ app.get('/', function (req, res) {
res
.
send
(
'
Hello World!
'
)
})
app
.
listen
(
3000
,
function
()
{
console
.
log
(
'
Secure Example app listening on port 3000!
'
)
})
\ No newline at end of file
try
{
fs
.
accessSync
(
__dirname
+
'
/private.key
'
)
var
privateKey
=
fs
.
readFileSync
(
__dirname
+
'
/private.key
'
,
'
utf8
'
)
var
certificate
=
fs
.
readFileSync
(
__dirname
+
'
/certificate.crt
'
,
'
utf8
'
)
var
credentials
=
{
key
:
privateKey
,
cert
:
certificate
}
var
httpsServer
=
https
.
createServer
(
credentials
,
app
)
httpsServer
.
listen
(
8443
,
()
=>
{
console
.
log
(
'
Secure Example app listening on port 8443 via HTTPS!
'
)
})
}
catch
(
error
)
{
console
.
log
(
'
HTTPS-Server not running
'
)
}
var
httpServer
=
http
.
createServer
(
app
)
httpServer
.
listen
(
8080
,
()
=>
{
console
.
log
(
'
Secure Example app listening on port 8080 via HTTP!
'
)
})
This diff is collapsed.
Click to expand it.
index.js
+
1
−
1
View file @
92fd4c89
...
...
@@ -46,7 +46,7 @@ module.exports = function(options) {
}
if
(
typeof
options
.
ExpectCT
===
'
undefined
'
)
{
options
.
ExpectCT
=
'
report-uri="/_report"
, enforce, max-age=30
'
options
.
ExpectCT
=
'
enforce; max-age=30;
report-uri="/_report"
'
}
if
(
options
.
ExpectCT
!==
false
)
{
res
.
set
(
'
Expect-CT
'
,
options
.
ExpectCT
)
...
...
This diff is collapsed.
Click to expand it.
index.test.js
+
2
−
2
View file @
92fd4c89
...
...
@@ -57,7 +57,7 @@ describe('Unit Tests', () => {
headerUnitTest
(
'
Content-Security-Policy
'
,
'
ContentSecurityPolicy
'
,
'
default-src
\'
self
\'
; frame-ancestors
\'
none
\'
'
)
headerUnitTest
(
'
X-XSS-Protection
'
,
'
XXSSProtection
'
,
'
1; mode=block
'
)
headerUnitTest
(
'
X-DNS-Prefetch-Control
'
,
'
XDNSPrefetchControl
'
,
'
off
'
)
headerUnitTest
(
'
Expect-CT
'
,
'
ExpectCT
'
,
'
report-uri="/_report"
, enforce, max-age=30
'
)
headerUnitTest
(
'
Expect-CT
'
,
'
ExpectCT
'
,
'
enforce; max-age=30;
report-uri="/_report"
'
)
headerUnitTest
(
'
X-Frame-Options
'
,
'
XFrameOptions
'
,
'
deny
'
)
describe
(
'
Header: X-Powered-By
'
,
()
=>
{
it
(
'
should remove Header if not defined
'
,
(
done
)
=>
{
...
...
@@ -152,7 +152,7 @@ describe('Integration Tests', () => {
headerIntegrationTest
(
'
Content-Security-Policy
'
,
'
ContentSecurityPolicy
'
,
'
default-src
\'
self
\'
; frame-ancestors
\'
none
\'
'
)
headerIntegrationTest
(
'
X-XSS-Protection
'
,
'
XXSSProtection
'
,
'
1; mode=block
'
)
headerIntegrationTest
(
'
X-DNS-Prefetch-Control
'
,
'
XDNSPrefetchControl
'
,
'
off
'
)
headerIntegrationTest
(
'
Expect-CT
'
,
'
ExpectCT
'
,
'
report-uri="/_report"
, enforce, max-age=30
'
)
headerIntegrationTest
(
'
Expect-CT
'
,
'
ExpectCT
'
,
'
enforce; max-age=30;
report-uri="/_report"
'
)
headerIntegrationTest
(
'
X-Frame-Options
'
,
'
XFrameOptions
'
,
'
deny
'
)
describe
(
'
Header: X-Powered-By
'
,
()
=>
{
it
(
'
should remove Header if not defined
'
,
(
done
)
=>
{
...
...
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