Skip to content

Commit

Permalink
fix: some cache ttls were getting stringified, which leads to dynamod…
Browse files Browse the repository at this point in the history
…b silently not expiring them (#763)
  • Loading branch information
Ed⁦ authored May 31, 2023
1 parent 364efe5 commit 0f59610
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rules/okta_rules/okta_geo_improbable_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def store_login_info(key, event):
],
)
# Expire the entry after a week so the table doesn't fill up with past users
set_key_expiration(key, str((datetime.now() + timedelta(days=7)).timestamp()))
set_key_expiration(key, int((datetime.now() + timedelta(days=7)).timestamp()))


def title(event):
Expand Down
2 changes: 1 addition & 1 deletion rules/onelogin_rules/onelogin_high_risk_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def rule(event):
if event.get("event_type_id") == 6:
# update a counter for this user's failed login attempts with a high risk score
increment_counter(event_key)
set_key_expiration(event_key, time.time() + THRESH_TTL)
set_key_expiration(event_key, int(time.time()) + THRESH_TTL)

# Trigger alert if this user recently
# failed a high risk login
Expand Down
2 changes: 1 addition & 1 deletion rules/slack_rules/slack_application_dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ def store_reset_info(key, event):
],
)
# Expire the entry after 24 hours
set_key_expiration(key, str((datetime.now() + timedelta(days=1)).timestamp()))
set_key_expiration(key, int((datetime.now() + timedelta(days=1)).timestamp()))

0 comments on commit 0f59610

Please sign in to comment.