IMGIITRoorkee / IMGIITRoorkee/placement-flutter

Store JWTs in secure storage instead of a plaintext Hive box

Open
#47 0 comments 0 reactions 0 assignees View on GitHub
bug P1 security
Dominant language
Dart
Stars
3
Forks
10
Avg merge
8d 21h
Merged PRs (30d)
4

Description

**Problem**

`Hive.openBox` is called with no `encryptionCipher`, so the access and refresh tokens sit in plaintext in `placementAuthBox.hive` under the app's Documents directory, which iOS includes in iCloud and iTunes backups by default.

The naming actively misleads: the opener is `_openEncryptedBox()` and the writers are `_encrypt()` and `_encryptToken()`, none of which encrypt anything.

**Where**

- `lib/services/auth/auth_service.dart:91-97` (`_openEncryptedBox`, plain `Hive.openBox`)
- `lib/services/auth/auth_service.dart:77-80` (`_encrypt`)
- `lib/services/auth/auth_service.dart:87-89` (`_encryptToken`)

**Expected**

Tokens at rest in the Keychain on iOS and EncryptedSharedPreferences on Android.

**Fix sketch**

- Replace the Hive box with `flutter_secure_storage` for the token pair.
- Rename the three methods to describe what they actually do.
- Drop `hive` and `hive_flutter` from `pubspec.yaml` once nothing else uses them; this box is currently their only use.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with lib/services/auth/auth_service.dart, especially _openEncryptedBox(), _encrypt(), and _encryptToken(), then inspect pubspec.yaml to confirm Hive is only used here. Verify the token pair is stored using the expected iOS and Android secure-storage backends, the methods have accurate names, and unused Hive dependencies are removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
authentication, mobile, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.