mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GP-3852: Preventing installation of extension source directories
This commit is contained in:
parent
0f7300aac0
commit
b639053178
2 changed files with 23 additions and 15 deletions
|
@ -166,6 +166,18 @@ public class ExtensionTableProvider extends DialogComponentProvider {
|
||||||
private boolean installExtensions(List<File> files) {
|
private boolean installExtensions(List<File> files) {
|
||||||
boolean didInstall = false;
|
boolean didInstall = false;
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
|
|
||||||
|
// A sanity check for users that try to install an extension from a source folder
|
||||||
|
// instead of a fully built extension.
|
||||||
|
if (new File(file, "build.gradle").isFile()) {
|
||||||
|
Msg.showWarn(this, null, "Invalid Extension", "The selected extension folder " +
|
||||||
|
"contains a 'build.gradle' file.\nGhidra does not support installing " +
|
||||||
|
"extensions in source form.\nPlease build the extension and install its zip " +
|
||||||
|
"file.");
|
||||||
|
didInstall = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
boolean success = ExtensionUtils.install(file);
|
boolean success = ExtensionUtils.install(file);
|
||||||
didInstall |= success;
|
didInstall |= success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -515,10 +515,6 @@ public class ExtensionUtils {
|
||||||
if (file.isDirectory() && file.canRead()) {
|
if (file.isDirectory() && file.canRead()) {
|
||||||
File propertyFile = new File(file, PROPERTIES_FILE_NAME);
|
File propertyFile = new File(file, PROPERTIES_FILE_NAME);
|
||||||
if (propertyFile.isFile()) {
|
if (propertyFile.isFile()) {
|
||||||
if (new File(file, "build.gradle").isFile()) {
|
|
||||||
log.error("Extension source directories are not valid extensions");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return tryToLoadExtensionFromProperties(propertyFile);
|
return tryToLoadExtensionFromProperties(propertyFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue