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

Func 'runCreateUser' of cli command needs to check the value of DEFAULT_USER_VISIBILITY #22523

Closed
yp05327 opened this issue Jan 19, 2023 · 4 comments · Fixed by #22750
Closed
Labels

Comments

@yp05327
Copy link
Contributor

yp05327 commented Jan 19, 2023

Description

I have post a issue at this project: gitea/helm-chart
Admin account's user visibility is public even ALLOWED_USER_VISIBILITY_MODES equals private
But i found that this maybe an issue of gitea cli.

Problem:
In the official helm chart, cli command is used to create the first admin user.

gitea admin user create --admin --username "${GITEA_ADMIN_USERNAME}" --password "${GITEA_ADMIN_PASSWORD}" --email {{ .Values.gitea.admin.email | quote }} --must-change-password=false

This command will call func runCreateUser which is defined in gitea/cmd/admin.go.
In this function, a new user will be create without checking the env variable DEFAULT_USER_VISIBILITY.
so this new user's visibility will always be public.

If you set the env as the following:

DEFAULT_USER_VISIBILITY = private
ALLOWED_USER_VISIBILITY_MODES = private

When you login with the first created admin user, You will get 500 server error page. Because this user's visibility is public
but ALLOWED_USER_VISIBILITY_MODES is private.

Gitea Version

1.18.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Using Official Helm Chart
Helm Chart Version: 7.0.0
Gitea version: 1.18.1

env setting:

gitea:
  config:
    service:
      DISABLE_REGISTRATION: true
      DEFAULT_USER_VISIBILITY: private
      ALLOWED_USER_VISIBILITY_MODES: private
      DEFAULT_ORG_VISIBILITY: private
    service.explore:
      REQUIRE_SIGNIN_VIEW: true
      DISABLE_USERS_PAGE: true

Database

MySQL

@justusbunsi
Copy link
Member

I've analysed this particular Helm Chart issue and what I noticed is that the user create cli command runs without taking the actual app.ini into account with regards to a (possible) default value other than public.

So from my perspective there would be a bugfix for that and maybe a feature for allowing to set the visibility via cli.

@pat-s
Copy link
Member

pat-s commented Jan 19, 2023

Should the issue better be moved to https://gitea.com/gitea/tea?

@jolheiser
Copy link
Member

jolheiser commented Jan 19, 2023

Should the issue better be moved to https://gitea.com/gitea/tea?

No, it looks like this is particularly a command in the Gitea binary itself.
Whether that command should be moved to tea is another matter, but this code is in the main repository currently.


I think at the very least a flag for setting visibility can be added. 👍

@justusbunsi
Copy link
Member

Yep. It's the built-in gitea admin user create command. A flag would actually fix the issue for the Helm chart. Nonetheless there seem to be an issue regarding app.ini consideration during execution.

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.

4 participants