Skip to content

Misleading LFS_JWT_SECRET description #22727

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

Closed
pboguslawski opened this issue Feb 2, 2023 · 2 comments
Closed

Misleading LFS_JWT_SECRET description #22727

pboguslawski opened this issue Feb 2, 2023 · 2 comments
Labels
type/bug type/docs This PR mainly updates/creates documentation

Comments

@pboguslawski
Copy link
Contributor

pboguslawski commented Feb 2, 2023

Description

According to https://docs.gitea.io/en-us/config-cheat-sheet/#server-server

LFS_JWT_SECRET: <empty>: LFS authentication secret, change this a unique string.

which is not true because gitea requires such string to be unpadded urlsafe base64 encoded 32 bytes, i.e. generated with

dd if=/dev/urandom bs=1 count=32 status=none | base64 | tr '/+' '_-' | tr -d '='

If it's not - gitea generates own value on startup and logs

2023/02/01 22:26:08 ...s/setting/setting.go:1318:CreateOrAppendToCustomConf() [I] Settings for server.LFS_JWT_SECRET saved to: "[...]app.ini"

If LFS_JWT_SECRET is longer than 32 bytes i.e. generated with

dd if=/dev/urandom bs=1 count=33 status=none | base64 | tr '/+' '_-' | tr -d '='

gitea will panic on startup with

2023/02/02 10:29:24 cmd/web.go:95:func1() [F] PANIC: runtime error: index out of range [2] with length 2

which is caused by golang/go#54532 probably.

Consider fixing manual and handling panic.

Gitea Version

1.18.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

from git

Database

None

@lonix1
Copy link
Contributor

lonix1 commented Jun 17, 2023

Should be cross referenced to docs here which show how to generate the other three secrets, but not LFS_JWT_SECRET.

In fact, it would be nice to safely/easily create this secret with gitea generate secret.

@lunny lunny added the type/docs This PR mainly updates/creates documentation label Jul 27, 2023
@lunny
Copy link
Member

lunny commented Aug 5, 2024

This should be fixed by https://gitea.com/gitea/docs/pulls/46

@lunny lunny closed this as completed Aug 5, 2024
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/bug type/docs This PR mainly updates/creates documentation
Projects
None yet
Development

No branches or pull requests

3 participants