Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Play security http headers #3084

Merged
merged 5 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).

### Added

-
- Improved security by enabling http security headers [#3084](https://github.com/scalableminds/webknossos/pull/3084)

### Changed

Expand Down
4 changes: 4 additions & 0 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ silhouette {
}
}

play.http.filters = "com.scalableminds.webknossos.datastore.Filters"
# we do not want to set *all* of the security filters, though:
play.filters.headers.contentSecurityPolicy = null
play.filters.headers.contentTypeOptions = null

operatorData = """
**scalable minds UG (haftungsbeschränkt) & Co. KG**
Expand Down
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ object Dependencies {
grpc,
grpcServices,
scalapbRuntimeGrpc,
filters,
component("play-test")
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.scalableminds.webknossos.datastore

import javax.inject.Inject

import play.api.http.HttpFilters
import play.filters.headers.SecurityHeadersFilter

class Filters @Inject() (securityHeadersFilter: SecurityHeadersFilter) extends HttpFilters {
def filters = Seq(securityHeadersFilter)
}
5 changes: 5 additions & 0 deletions webknossos-datastore/conf/standalone-datastore.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ pidfile.path = "/dev/null"
# other settings
play.http.parser.maxMemoryBuffer=250M
play.http.parser.maxDiskBuffer=1G

play.http.filters = "com.scalableminds.webknossos.datastore.Filters"
# we do not want to set *all* of the security filters, though:
play.filters.headers.contentSecurityPolicy = null
play.filters.headers.contentTypeOptions = null