feat(core): extend FrameworkDetector to support split APKs#14
feat(core): extend FrameworkDetector to support split APKs#14luca-regne wants to merge 11 commits intomainfrom
Conversation
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Validate commit messages | ||
| uses: wagoid/commitlint-github-action@v5 | ||
| with: | ||
| configFile: .commitlintrc.json |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 days ago
In general, this problem is fixed by explicitly setting a permissions block in the workflow or job to restrict the GITHUB_TOKEN to the least privileges required (typically contents: read for read‑only workflows). For this specific commit‑lint workflow, the job only needs to read commits and configuration; it does not need to write to the repo, create issues, or modify PRs. Therefore we can add a job‑level permissions block under lint-commits: specifying contents: read. This keeps existing behavior (actions/checkout and commitlint can still read the repository) while preventing any unintended write operations via the token.
Concretely, edit .github/workflows/commit-lint.yml in the lint-commits job definition. Immediately under lint-commits: (before runs-on:) add:
permissions:
contents: readNo imports or additional methods are needed, as this is pure workflow configuration.
| @@ -6,6 +6,8 @@ | ||
|
|
||
| jobs: | ||
| lint-commits: | ||
| permissions: | ||
| contents: read | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout |
| fetch-depth: 0 | ||
|
|
||
| - name: Validate commit messages | ||
| uses: wagoid/commitlint-github-action@v5 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
| name: Pre-release Validation | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v7 | ||
|
|
||
| - name: Install Python 3.13 | ||
| run: uv python install 3.13 | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --group dev | ||
|
|
||
| - name: Lint with ruff | ||
| run: uv run ruff check src/batuta/ | ||
|
|
||
| - name: Type check with mypy | ||
| run: uv run mypy src/batuta/ | ||
|
|
||
| - name: Build package | ||
| run: uv build | ||
|
|
||
| - name: Verify installation | ||
| run: | | ||
| uv venv .test-venv | ||
| source .test-venv/bin/activate | ||
| uv pip install dist/*.whl | ||
| batuta --help | ||
| deactivate | ||
|
|
||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
|
|
||
| publish: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 days ago
In general, the fix is to add an explicit permissions block that grants only the minimal required scopes to the GITHUB_TOKEN. For the validate job, the steps only need to read the repository contents (for checkout and analysis) and do not push commits, create releases, or interact with issues/PRs, so contents: read is sufficient.
The best minimal fix, without changing functionality, is to add a permissions block under the validate job (since the publish job already has its own permissions). This block should be placed at the same indentation level as runs-on and steps. A suitable configuration is:
permissions:
contents: readNo new imports, methods, or definitions are needed; this is purely a YAML configuration change in .github/workflows/publish.yml, specifically adding the permissions section after runs-on: ubuntu-latest (line 11) and before steps: for the validate job.
| @@ -9,6 +9,8 @@ | ||
| validate: | ||
| name: Pre-release Validation | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 |
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v7 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
| path: dist/ | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v7 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
| git cliff --tag "$VERSION" --unreleased --strip header > release-notes.md | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
FrameworkDetector now accepts a list of APK paths and aggregates file listings across all parts before signature matching, so frameworks whose libs or assets live in split config APKs (e.g. split_config.arm64_v8a.apk) are correctly detected without requiring a full decompile. - models/analyze.py: apk_path → apk_paths (list[Path]) - core/analyzer.py: constructor takes list[Path]; detect() iterates all paths and extends a combined namelist before running _detect_frameworks - cli/analyze.py: 'analyze framework' now accepts a file or directory; when given a directory it globs *.apk and passes all parts to the detector - cli/apk.py: 'apk pull' runs a lightweight framework scan after pulling (ZIP listing only, non-fatal) and reports detected frameworks in both Rich and JSON output Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e027ae3 to
f027e8f
Compare
Summary
FrameworkDetectornow acceptslist[Path]and aggregates file listings across all APK parts before signature matching — frameworks whose libs/assets live in split config APKs (e.g.split_config.arm64_v8a.apk) are now correctly detected without requiring a full decompilebatuta analyze frameworkaccepts a file or a split APK directory; when given a directory it globs*.apkand scans all parts togetherbatuta apk pullnow runs a lightweight framework scan (ZIP listing only, non-fatal) immediately after pulling and reports detected frameworks in both Rich and JSON outputMotivation
Split APKs distribute their content across multiple parts — native
.solibraries typically land in ABI-specific splits rather thanbase.apk. The old single-path detector would miss these signatures entirely. This fix lets you identify the framework before committing to a full decompile.Test plan
batuta analyze framework ./single.apk— single file path still worksbatuta analyze framework ./split-dir/— scans all.apkfiles in dirbatuta analyze framework ./empty-dir/— prints error, exits 1batuta apk pull <flutter-app>— printsFramework: Flutterafter pullbatuta apk pull <native-app> --json— output includes"frameworks": [...]when detecteduv run ruff check src/batuta/passesuv run mypy src/batuta/passes🤖 Generated with Claude Code