robinbryce / iona

development cluster. gcp with managed k8s, multi-region
1 stars 0 forks source link

make an api key management service #33

Open robinbryce opened 2 years ago

robinbryce commented 2 years ago

Tasks

General

Secret generation

Recomendations taken from [here](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html

API Key Schema

api_key_collection name: default nano id 11 base64 encoded secret_hash: password hash[1] firebase_user_id: the firebase identity for the user that owns the key applications: empty or platform defined strings restricting which platform applications can redeem the key.

audience: defines how the audience for any generated token is created[2] scopes: defines the scopes requested for any access token obtained using the key[3]

api_key_usage_collection[3] rate_cap: last_used: access_count_indication: a not perfect count

  1. password is nanoid 21. The result of [secret generation](#Secret generation) is stored (it's a hash that is stored, plus possibly salt and iteration count)
  2. audience can be a fixed string or a glob pattern. the interpretation of both is down to the consuming application. audience example for nodes network means automatically chose the audience for the node the user happens to be routed to. ethnode{N} means audience is set to a specific node
  3. scopes example for nodes: "net* eth* admin_nodeInfo"
  4. if/when rate use and cleanup of unused keys is implemented the state goes in a separate collection so the 'reader' can be granted access without giving access to update the keys
robinbryce commented 2 years ago

Lets let go of json and use flatbuffers everywhere

https://engineering.fb.com/2015/07/31/android/improving-facebook-s-performance-on-android-with-flatbuffers/