# thecybersandeep/ipaauditor architecture

> Architecture diagram of the GitHub repository thecybersandeep/ipaauditor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thecybersandeep/ipaauditor
- Repository: https://github.com/thecybersandeep/ipaauditor

## Overview

1. **Overall shape**
   - IPA Auditor is a **static, client-side IPA analysis app**: a single-page HTML/JS site that runs entirely in the browser.
   - There is **no backend service** and no build pipeline. The repo is designed to be opened directly, or hosted as a static site on GitHub Pages/Netlify/Cloudflare Pages.

2. **Entry and presentation layer**
   - `index.html` is the app shell.
   - `src/styles.css` provides the UI styling and theme.
   - `src/main.js` owns the browser UI: drag-and-drop/file selection, tab switching, search, progress updates, result rendering, and export actions.

3. **Execution boundary: main thread vs worker**
   - Heavy analysis is offloaded to `src/analyzer.worker.js` so the UI stays responsive during IPA inspection.
   - The app falls back to running analysis on the **main thread** when the page is loaded from `file://`, because Web Worker spawning can be unreliable there.
   - This is the main architectural boundary: **UI orchestration** in `main.js` versus **analysis work** in the worker/core modules.

4. **Analysis orchestration**
   - `src/core/analyzer.js` is the central orchestrator for the scan.
   - It coordinates file extraction, metadata parsing, rule execution, secret detection, and aggregation into a single report model.
   - The analyzer is intentionally DOM-free so it can run identically in the worker or fallback path.

5. **IPA / bundle ingestion flow**
   - The dropped `.ipa` is treated as an archive and unpacked using vendored libraries in `lib/` such as **JSZip**.
   - The app then traverses the app bundle and inspects key artifacts:
     - the Mach-O executable
     - `embedded.mobileprovision`
     - `Info.plist`
     - other text files inside the bundle
   - This creates the input set for the rest of the security checks.

6. **Binary inspection subsystem**
   - `src/core/macho.js` parses the Mach-O executable and extracts load commands, symbols, code-signing metadata, encryption flags, and security-relevant header bits.
   - The README indicates checks such as `MH_PIE`, `LC_ENCRYPTION_INFO_64`, `LC_CODE_SIGNATURE`, and symbol table analysis are derived from actual binary flags rather than string matching.
   - This subsystem feeds findings for checksec-like posture and binary-level security flags.

7. **Provisioning and plist subsystem**
   - `src/core/provisioning.js` extracts and interprets the embedded provisioning profile from its CMS/PKCS#7 wrapper.
   - `src/core/plist.js` handles both XML and binary plist parsing, which is used for `Info.plist` and provisioning payloads.
   - These modules surface signing identity data, certificate details, distribution type, entitlements, and app configuration metadata.

8. **ATS and entitlement analysis**
   - `src/core/ats.js` performs per-domain App Transport Security evaluation, including HTTP usage, minimum TLS version, forward secrecy, Certificate Transparency, and pinning-related checks.
   - Entitlement risk checks are handled through the rules/analysis layer and focus on sensitive flags such as `get-task-allow`, sandbox bypass-related entitlements, network extension, and VPN capabilities.
   - This is a distinct metadata-analysis lane separate from binary parsing.

9. **Secret detection and heuristic scanning**
   - `src/core/entropy.js` combines Shannon entropy scoring with vendor-specific regex detection to reduce false positives.
   - The scanner runs across bundle text files and strings extracted from the binary, looking for secrets such as AWS, Stripe, GitHub, Slack, SendGrid, JWT, PEMs, and similar credentials.
   - Findings carry confidence values, which makes this subsystem heuristic rather than deterministic.

10. **Rule engine**
    - `src/core/rules.js` holds the rule registry and tracker registry for the report’s broader security checks.
    - The repo describes 60+ rule-based checks aligned to **OWASP MASVS**, so this layer acts as the policy engine that turns parsed facts into findings.
    - In architecture terms, this is the “decision” layer sitting on top of the parsers and detectors.

11. **Report generation and export**
    - `src/core/export.js` formats the analysis output for machine-readable exports: **JSON, CSV, and SARIF 2.1**.
    - `src/core/pdf.js` builds a human-readable PDF report.
    - These exports consume the same unified analysis model produced by the orchestrator, so presentation/export is separated from scanning logic.

12. **Runtime constraints and dependencies**
    - The app depends on vendored browser-side libraries in `lib/`:
      - **JSZip** for archive extraction
      - **plist.js** for plist parsing
      - **jsPDF** for PDF generation
    - Because everything runs in-browser, the architecture is constrained by memory and tab runtime limits rather than server capacity.

13. **Security and privacy boundary**
    - The user’s IPA is read into memory locally and **never leaves the tab**.
    - There is no telemetry or cookie-based tracking; the only persisted preference is theme selection via `localStorage`.
    - This privacy stance is a core architectural property, not just a product claim.

