feat: Opt-in API.HTTPAuthSecrets for securing Kubo RPC #10187
Labels
dif/hard
effort/weeks
Estimated to take multiple weeks
exp/expert
Having worked on the specific codebase is important
kind/enhancement
A net-new feature or improvement to an existing feature
P1
High: Likely tackled by core team if no one steps up
TLDR
We need to provide an HTTP-based solution for #1532 due to the needs from Brave,
which uses Kubo for their embedded IPFS node feature.
For Brave specifically:
Authorization
header and modifyOrigin
to work-around CORS.cc @autonome @meandavejustice @darobin @cypt4 @vadims fysa
cc brave/brave-browser#34000
Why we need this
webRequest
API for adjustingOrigin
header to bypass that.Initial design proposal
Add opt-in access control for Kubo RPC port based on HTTP Authorization HTTP header.
API.HTTPAuthSecrets
(typeoptionalString
ormap[string]string
)/api/v0
are rejected with HTTP 403 Forbidden unless they includeAuthorization
HTTP header with the provided value.Identity.PrivKey
(it is not sent over wire, not output byipfs config show
etc)Open questions
What should be the UX? There are use-cases beyond Brave, we should support basic auth too. How do we allow use of different authg types?
HTTPAuthSecrets
follow formattype:value
basic:
and has two:
then we parse it asbasic:user:password
, and expectAuthorization: Basic <base64("user:password")>
bearer:
, expect an opaque bearer token sent asAuthorization: Bearer <secret-token>
type:value
format can be reused in other places, likewindow.localStorage
in webui.struct
herewithFlag
andoptionalString
– something similar to what we do in Gateway.PublicGatewaysIf we plan to have app-scoped data spaces, we may need a map of strings (
map[string]string
) instead of a singleoptionalString
.ipfs --api
CLI needs to be extended by adding optional--api-secret
that takes the valuesWe need to figure out how webui can load in Brave when the token is set
window.localStorage
key for auth value, and use it if presenthttps://127.0.0.1:485001
andchrome-extension://companion-id
Origins, so things "just work" without user's involvementbrave://internal-ipfs
could have#auth:<auth-type>:<secret-value>
attached, and webui could consume it and save it in localstorage to send with all RPC requestsThe text was updated successfully, but these errors were encountered: