Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-side HTTP basic authentication support #2450

Open
thehowl opened this issue Jun 27, 2024 · 4 comments
Open

Client-side HTTP basic authentication support #2450

thehowl opened this issue Jun 27, 2024 · 4 comments
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related 🌟 improvement performance improvements, refactors ...

Comments

@thehowl
Copy link
Member

thehowl commented Jun 27, 2024

HTTP basic authentication is a simple authentication mechanism, implemented directly in the protocol. Because it is integrated at a protocol level, web services can be protected by edge web servers like nginx and caddy, without requiring changes in the application itself.

For instance, I could have a simple caddy set up of a gno.land node, password-protecting its RPC, as follows:

rpc.gno.land {
	reverse_proxy gnoland:26657
	basic_auth {
		# Username "bob", password "hiccup"
		bob $2a$14$Zkx19XLiW6VYouLHR5NmfOFU0z2GTNmpkT/5qqR7hx4IjWJPDhjvG
	}
}

However, this is not supported client-side, for instance in gnokey. The URL-spec compliant syntax for providing basic authentication is prefixing the domain with user:password@, as follows:

https://bob:[email protected]:443

It would be nice if our clients, like gnokey and gnoclient, supported basic authentication and automatically added the Authorization header in HTTP requests when provided.

@thehowl thehowl added 📦 ⛰️ gno.land Issues or PRs gno.land package related 🌟 improvement performance improvements, refactors ... labels Jun 27, 2024
@linhpn99
Copy link
Contributor

linhpn99 commented Jun 28, 2024

@thehowl I will create a PR to address this issue and look forward to your guidance to complete this

@thehowl
Copy link
Member Author

thehowl commented Jun 28, 2024

Thanks!

@linhpn99
Copy link
Contributor

linhpn99 commented Jul 2, 2024

it seems you're recommending to use bcrypt to encrypt the password, where can we store the salt for both server and client ?

HTTP basic authentication is a simple authentication mechanism, implemented directly in the protocol. Because it is integrated at a protocol level, web services can be protected by edge web servers like nginx and caddy, without requiring changes in the application itself.

For instance, I could have a simple caddy set up of a gno.land node, password-protecting its RPC, as follows:

rpc.gno.land {
	reverse_proxy gnoland:26657
	basic_auth {
		# Username "bob", password "hiccup"
		bob $2a$14$Zkx19XLiW6VYouLHR5NmfOFU0z2GTNmpkT/5qqR7hx4IjWJPDhjvG
	}
}

However, this is not supported client-side, for instance in gnokey. The URL-spec compliant syntax for providing basic authentication is prefixing the domain with user:password@, as follows:

https://bob:[email protected]:443

It would be nice if our clients, like gnokey and gnoclient, supported basic authentication and automatically added the Authorization header in HTTP requests when provided.

@Kouteki Kouteki moved this from Triage to Todo in 🧙‍♂️gno.land core team Jul 5, 2024
@thehowl
Copy link
Member Author

thehowl commented Jul 15, 2024

@linhpn99 No I'm not. That's an example of how basic auth can be implemented at the server level, using caddy (which requires the password to be stored as safe hashes); it's provided as a reference for testing.

This is not a server change, only a client change. It can be as simple as calling this with the values provided in the remote URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related 🌟 improvement performance improvements, refactors ...
Projects
Status: Backlog
Development

No branches or pull requests

2 participants