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

Enable X-Gitea-OTP header for git operations #28968

Open
Kwonunn opened this issue Jan 28, 2024 · 12 comments
Open

Enable X-Gitea-OTP header for git operations #28968

Kwonunn opened this issue Jan 28, 2024 · 12 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@Kwonunn
Copy link

Kwonunn commented Jan 28, 2024

Feature Description

Currently, users with Multi-Factor Auth can't use http/https to perform git operations. The Gitea API does support sending the OTP along using the X-Gitea-OTP header. It would be useful if git operations also supported this header.

It is possible to add custom headers to git http requests using the -c http.extraHeaders="X-Gitea-OTP: 123456" flag.

This would be useful for one-time cloning of projects to computers where we don't want to set up our entire SSH key, and is a lot easier than creating an application token for the operation.

Screenshots

No response

@Kwonunn Kwonunn added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Jan 28, 2024
@KN4CK3R
Copy link
Member

KN4CK3R commented Jan 28, 2024

That sounds really exhausting because the OTP always needs to be refreshed. Why not use a PAT instead of the normal password?

@Kwonunn
Copy link
Author

Kwonunn commented Jan 28, 2024

This is just for use in cases where I'm fetching a project once onto a server I don't want to set up SSH on.

Using tokens for this would either require making a fresh token every time which is annoying, or having one to always use which is a security hole.

@techknowlogick
Copy link
Member

This is quite interesting. On one hand user/pass auth for api/git operations are being depreciated, but it does give the idea of otp with scoped tokens 🤔

@Kwonunn
Copy link
Author

Kwonunn commented Jan 28, 2024

Is Gitea planning to deprecate http entirely for git operations?

@KN4CK3R
Copy link
Member

KN4CK3R commented Jan 28, 2024

No, only the combination with username and password.

@Kwonunn
Copy link
Author

Kwonunn commented Jan 28, 2024

Why, if I may ask? I know GitHub has stopped allowing it but I'm not quite sure why.

@KN4CK3R
Copy link
Member

KN4CK3R commented Jan 28, 2024

Because the username/password combination should be used in less places in favor of configurable tokens.

@Kwonunn
Copy link
Author

Kwonunn commented Jan 28, 2024

I see. Then, perhaps another method is more appropriate.

Maybe we could add a quick token button in this menu
image
which would generate a temporary personal access token scoped specifically to that repository and with read-only access, which you could use once to clone the repository somewhere?

@JakobDev
Copy link
Contributor

No, only the combination with username and password.

Why?

@KN4CK3R
Copy link
Member

KN4CK3R commented Jan 29, 2024

No, only the combination with username and password.

Why?

#28968 (comment)
https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/#background

@Kwonunn
Copy link
Author

Kwonunn commented Jan 29, 2024

I see. Then, perhaps another method is more appropriate.

Maybe we could add a quick token button in this menu image which would generate a temporary personal access token scoped specifically to that repository and with read-only access, which you could use once to clone the repository somewhere?

Should I make a new feature request for this new idea and just leave the http OTP thing?

@JakobDev
Copy link
Contributor

Not beeing able to use Username/Password could be a problem for one time contributors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

4 participants