Skip to content

fix: improve root user password check logic in ServerSecurity#2149

Closed
ExtReMLapin wants to merge 2 commits into
ArcadeData:mainfrom
ExtReMLapin:fix_removed_root
Closed

fix: improve root user password check logic in ServerSecurity#2149
ExtReMLapin wants to merge 2 commits into
ArcadeData:mainfrom
ExtReMLapin:fix_removed_root

Conversation

@ExtReMLapin
Copy link
Copy Markdown
Contributor

@ExtReMLapin ExtReMLapin commented Apr 11, 2025

as proposed there : #2058 (comment)

Issue is that is we have at least one user registered it will not try to recreate root because the current contition doesn't allow it

this pr fixes it

Thanks to Tom Krawczyk for helping us find this bug.

@ExtReMLapin ExtReMLapin marked this pull request as ready for review April 11, 2025 15:28
}

if (users.isEmpty() || (users.containsKey("root") && users.get("root").getPassword() == null))
if (users.isEmpty() || !users.containsKey("root") || (users.containsKey("root") && users.get("root").getPassword() == null))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean we could even remove users.isEmpty()

@ExtReMLapin
Copy link
Copy Markdown
Contributor Author

Forgot to run the CI tests

oopsie woopsie

@robfrank
Copy link
Copy Markdown
Collaborator

hi, so, AFAIU, in this way when I restart arcade passing a new rootPassword, the previous one will be overwritten.
It looks like a possible security hole. An attacker can gai access to the database just restarting it providing a new root password.
That said, I understand your needs. Maybe we can add a flag to enable this feature keeping it disabled by default. WDYT?

@ExtReMLapin
Copy link
Copy Markdown
Contributor Author

ExtReMLapin commented Apr 12, 2025

hi, so, AFAIU, in this way when I restart arcade passing a new rootPassword, the previous one will be overwritten.

Only if the user root has been removed manually editing the jsonl users file, unlike this PR where just passing as arg on boot changes it


If it sounds safer to you feel free to edit the PR to add this check.

However I feel like if the attacker already got

  • write access to the jsonl file
  • access to env variables or stdin to set the new password

I fear the changes from this PR doesn't introduce any security exploit.

All it does is allowing to set root password if it's not set.

@robfrank
Copy link
Copy Markdown
Collaborator

Before merging, I need some hints on how to tests this.
AFAIU, to test I should:

  • start with a given password
  • authenticate to verify it works
  • stop
  • ---->>>> do something that I don't know to allow arcadeDb accept a new passwrd
  • start again providing a new root password
  • authenticate to verify it works

Is it right?
What is the "do something that I don't know to allow arcadeDb accept a new passwrd"?
Thanks

@robfrank
Copy link
Copy Markdown
Collaborator

moreover, how is this related to #2059 ?

@ExtReMLapin
Copy link
Copy Markdown
Contributor Author

This can be related but more like an alternative proposed here #2058 (comment)

Before merging, I need some hints on how to tests this. AFAIU, to test I should:

* start with a given password

* authenticate to verify it works

* stop

* ---->>>> do something that I don't know to allow arcadeDb accept a new passwrd

* start again providing a new root password

* authenticate to verify it works

Is it right? What is the "do something that I don't know to allow arcadeDb accept a new passwrd"? Thanks

As you said

  1. Start with given password, either stdin or env variable
  2. Auth with given password
  3. Create extra user not called root
  4. kill arcadedb
  5. In the users jsonl file kill the line with root user
  6. Restart arcadedb
  7. Ensure it tries to create root session either using stdin or using env variable (checks if first issue is fixed by this PR)
  8. create a db with random name
  9. list db and ensure it's in there (checks second issue created by this PR)

@robfrank robfrank modified the milestones: 25.4.1, 25.5.1 Apr 22, 2025
@lvca
Copy link
Copy Markdown
Member

lvca commented May 30, 2025

@robfrank What's the status of this issue?

@robfrank robfrank modified the milestones: 25.5.1, 25.6.1 May 30, 2025
@lvca lvca modified the milestones: 25.6.1, 25.7.1 Jul 4, 2025
@robfrank
Copy link
Copy Markdown
Collaborator

I'm coming back to this.
What happens now is that if you remove the "root" user, but there are other users configured, the root user is not created.
With this PR, if the root user is removed, it is always recreated.

I don't think it is good.

Suppose to provide users/groups configuration without the root user: with this PR it is not possible anymore. At the first start a new root user if created.

@lvca WDYT?

@robfrank robfrank modified the milestones: 25.7.1, 25.8.1 Aug 11, 2025
@lvca
Copy link
Copy Markdown
Member

lvca commented Sep 10, 2025

I agree, if somebody decides to remove the root user, it shouldn't be created automatically at the next restart, unless root is internally needed for some reason, but I can't think of anything right now.

@lvca lvca modified the milestones: 25.8.1, 25.10.1 Sep 10, 2025
@robfrank robfrank modified the milestones: 25.10.1, 25.11.1 Nov 5, 2025
@lvca lvca closed this Dec 9, 2025
@lvca
Copy link
Copy Markdown
Member

