diff --git a/.github/workflows/mobsfscan.yml b/.github/workflows/mobsfscan.yml new file mode 100644 index 000000000..de246eb0d --- /dev/null +++ b/.github/workflows/mobsfscan.yml @@ -0,0 +1,48 @@ +name: MobSF Scan + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +permissions: + contents: read + security-events: write + +jobs: + mobsfscan: + name: mobsfscan static analysis + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + + - name: Install mobsfscan + run: uv tool install mobsfscan + + - name: Run mobsfscan + run: | + set +e + uv tool run mobsfscan -- --type ios --config .mobsf --sarif --output results.sarif --exit-warning + EXIT_CODE=$? + echo "MOBSF_EXIT=${EXIT_CODE}" >> "$GITHUB_ENV" + exit 0 + + - name: Upload mobsfscan SARIF + if: always() && hashFiles('results.sarif') != '' + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: results.sarif + + - name: Fail when mobsfscan finds issues + if: ${{ env.MOBSF_EXIT != '' && env.MOBSF_EXIT != '0' }} + run: | + echo "mobsfscan reported security findings. Review the SARIF upload for details." + exit 1 diff --git a/.mobsf b/.mobsf new file mode 100644 index 000000000..c259cc41e --- /dev/null +++ b/.mobsf @@ -0,0 +1,21 @@ +--- +- ignore-paths: + - build + - .build + - core + - Gem.xcodeproj + - Gem/Generated + - GemTests/Fixtures + - GemTests + - Packages/Keystore/Tests + - Packages/Keychain/Tests + - Packages/Keychain/Sources/Types/Accessibility.swift + - Packages/Keystore/TestKit + - Packages/Gemstone + - Packages/GemstonePrimitives + - Packages/Primitives/Sources/Extensions/Color+Primitives.swift + - Packages/Primitives/Sources/TransactionLoadMetadata.swift + - swiftgen.yml + severity-filter: + - WARNING + - ERROR diff --git a/Features/FiatConnect/Sources/ViewModels/FiatTransactionTypeViewModel.swift b/Features/FiatConnect/Sources/ViewModels/FiatTransactionTypeViewModel.swift index ac8ac2c26..7122d17c6 100644 --- a/Features/FiatConnect/Sources/ViewModels/FiatTransactionTypeViewModel.swift +++ b/Features/FiatConnect/Sources/ViewModels/FiatTransactionTypeViewModel.swift @@ -31,7 +31,7 @@ public extension FiatQuoteTypeViewModel { func randomAmount(maxAmount: Double) -> Double? { switch type { - case .buy: Double(Int.random(in: Int(defaultAmount)../dev/null || { \ + echo "uv is not installed. Install it via 'curl -LsSf https://astral.sh/uv/install.sh | sh'."; \ + exit 1; } + uv tool run mobsfscan -- --type ios --config .mobsf --exit-warning + localize: @sh core/scripts/localize.sh ios Packages/Localization/Sources/Resources just generate-model @@ -138,4 +144,4 @@ generate-stone: bump-version: @sh ./scripts/bump-version-and-commit.sh patch -mod core \ No newline at end of file +mod core