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

Gitea doesn't handle newline ('\n') in file specified by INTERNAL_TOKEN_URI #11498

Closed
2 of 7 tasks
paradon opened this issue May 18, 2020 · 1 comment · Fixed by #11502
Closed
2 of 7 tasks

Gitea doesn't handle newline ('\n') in file specified by INTERNAL_TOKEN_URI #11498

paradon opened this issue May 18, 2020 · 1 comment · Fixed by #11502
Labels

Comments

@paradon
Copy link

paradon commented May 18, 2020

Description

If the content in the file referenced by INTERNAL_TOKEN_URI ends with a newline, all commits fail with an internal server error.

As gitea generate secret appends a newline to its output, this means that, (where app.ini contains INTERNAL_TOKEN_URI = file:/data/gitea/conf/internal-token), generating this file as below will cause this error:

gitea generate secret INTERNAL_TOKEN >/data/gitea/conf/internal-token

Screenshots

image

@zeripath
Copy link
Contributor

I also note that this uses ioutil.ReadAll which will not work on Symlinks...

zeripath added a commit to zeripath/gitea that referenced this issue May 19, 2020
InternalTokens are fixed as alphanum strings therefore TrimSpace from these.
Also use isatty to not add a terminal newline when redirecting generate.

Fix go-gitea#11498

Signed-off-by: Andrew Thornton <[email protected]>
lafriks added a commit that referenced this issue May 20, 2020
InternalTokens are fixed as alphanum strings therefore TrimSpace from these.
Also use isatty to not add a terminal newline when redirecting generate.

Fix #11498

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
zeripath added a commit to zeripath/gitea that referenced this issue May 20, 2020
InternalTokens are fixed as alphanum strings therefore TrimSpace from these.
Also use isatty to not add a terminal newline when redirecting generate.

Fix go-gitea#11498

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
techknowlogick pushed a commit that referenced this issue May 20, 2020
InternalTokens are fixed as alphanum strings therefore TrimSpace from these.
Also use isatty to not add a terminal newline when redirecting generate.

Fix #11498

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
ydelafollye pushed a commit to ydelafollye/gitea that referenced this issue Jul 31, 2020
InternalTokens are fixed as alphanum strings therefore TrimSpace from these.
Also use isatty to not add a terminal newline when redirecting generate.

Fix go-gitea#11498

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants