Skip to content

Commit

Permalink
Changed|Fixed: Bump down minSdkVersion from 24 to 21 to restart…
Browse files Browse the repository at this point in the history
… supporting android 5/6 for the time being

Also fixes vulnerability detailed in https://termux.dev/en/posts/general/2022/02/15/termux-apps-vulnerability-disclosures.html#termuxtasker-privilege-escalation-vulnerability for Android 5/6

Related commit termux/termux-app@623aaebb

Related pull request termux/termux-app#2740
  • Loading branch information
agnostic-apollo committed Aug 23, 2022
1 parent 78130a8 commit 10cc047
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,11 @@ dependencies {
androidTestImplementation 'androidx.test:rules:1.4.0'

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation "androidx.annotation:annotation:1.2.0"
implementation "androidx.annotation:annotation:1.3.0"
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.guava:guava:24.1-jre'

implementation 'com.termux.termux-app:termux-shared:68cdbd6ff4'

implementation 'com.termux.termux-app:termux-shared:211340781b'
// Use if below libraries are published locally by termux-app with `./gradlew publishReleasePublicationToMavenLocal` and used with `mavenLocal()`.
// If updates are done, republish there and sync project with gradle files here
// https://github.com/termux/termux-app/wiki/Termux-Libraries
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/termux/tasker/FireReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ public void onReceive(final Context context, final Intent intent) {
String executableExtra = executionCommand.executable = IntentUtils.getStringExtraIfSet(intent, PluginBundleManager.EXTRA_EXECUTABLE, null);
final String arguments_string = bundle.getString(PluginBundleManager.EXTRA_ARGUMENTS);
executionCommand.workingDirectory = IntentUtils.getStringExtraIfSet(intent, PluginBundleManager.EXTRA_WORKDIR, null);
executionCommand.inBackground = !(intent.getBooleanExtra(PluginBundleManager.EXTRA_TERMINAL, false));
executionCommand.runner = intent.getBooleanExtra(PluginBundleManager.EXTRA_TERMINAL, false) ?
ExecutionCommand.Runner.TERMINAL_SESSION.getName() : ExecutionCommand.Runner.APP_SHELL.getName();
final boolean waitForResult = bundle.getBoolean(PluginBundleManager.EXTRA_WAIT_FOR_RESULT, true);

if (executionCommand.inBackground) {
if (ExecutionCommand.Runner.APP_SHELL.equalsRunner(executionCommand.runner)) {
executionCommand.stdin = IntentUtils.getStringExtraIfSet(intent, PluginBundleManager.EXTRA_STDIN, null);
executionCommand.backgroundCustomLogLevel = IntentUtils.getIntegerExtraIfSet(intent, PluginBundleManager.EXTRA_BACKGROUND_CUSTOM_LOG_LEVEL, null);
} else {
Expand Down Expand Up @@ -189,7 +190,7 @@ public void onReceive(final Context context, final Intent intent) {
executionIntent.putExtra(TERMUX_SERVICE.EXTRA_STDIN, executionCommand.stdin);
executionIntent.putExtra(TERMUX_SERVICE.EXTRA_SESSION_ACTION, executionCommand.sessionAction);
executionIntent.putExtra(TERMUX_SERVICE.EXTRA_BACKGROUND_CUSTOM_LOG_LEVEL, DataUtils.getStringFromInteger(executionCommand.backgroundCustomLogLevel, null));
executionIntent.putExtra(TERMUX_SERVICE.EXTRA_BACKGROUND, executionCommand.inBackground);
executionIntent.putExtra(TERMUX_SERVICE.EXTRA_RUNNER, executionCommand.runner);
executionIntent.putExtra(TERMUX_SERVICE.EXTRA_PLUGIN_API_HELP, context.getString(R.string.plugin_api_help, TermuxConstants.TERMUX_TASKER_GITHUB_REPO_URL));

// Send execution intent to TERMUX_SERVICE
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/termux/tasker/utils/PluginUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.termux.shared.shell.command.runner.app.AppShell;
import com.termux.shared.termux.settings.preferences.TermuxPreferenceConstants.TERMUX_TASKER_APP;
import com.termux.shared.termux.settings.preferences.TermuxTaskerAppSharedPreferences;
import com.termux.shared.termux.settings.properties.TermuxPropertyConstants;
import com.termux.shared.termux.shell.command.runner.terminal.TermuxSession;
import com.termux.tasker.FireReceiver;
import com.termux.tasker.PluginResultsService;
Expand Down Expand Up @@ -509,8 +508,11 @@ public static String checkIfTermuxTaskerAllowExternalAppsPolicyIsViolated(final
if (executable == null || executable.isEmpty()) return context.getString(R.string.error_null_or_empty_executable);

String errmsg = null;

if (!FileUtils.isPathInDirPath(executable, TermuxConstants.TERMUX_TASKER_SCRIPTS_DIR_PATH, true) &&
!SharedProperties.isPropertyValueTrue(context, TermuxPropertyConstants.getTermuxPropertiesFile(), TermuxConstants.PROP_ALLOW_EXTERNAL_APPS, true)) {
!SharedProperties.isPropertyValueTrue(context,
SharedProperties.getPropertiesFileFromList(TermuxConstants.TERMUX_PROPERTIES_FILE_PATHS_LIST, LOG_TAG),
TermuxConstants.PROP_ALLOW_EXTERNAL_APPS, true)) {
errmsg = context.getString(R.string.error_allow_external_apps_ungranted_warning);
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ org.gradle.jvmargs=-Xmx1536m
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

minSdkVersion=24
minSdkVersion=21
targetSdkVersion=28
compileSdkVersion=30

0 comments on commit 10cc047

Please sign in to comment.