lvca commented Dec 9, 2025

Closing this PR not merging it. The user must be able to remove "root" as user.

mergify Bot added a commit that referenced this pull request Mar 13, 2026
…[skip ci]

Bumps [https://github.com/pycqa/isort](https://github.com/pycqa/isort) from 7.0.0 to 8.0.1.
Release notes

*Sourced from [https://github.com/pycqa/isort's releases](https://github.com/pycqa/isort/releases).*

> 8.0.0
> -----
>
> Changes
> -------
>
> * Update CHANGELOG for version 8.0.0 ([#2460](https://redirect.github.com/pycqa/isort/issues/2460)) [`@​DanielNoord`](https://github.com/DanielNoord)
> * Fix edge case of `__future__` import. ([#2458](https://redirect.github.com/pycqa/isort/issues/2458)) [`@​skv0zsneg`](https://github.com/skv0zsneg)
> * Fix the Plone profile to be compatible with black ([#2457](https://redirect.github.com/pycqa/isort/issues/2457)) [`@​ale-rt`](https://github.com/ale-rt)
> * typo fix ([#2450](https://redirect.github.com/pycqa/isort/issues/2450)) [`@​jsta`](https://github.com/jsta)
> * Remove the `setuptools` plugin ([#2427](https://redirect.github.com/pycqa/isort/issues/2427)) [`@​DanielNoord`](https://github.com/DanielNoord)
> * Turn some warnings into errors in test suite ([#2449](https://redirect.github.com/pycqa/isort/issues/2449)) [`@​DanielNoord`](https://github.com/DanielNoord)
> * chore: replace black with ruff in clean.sh ([#2448](https://redirect.github.com/pycqa/isort/issues/2448)) [`@​joao-faria-dev`](https://github.com/joao-faria-dev)
> * feat!: remove old finders flag and legacy finder logic ([#2446](https://redirect.github.com/pycqa/isort/issues/2446)) [`@​joao-faria-dev`](https://github.com/joao-faria-dev)
> * Fix whitespace insensitive check triggering on tabs ([#2437](https://redirect.github.com/pycqa/isort/issues/2437)) [`@​robsdedude`](https://github.com/robsdedude)
> * Fix line separator detection not considering form feed as white space ([#2436](https://redirect.github.com/pycqa/isort/issues/2436)) [`@​robsdedude`](https://github.com/robsdedude)
> * Fix [#1964](https://redirect.github.com/pycqa/isort/issues/1964): `lines_before_import` sometimes ignored ([#1965](https://redirect.github.com/pycqa/isort/issues/1965)) [`@​robsdedude`](https://github.com/robsdedude)
> * Remove reference to 3.9 in README ([#2434](https://redirect.github.com/pycqa/isort/issues/2434)) [`@​DanielNoord`](https://github.com/DanielNoord)
>
> 🚀 Features
> -----------------
>
> * Ensure `multiprocessing.Pool` is always closed and joined ([#2442](https://redirect.github.com/pycqa/isort/issues/2442)) [`@​DanielNoord`](https://github.com/DanielNoord)
>
> :construction\_worker: Continuous Integration
> ---------------------------------------------
>
> * Simplify CI by putting similar steps into a single action file ([#2444](https://redirect.github.com/pycqa/isort/issues/2444)) [`@​DanielNoord`](https://github.com/DanielNoord)
>
> 📦 Dependencies
> ----------------------
>
> * Bump actions/checkout from 5 to 6 in the github-actions group ([#2451](https://redirect.github.com/pycqa/isort/issues/2451)) @[dependabot[bot]](https://github.com/apps/dependabot)
> * Bump astral-sh/setup-uv from 6 to 7 in the github-actions group ([#2441](https://redirect.github.com/pycqa/isort/issues/2441)) @[dependabot[bot]](https://github.com/apps/dependabot)


Changelog

*Sourced from [https://github.com/pycqa/isort's changelog](https://github.com/PyCQA/isort/blob/main/CHANGELOG.md).*

> Changelog
> =========
>
> NOTE: isort follows the [semver](https://semver.org/) versioning standard.
> Find out more about isort's release policy [here](https://pycqa.github.io/isort/docs/major_releases/release_policy).
>
> Releases
> --------
>
> ### Unreleased
>
> ### 8.0.0 February 19 2026
>
> * Removed `--old-finders` and `--magic-placement` flags and `old_finders` configuration option. The legacy finder logic that relied on environment introspection has been removed ([#2445](https://redirect.github.com/pycqa/isort/issues/2445)) [`@​joao-faria-dev`](https://github.com/joao-faria-dev)
> * Update the `plone` profile to not clash with `black` ([#2456](https://redirect.github.com/pycqa/isort/issues/2456)) [`@​ale-rt`](https://github.com/ale-rt)
>
> ### 6.1.0 October 1 2025
>
> * Add python 3.14 classifier and badge ([#2409](https://redirect.github.com/pycqa/isort/issues/2409)) [`@​staticdev`](https://github.com/staticdev)
> * Drop use of non-standard pkg\_resources API ([#2405](https://redirect.github.com/pycqa/isort/issues/2405)) [`@​dvarrazzo`](https://github.com/dvarrazzo)
>
> ### 6.0.1 Febuary 26 2025
>
> * Add OSError handling in find\_imports\_in\_file ([#2331](https://redirect.github.com/pycqa/isort/issues/2331)) [`@​kobarity`](https://github.com/kobarity)
>
> ### 6.0.0 January 27 2025
>
> * Remove support for Python 3.8 ([#2327](https://redirect.github.com/pycqa/isort/issues/2327)) [`@​DanielNoord`](https://github.com/DanielNoord)
> * Python 3.13 support ([#2306](https://redirect.github.com/pycqa/isort/issues/2306)) [`@​mayty`](https://github.com/mayty)
> * Speed up exists\_case\_sensitive calls ([#2264](https://redirect.github.com/pycqa/isort/issues/2264)) [`@​correctmost`](https://github.com/correctmost)
> * Ensure that split\_on\_trailing\_comma works with as imports ([#2340](https://redirect.github.com/pycqa/isort/issues/2340)) [`@​DanielNoord`](https://github.com/DanielNoord)
> * Black profile: enable magic comma ([#2236](https://redirect.github.com/pycqa/isort/issues/2236)) [`@​MrMino`](https://github.com/MrMino)
> * Update line\_length and single\_line\_exclusions in google profile ([#2149](https://redirect.github.com/pycqa/isort/issues/2149)) [`@​jagapiou`](https://github.com/jagapiou)
> * Allow --diff to be used with --jobs ([#2302](https://redirect.github.com/pycqa/isort/issues/2302)) [`@​mnakama`](https://github.com/mnakama)
> * Fix wemake profile to have correct character limit ([#2241](https://redirect.github.com/pycqa/isort/issues/2241)) [`@​sobolevn`](https://github.com/sobolevn)
> * Fix sort\_reexports code mangling ([#2283](https://redirect.github.com/pycqa/isort/issues/2283)) [`@​Helveg`](https://github.com/Helveg)
> * Fix correct group by package tokenization ([#2136](https://redirect.github.com/pycqa/isort/issues/2136)) [`@​glasnt`](https://github.com/glasnt)
>
> ### 5.13.2 December 13 2023
>
> * Apply the bracket fix from issue [#471](https://redirect.github.com/pycqa/isort/issues/471) only for use\_parentheses=True ([#2184](https://redirect.github.com/pycqa/isort/issues/2184)) [`@​bp72`](https://github.com/bp72)
> * Confine pre-commit to stages ([#2213](https://redirect.github.com/pycqa/isort/issues/2213)) [`@​davidculley`](https://github.com/davidculley)
> * Fixed colors extras ([#2212](https://redirect.github.com/pycqa/isort/issues/2212)) [`@​staticdev`](https://github.com/staticdev)
>
> ### 5.13.1 December 11 2023
>
> * Fixed integration tests ([#2208](https://redirect.github.com/pycqa/isort/issues/2208)) [`@​bp72`](https://github.com/bp72)
> * Fixed normalizing imports from more than one level of parent modules (issue/2152) ([#2191](https://redirect.github.com/pycqa/isort/issues/2191)) [`@​bp72`](https://github.com/bp72)
> * Remove optional dependencies without extras ([#2207](https://redirect.github.com/pycqa/isort/issues/2207)) [`@​staticdev`](https://github.com/staticdev)
>
> ### 5.13.0 December 9 2023

... (truncated)


Commits

* [`a333737`](PyCQA/isort@a333737) Merge pull request [#2463](https://redirect.github.com/pycqa/isort/issues/2463) from FinlayTheBerry/issue/2461
* [`878ba7e`](PyCQA/isort@878ba7e) Added compression to stdlibs for Python 3.14 in isort/stdlibs/py314.py
* [`b5f06a7`](PyCQA/isort@b5f06a7) Merge pull request [#2459](https://redirect.github.com/pycqa/isort/issues/2459) from Fridayai700/fix-unindented-comment-corruption
* [`3459bde`](PyCQA/isort@3459bde) Merge pull request [#2460](https://redirect.github.com/pycqa/isort/issues/2460) from PyCQA/DanielNoord-patch-1
* [`6e70bb6`](PyCQA/isort@6e70bb6) Update CHANGELOG for version 8.0.0
* [`fd2514b`](PyCQA/isort@fd2514b) Fix unindented comments being corrupted in indented blocks
* [`b0f2dab`](PyCQA/isort@b0f2dab) Merge pull request [#2458](https://redirect.github.com/pycqa/isort/issues/2458) from skv0zsneg/issue/1882
* [`313797b`](PyCQA/isort@313797b) Fix lint.
* [`7d3a6f5`](PyCQA/isort@7d3a6f5) Add ignore for cyclomatic complexity check.
* [`6b9f895`](PyCQA/isort@6b9f895) Remove debug prints.
* Additional commits viewable in [compare view](PyCQA/isort@7.0.0...8.0.1)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=https://github.com/pycqa/isort&package-manager=pre\_commit&previous-version=7.0.0&new-version=8.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants