Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions .phptidy-config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

$indent_char = " ";
?>
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ docker push $IMAGE_NAME
```
This approach also allows teams to perform self assessment with changes tracked in a repository.


## Amazon EC2 Instance

1. In the _EC2_ sidenav select _Instances_ and click _Launch Instance_
Expand All @@ -89,6 +90,14 @@ service docker start
docker run -d -p 80:80 wurstbrot/dsomm:latest
```

## Tests

To run basic tests just

```bash
docker-compose -f docker-compose.dev.yaml up test-php
```

# Credits
* The dimension _Test and Verification_ is based on Christian Schneiders [Security DevOps Maturity Model (SDOMM)](https://www.christian-schneider.net/SecurityDevOpsMaturityModel.html). _Application tests_ and _Infrastructure tests_ are added by Timo Pagel. Also, the sub-dimension _Static depth_ has been evaluated by security experts at [OWASP Stammtisch Hamburg](https://www.owasp.org/index.php/OWASP_German_Chapter_Stammtisch_Initiative/Hamburg).
* The sub-dimension <i>Process</i> has been added after a discussion with [Francois Raynaud](https://www.linkedin.com/in/francoisraynaud/) that reactive activities are missing.
Expand Down
2 changes: 1 addition & 1 deletion data.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function build_table_tooltip($array, $headerWeight = 2) {
if (IS_SHOW_EVIDENCE_TODO || $evidenceContent != "TODO")
$html .= "<div><b>" . "Evidence" . ":</b> " . $evidenceContent . "</div>";
$html .= "<hr />";
$html .= "<h$headerWeight>Usefulness and Requirements of this Activitiy"</h$headerWeight>";
$html .= "<h$headerWeight>Usefulness and Requirements of this Activitiy</h$headerWeight>";
$html .= "<div><b>Usefullness:</b> " . ucfirst($mapUsefulness[$array['usefulness'] - 1]) . "</div>";
$html .= "<div><b>Required knowledge:</b> " . ucfirst($mapKnowLedge[$array['difficultyOfImplementation']['knowledge'] - 1]) . "</div>";
$html .= "<div><b>Required time:</b> " . ucfirst($mapTime[$array['difficultyOfImplementation']['time'] - 1]) . "</div>";
Expand Down
10 changes: 8 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
version: "3.0"
services:
dsomm:
dsomm: &dsomm
build: .
volumes:
- .:/var/www/html
working_dir: /var/www/html
ports:
- "8080:80"

test-php:
<<: *dsomm
volumes:
- .:/var/www/html
working_dir: /var/www/html
entrypoint: ["/var/www/html/tests.sh"]
83 changes: 40 additions & 43 deletions report-samm.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,60 +21,57 @@
$old_dimension = null;


foreach (getActions($dimensions) as list($dimension, $subdimensions, $element) {
if ($dimension != $old_dimension) {
echo "<h1>Dimension $dimension</h1>";
$old_dimension = $dimension;
}
foreach (getActions($dimensions) as list($dimension, $subdimensions, $element)) {
if ($dimension != $old_dimension) {
echo "<h1>Dimension $dimension</h1>";
$old_dimension = $dimension;
}

$mappingExists[$subdimension] = array();
$noMappingExists[$subdimension] = array();
echo "<h2>Sub-Dimension $subdimension</h2>";
$mappingExists[$subdimension] = array();
$noMappingExists[$subdimension] = array();
echo "<h2>Sub-Dimension $subdimension</h2>";

echo "<h3 style='color:green;'>With SAMM2 Mapping</h3>";
for ($i = 1; $i <= 4; $i++) {
$tableContent .= "<td><ul>";
foreach ($element as $activityName => $content) {
if (array_key_exists("samm2", $content) && !preg_match("/TODO/i", $content["samm2"])) {
$content2 = getContentForLevelFromSubdimensions($i, $content, $activityName);
echo "<h3 style='color:green;'>With SAMM2 Mapping</h3>";
for ($i = 1; $i <= 4; $i++) {
$tableContent .= "<td><ul>";
foreach ($element as $activityName => $content) {
if (array_key_exists("samm2", $content) && !preg_match("/TODO/i", $content["samm2"])) {
$content2 = getContentForLevelFromSubdimensions($i, $content, $activityName);

if ($content2 != "") {
printDetail($dimension, $subdimension, $activityName, $dimensions, true);
$mappingExists[$subdimension][$content["samm2"]][$activityName] = $content;
}
if ($content2 != "") {
printDetail($dimension, $subdimension, $activityName, $dimensions, true);
$mappingExists[$subdimension][$content["samm2"]][$activityName] = $content;
}
}
}
}

echo "<h3 style='color:red;'>Without SAMM2 Mapping</h3>";
for ($i = 1; $i <= 4; $i++) {
$tableContent .= "<td><ul>";
foreach ($element as $activityName => $content) {
if (!array_key_exists("samm2", $content) || preg_match("/TODO/i", $content["samm2"])) {
$content2 = getContentForLevelFromSubdimensions($i, $content, $activityName);
echo "<h3 style='color:red;'>Without SAMM2 Mapping</h3>";
for ($i = 1; $i <= 4; $i++) {
$tableContent .= "<td><ul>";
foreach ($element as $activityName => $content) {
if (!array_key_exists("samm2", $content) || preg_match("/TODO/i", $content["samm2"])) {
$content2 = getContentForLevelFromSubdimensions($i, $content, $activityName);

if ($content2 != "") {
printDetail($dimension, $subdimension, $activityName, $dimensions, true);
$content["name"] = $activityName;
$noMappingExists[$subdimension][$content["samm2"]][$activityName] = $content;
}
if ($content2 != "") {
printDetail($dimension, $subdimension, $activityName, $dimensions, true);
$content["name"] = $activityName;
$noMappingExists[$subdimension][$content["samm2"]][$activityName] = $content;
}
}
}
}
foreach ($mappingExists as $dimension => $category) {
//var_dump($mappingExists);
echo "<h1>".$dimension ."</h1>";
foreach ($category as $category => $content) {
//var_dump($content);exit;
echo $category . " ".count($content) . " ";
foreach ($content as $activityName => $content2) {
echo "$activityName" . " /"; }
echo "<br>";
}
}
foreach ($mappingExists as $dimension => $category) {
//var_dump($mappingExists);
echo "<h1>".$dimension ."</h1>";
foreach ($category as $category => $content) {
//var_dump($content);exit;
echo $category . " ".count($content) . " ";
foreach ($content as $activityName => $content2) {
echo "$activityName" . " /"; }
echo "<br>";
}
}

//var_dump($noMappingExists);



//var_dump($noMappingExists);
17 changes: 17 additions & 0 deletions tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

test -f phptidy.php || wget https://raw.githubusercontent.com/cmrcx/phptidy/master/phptidy.php

echo "
Reformat code according to .phptidy-config.php
in order do minimize patch differences.
"
php ./phptidy.php replace *.php

echo "
Checking php syntax.
"
find > /tmp/php-check.out 2>&1 . -type f -name \*.php -exec php -l {} \;
cat /tmp/php-check.out
grep 'Errors parsing' /tmp/php-check.out && exit 1 || exit 0