Skip to content

Commit 5d16d05

Browse files
authored
rename mitigations to best-practices (#3085)
1 parent 3ca954b commit 5d16d05

25 files changed

+108
-107
lines changed

Document/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Start exploring the MASTG:
2525
<a href="/MASTG/demos/" class="md-button md-button--primary" style="margin: 5px; min-width: 12em; text-align: center;">:material-flask-outline: Demos</a>
2626
<a href="/MASTG/tools/" class="md-button md-button--primary" style="margin: 5px; min-width: 12em; text-align: center;">:octicons-tools-24: Tools</a>
2727
<a href="/MASTG/apps/" class="md-button md-button--primary" style="margin: 5px; min-width: 12em; text-align: center;">:octicons-code-square-24: Apps</a>
28-
<a href="/MASTG/mitigations/" class="md-button md-button--primary" style="margin: 5px; min-width: 12em; text-align: center;">:material-bandage: Mitigations (v2 Beta)</a>
28+
<a href="/MASTG/best-practices/" class="md-button md-button--primary" style="margin: 5px; min-width: 12em; text-align: center;">:material-shield-check: Best Practices (v2 Beta)</a>
2929

3030
<span style="color: darkgray; font-size: small"> :blue_heart:{ .pump } Support the project by purchasing the [OWASP MASTG on leanpub.com](https://leanpub.com/owasp-mastg). All funds raised through sales of this book go directly into the project budget and will be used to for technical editing and designing the book and fund production of future releases.</span>
3131

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: Use Secure Random Number Generators APIs
2+
title: Use Secure Random Number Generator APIs
33
alias: android-use-secure-random
4-
id: MASTG-MITIG-0001
4+
id: MASTG-BEST-0001
55
platform: android
66
---
77

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Remove Logging Code
33
alias: remove-logging-code
4-
id: MASTG-MITIG-0002
4+
id: MASTG-BEST-0002
55
platform: android
66
---
77

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Comply with Privacy Regulations and Best Practices
33
alias: comply-with-privacy-regulations
4-
id: MASTG-MITIG-0003
4+
id: MASTG-BEST-0003
55
platform: android
66
---
77

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Exclude Sensitive Data from Backups
33
alias: exclude-sensitive-data-from-backups
4-
id: MASTG-MITIG-0004
4+
id: MASTG-BEST-0004
55
platform: android
66
---
77

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Use Secure Encryption Modes
33
alias: use-secure-encryption-modes
4-
id: MASTG-MITIG-0005
4+
id: MASTG-BEST-0005
55
platform: android
66
---
77

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Use Up-to-Date APK Signing Schemes
33
alias: use-up-to-date-apk-signing-schemes
4-
id: MASTG-MITIG-0006
4+
id: MASTG-BEST-0006
55
platform: android
66
---
77

best-practices/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
hide: toc
3+
title: Best Practices (v2 - Beta)
4+
status: new
5+
---
6+
7+
??? info "About the MASTG Best Practices"
8+
9+
The MASTG Best Practices are a collection of specific strategies and practices that can be used to prevent or mitigate security and privacy risks in mobile apps.
10+
11+
Each Best Practices is designed to be simple and focused and may apply to one or multiple tests in the MASTG.

demos/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
hide: toc
3-
title: MASTG Demos
3+
title: MASTG Demos (v2 Beta)
44
status: new
55
---
66

docs/hooks/add-cross-references.py

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,28 @@ def generate_cross_references():
3333
cross_references = {
3434
"weaknesses": {},
3535
"tests": {},
36-
"mitigations": {}
36+
"best-practices": {}
3737
}
3838

3939
for test_id, test_meta in tests.items():
4040
weakness_id = test_meta.get("weakness")
4141
test_path = test_meta.get("path")
4242
test_title = test_meta.get("title")
4343
test_platform = test_meta.get("platform")
44-
mitigations_ids = test_meta.get("mitigations")
44+
best_practices_ids = test_meta.get("best-practices")
4545

4646
# Create cross-references for weaknesses listing all tests that reference each weakness ID
4747
if weakness_id:
4848
if weakness_id not in cross_references["weaknesses"]:
4949
cross_references["weaknesses"][weakness_id] = []
5050
cross_references["weaknesses"][weakness_id].append({"id": test_id, "path": test_path, "title": test_title, "platform": test_platform})
5151

52-
# Create cross-references for mitigations listing all tests that reference each mitigation ID
53-
if mitigations_ids:
54-
for mitigation_id in mitigations_ids:
55-
if mitigation_id not in cross_references["mitigations"]:
56-
cross_references["mitigations"][mitigation_id] = []
57-
cross_references["mitigations"][mitigation_id].append({"id": test_id, "path": test_path, "title": test_title, "platform": test_platform})
52+
# Create cross-references for best_practices listing all tests that reference each best_practice ID
53+
if best_practices_ids:
54+
for best_practice_id in best_practices_ids:
55+
if best_practice_id not in cross_references["best-practices"]:
56+
cross_references["best-practices"][best_practice_id] = []
57+
cross_references["best-practices"][best_practice_id].append({"id": test_id, "path": test_path, "title": test_title, "platform": test_platform})
5858

5959
for demo_id, demo_meta in demos.items():
6060
test_id = demo_meta.get("test")
@@ -108,6 +108,20 @@ def on_page_markdown(markdown, page, config, **kwargs):
108108
markdown += f"\n\n{tests_section}"
109109

110110
if "MASTG-TEST-" in path:
111+
112+
# Add best_practices section to tests as a bullet point list with IDs, links are resolved in a separate hook
113+
# ORIGIN: Test metadata
114+
115+
best_practices = meta.get('best-practices')
116+
if best_practices:
117+
best_practices_section = "## Mitigations\n\n"
118+
for best_practice_id in best_practices:
119+
best_practice_path = f"MASTG/best-practices/{best_practice_id}.md"
120+
relPath = os.path.relpath(best_practice_path, os.path.dirname(path))
121+
best_practices_section += f"- @{best_practice_id}\n"
122+
123+
markdown += f"\n\n{best_practices_section}"
124+
111125
test_id = meta.get('id')
112126

113127
# Add Demos section to tests as buttons
@@ -123,35 +137,22 @@ def on_page_markdown(markdown, page, config, **kwargs):
123137
demos_section += f"[{get_platform_icon(demo['platform'])} {demo['id']}: {demo['title']}]({relPath}){{: .mas-demo-button}} "
124138

125139
markdown += f"\n\n{demos_section}"
126-
127-
# Add Mitigations section to tests as a bullet point list with IDs, links are resolved in a separate hook
128-
# ORIGIN: Test metadata
129-
130-
mitigations = meta.get('mitigations')
131-
if mitigations:
132-
mitigations_section = "## Mitigations\n\n"
133-
for mitigation_id in mitigations:
134-
mitigation_path = f"MASTG/mitigations/{mitigation_id}.md"
135-
relPath = os.path.relpath(mitigation_path, os.path.dirname(path))
136-
mitigations_section += f"- @{mitigation_id}\n"
137-
138-
markdown += f"\n\n{mitigations_section}"
139140

140-
if "MASTG-MITIG" in path:
141-
mitig_id = meta.get('id')
141+
if "MASTG-BEST" in path:
142+
best_practice_id = meta.get('id')
142143

143-
# Add Tests section to mitigations as buttons
144+
# Add Tests section to best_practices as buttons
144145
# ORIGIN: Cross-references from this script
145146

146-
if mitig_id in cross_references["mitigations"]:
147-
mitigations = cross_references["mitigations"].get(mitig_id)
148-
meta['mitigations'] = mitigations
149-
if mitigations:
150-
mitigations_section = "## Tests\n\n"
151-
for mitigation in mitigations:
152-
relPath = os.path.relpath(mitigation['path'], os.path.dirname(path))
153-
mitigations_section += f"[{get_platform_icon(mitigation['platform'])} {mitigation['id']}: {mitigation['title']}]({relPath}){{: .mas-test-button}} "
147+
if best_practice_id in cross_references["best-practices"]:
148+
best_practices = cross_references["best-practices"].get(best_practice_id)
149+
meta['best-practices'] = best_practices
150+
if best_practices:
151+
best_practices_section = "## Tests\n\n"
152+
for best_practice in best_practices:
153+
relPath = os.path.relpath(best_practice['path'], os.path.dirname(path))
154+
best_practices_section += f"[{get_platform_icon(best_practice['platform'])} {best_practice['id']}: {best_practice['title']}]({relPath}){{: .mas-test-button}} "
154155

155-
markdown += f"\n\n{mitigations_section}"
156+
markdown += f"\n\n{best_practices_section}"
156157

157158
return markdown

0 commit comments

Comments
 (0)