in beam-collector/src/main/java/com/google/collector/clustering/CreateConstellation.java [76:100]
private Refactoring determineRefactoring(SecurityReport sample) {
switch (sample.getReportExtensionCase()) {
case CSP_REPORT:
CspReport cspReport = sample.getCspReport();
if (cspReport.getBlockedUri().equals("eval")) {
return Refactoring.CSP_EVAL;
} else if (cspReport.getBlockedUri().equals("inline")) {
return Refactoring.CSP_INLINE;
} else if (cspReport.getEffectiveDirective().equals("frame-ancestors") || cspReport.getEffectiveDirective().equals("frame-src")) {
return Refactoring.CSP_FRAME_ANCESTORS;
} else if (cspReport.getEffectiveDirective().startsWith("style-src")) {
return Refactoring.CSP_STYLE;
} else if (cspReport.getEffectiveDirective().startsWith("img-src")) {
return Refactoring.CSP_MEDIA;
} else if (cspReport.getEffectiveDirective().equals("require-trusted-types-for")) {
return Refactoring.TRUSTED_TYPES_SINK;
} else {
return Refactoring.CSP_URL;
}
case DEPRECATION_REPORT:
return Refactoring.API_REPLACEMENT;
default:
return Refactoring.REFACTORING_UNKNOWN;
}
}