aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/test/java
AgeCommit message (Collapse)AuthorFilesLines
17 hoursfix(crypto): refuse to encrypt when a .gpg-id recipient key is missingDanilo M.1-0/+84
CryptoRepository.encrypt looked up every .gpg-id recipient and dropped the ones it could not find, so an entry saved on a device that lacked one recipient's key was encrypted to the others only. With a store shared between a phone key and a smartcard key, entries created on the phone could no longer be decrypted with the smartcard alone. Fail with the lookup error instead (KeyNotFoundException names the key), so the user imports the missing public key and saves again. PasswordCreationActivity also ignored the Result of encrypt and wrote the output buffer regardless: on any encryption failure it wrote an empty .gpg file, overwriting the entry when editing, and committed it. Show the error and leave the file untouched. CryptoRepositoryTest covers both the missing-recipient failure and the all-present success path, with keys generated by PGPainless (added as an app test dependency). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 hoursbuild(deps): update JGit from 4.5.7 to 5.13.5Danilo M.1-1/+27
JGit 4.5.7 dates from 2019. 5.13 is the last line that needs only Java 8 APIs, so it works with Android's desugaring; it also fixes GHSA-3p86-9955-h393 (arbitrary file overwrite on checkout). GHSA-vrpq-qp53-qv56 (XXE in repo manifest parsing) has no 5.x fix but the app never parses repo manifests. API changes: - SshSessionFactory now requires getType(). - CheckoutCommand.setForce is deprecated; setForceRefUpdate is its documented replacement with the same meaning. JGit 5 references java.lang.management and javax.management, which Android lacks; R8 flagged them. Both paths are made unreachable rather than only silenced: - WindowCache registers JMX statistics by default; Application.onCreate now installs a WindowCacheConfig with exposeStatsViaJmx = false. - GC.gc() takes a PID lock that queries ManagementFactory and would throw NoClassDefFoundError on a device. GcOperation now runs the GC steps (packRefs, repack, prune) directly; the lock only guards against concurrent gc processes, which cannot happen in the app. Aggressive packing is dropped. The R8 -dontwarn rules and the lint baseline entries are added only for those two now-unreachable references. JGitBehaviourTest covers the operations' command chains plus the GC steps and passes on 5.13.5. It now ignores the developer's global git config, which JGit 5 reads (commit.gpgsign made test commits try to sign). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 hourstest(git): pin down the JGit behaviour the git operations rely onDanilo M.1-0/+158
Run the command chains of SyncOperation, PushOperation, BreakOutOfDetached and ResetToRemoteOperation against a local bare repository and assert the results GitCommandExecutor branches on: rebase success, push OK / UP_TO_DATE / REJECTED_NONFASTFORWARD, a stopped rebase with its branch recoverable, abort and push to a conflict branch, and hard reset to the remote. Passes on JGit 4.5.7; it is the safety net for the JGit upgrade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 hoursfix(git): keep the branch name when breaking out of a failed rebaseDanilo M.1-0/+28
When a pull with rebase stops on a conflict, HEAD is detached and getCurrentBranch() returned null. "Abort rebase and push new branch" then pushed the local commits to "conflicting-null-<time>" and failed to switch back with "Branch name <null> is not allowed", leaving the repository on the conflict branch. Fall back to the branch JGit records in rebase-merge/head-name (or rebase-apply/head-name) while a rebase is in progress. Found while driving the conflict flow on an emulator against the e2e test server; verified there: the edit is pushed to conflicting-master-<time> and the operation completes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 hoursfix: stop exporting DecryptActivity and validate decrypt pathsDanilo M.1-0/+45
DecryptActivity was exported without an intent filter, so any installed app could start it with arbitrary FILE_PATH/REPO_PATH extras (and crash it by omitting them). Nothing outside the app needs to launch it: shortcuts and the decrypt action go through LaunchActivity. LaunchActivity stays exported, so it now treats FILE_PATH as untrusted: the path is forwarded only when it canonically resolves to a regular file inside the password store, and REPO_PATH is always the real store directory instead of the caller-supplied value. Anything else falls back to the main screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2024-08-14chore: add missing copyright headers and update existing onesHarsh Shandilya2-2/+2
2024-05-28chore: reformat with trailing commas changesHarsh Shandilya1-9/+9
2022-10-25refactor: move UriTotpFinderTest to `format-common-impl`Harsh Shandilya1-60/+0
2022-07-15Remove OpenKeychain code and leave TODOs for missing functionalityHarsh Shandilya1-41/+0
2022-07-15all: re-do package structure yet againHarsh Shandilya4-5/+5
2022-05-02Misc cleanups (#1891)Harsh Shandilya1-4/+4
2022-04-21Remove support for external storage and raise target SDK to 31 (#1863)Harsh Shandilya1-19/+20
2021-12-21app: migrate XkPasswd users to DicewareHarsh Shandilya1-0/+28
2021-12-02Cleanup dependency declarations and upgrade to Kotlin 1.6.0 (#1565)Harsh Shandilya3-8/+8
2021-07-17Refactor TOTP implementation and expand SteamGuard hacks (#1460)Harsh Shandilya1-0/+6
* UriTotpFinder: commonize query parameter handling * gitignore: add more IDEA files * TotpFinder: add `findIssuer` * PasswordEntry: don't eagerly fetch TOTP related fields * format-common: expand SteamGuard workaround * CHANGELOG: add SteamGuard workaround
2021-05-22Tweak documentation and drop unused importHarsh Shandilya1-1/+0
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-05-22test: remove context parameterAditya Wasan1-2/+2
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
2021-05-22spotless: fix formattingAditya Wasan1-9/+30
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
2021-05-22test: update MigrationsTest to run on JVMAditya Wasan1-31/+45
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
2021-05-22chore(format): format code using spotlessSphericalKat1-1/+0
Signed-off-by: SphericalKat <amolele@gmail.com>
2021-05-17fix(tests): return null/default values from faked android sdkSphericalKat1-0/+125
fixes behaviour of getFilesDir Signed-off-by: SphericalKat <amolele@gmail.com>
2021-05-02app: update GpgIdentifier testsHarsh Shandilya1-5/+3
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-04-19Migrate some tests to Robolectric (#1389)Harsh Shandilya2-0/+114
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-04-18app: switch to format-common's PasswordEntryHarsh Shandilya2-268/+0
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-03-18all: reformat with ktfmtHarsh Shandilya3-224/+251
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-03-18all: update copyrightsHarsh Shandilya3-2/+7
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-02-19Parse extra content into key value pairs (#1321)Aditya Wasan1-1/+33
* ui: add skeleton recyclerview to parse extra content Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * ui: add recyclerview and update PasswordEntry to create map of key-value pairs Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * password-entry: When key-value pair is not correctly formed, display it as Extra Content Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * Fix formatting Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * bug: update otp code on main thread Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * Add complete string if key-value pair cannot be formed Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * test: add a few tests for key-value parsing logic Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * prefs: remove SHOW_EXTRA_CONTENT from shared preferences Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * Update CHANGELOG.md * Cleanup and refactor Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * PasswordEntryTest: silence nullability warning Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * PasswordEntry: simplify constructor Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * PasswordEntry: annotate test-enablement visibility Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Reintroduce the catch-all field Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * update parsing logic Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * add one more test case Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * Add missing newlines Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Remove unnecessary scrollview Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * rv: do not return if hasExtraContent is false Signed-off-by: Aditya Wasan <adityawasan55@gmail.com> * Don't anchor RV to bottom Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
2021-02-15Add tests for GPG identifier parsing (#1319)Harsh Shandilya1-0/+38
2020-12-05Refactor package structure (#1233)Harsh Shandilya2-4/+4
* idea: default test runner to Gradle * Kick off package structure revamp * Reparent all classes under dev.msfjarvis.aps Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2020-11-06Fix extra content for multiple username fields (#1192)Harsh Shandilya1-0/+11
Fixes #1190 Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2020-10-23Minimal support for MIME secret encoding (#1170)Joris Minjat1-0/+9
Co-authored-by: Fabian Henneke <FabianHenneke@users.noreply.github.com>
2020-09-05Otp: use runCatching to replace exception handlingHarsh Shandilya2-17/+19
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2020-07-25Properly handle files without passwords (#969)Harsh Shandilya1-0/+23
* Properly handle files without passwords Fixes #967 Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Fix tests Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Only look for TOTP URI Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2020-07-14Fix navigation bar theming and reformat (#930)Harsh Shandilya2-2/+9
2020-06-29Reintroduce TOTP support (#890)Harsh Shandilya3-63/+157
Co-authored-by: Fabian Henneke <fabian@henneke.me>
2020-05-28Remove HOTP/TOTP support (#806)Harsh Shandilya1-0/+63