Skip to content

feat: add ethereum signature based auth api for vpc allow list management#27

Open
Leechael wants to merge 3 commits intomainfrom
feat-vpc-api-auth
Open

feat: add ethereum signature based auth api for vpc allow list management#27
Leechael wants to merge 3 commits intomainfrom
feat-vpc-api-auth

Conversation

@Leechael
Copy link
Contributor

No description provided.

### Admin Endpoints

- `GET /admin/nonce` - Obtain a new nonce for signing requests
- `POST /admin/allowlist` - Add an app to the allowlist (Body: `{"app_id":"..."}`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This endpoint looks like it would overwrite the entire list. It would be better to use a more descriptive path, such as POST /admin/allowlist/add, and perhaps support batch updates.

return fmt.Sprintf("https://%s-8080.%s", appID, gatewayDomain)
}

func parseAllowedApps(allowedApps string) []string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

As the new implementation is not fully decentralized so far, it might be better to keep the previous implementation as an choice for web3 purists.

}

func (s *AppState) storeNonce(nonce string) error {
return s.nonceDB.Update(func(txn *badger.Txn) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Allowing anonymous users to insert unlimited data poses a risk of storage DoS. A stateless server-side JWT might be sufficient here.

I'm not entirely sure what specific attack the nonce is intended to prevent. A simpler approach might be using a client-side token. The flow would be: the client uses their wallet to sign a token containing 'allowed operations' and an 'expiration time' before sending the request. We can set a short expiration time to ensure security.

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