10: Add OrderedBroadcastPlugin
This commit is contained in:
@@ -131,4 +131,10 @@ public class PluginModule {
|
|||||||
public Plugin worldAccessPermissionsPlugin(GlobMatcher globMatcher, XmlHelper xmlHelper) {
|
public Plugin worldAccessPermissionsPlugin(GlobMatcher globMatcher, XmlHelper xmlHelper) {
|
||||||
return new WorldAccessPermissionsPlugin(globMatcher, xmlHelper);
|
return new WorldAccessPermissionsPlugin(globMatcher, xmlHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@IntoSet
|
||||||
|
public Plugin orderedAndStickyBroadcastPlugin(GlobMatcher globMatcher, XmlHelper xmlHelper) {
|
||||||
|
return new OrderedBroadcastPlugin(globMatcher, xmlHelper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.bartek.esa.core.plugin;
|
||||||
|
|
||||||
|
import com.bartek.esa.core.archetype.JavaPlugin;
|
||||||
|
import com.bartek.esa.core.model.enumeration.Severity;
|
||||||
|
import com.bartek.esa.core.xml.XmlHelper;
|
||||||
|
import com.bartek.esa.file.matcher.GlobMatcher;
|
||||||
|
import com.github.javaparser.ast.CompilationUnit;
|
||||||
|
import com.github.javaparser.ast.expr.MethodCallExpr;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
public class OrderedBroadcastPlugin extends JavaPlugin {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public OrderedBroadcastPlugin(GlobMatcher globMatcher, XmlHelper xmlHelper) {
|
||||||
|
super(globMatcher, xmlHelper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(CompilationUnit compilationUnit) {
|
||||||
|
compilationUnit.findAll(MethodCallExpr.class).stream()
|
||||||
|
.filter(expr -> expr.getName().getIdentifier().matches("sendOrderedBroadcast|sendOrderedBroadcastAsUser|sendStickyOrderedBroadcast|sendStickyOrderedBroadcastAsUser"))
|
||||||
|
.forEach(expr -> addIssue(Severity.WARNING, getLineNumberFromExpression(expr), expr.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -115,4 +115,7 @@ com.bartek.esa.core.plugin.SqlInjectionPlugin='rawQuery' method detected. Potent
|
|||||||
com.bartek.esa.core.plugin.WorldAccessPermissionsPlugin=World access permissions detected. Potential data leakage.\n\
|
com.bartek.esa.core.plugin.WorldAccessPermissionsPlugin=World access permissions detected. Potential data leakage.\n\
|
||||||
The deprecated '${exprName}' constant has been found and it can be risky to use.\n\
|
The deprecated '${exprName}' constant has been found and it can be risky to use.\n\
|
||||||
It grants world access permission to selected resource.\n\
|
It grants world access permission to selected resource.\n\
|
||||||
Consider using less permissive mode.a.
|
Consider using less permissive mode.
|
||||||
|
|
||||||
|
com.bartek.esa.core.plugin.OrderedBroadcastPlugin=Sending ordered broadcast. Potential broadcast theft.\n\
|
||||||
|
Malicious applications can intercept ordered broadcasts, stop their propagation and resend with malicious data.
|
||||||
Reference in New Issue
Block a user