Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/publish-test-results.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Test Results

on:
workflow_run:
workflows: ["Android Build CI", "Android Feature CI"]
types:
- completed
permissions: {}

jobs:
publish_test_results:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure'

permissions:
checks: write
pull-requests: write
actions: read
steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2.16.1
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/**/*.xml"
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ dependencies {
implementation libs.androidX.constraintLayout
implementation libs.androidX.multidex //Multiple dex files
implementation libs.androidX.biometric
implementation libs.androidX.lifecycle
implementation libs.androidX.lifecycle.process
implementation libs.room.runtime
implementation libs.room.rxjava2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ class FtpServiceEspressoTest {
.putString(
FtpService.KEY_PREFERENCE_PASSWORD,
PasswordUtil.encryptPassword(
ApplicationProvider.getApplicationContext(),
"passw0rD",
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,19 @@

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.amaze.filemanager.BuildConfig;
import com.amaze.filemanager.utils.PasswordUtil;

import android.content.Context;
import android.util.Base64;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;

@RunWith(AndroidJUnit4.class)
public class CryptUtilTest {

private Context context;

@Before
public void setUp() {
context = InstrumentationRegistry.getInstrumentation().getTargetContext();
}

@Test
public void testIvValueIsCorrect() {
assertEquals("LxbHiJhhUXcj", BuildConfig.CRYPTO_IV);
Expand All @@ -53,8 +43,7 @@ public void testIvValueIsCorrect() {
@Test
public void testEncryptDecrypt() throws Exception {
String password = "hackme";
String encrypted = PasswordUtil.INSTANCE.encryptPassword(context, password, Base64.URL_SAFE);
assertEquals(
password, PasswordUtil.INSTANCE.decryptPassword(context, encrypted, Base64.URL_SAFE));
String encrypted = PasswordUtil.INSTANCE.encryptPassword(password, Base64.URL_SAFE);
assertEquals(password, PasswordUtil.INSTANCE.decryptPassword(encrypted, Base64.URL_SAFE));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.amaze.filemanager.fileoperations.exceptions.ShellNotRunningException;
import com.amaze.filemanager.fileoperations.filesystem.OpenMode;
import com.amaze.filemanager.filesystem.HybridFile;
import com.amaze.filemanager.filesystem.ftp.NetCopyClientConnectionPool;
import com.amaze.filemanager.filesystem.ssh.CustomSshJConfig;
import com.amaze.filemanager.ui.fragments.preferencefragments.PreferencesConstants;
import com.amaze.filemanager.ui.provider.UtilitiesProvider;
Expand Down Expand Up @@ -108,6 +109,8 @@ public void onCreate() {
utilsHandler = new UtilsHandler(this, utilitiesDatabase);

runInBackground(Config::registerSmbURLHandler);
// Force Kotlin object NetCopyClientConnectionPool to initialize
NetCopyClientConnectionPool.INSTANCE.initialize();

// disabling file exposure method check for api n+
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ abstract class AbstractGetHostInfoTask<V, T : Callable<V>>(
AppConfig.getInstance().run {
progressDialog =
ProgressDialog.show(
this.mainActivityContext,
requireNotNull(this.mainActivityContext),
"",
this.resources.getString(R.string.processing),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import com.amaze.filemanager.asynchronous.asynctasks.Task
import com.amaze.filemanager.filesystem.ftp.NetCopyClientConnectionPool.FTP_URI_PREFIX
import org.apache.commons.net.ftp.FTPClient
import org.json.JSONObject
import java.net.ConnectException
import java.net.SocketException
import java.net.SocketTimeoutException

Expand Down Expand Up @@ -62,8 +61,7 @@ class FtpAuthenticationTask(

@MainThread
override fun onError(error: Throwable) {
if (error is SocketException || error is SocketTimeoutException || error is ConnectException
) {
if (error is SocketException || error is SocketTimeoutException) {
AppConfig.toast(
AppConfig.getInstance(),
AppConfig.getInstance()
Expand All @@ -79,7 +77,5 @@ class FtpAuthenticationTask(
}

@MainThread
override fun onFinish(value: FTPClient) {
android.util.Log.d("TEST", value.toString())
}
override fun onFinish(value: FTPClient) = Unit
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package com.amaze.filemanager.asynchronous.asynctasks.ftp.auth

import androidx.annotation.WorkerThread
import com.amaze.filemanager.application.AppConfig
import com.amaze.filemanager.filesystem.ftp.FTPClientImpl
import com.amaze.filemanager.filesystem.ftp.NetCopyClientConnectionPool
import com.amaze.filemanager.filesystem.ftp.NetCopyClientConnectionPool.CONNECT_TIMEOUT
Expand Down Expand Up @@ -55,7 +54,7 @@ open class FtpAuthenticationTaskCallable(
ftpClient.login(
decode(username, UTF_8.name()),
decode(
PasswordUtil.decryptPassword(AppConfig.getInstance(), password),
PasswordUtil.decryptPassword(password),
UTF_8.name(),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

package com.amaze.filemanager.asynchronous.asynctasks.ftp.auth

import com.amaze.filemanager.application.AppConfig
import com.amaze.filemanager.filesystem.ftp.FTPClientImpl
import com.amaze.filemanager.filesystem.ftp.FTPClientImpl.Companion.ARG_TLS
import com.amaze.filemanager.filesystem.ftp.FTPClientImpl.Companion.TLS_EXPLICIT
Expand Down Expand Up @@ -57,7 +56,7 @@ class FtpsAuthenticationTaskCallable(
} else {
ftpClient.login(
username,
PasswordUtil.decryptPassword(AppConfig.getInstance(), password),
PasswordUtil.decryptPassword(password),
)
}
return if (loginSuccess) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

package com.amaze.filemanager.asynchronous.asynctasks.ssh

import com.amaze.filemanager.application.AppConfig
import com.amaze.filemanager.filesystem.ftp.NetCopyClientConnectionPool
import com.amaze.filemanager.filesystem.ssh.CustomSshJConfig
import com.amaze.filemanager.utils.PasswordUtil
Expand Down Expand Up @@ -74,13 +73,7 @@ class SshAuthenticationTaskCallable(
} else {
sshClient.authPassword(
decode(username, UTF_8.name()),
decode(
PasswordUtil.decryptPassword(
AppConfig.getInstance(),
password!!,
),
UTF_8.name(),
),
decode(PasswordUtil.decryptPassword(password!!), UTF_8.name()),
)
sshClient
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ class FtpService : Service(), Runnable {
runCatching {
password =
PasswordUtil.decryptPassword(
applicationContext,
preferences.getString(KEY_PREFERENCE_PASSWORD, "")!!,
)
isPasswordProtected = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.amaze.filemanager.application.AppConfig
import com.amaze.filemanager.database.daos.BookmarkEntryDao
import com.amaze.filemanager.database.daos.GridEntryDao
import com.amaze.filemanager.database.daos.HiddenEntryDao
Expand Down Expand Up @@ -441,13 +440,11 @@ abstract class UtilitiesDatabase : RoomDatabase() {
try {
val oldPassword =
decryptPassword(
AppConfig.getInstance(),
password,
Base64.DEFAULT,
)
val newPassword =
encryptPassword(
AppConfig.getInstance(),
oldPassword,
Base64.URL_SAFE,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package com.amaze.filemanager.database.typeconverters

import android.util.Log
import androidx.room.TypeConverter
import com.amaze.filemanager.application.AppConfig
import com.amaze.filemanager.database.models.StringWrapper
import com.amaze.filemanager.utils.PasswordUtil
import com.amaze.filemanager.utils.PasswordUtil.decryptPassword
Expand All @@ -47,9 +46,7 @@ object EncryptedStringTypeConverter {
@TypeConverter
fun toPassword(encryptedStringEntryInDb: String): StringWrapper {
return runCatching {
StringWrapper(
decryptPassword(AppConfig.getInstance(), encryptedStringEntryInDb),
)
StringWrapper(decryptPassword(encryptedStringEntryInDb))
}.onFailure {
Log.e(TAG, "Error decrypting password", it)
}.getOrElse {
Expand All @@ -64,10 +61,7 @@ object EncryptedStringTypeConverter {
@TypeConverter
fun fromPassword(unencryptedPasswordString: StringWrapper): String? {
return runCatching {
encryptPassword(
AppConfig.getInstance(),
unencryptedPasswordString.value,
)
encryptPassword(unencryptedPasswordString.value)
}.onFailure {
Log.e(TAG, "Error encrypting password", it)
}.getOrElse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ object EncryptDecryptUtils {
decryptIntent,
utilsProvider.appTheme,
decryptPassword(
c,
preferences.getString(
PreferencesConstants.PREFERENCE_CRYPT_MASTER_PASSWORD,
PreferencesConstants.PREFERENCE_CRYPT_MASTER_PASSWORD_DEFAULT,
Expand Down
Loading
Loading