Soteria
Security and consistency all in one.
Made by Leo Benkel
By Leo Benkel
Leo Benkel
2
leobenkel
Made by Leo Benkel
By Leo Benkel
Agenda
3
Made by Leo Benkel
By Leo Benkel
Write good Scala code
4
Made by Leo Benkel
By Leo Benkel
Vulnerabilities
5
Made by Leo Benkel
By Leo Benkel
Example of vulnerabilities
6
Made by Leo Benkel
By Leo Benkel
Remote code execution in jackson-databind
7
Made by Leo Benkel
By Leo Benkel
8
Made by Leo Benkel
By Leo Benkel
Solution on how to resolve the issue
9
Made by Leo Benkel
By Leo Benkel
How to make sure
all projects, all teams,
are using the right versions ?
10
Made by Leo Benkel
By Leo Benkel
Why would we want that?
Security audit
The faster the auditor can assess your company, the better.
If every single projects are guaranteed to follow the same rules, it is straightforward.
11
Made by Leo Benkel
By Leo Benkel
Code styling
12
Made by Leo Benkel
By Leo Benkel
Consistency
13
Made by Leo Benkel
By Leo Benkel
Consistency!
14
Made by Leo Benkel
By Leo Benkel
Why consistency?
Easier ramping time for new employees
If you only have one system to teach, it is much easier for employees to ramp up for each and every projects across your enterprise.
This also apply to internal team changes.
15
Made by Leo Benkel
By Leo Benkel
Unit test
16
Made by Leo Benkel
By Leo Benkel
Measure unit test?
17
Made by Leo Benkel
By Leo Benkel
Soteria
18
Made by Leo Benkel
By Leo Benkel
19
Made by Leo Benkel
By Leo Benkel
20
Made by Leo Benkel
By Leo Benkel
Soteria's features
21
Made by Leo Benkel
By Leo Benkel
Configuration
22
Made by Leo Benkel
By Leo Benkel
soteria.json
{
"dockerImage": "openjdk:8-jre",
"modules": { ??? },
"scalaCFlags": ["-Ywarn-unused", "-Ywarn-unused-import", "-Ywarn-dead-code", ...],
"sbtVersion": "1.2.6",
"scalaVersions": ["2.12.7", "2.11.12"]
}
23
Made by Leo Benkel
By Leo Benkel
Where is the configuration located?
soteriaConfPath := "soteria.json"
By default it will search for "soteria.json" but you can point it to any other files or even URL.
24
Made by Leo Benkel
By Leo Benkel
Packaged plugins
25
Made by Leo Benkel
By Leo Benkel
Packaged sbt plugin - Code style
26
Made by Leo Benkel
By Leo Benkel
Packaged sbt plugin - For test
27
Made by Leo Benkel
By Leo Benkel
Fat-jar build
28
Made by Leo Benkel
By Leo Benkel
Packaged sbt plugin - Fat jar
assemblyOption in assembly := soteriaAssemblySettings.value
enablePlugins(DockerPlugin)
29
Made by Leo Benkel
By Leo Benkel
Docker image
"dockerImage": "openjdk:8-jre"
30
Made by Leo Benkel
By Leo Benkel
Docker image
libraryDependencies ++= soteriaGetAllDependencies.value
31
Made by Leo Benkel
By Leo Benkel
How to enforce a library version
32
Made by Leo Benkel
By Leo Benkel
Enforce version
{
"modules": {
"group.id": {
"artifact-name": {
"version": "1.2.3"
}
}
}
}
If you add "group.id" % "artifact-name" % "1.1.1" , the compilation will be blocked.
Changing it to "group.id" % "artifact-name" % "1.2.3" will allow compilation to complete.
33
Made by Leo Benkel
By Leo Benkel
Error showed in case of violation
[Soteria] Found blocks of errors (1) :
Wrong versions (1) :
["group.id" % "artifact-name" % "1.1.1"] should be ["group.id" % "artifact-name" % "1.2.3"]
34
Made by Leo Benkel
By Leo Benkel
Forbidding a library entirely
35
Made by Leo Benkel
By Leo Benkel
Forbid a library
{
"modules": {
"group.id": {
"artifact-name": {
"forbidden": "You should not include this library.",
"version": "None"
}
}
}
}
If you add "group.id" % "artifact-name" with any version, the compilation will be blocked.
36
Made by Leo Benkel
By Leo Benkel
Error showed in case of violation
[Soteria] You have errors in your 'libraryDependencies':
["group.id" % "artifact-name" % "2.9.0"]
Detailed error > You should not include this library.
37
Made by Leo Benkel
By Leo Benkel
Replace bad dependency
38
Made by Leo Benkel
By Leo Benkel
Replace a dependency
39
Library A
Library with vulnerabilities
Pull
Safe version of the library
Made by Leo Benkel
By Leo Benkel
Replace a dependency
40
Library A
Pull
Safe version of the library
Made by Leo Benkel
By Leo Benkel
Replace a dependency
{
"modules": {
"group.id": {
"artifact-name": {
"version": "1.2.3",
"dependenciesToRemove": [
"com.danger | risky_artifact"
]
}
},
"com.danger": {
"risky_artifact": {
"version": "5.6.7"
}
}
}
}
41
Made by Leo Benkel
By Leo Benkel
Replace a dependency
{
"modules": {
"group.id": {
"artifact-name": {
"version": "1.2.3",
"dependenciesToRemove": [
"com.danger | risky_artifact"
]
}
},
"com.danger": {
"risky_artifact": {
"version": "5.6.7",
"overrideIsEnough": false
}
}
}
}
42
Made by Leo Benkel
By Leo Benkel
Replace a dependency
{
"modules": {
"group.id": {
"artifact-name": {
"version": "1.2.3",
"dependenciesToRemove": [
"com.danger | risky_artifact"
]
}
},
"com.danger": {
"risky_artifact": {
"version": "None",
"overrideIsEnough": false
}
}
}
}
43
Made by Leo Benkel
By Leo Benkel
How to build dependenciesToRemove
44
Made by Leo Benkel
By Leo Benkel
Generate the tree of dependenciesToRemove
sbt soteriaDebugAllModules
45
Made by Leo Benkel
By Leo Benkel
What does it do ?
46
Made by Leo Benkel
By Leo Benkel
I can't do it all at once !
47
Made by Leo Benkel
By Leo Benkel
How to progressively get to compliance?
soteriaSoft := true
soteriaSoftOnCompilerWarning := true
48
Made by Leo Benkel
By Leo Benkel
What next?
49
Made by Leo Benkel
By Leo Benkel
What next?
50
Made by Leo Benkel
By Leo Benkel
Thank you !
Questions?
51
Made by Leo Benkel
By Leo Benkel