Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit cbfcf7c

Browse files
authored
Add mobsfscan into the build (appmattus#127)
1 parent 0e65fd8 commit cbfcf7c

File tree

10 files changed

+68
-13
lines changed

10 files changed

+68
-13
lines changed

.github/workflows/autorelease.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ jobs:
1919

2020
- name: 'Get last tag'
2121
id: lasttag
22-
uses: "WyriHaximus/github-action-get-previous-tag@v1"
22+
uses: WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # v1.4.0
2323

2424
- name: 'Get next version'
2525
id: semvers
26-
uses: "WyriHaximus/github-action-next-semvers@v1"
26+
uses: WyriHaximus/github-action-next-semvers@18aa9ed4152808ab99b88d71f5481e41f8d89930 # v1.2.1
2727
with:
2828
version: ${{ steps.lasttag.outputs.tag }}
2929

3030
- name: 'Create tag and release'
31-
uses: ncipollo/release-action@v1
31+
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 # v1.15.0
3232
with:
3333
tag: ${{ steps.semvers.outputs.patch }}
3434
commit: "main"

.github/workflows/loglist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: ./gradlew updateLogList
2727

2828
- name: Push log list
29-
uses: stefanzweifel/git-auto-commit-action@v4
29+
uses: stefanzweifel/git-auto-commit-action@e348103e9026cc0eee72ae06630dbe30c8bf7a79 # v5.1.0
3030
with:
3131
commit_message: Auto update log_list.json and log_list.sig
3232
file_pattern: 'certificatetransparency/src/main/resources/*'

.github/workflows/main.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,29 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4
23-
- uses: gradle/wrapper-validation-action@v1
23+
- uses: gradle/actions/wrapper-validation@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0
24+
25+
mobsfscan:
26+
needs: [validation]
27+
name: "MobSF Code Scanning"
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/[email protected]
32+
with:
33+
python-version: '3.12'
34+
- name: mobsfscan
35+
uses: MobSF/mobsfscan@main
36+
with:
37+
args: '. --sarif --output mobsfscan.sarif || true'
38+
- name: Upload mobsfscan report
39+
uses: github/codeql-action/upload-sarif@v3
40+
with:
41+
sarif_file: mobsfscan.sarif
42+
- uses: actions/upload-artifact@v4
43+
with:
44+
name: mobsfscan.sarif
45+
path: mobsfscan.sarif
2446

2547
snyk:
2648
needs: [ validation ]
@@ -126,7 +148,7 @@ jobs:
126148
retention-days: 1
127149

128150
build:
129-
needs: [ snyk, codeql-java-kotlin, codeql-actions ]
151+
needs: [ snyk, codeql-java-kotlin, codeql-actions, mobsfscan ]
130152
runs-on: ubuntu-latest
131153

132154
steps:
@@ -149,7 +171,7 @@ jobs:
149171
path: '**/build/reports/**'
150172

151173
- name: Upload coverage to Codecov
152-
uses: codecov/codecov-action@v3
174+
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
153175
with:
154176
token: ${{secrets.CODECOV_TOKEN}}
155177

.mobsf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
- ignore-paths:
3+
# Ignore files in the sample app
4+
- sampleapp
5+
6+
ignore-rules:
7+
# Sample app only so rule not relevant
8+
- android_tapjacking
9+
10+
# Sample app only so rule not relevant
11+
- android_safetynet
12+
13+
# Sample app only so rule not relevant
14+
- android_prevent_screenshot
15+
16+
# Sample app only so rule not relevant
17+
- android_root_detection

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ We are open about the security of our library and provide a threat model in the
2626
we have missed please reach out so we can keep this up to date.
2727

2828
The source code and dependencies are continuously scanned with
29-
[Snyk](https://snyk.io).
29+
[Snyk](https://snyk.io), [CodeQL](https://codeql.github.com) and [mobsfscan](https://github.com/MobSF/mobsfscan).
3030

3131
## Getting started
3232

@@ -70,6 +70,9 @@ class SampleApplication : Application() {
7070

7171
installCertificateTransparencyProvider {
7272
// Setup a logger
73+
// NOTE: The logger outputs the host name and certificate
74+
// transparency results which could be considered sensitive data.
75+
// Please ensure you review your usage.
7376
logger = BasicAndroidCTLogger(BuildConfig.DEBUG)
7477

7578
// Setup disk cache

certificatetransparency-android/src/main/kotlin/com/appmattus/certificaterevocation/BasicAndroidCRLogger.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@ package com.appmattus.certificaterevocation
2222

2323
import android.util.Log
2424

25+
/**
26+
* Basic logger which outputs the host name and certificate revocation results.
27+
*
28+
* **NOTE:** This data could be considered sensitive data. Please ensure you review your usage.
29+
*/
2530
public class BasicAndroidCRLogger(private val isDebugMode: Boolean) : CRLogger {
2631
override fun log(host: String, result: RevocationResult) {
2732
if (isDebugMode) {
28-
Log.i("CertificateRevocation", "$host $result")
33+
// Suppressing MobSF warning as note added to documentation
34+
Log.i("CertificateRevocation", "$host $result") // mobsf-ignore: android_kotlin_logging
2935
}
3036
}
3137
}

certificatetransparency-android/src/main/kotlin/com/appmattus/certificatetransparency/BasicAndroidCTLogger.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@ package com.appmattus.certificatetransparency
2222

2323
import android.util.Log
2424

25+
/**
26+
* Basic logger which outputs the host name and certificate transparency results.
27+
*
28+
* **NOTE:** This data could be considered sensitive data. Please ensure you review your usage.
29+
*/
2530
public class BasicAndroidCTLogger(private val isDebugMode: Boolean) : CTLogger {
2631
override fun log(host: String, result: VerificationResult) {
2732
if (isDebugMode) {
28-
Log.i("CertificateTransparency", "$host $result")
33+
// Suppressing MobSF warning as note added to documentation
34+
Log.i("CertificateTransparency", "$host $result") // mobsf-ignore: android_kotlin_logging
2935
}
3036
}
3137
}

certificatetransparency/src/main/kotlin/com/appmattus/certificatetransparency/internal/utils/Base64.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Appmattus Limited
2+
* Copyright 2023-2025 Appmattus Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

certificatetransparency/src/test/kotlin/com/appmattus/certificatetransparency/internal/loglist/model/v3/LogListV3Test.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ internal class LogListV3Test {
5252

5353
val nimbusLog = cloudflare.logs.first { it.description == "Cloudflare 'Nimbus2022' Log" }
5454
assertEquals(86400, nimbusLog.maximumMergeDelay)
55-
assertEquals(Instant.ofEpochMilli(1572549720000), nimbusLog.state?.timestamp)
55+
// Suppressing MobSF warning as false positive, no logging occurs here
56+
assertEquals(Instant.ofEpochMilli(1572549720000), nimbusLog.state?.timestamp) // mobsf-ignore: android_kotlin_logging
5657
}
5758
}

sampleapp/src/main/java/com/appmattus/certificatetransparency/sampleapp/item/CodeViewItem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ fun CodeViewItem(language: Language, sourceCode: String?, modifier: Modifier = M
4444
@Preview
4545
@Composable
4646
fun PreviewCodeViewItem() {
47-
CodeViewItem(language = Language.JAVA, sourceCode = "fun main() {\n System.out.println(\"Hello world!\");\n}")
47+
CodeViewItem(language = Language.JAVA, sourceCode = "fun main() {\n helloWorld();\n}")
4848
}

0 commit comments

Comments
 (0)