Refactoring

pull/217/head
M66B 11 months ago
parent ff1232c48a
commit cbfccc50b8

@ -167,7 +167,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
? View.VISIBLE : View.INVISIBLE);
}
boolean dangerous = Helper.DANGEROUS_EXTENSIONS.contains(Helper.getExtension(attachment.name));
boolean dangerous = EntityAttachment.DANGEROUS_EXTENSIONS.contains(Helper.getExtension(attachment.name));
tvName.setText(attachment.name);
tvName.setTextColor(dangerous ? colorWarning : textColorPrimary);
tvName.setTypeface(null, dangerous ? Typeface.BOLD : Typeface.NORMAL);

@ -42,6 +42,8 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
@ -76,6 +78,26 @@ public class EntityAttachment {
static final String VCARD_PREFIX = BuildConfig.APPLICATION_ID + ".vcard.";
// https://support.google.com/mail/answer/6590#zippy=%2Cmessages-that-have-attachments
static final List<String> DANGEROUS_EXTENSIONS = Collections.unmodifiableList(Arrays.asList(
"ade", "adp", "apk", "appx", "appxbundle",
"bat",
"cab", "chm", "cmd", "com", "cpl",
"dll", "dmg",
"ex", "ex_", "exe",
"hta",
"ins", "isp", "iso",
"jar", "js", "jse",
"lib", "lnk",
"mde", "msc", "msi", "msix", "msixbundle", "msp", "mst",
"nsh",
"pif", "ps1",
"rdp", // https://www.microsoft.com/en-us/security/blog/2024/10/29/midnight-blizzard-conducts-large-scale-spear-phishing-campaign-using-rdp-files/
"scr", "sct", "shb", "sys",
"vb", "vbe", "vbs", "vxd",
"wsc", "wsf", "wsh"
));
@PrimaryKey(autoGenerate = true)
public Long id;
public String section;

@ -7438,7 +7438,7 @@ public class FragmentCompose extends FragmentBase {
else if (attachment.isAttachment())
attached++;
String ext = Helper.getExtension(attachment.name);
if (Helper.DANGEROUS_EXTENSIONS.contains(ext))
if (EntityAttachment.DANGEROUS_EXTENSIONS.contains(ext))
dangerous.add(attachment.name);
}
if (dangerous.size() > 0)

@ -261,26 +261,6 @@ public class Helper {
")+"
);
// https://support.google.com/mail/answer/6590#zippy=%2Cmessages-that-have-attachments
static final List<String> DANGEROUS_EXTENSIONS = Collections.unmodifiableList(Arrays.asList(
"ade", "adp", "apk", "appx", "appxbundle",
"bat",
"cab", "chm", "cmd", "com", "cpl",
"dll", "dmg",
"ex", "ex_", "exe",
"hta",
"ins", "isp", "iso",
"jar", "js", "jse",
"lib", "lnk",
"mde", "msc", "msi", "msix", "msixbundle", "msp", "mst",
"nsh",
"pif", "ps1",
"rdp", // https://www.microsoft.com/en-us/security/blog/2024/10/29/midnight-blizzard-conducts-large-scale-spear-phishing-campaign-using-rdp-files/
"scr", "sct", "shb", "sys",
"vb", "vbe", "vbs", "vxd",
"wsc", "wsf", "wsh"
));
private static ExecutorService sSerialExecutor = null;
private static ExecutorService sParallelExecutor = null;
private static ExecutorService sUIExecutor = null;

Loading…
Cancel
Save