use of com.epam.pipeline.exception.ToolExecutionDeniedException in project cloud-pipeline by epam.
the class ToolSecurityPolicyAspect method checkToolBySecurityPolicy.
@Before("@annotation(com.epam.pipeline.manager.docker.scan.ToolSecurityPolicyCheck) && args(runVO,..)")
public void checkToolBySecurityPolicy(JoinPoint joinPoint, PipelineStart runVO) {
if (runVO.isForce()) {
PipelineUser user = authManager.getCurrentUser();
if (user != null && user.isAdmin()) {
return;
}
}
PipelineConfiguration configuration = configurationManager.getPipelineConfiguration(runVO);
String tag = toolManager.getTagFromImageName(configuration.getDockerImage());
Tool tool = toolManager.loadByNameOrId(configuration.getDockerImage());
if (!clairToolScanManager.checkTool(tool, tag)) {
throw new ToolExecutionDeniedException(messageHelper.getMessage(MessageConstants.ERROR_TOOL_SECURITY_POLICY_VIOLATION));
}
}
Aggregations