14. **Deployment model**
    - The presence of `CNAME`, `robots.txt`, `sitemap.xml`, and static assets like `404.html` indicates a static website deployment model.
    - The repo is therefore best understood as a **static SPA + worker + analysis core + export pipeline**, with all security processing performed entirely on the client side.

Main entry points: [`src/core/analyzer.js`](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/analyzer.js) (Analyzer), [`src/core/rules.js`](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/rules.js) (Rules engine), [`src/main.js`](https://github.com/thecybersandeep/ipaauditor/blob/main/src/main.js) (Main UI), [`index.html`](https://github.com/thecybersandeep/ipaauditor/blob/main/index.html) (index.html)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_ui["Client app"]
  node_index_html["index.html<br/>app shell<br/>[index.html]"]
  node_main_js["Main UI<br/>browser orchestration<br/>[main.js]"]
  node_styles_css["Styles<br/>ui styling<br/>[styles.css]"]
  node_worker_js["Analyzer worker<br/>web worker<br/>[analyzer.worker.js]"]
end

subgraph group_grp_core["Analysis core"]
  node_analyzer_js["Analyzer<br/>scan orchestrator<br/>[analyzer.js]"]
  node_macho_js["Mach-O parser<br/>binary inspection<br/>[macho.js]"]
  node_provisioning_js["Provisioning<br/>signing metadata<br/>[provisioning.js]"]
  node_plist_js["Plist parser<br/>metadata parser<br/>[plist.js]"]
  node_ats_js["ATS checks<br/>network policy<br/>[ats.js]"]
  node_entropy_js["Secret scan<br/>heuristic detector<br/>[entropy.js]"]
  node_rules_js["Rules engine<br/>policy registry<br/>[rules.js]"]
end

subgraph group_grp_exports["Export pipeline"]
  node_export_js["Exports<br/>machine output<br/>[export.js]"]
  node_pdf_js["PDF report<br/>human report<br/>[pdf.js]"]
end

subgraph group_grp_vendor["Vendored libs"]
  node_jszip_lib["JSZip<br/>archive library"]
  node_plist_lib["plist.js<br/>plist library"]
  node_jspdf_lib["jsPDF<br/>pdf library"]
end

node_static_assets["Static site<br/>deployment assets"]

node_index_html -->|"loads"| node_main_js
node_index_html -->|"styles"| node_styles_css
node_main_js -->|"dispatches"| node_worker_js
node_main_js -.->|"fallbacks to"| node_analyzer_js
node_worker_js -->|"invokes"| node_analyzer_js
node_analyzer_js -->|"unzips"| node_jszip_lib
node_analyzer_js -->|"parses"| node_macho_js
node_analyzer_js -->|"reads"| node_provisioning_js
node_analyzer_js -->|"parses"| node_plist_js
node_analyzer_js -->|"evaluates"| node_ats_js
node_analyzer_js -->|"scans"| node_entropy_js
node_analyzer_js -->|"scores"| node_rules_js
node_macho_js -->|"feeds"| node_rules_js
node_provisioning_js -->|"feeds"| node_rules_js
node_ats_js -->|"feeds"| node_rules_js
node_entropy_js -->|"feeds"| node_rules_js
node_analyzer_js -->|"outputs"| node_export_js
node_analyzer_js -->|"outputs"| node_pdf_js
node_pdf_js -->|"uses"| node_jspdf_lib
node_static_assets -->|"hosts"| node_index_html

click node_index_html "https://github.com/thecybersandeep/ipaauditor/blob/main/index.html"
click node_main_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/main.js"
click node_styles_css "https://github.com/thecybersandeep/ipaauditor/blob/main/src/styles.css"
click node_worker_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/analyzer.worker.js"
click node_analyzer_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/analyzer.js"
click node_macho_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/macho.js"
click node_provisioning_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/provisioning.js"
click node_plist_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/plist.js"
click node_ats_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/ats.js"
click node_entropy_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/entropy.js"
click node_rules_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/rules.js"
click node_export_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/export.js"
click node_pdf_js "https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/pdf.js"
click node_jszip_lib "https://github.com/thecybersandeep/ipaauditor/tree/main/lib"
click node_plist_lib "https://github.com/thecybersandeep/ipaauditor/tree/main/lib"
click node_jspdf_lib "https://github.com/thecybersandeep/ipaauditor/tree/main/lib"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_index_html,node_main_js,node_styles_css,node_worker_js toneBlue
class node_analyzer_js,node_macho_js,node_provisioning_js,node_plist_js,node_ats_js,node_entropy_js,node_rules_js toneAmber
class node_export_js,node_pdf_js toneMint
class node_jszip_lib,node_plist_lib,node_jspdf_lib toneRose
class node_static_assets toneNeutral
```

## Components

### Client app

Browser-side shell, interaction, styling, and worker orchestration.

- [index.html](https://github.com/thecybersandeep/ipaauditor/blob/main/index.html): app shell · Single-page entry document for the client-side app. · `index.html`
- [Main UI](https://github.com/thecybersandeep/ipaauditor/blob/main/src/main.js): browser orchestration · Handles file input, tabs, search, progress, rendering, and exports in the main thread. · `src/main.js`
- [Styles](https://github.com/thecybersandeep/ipaauditor/blob/main/src/styles.css): ui styling · Theme and layout styling for the interface. · `src/styles.css`
- [Analyzer worker](https://github.com/thecybersandeep/ipaauditor/blob/main/src/analyzer.worker.js): web worker · Runs heavy IPA analysis off the UI thread when workers are available. · `src/analyzer.worker.js`

### Analysis core

DOM-free modules that parse IPA artifacts, score risks, and assemble reports.

- [Analyzer](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/analyzer.js): scan orchestrator · Coordinates extraction, parsing, rule execution, secret detection, and report assembly. · `src/core/analyzer.js`
- [Mach-O parser](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/macho.js): binary inspection · Extracts load commands, symbols, code-signing data, and security flags from the executable. · `src/core/macho.js`
- [Provisioning](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/provisioning.js): signing metadata · Parses embedded mobileprovision data and surfaces certificate, entitlement, and distribution details. · `src/core/provisioning.js`
- [Plist parser](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/plist.js): metadata parser · Handles XML and binary plist parsing for app and signing metadata. · `src/core/plist.js`
- [ATS checks](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/ats.js): network policy · Evaluates App Transport Security settings and domain-level TLS/pinning posture. · `src/core/ats.js`
- [Secret scan](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/entropy.js): heuristic detector · Combines entropy scoring and pattern matching to find likely secrets in text and strings. · `src/core/entropy.js`
- [Rules engine](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/rules.js): policy registry · Maps parsed facts to MASVS-aligned findings and tracking rules. · `src/core/rules.js`

### Export pipeline

Formatting and report generation from the unified analysis model.

- [Exports](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/export.js): machine output · Formats unified results as JSON, CSV, and SARIF 2.1. · `src/core/export.js`
- [PDF report](https://github.com/thecybersandeep/ipaauditor/blob/main/src/core/pdf.js): human report · Builds the printable analysis report. · `src/core/pdf.js`

### Vendored libs

Browser libraries used for archive parsing, plist handling, and PDF output.

- [JSZip](https://github.com/thecybersandeep/ipaauditor/tree/main/lib): archive library · Vendored library used to unpack IPA archives in the browser. · `lib`
- [plist.js](https://github.com/thecybersandeep/ipaauditor/tree/main/lib): plist library · Vendored library for plist parsing support. · `lib`
- [jsPDF](https://github.com/thecybersandeep/ipaauditor/tree/main/lib): pdf library · Vendored library used to generate PDF output. · `lib`

### Other components

- **Static site**: deployment assets · Static hosting artifacts such as 404 handling, robots, sitemap, and CNAME.

## Connections

- index.html → Main UI: loads · Bootstraps the single-page application.
- index.html → Styles: styles · Applies the UI theme and layout.
- Main UI → Analyzer worker: dispatches · Sends IPA analysis jobs to a worker when supported.
- Main UI → Analyzer: fallbacks to · Runs analysis on the main thread when workers are unavailable.
- Analyzer worker → Analyzer: invokes · Worker delegates scan execution to the core analyzer.
- Analyzer → JSZip: unzips · Reads the IPA archive contents.
- Analyzer → Mach-O parser: parses · Inspects the app executable for binary security flags.
- Analyzer → Provisioning: reads · Extracts signing and entitlement metadata.
- Analyzer → Plist parser: parses · Loads Info.plist and provisioning plists.
- Analyzer → ATS checks: evaluates · Checks ATS posture and per-domain transport policy.
- Analyzer → Secret scan: scans · Runs secret and heuristic detection across bundle contents.
- Analyzer → Rules engine: scores · Converts parsed facts into policy findings.
- Mach-O parser → Rules engine: feeds · Binary posture results inform rule evaluation.
- Provisioning → Rules engine: feeds · Signing and entitlement facts inform rule evaluation.
- ATS checks → Rules engine: feeds · Network policy findings are passed into the rules layer.
- Secret scan → Rules engine: feeds · Secret-detection hits become findings.
- Analyzer → Exports: outputs · Provides the unified report model for machine exports.
- Analyzer → PDF report: outputs · Provides the unified report model for the PDF report.
- PDF report → jsPDF: uses · Relies on jsPDF for document generation.
- Static site → index.html: hosts · Static deployment serves the app shell and site assets.
