Skip to content

Commit

Permalink
feat(BOUN-1295): periodically rotate anonymization salt (#2928)
Browse files Browse the repository at this point in the history
This change introduces a periodic rotation of the anonymization salt,
currently set to 30 days.
  • Loading branch information
rikonor authored Dec 3, 2024
1 parent 8b74dc5 commit 7558434
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions rs/boundary_node/anonymization/backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ thread_local! {
// Timers

const SECOND: Duration = Duration::from_secs(1);
const DAY: Duration = Duration::from_secs(24 * 60 * 60);

fn timers() {
// ACLs
Expand Down Expand Up @@ -326,6 +327,31 @@ fn timers() {
});
});

// TTLs
set_timer_interval(7 * DAY, || {
// Remove all encrypted values
let ids = ENCRYPTED_VALUES.with(|vs| {
let mut vs = vs.borrow_mut();

let ids: Vec<_> = vs.iter().map(|(k, _)| k).collect();
vs.clear_new();

ids
});

// Re-queue
QUEUE.with(|q| {
let mut q = q.borrow_mut();

for id in ids {
q.insert(
id, // principal
(), // unit
);
}
});
});

// Leader
set_timer_interval(30 * SECOND, || {
// Collect candidates that have registered a public-key
Expand Down

0 comments on commit 7558434

Please sign in to comment.