Integrate flutter_appavailability package for vulnerability scanning
This PR implements the integration of the flutter_appavailability package as requested in the issue to enable users to view and select installed apps when reporting security vulnerabilities.
What's Changed
Package Integration
- Added
flutter_appavailability: ^0.0.9dependency topubspec.yaml - Added required
QUERY_ALL_PACKAGESpermission toAndroidManifest.xmlfor app discovery on Android
New Components
-
InstalledAppsService: Service class handling app discovery, filtering system apps, and sorting alphabetically -
InstalledAppsWidget: Reusable UI widget with expandable interface, multi-select functionality, and comprehensive error handling
Report Bug Form Enhancement
The bug reporting form now includes an "Installed Apps for Vulnerability Scan" section that allows users to:
- View all installed apps on their device (excluding system apps)
- Select multiple apps that may be relevant to the security issue
- Provide additional context for vulnerability researchers
Data Model Updates
- Extended
Issuemodel to includeinstalledAppsfield - Selected apps are sent to the backend as
{appName, packageName}objects - App data only included in API calls when user makes selections
UI Features
- Expandable Section: Clean collapsible interface that doesn't clutter the form
- Loading States: Progress indicator while fetching apps from device
- Error Handling: Retry functionality if app loading fails
- Badge Counter: Visual indicator showing number of selected apps
- Scrollable List: Fixed height (250px) container for devices with many apps
- Privacy Conscious: Automatically filters out system apps
Screenshot
The collapsed state of the installed apps widget integrated into the report bug form
Benefits
This enhancement helps security researchers by providing context about which applications users were interacting with when security issues occurred, enabling more targeted vulnerability analysis and better issue categorization.
Files Changed
-
pubspec.yaml- Added flutter_appavailability dependency -
lib/src/pages/home/report_bug.dart- Integrated widget and updated Issue creation -
lib/src/models/issue_model.dart- Added installedApps field -
lib/src/util/services/installed_apps_service.dart- New service class -
lib/src/util/widgets/installed_apps_widget.dart- New UI widget -
android/app/src/main/AndroidManifest.xml- Added required permissions -
test/installed_apps_integration_test.dart- Integration tests
Fixes #[issue_number]
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.24.5-stable.tar.xz
- Triggering command:
curl -fsSL REDACTED -o flutter.tar.xz(http block)- Triggering command:
wget -q REDACTED -O flutter.tar.xz(http block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
Original prompt
This section details on the original issue you should resolve
<issue_title>For the app integrate the flutter_appavailability</issue_title> <issue_description>To integrate the
flutter_appavailabilitypackage into your app, you can follow these steps:
- Add the
flutter_appavailabilitypackage to your project by adding the following line to yourpubspec.yamlfile:dependencies: flutter_appavailability: ^0.5.2+1
- Import the package in your Dart file where you want to use it:
import 'package:flutter_appavailability/flutter_appavailability.dart';
- Use the
getInstalledApps()method to get a list of installed apps on the device:List<Application> installedApps = []; void getInstalledApps() async { List<Application> apps = await AppAvailability.getInstalledApps(); setState(() { installedApps = apps; }); }In this example, we're using the
getInstalledApps()method from theflutter_appavailabilitypackage to get a list of all installed apps on the device. ThegetInstalledApps()method returns aList<Application>object containing information about each installed app, such as the app name, package name, and icon.
- Display the list of installed apps in your app's UI.
ListView.builder( itemCount: installedApps.length, itemBuilder: (context, index) { return ListTile( leading: CircleAvatar( backgroundImage: MemoryImage(installedApps[index].icon), ), title: Text(installedApps[index].appName), subtitle: Text(installedApps[index].packageName), ); }, )In this example, we're using a
ListView.builderwidget to display the list of installed apps in a scrollable list. Each app is displayed as aListTilewidget, with the app icon, name, and package name shown.
- Use the installed app list when reporting an issue. You can use the installed app list to provide additional information when reporting an issue in your app. For example, you could ask the user to select the app they were using when the issue occurred, and include this information in the bug report. Note that the
getInstalledApps()method can take a long time to complete on devices with many installed apps, so you should consider using a loading indicator while the list is being fetched. </issue_description><agent_instructions>please integrate this plugin so that the app will show what apps are installed with the user's permission in order to scan for vulnerabilities and report it to the user</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@justary27 @fredfalcon What's this issue about? Show installed apps in our app?@justary27 Done. @WaniAthar@DonnieBLT It looks like this didn't make it in to the code, it's still a useful feature.@DonnieBLT @coderabbitai please code this flutter feature for the BLT-Flutter repo
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.