Properly sanitize gitea admin
output
#590
Reference in New Issue
Block a user
No description provided.
Delete Branch "refs/pull/590/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description of the change
With https://github.com/go-gitea/gitea/pull/28390, Gitea 1.21.2 introduced warning log output within the result of
gitea admin <subcommand>
and therefore affects the current provisioning script.That script previously assumed a clean result set and was therefore doomed to fail at some point.
This introduces output sanitizing to trim such logs above the actual result table.
Applicable issues
Additional information
The non-sanitized output were only an issue for admin account provisioning, and only when the username matched one of these words (in case of #589 it was
gitea
):LDAP and OAuth sources were not affected by this particular log line, but also processed non-sanitized result sets. Changing their code is a precaution.
I am aware that I introduce nearly duplicated code here. But the current
configure_gitea.sh
doesn't allow for deduplication. And I didn't want to open Pandora's box in this PR.Thanks for the quick reaction and fix! This is indeed unfortunate. I wonder how we can prevent similar issues from happening in the future. Also when the warning will go away after 1.24 again - there might be others in the future.
Maybe we could also temporarily change the log level, though I haven't found if this would even apply to this internal call.
Let's get the fix out first!