cds-snc / notification-planning-core

Project planning for GC Notify Core Team
0 stars 0 forks source link

Test SECRET_KEY rotation in staging #102

Open sastels opened 1 year ago

sastels commented 1 year ago

Description

As a Notify dev, I need to be able to test our SECRET_KEY rotations

WHY are we building?

want to precisely document the steps for rotating SECRET_KEY and ensure that it's fully tested

WHAT are we building?

Steps for rotating the SECRET_KEY and testing along the way

VALUE created by our solution

We can confidently rotate in production

Acceptance Criteria

Note:

Step 0: Test the system before doing anything

Step 1: Rotate SECRET_KEY Assume that the current SECRET_KEY is K1 or K0,K1 Everything has been signed with K1 in the database and in transit K1 is being used for signing K0 (if it’s there) and K1 are used for verifying

Step 2: Resign database fields The database fields for old records have previously been signed with K1. New records are now being signed with K2

Bonus Step Locally:

QA Steps

sastels commented 1 year ago

PR tested locally. https://github.com/cds-snc/notification-api/pull/1789

sastels commented 1 year ago

Not that currently staging has 61K rows in notifications and prod has 1.5M so we should do so resigning timings.

If it takes an unacceptable amount of time to resign, we should either (or both)

sastels commented 1 year ago

ok, trying to resign 70K notifications crashed both api and celery pods. Looking at doing it in batches...

jimleroyer commented 1 year ago

@sastels fixed the script to do it in batches and found that 50K was working in staging. To be extra safe, we can size the batch through a command line parameter when executing in production.

jimleroyer commented 1 year ago

We need to test the script for this task to get forward.

ben851 commented 1 year ago