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

[BUG]: Root user created with credentials - but which ones??? #131

Open
sglebs opened this issue Feb 4, 2024 · 6 comments · May be fixed by #132
Open

[BUG]: Root user created with credentials - but which ones??? #131

sglebs opened this issue Feb 4, 2024 · 6 comments · May be fixed by #132
Assignees
Labels
bug Something isn't working core-team

Comments

@sglebs
Copy link

sglebs commented Feb 4, 2024

How are you running VectorAdmin?

Local development

What happened?

I already have a database from running this tool in December (see #93). I did a fresh git clone and re-ran the steps, pointing at my existing database. It all went well, except that it did not honor my existing admin account. It printed:

Root user created with credentials

But what credentials? Using DBeaver I see the database:

[email protected] $2b$10$sxqOOuQ7ocYZmhkMfdADZuxUa0ar3yIMzK113wvd3JoL3AYGepSJK

I am assuming this is a hashed/salted password, but... what is the password? (yes, I did try the hash as password in the GUI, to no avail)

If it is impossible to tell the initial default password, then please let me know how to force a reset. Delete this entire row? Delete the password field?

Are there known steps to reproduce?

No response

@sglebs sglebs added the possible bug unconfirmed bug report label Feb 4, 2024
@sglebs
Copy link
Author

sglebs commented Feb 4, 2024

Found the algorithm:

const User = {
  create: async function ({ email, password, role = null }) {
    try {
      const bcrypt = require("bcrypt");
      const user = await prisma.users.create({
        data: {
          email,
          password: bcrypt.hashSync(password, 10),
          role: role ?? "default",
        },
      });

      return { user, message: null };
    } catch (e) {
      console.error("FAILED TO CREATE USER.", e.message);
      return { user: null, error: e.message };
    }
  },

still looking for the initial setup with the initial password.

@sglebs
Copy link
Author

sglebs commented Feb 4, 2024

Found the defaults:

    process.env.SYS_EMAIL = "[email protected]";
    process.env.SYS_PASSWORD = "password";

How about updating the Readme to mention these 2 very important env vars?

@sglebs
Copy link
Author

sglebs commented Feb 4, 2024

It turns out the system does not honor these env vars.

(venv) mqm@Marcios-MBP vector-admin % export SYS_EMAIL="[email protected]"
export SYS_EMAIL="[email protected]"
(venv) mqm@Marcios-MBP vector-admin % export SYS_PASSWORD="vector@admin"
(venv) mqm@Marcios-MBP vector-admin % echo "now I deleted the row in DBeaver"
now I deleted the row in DBeaver
(venv) mqm@Marcios-MBP vector-admin % yarn dev:server                        
yarn run v1.22.21
$ cd backend && yarn dev
$ NODE_ENV=development nodemon --ignore storage/ --trace-warnings index.js
[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node --trace-warnings index.js`
Storage folder for vector-cache created.
prisma:info Starting a postgresql pool with 25 connections.
[DEVELOPER MODE: TELEMETRY STUBBED] {
  event: 'server_boot',
  properties: { commit: '39fe4a1117a81feaf09a440b79792120964bb4d6' }
}
Root user created with credentials
Backend server listening on port 3001
[express-admin] No schema changes found. Will not republish settings.
image

@sglebs
Copy link
Author

sglebs commented Feb 4, 2024

And it turns out the system fails with the hardcoded credentials also:

image image

@timothycarambat
Copy link
Member

timothycarambat commented Feb 4, 2024

The root user login creation is automatic and once you land on the sign-in page for the first time you should automatically be sent to an onboarding flow, you should not need to log in at all visiting the main page after booting up for the first time.

If it was failing to direct you to onboarding, then that is the bug

@sglebs
Copy link
Author

sglebs commented Feb 5, 2024

Yes, I remember that from December. But now, with today's clone, after starting with a fresh database, it does not redirect me. Maybe that is the real bug, as you said.

@timothycarambat timothycarambat added bug Something isn't working core-team and removed possible bug unconfirmed bug report labels Feb 5, 2024
@shatfield4 shatfield4 linked a pull request Feb 9, 2024 that will close this issue
10 tasks
@shatfield4 shatfield4 linked a pull request Feb 9, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core-team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants