akshayrai commented on a change in pull request #4341: [TE] Authorize service 
account to prevent config modification
URL: https://github.com/apache/incubator-pinot/pull/4341#discussion_r295919428
 
 

 ##########
 File path: 
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
 ##########
 @@ -375,6 +398,43 @@ void updateDetectionPipeline(long detectionID, String 
payload, long startTime, l
     }
   }
 
+  private boolean isServiceAccount(ThirdEyePrincipal user) {
+    List<Predicate> predicates = new ArrayList<>();
+    predicates.add(Predicate.EQ("sessionKey", user.getSessionKey()));
+    predicates.add(Predicate.EQ("principalType", "SERVICE"));
+
+    List<SessionDTO> sessionDTO = 
this.sessionDAO.findByPredicate(Predicate.AND(predicates.toArray(new 
Predicate[0])));
+    return sessionDTO != null && !sessionDTO.isEmpty();
+  }
+
+  private void validateConfigOwner(ThirdEyePrincipal user, List<String> 
owners) {
+    if (owners == null || !owners.contains(user.getName())) {
 
 Review comment:
   Good point. I could find 6 alerts, all created by career-comms service 
account. I will update them during deployment.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to