Skip to content

Implement client session secret store#6183

Merged
aduth merged 19 commits intomainfrom
aduth-secret-store
May 5, 2022
Merged

Implement client session secret store#6183
aduth merged 19 commits intomainfrom
aduth-secret-store

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Apr 11, 2022

Why: As a demonstration of secure client-side storage decrypted with key provided by server per session.

What:

  • Storage persists across page reloads and navigation
  • Storage is held in sessionStorage
  • Server provides key for session
    • For demonstration, current implementation uses session, though a final implementation could likely store this as associated with the user in the document_capture_sessions table Edit: Review-ready version still uses user_session. We could revisit this later, but session should suffice.

@aduth aduth force-pushed the aduth-verify-api-route branch from 6a81f95 to bee7044 Compare April 12, 2022 14:49
@aduth aduth force-pushed the aduth-secret-store branch from c7229dc to ee19f04 Compare April 12, 2022 15:42
@aduth aduth force-pushed the aduth-verify-api-route branch 2 times, most recently from fc7fb1b to 446e4b5 Compare April 13, 2022 16:22
Base automatically changed from aduth-verify-api-route to main April 14, 2022 12:21
aduth added a commit that referenced this pull request Apr 14, 2022
To avoid magic number and make it clearer what's happening

#6183 (comment)
@aduth aduth force-pushed the aduth-secret-store branch from 80aa9f2 to 4ebaf09 Compare April 14, 2022 12:58
@aduth aduth force-pushed the aduth-secret-store branch from 4ebaf09 to 1d7409b Compare April 21, 2022 15:26
aduth added a commit that referenced this pull request Apr 21, 2022
To avoid magic number and make it clearer what's happening

#6183 (comment)
aduth added a commit that referenced this pull request Apr 21, 2022
aduth added a commit that referenced this pull request Apr 21, 2022
@aduth aduth force-pushed the aduth-secret-store branch from 1d7409b to 2848802 Compare April 21, 2022 17:56
@aduth aduth changed the title Proof-of-Concept: Client session secret store Implement client session secret store Apr 21, 2022
aduth added 3 commits May 4, 2022 09:07
**Why**: As a demonstration of secure client-side storage decrypted with key provided by server per session.

changelog: Upcoming Features, Identity Proofing, Add client-side encrypted storage
To avoid magic number and make it clearer what's happening

#6183 (comment)
@aduth aduth force-pushed the aduth-secret-store branch from 8cd51de to 2082ad3 Compare May 4, 2022 13:08
@aduth aduth marked this pull request as ready for review May 4, 2022 13:08
@aduth
Copy link
Contributor Author

aduth commented May 4, 2022

Marking this ready for review. We don't currently store anything in it, so it's a bit difficult to review in its current form. The plan would be to use this for "Password Entry" -> "Personal Key" submission so that we can store and restore the personal key received from the API response.

Also, originally I planned to move away from using the session to store the encryption key, but ultimately I think it should be fine as it is? Open to feedback.

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +82 to +86
<StepIndicatorStep title="Getting Started" status={StepStatus.COMPLETE} />
<StepIndicatorStep title="Verify your ID" status={StepStatus.COMPLETE} />
<StepIndicatorStep title="Verify your personal details" status={StepStatus.COMPLETE} />
<StepIndicatorStep title="Verify phone or address" status={StepStatus.COMPLETE} />
<StepIndicatorStep title="Secure your account" status={StepStatus.CURRENT} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is translating these titles is a "later" item?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😬

While it wasn't really intended as part of the changes here (mostly moved file verbatim), and while it was probably a "later" item at the time of original implementation in #6187, admittedly I kinda forgot about it, and probably should have translated it already.

I'll do a quick follow-on after this is merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up at #6310

@aduth aduth merged commit e38b3c0 into main May 5, 2022
@aduth aduth deleted the aduth-secret-store branch May 5, 2022 12:18
peggles2 pushed a commit that referenced this pull request May 5, 2022
* Implement client session secret store

**Why**: As a demonstration of secure client-side storage decrypted with key provided by server per session.

changelog: Upcoming Features, Identity Proofing, Add client-side encrypted storage

* Collapse readStorage try blocks

* Clarify AES cipher key/iv generation

To avoid magic number and make it clearer what's happening

#6183 (comment)

* Simplify cipher assignment logic

* Refactor SecretsContextProvider as observable initializer

- Avoid waiting to render the app
- Manage subscribers automatically via context value change

* Rename encode as s2ab

Consistency

#6183 (comment)

* iv per encrypt

#6183 (comment)

* Make setItem await-able

* Reference crypto consistently from window object

* Add SecretSessionStorage inline comment docs

* Add SecretSessionStorage specs

* Merge useSecretValue to context implementation

* Remove demo value from SecretValues

* Add docs for SecretsContext

* Use flow values as secrets

* Split VerifyFlow from index

Avoid dependency cycle, make room for more index-exported

* Destructure storeKey in same way as other data attributes

* Use user_session instead of session

Route now authenticated

* Inline encryption cipher initialization to memoized session assignment

See: https://github.com/18F/identity-idp/pull/6183/files#r865355166
Co-Authored-By: Zach Margolis <zbmargolis@gmail.com>

Co-authored-by: Zach Margolis <zbmargolis@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants