flutter-security-analyzer 1.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flutter_security_analyzer/__init__.py +12 -0
- flutter_security_analyzer/__main__.py +8 -0
- flutter_security_analyzer/core/__init__.py +15 -0
- flutter_security_analyzer/core/config.py +128 -0
- flutter_security_analyzer/core/scanner.py +543 -0
- flutter_security_analyzer/main.py +150 -0
- flutter_security_analyzer/mappers/__init__.py +9 -0
- flutter_security_analyzer/mappers/masvs_mapper.py +308 -0
- flutter_security_analyzer/patterns/__init__.py +32 -0
- flutter_security_analyzer/patterns/auth_patterns.py +95 -0
- flutter_security_analyzer/patterns/base_pattern.py +514 -0
- flutter_security_analyzer/patterns/code_patterns.py +103 -0
- flutter_security_analyzer/patterns/crypto_patterns.py +78 -0
- flutter_security_analyzer/patterns/network_patterns.py +61 -0
- flutter_security_analyzer/patterns/pattern_registry.py +164 -0
- flutter_security_analyzer/patterns/platform_patterns.py +97 -0
- flutter_security_analyzer/patterns/privacy_patterns.py +64 -0
- flutter_security_analyzer/patterns/resilience_patterns.py +68 -0
- flutter_security_analyzer/patterns/storage_patterns.py +111 -0
- flutter_security_analyzer/reporters/__init__.py +11 -0
- flutter_security_analyzer/reporters/console_reporter.py +165 -0
- flutter_security_analyzer/reporters/html_reporter.py +230 -0
- flutter_security_analyzer/reporters/json_reporter.py +107 -0
- flutter_security_analyzer/utils/__init__.py +7 -0
- flutter_security_analyzer-1.0.1.dist-info/METADATA +239 -0
- flutter_security_analyzer-1.0.1.dist-info/RECORD +30 -0
- flutter_security_analyzer-1.0.1.dist-info/WHEEL +5 -0
- flutter_security_analyzer-1.0.1.dist-info/entry_points.txt +2 -0
- flutter_security_analyzer-1.0.1.dist-info/licenses/LICENSE +21 -0
- flutter_security_analyzer-1.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flutter-security-analyzer
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Static security analysis tool for Flutter/Dart applications with MASVS compliance mapping
|
|
5
|
+
Author-email: Caleb Elebhose <elebhosec@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/eCaleb/flutter-security-analyzer
|
|
8
|
+
Project-URL: Source, https://github.com/eCaleb/flutter-security-analyzer
|
|
9
|
+
Project-URL: Issues, https://github.com/eCaleb/flutter-security-analyzer/issues
|
|
10
|
+
Keywords: flutter,dart,security,scanner,masvs,owasp,static-analysis
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Security
|
|
15
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# Flutter Security Analyzer
|
|
33
|
+
|
|
34
|
+
[](https://github.com/eCaleb/flutter-security-analyzer/actions/workflows/ci.yml)
|
|
35
|
+
[](https://github.com/eCaleb/flutter-security-analyzer/blob/main/LICENSE)
|
|
36
|
+
|
|
37
|
+
A static analysis tool for detecting security vulnerabilities in Flutter/Dart applications with OWASP MASVS v2.1.0 compliance mapping.
|
|
38
|
+
|
|
39
|
+
## Academic Project
|
|
40
|
+
|
|
41
|
+
This tool is developed as part of an MSc Cybersecurity final year project at the University of Chester.
|
|
42
|
+
|
|
43
|
+
**Author:** Caleb Elebhose
|
|
44
|
+
**Supervisor:** Dr. Bismark Asare
|
|
45
|
+
**Module:** WB7103/WB7104
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- **Pattern-Based Detection**: Regex-based vulnerability detection for Dart code
|
|
50
|
+
- **MASVS Compliance Mapping**: All findings mapped to OWASP MASVS v2.1.0 controls
|
|
51
|
+
- **Multiple Output Formats**: Console, JSON, and HTML reports
|
|
52
|
+
- **CI/CD Integration**: Exit codes suitable for pipeline integration
|
|
53
|
+
- **26 Vulnerability Checks**: Covering all 8 MASVS categories
|
|
54
|
+
|
|
55
|
+
## Sample Report
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
The HTML report from scanning `samples/vulnerable_app.dart`, which contains deliberate vulnerabilities: 47 findings across all 8 MASVS categories.
|
|
60
|
+
|
|
61
|
+
## MASVS Categories Covered
|
|
62
|
+
|
|
63
|
+
| Category | Description | Checks |
|
|
64
|
+
|----------|-------------|--------|
|
|
65
|
+
| STORAGE | Data storage security | 4 |
|
|
66
|
+
| CRYPTO | Cryptographic implementations | 3 |
|
|
67
|
+
| AUTH | Authentication and authorization | 3 |
|
|
68
|
+
| NETWORK | Network communication security | 3 |
|
|
69
|
+
| PLATFORM | Platform interaction security | 4 |
|
|
70
|
+
| CODE | Code quality and injection prevention | 4 |
|
|
71
|
+
| RESILIENCE | Anti-reverse engineering | 3 |
|
|
72
|
+
| PRIVACY | User privacy protection | 2 |
|
|
73
|
+
|
|
74
|
+
Most checks run line by line on `.dart` files. A few look at project configuration instead:
|
|
75
|
+
|
|
76
|
+
| Check | Files read |
|
|
77
|
+
|-------|------------|
|
|
78
|
+
| Missing certificate pinning, missing root/jailbreak detection | `pubspec.yaml` (dependencies) |
|
|
79
|
+
| Vulnerable third-party dependencies | `pubspec.yaml` |
|
|
80
|
+
| Outdated minimum SDK version | `android/app/build.gradle`, `android/app/build.gradle.kts`, `ios/Podfile` |
|
|
81
|
+
| Missing code obfuscation | CI workflows (`.github/workflows/*.yml`, `.gitlab-ci.yml`, `codemagic.yaml`, `bitrise.yml`), `Makefile` and shell scripts in the project root or `scripts/` |
|
|
82
|
+
|
|
83
|
+
Only the check listed for a file is applied to it, and comment lines are ignored.
|
|
84
|
+
|
|
85
|
+
## Installation
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install flutter-security-analyzer
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This adds the `flutter-security-analyzer` command. The scanner has no runtime dependencies beyond the Python standard library (Python 3.10 or later).
|
|
92
|
+
|
|
93
|
+
To work on the code, install it from a clone in editable mode:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git clone https://github.com/eCaleb/flutter-security-analyzer.git
|
|
97
|
+
cd flutter-security-analyzer
|
|
98
|
+
pip install -e ".[dev]"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
|
|
103
|
+
### Basic Scan
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
flutter-security-analyzer /path/to/flutter/project
|
|
107
|
+
|
|
108
|
+
# or run it as a module
|
|
109
|
+
python -m flutter_security_analyzer /path/to/flutter/project
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Output Formats
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Console output (default)
|
|
116
|
+
flutter-security-analyzer ./my_flutter_app
|
|
117
|
+
|
|
118
|
+
# JSON output
|
|
119
|
+
flutter-security-analyzer ./my_flutter_app -f json -o results.json
|
|
120
|
+
|
|
121
|
+
# HTML report
|
|
122
|
+
flutter-security-analyzer ./my_flutter_app -f html -o report.html
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Filter by Severity
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Only show high and critical findings
|
|
129
|
+
flutter-security-analyzer ./my_flutter_app -s high
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Filter by MASVS Category
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Only scan for STORAGE and CRYPTO issues
|
|
136
|
+
flutter-security-analyzer ./my_flutter_app --masvs-category STORAGE CRYPTO
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Verbose Mode
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
flutter-security-analyzer ./my_flutter_app -v
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## CI/CD Integration
|
|
146
|
+
|
|
147
|
+
### Exit Codes
|
|
148
|
+
|
|
149
|
+
- `0`: No high or critical findings
|
|
150
|
+
- `1`: High severity findings detected
|
|
151
|
+
- `2`: Critical findings detected
|
|
152
|
+
|
|
153
|
+
### GitHub Actions Example
|
|
154
|
+
|
|
155
|
+
```yaml
|
|
156
|
+
- name: Security Scan
|
|
157
|
+
run: |
|
|
158
|
+
pip install flutter-security-analyzer
|
|
159
|
+
flutter-security-analyzer ./lib -f json -o security-results.json
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Docker
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Build the image (this also runs the unit tests)
|
|
166
|
+
docker build -t flutter-security-analyzer .
|
|
167
|
+
|
|
168
|
+
# Scan a project mounted at /scan
|
|
169
|
+
docker run -v $(pwd):/scan flutter-security-analyzer /scan
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Known Limitations
|
|
173
|
+
|
|
174
|
+
- Detection is pattern-based. The scanner matches regular expressions against the source rather than tracing how data flows between functions or files, so expect some false positives and some missed issues. A shared whitelist filters common false positives, such as security keywords in function and class names.
|
|
175
|
+
- It scans `.dart` files plus the configuration files listed above. Apart from the build files used for the minimum SDK check, the `android/` and `ios/` folders are skipped, as are test folders, so it does not check `AndroidManifest.xml`, `Info.plist`, native code or compiled builds.
|
|
176
|
+
- The dependency check only recognises a short list of known outdated versions written with a caret (for example `http: ^0.13.0`). It is not a full vulnerability database lookup, so use `flutter pub outdated` as well.
|
|
177
|
+
- Findings are a starting point for review, not proof of a vulnerability. Check each one in context before acting on it.
|
|
178
|
+
|
|
179
|
+
## Project Structure
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
flutter-security-analyzer/
|
|
183
|
+
├── src/flutter_security_analyzer/
|
|
184
|
+
│ ├── main.py # CLI entry point
|
|
185
|
+
│ ├── __main__.py # python -m flutter_security_analyzer
|
|
186
|
+
│ ├── core/
|
|
187
|
+
│ │ ├── scanner.py # Main scanner logic
|
|
188
|
+
│ │ └── config.py # Configuration handling
|
|
189
|
+
│ ├── patterns/
|
|
190
|
+
│ │ ├── base_pattern.py # Pattern base class
|
|
191
|
+
│ │ ├── pattern_registry.py
|
|
192
|
+
│ │ ├── storage_patterns.py
|
|
193
|
+
│ │ ├── crypto_patterns.py
|
|
194
|
+
│ │ ├── auth_patterns.py
|
|
195
|
+
│ │ ├── network_patterns.py
|
|
196
|
+
│ │ ├── platform_patterns.py
|
|
197
|
+
│ │ ├── code_patterns.py
|
|
198
|
+
│ │ ├── resilience_patterns.py
|
|
199
|
+
│ │ └── privacy_patterns.py
|
|
200
|
+
│ ├── mappers/
|
|
201
|
+
│ │ └── masvs_mapper.py # MASVS compliance mapping
|
|
202
|
+
│ └── reporters/
|
|
203
|
+
│ ├── console_reporter.py
|
|
204
|
+
│ ├── json_reporter.py
|
|
205
|
+
│ └── html_reporter.py
|
|
206
|
+
├── tests/
|
|
207
|
+
├── docs/images/ # README screenshots
|
|
208
|
+
├── samples/ # Deliberately vulnerable and secure sample apps
|
|
209
|
+
├── .github/workflows/
|
|
210
|
+
├── Dockerfile
|
|
211
|
+
├── pyproject.toml
|
|
212
|
+
├── requirements.txt
|
|
213
|
+
└── README.md
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Testing
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Run all tests
|
|
220
|
+
pytest
|
|
221
|
+
|
|
222
|
+
# With coverage
|
|
223
|
+
pytest --cov=src tests/
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
MIT License - See LICENSE file for details.
|
|
229
|
+
|
|
230
|
+
## Acknowledgements
|
|
231
|
+
|
|
232
|
+
- OWASP Mobile Application Security Project
|
|
233
|
+
- University of Chester Cybersecurity Department
|
|
234
|
+
|
|
235
|
+
## References
|
|
236
|
+
|
|
237
|
+
- [OWASP MASVS v2.1.0](https://mas.owasp.org/MASVS/)
|
|
238
|
+
- [OWASP Mobile Security Testing Guide](https://mas.owasp.org/MSTG/)
|
|
239
|
+
- [Flutter Security Documentation](https://flutter.dev/security)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
flutter_security_analyzer/__init__.py,sha256=yyhTEfkUgW9CKFS8_X2VUTit16vg6jr6ska9HXreNB4,281
|
|
2
|
+
flutter_security_analyzer/__main__.py,sha256=_jgwR_sQowjwf-0HEpHPVVW_py33tJA9fsbMm_8fvVE,190
|
|
3
|
+
flutter_security_analyzer/main.py,sha256=S0LtdTa65cgLB5aSi4JAO7dgzlORRM1UlI_Df0YKNok,4130
|
|
4
|
+
flutter_security_analyzer/core/__init__.py,sha256=PZ8k2yeWqEko2JocmNEb0ymN6R5N0wpS4GrKu0-nK9s,245
|
|
5
|
+
flutter_security_analyzer/core/config.py,sha256=66JBxtxSNaCkLDIDlPR1awwhJzYrfF9wesTWam4JP3Q,4519
|
|
6
|
+
flutter_security_analyzer/core/scanner.py,sha256=UxcjL8C1owKOhGhaDqX-K_4l6XqpKVkE02tUEukcp8k,20154
|
|
7
|
+
flutter_security_analyzer/mappers/__init__.py,sha256=9h3elSyG7NXX9ZDi2CSjmjfqPf9kx_HYlj2wFQsHlLw,206
|
|
8
|
+
flutter_security_analyzer/mappers/masvs_mapper.py,sha256=qvMerpxaiIkXO_UkEU8KKF91OFOr8saaZrXnVek-woU,12699
|
|
9
|
+
flutter_security_analyzer/patterns/__init__.py,sha256=r34lV4b48RVm5eYrdgvpSeGifIw07ZOpqHJDMpUUERs,933
|
|
10
|
+
flutter_security_analyzer/patterns/auth_patterns.py,sha256=p-Kgwl00OXZbfALdEN-wHfTZ_XGlgiLkT2nYF732GZA,4503
|
|
11
|
+
flutter_security_analyzer/patterns/base_pattern.py,sha256=eX2TqqFyCrKDX2Gc9osA_Q3T6awHgYQKRPHmFh57Ol8,25551
|
|
12
|
+
flutter_security_analyzer/patterns/code_patterns.py,sha256=ZhqFAc3mAn3oL6OH1HIQAH2DcMzx7qc-v0wMVcInQmM,5098
|
|
13
|
+
flutter_security_analyzer/patterns/crypto_patterns.py,sha256=PHL2CtDLPSwzqEfLifKf6Zrm9RPbcwEck-QkGTQxka0,3482
|
|
14
|
+
flutter_security_analyzer/patterns/network_patterns.py,sha256=d_NZUeMYhNAJoV2K6EwkcvAOSNpHlSm77CbV1HJC91o,2795
|
|
15
|
+
flutter_security_analyzer/patterns/pattern_registry.py,sha256=LOwoTD_9LNS_KMHCgXXb-rwUtGRwnjAHdnAz6hzB6PE,5982
|
|
16
|
+
flutter_security_analyzer/patterns/platform_patterns.py,sha256=M5wllqJ4i-fldbhBO4_gqswBHSE9bRPzqvLLqsWnrmI,4240
|
|
17
|
+
flutter_security_analyzer/patterns/privacy_patterns.py,sha256=B-JyU4wlUcsgIEVa1P2cKbrv1lH4864QiFGFcrQzWag,3046
|
|
18
|
+
flutter_security_analyzer/patterns/resilience_patterns.py,sha256=IN_ok1rA58yRR_ElQ1zMi6FSRf30QsV7MwXZf9OHUG4,3029
|
|
19
|
+
flutter_security_analyzer/patterns/storage_patterns.py,sha256=rIUTXGZT5jKyxLKXtBzDKRcCb0YdY8MTq6w1AIAy9gE,6267
|
|
20
|
+
flutter_security_analyzer/reporters/__init__.py,sha256=PvF3AOBmwUuP98yYZw2aB2pMThIWHsuZ-7cPhMV33xE,261
|
|
21
|
+
flutter_security_analyzer/reporters/console_reporter.py,sha256=u0KXjK2ZRTd2pR5O6XqpOEh-BTGJG3fdFHQ1eyxo6VQ,5965
|
|
22
|
+
flutter_security_analyzer/reporters/html_reporter.py,sha256=gJs4TkK5vR2A2YwtGI_rz00UDrJaq9Wp8-GLBsrodds,9800
|
|
23
|
+
flutter_security_analyzer/reporters/json_reporter.py,sha256=TJw9h_AnLMCqXPUOowvdyXfcAcwpPUoEJkZyMRdkuXQ,3584
|
|
24
|
+
flutter_security_analyzer/utils/__init__.py,sha256=EOO48DtlQYrX9ecicQf36n_-zAnYw6kxX2gEYTn2fyI,67
|
|
25
|
+
flutter_security_analyzer-1.0.1.dist-info/licenses/LICENSE,sha256=qv12HeEV3NK1kKOiQiXlC6ejnxqgLR2Nb_oyGGe-wTg,1071
|
|
26
|
+
flutter_security_analyzer-1.0.1.dist-info/METADATA,sha256=-DOj0VbpiYzckO9pklj-FnfP20u8z5Ea0Tze5gSSvYQ,8446
|
|
27
|
+
flutter_security_analyzer-1.0.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
28
|
+
flutter_security_analyzer-1.0.1.dist-info/entry_points.txt,sha256=kX2trRtjGKsBUdC9Mhuwtq5bS8fA3cQOX9SExWLAREI,82
|
|
29
|
+
flutter_security_analyzer-1.0.1.dist-info/top_level.txt,sha256=KVPvOGG12saRuhT5nDJppnDONv9q9ol5f6Kham5vwWU,26
|
|
30
|
+
flutter_security_analyzer-1.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Elebhose Caleb
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
flutter_security_analyzer
|