Skip to content

Hash shared secret before checking validity of IRS Attempts API token#7888

Merged
mitchellhenke merged 4 commits intomainfrom
mitchellhenke/hash-shared-secret-check
Mar 7, 2023
Merged

Hash shared secret before checking validity of IRS Attempts API token#7888
mitchellhenke merged 4 commits intomainfrom
mitchellhenke/hash-shared-secret-check

Conversation

@mitchellhenke
Copy link
Contributor

🛠 Summary of changes

This is generally not how one uses scrypt hashing, but we do not store the hashed version currently (though we may in the future and this puts the pieces in place).

@mitchellhenke mitchellhenke marked this pull request as draft February 24, 2023 20:22
Copy link
Contributor

Choose a reason for hiding this comment

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

this line is giving me bad vibes, I am really worried about the portability of secrets referencing each other during initialization like this. How would you feel about just hardcoding our production config cost here, since it's not likely to change anytime soon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The pain point is testing and local development where it'd hash the production value on startup every time. Maybe there's a different place to hold it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed on the bad vibes though

Copy link
Contributor

Choose a reason for hiding this comment

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

re: testing where it hashes the prod value on startup each time, I think that was why in my commit I redid re-stubbed the config value with a known new plaintext in the controller spec

Copy link
Contributor

Choose a reason for hiding this comment

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

this keep the original unhashed value in memory, right? I see that we're using it in specs, but I feel like the point of this PR was to remove that?

Comment on lines 123 to 125
Copy link
Contributor

Choose a reason for hiding this comment

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

they all have the same cost/salt right? so we could scrypt the incoming value once?

Maybe inside the processing block, we reorganize the secret value so it's more like a dictionary? or even a struct?

{
  cost: cost,
  salt: salt,
  hashed_tokens: ['a', 'b', 'c']
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, that makes sense.

@mitchellhenke mitchellhenke force-pushed the mitchellhenke/hash-shared-secret-check branch 2 times, most recently from ce3998c to de7a4cf Compare March 2, 2023 15:05
@mitchellhenke mitchellhenke marked this pull request as ready for review March 2, 2023 16:09
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

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can back out this change now that we're no longer using it

Mitchell Henke and others added 4 commits March 2, 2023 11:16
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/hash-shared-secret-check branch from de7a4cf to 404c5e3 Compare March 2, 2023 17:17
@mitchellhenke mitchellhenke merged commit 092df24 into main Mar 7, 2023
@mitchellhenke mitchellhenke deleted the mitchellhenke/hash-shared-secret-check branch March 7, 2023 16:39
@jmdembe jmdembe mentioned this pull request Mar 9, 2023
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.

2 participants