Mask sensitive data when logging action results
When passwords or other sensible data is returned by a Action, they can
be logged by Mistral. This change uses the password masking
functionality used in mistral-lib and privided by oslo-utils.
This function uses the standard cut_repr method in mistral-lib, which
also means the output is more standardised.
Related-Bug: #1850843
Change-Id: I01bf47f7a83102a1a16b15bf0bbb4021707e11fe
(cherry picked from commit a25c8fab88)
			
			
This commit is contained in:
		
				
					committed by
					
						
						Dougal Matthews
					
				
			
			
				
	
			
			
			
						parent
						
							090a255a58
						
					
				
				
					commit
					9726c1a593
				
			@@ -190,12 +190,6 @@ class Action(object):
 | 
				
			|||||||
    def _log_result(self, prev_state, result):
 | 
					    def _log_result(self, prev_state, result):
 | 
				
			||||||
        state = self.action_ex.state
 | 
					        state = self.action_ex.state
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        def _result_msg():
 | 
					 | 
				
			||||||
            if state == states.ERROR:
 | 
					 | 
				
			||||||
                return "error = %s" % utils.cut(result.error)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return "result = %s" % utils.cut(result.data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if prev_state != state:
 | 
					        if prev_state != state:
 | 
				
			||||||
            wf_trace.info(
 | 
					            wf_trace.info(
 | 
				
			||||||
                None,
 | 
					                None,
 | 
				
			||||||
@@ -205,7 +199,7 @@ class Action(object):
 | 
				
			|||||||
                 self.task_ex.name if self.task_ex else None,
 | 
					                 self.task_ex.name if self.task_ex else None,
 | 
				
			||||||
                 prev_state,
 | 
					                 prev_state,
 | 
				
			||||||
                 state,
 | 
					                 state,
 | 
				
			||||||
                 _result_msg())
 | 
					                 result.cut_repr())
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user