MCPcopy Create free account
hub / github.com/saltstack/salt / time_auth

Method time_auth

salt/auth/__init__.py:144–161  ·  view source on GitHub ↗

Make sure that all failures happen in the same amount of time

(self, load)

Source from the content-addressed store, hash-verified

142 return False
143
144 def time_auth(self, load):
145 """
146 Make sure that all failures happen in the same amount of time
147 """
148 start = time.time()
149 ret = self.__auth_call(load)
150 if ret:
151 return ret
152 f_time = time.time() - start
153 if f_time > self.max_fail:
154 self.max_fail = f_time
155 deviation = self.max_fail / 4
156 r_time = random.SystemRandom().uniform(
157 self.max_fail - deviation, self.max_fail + deviation
158 )
159 while start + r_time > time.time():
160 time.sleep(0.001)
161 return False
162
163 def __get_acl(self, load):
164 """

Callers 1

authenticate_eauthMethod · 0.95

Calls 3

__auth_callMethod · 0.95
timeMethod · 0.80
sleepMethod · 0.45

Tested by

no test coverage detected