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

Can set couch_peruser.database_prefix with illegal characters #2291

Open
paulbert opened this issue Oct 31, 2019 · 3 comments
Open

Can set couch_peruser.database_prefix with illegal characters #2291

paulbert opened this issue Oct 31, 2019 · 3 comments

Comments

@paulbert
Copy link

Description

When using couch_peruser it is allowed to set database_prefix with illegal characters for a database name. For us this resulted in CouchDB crashing and being unable to start until we changed the configuration manually in local.ini

Steps to Reproduce

  1. Set up single node CouchDB
  2. Run
curl -H 'Content-Type: application/json' -X PUT http:https://localhost:5984/_node/nonode@nohost/_config/couch_peruser/database_prefix -d '"userdb-.-"'
curl -H 'Content-Type: application/json' -X PUT http:https://localhost:5984/_node/nonode@nohost/_config/couch_peruser/enable -d '"true"'
  1. CouchDB has now crashed, and will crash immediately on restart. The error messages I saw after attempted restart were:
Error: {error,{illegal_database_name,<<"userdb-.-">>}}
[error] 2019-10-31T14:28:37.769379Z nonode@nohost <0.416.0> -------- CRASH REPORT Process couch_peruser (<0.416.0>) with 0 neighbors exited with reason: bad return value {error,{illegal_database_name,<<"userdb-.-">>}} at gen_server:init_it/6(line:356) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {couch_peruser,init,['Argument__1']}, ancestors: [couch_peruser_sup,<0.414.0>], messages: [], links: [<0.415.0>,<0.87.0>], dictionary: [], trap_exit: false, status: running, heap_size: 1598, stack_size: 27, reductions: 1586
[error] 2019-10-31T14:28:37.769649Z nonode@nohost <0.415.0> -------- Supervisor couch_peruser_sup had child couch_peruser started with couch_peruser:start_link() at undefined exit with reason bad return value {error,{illegal_database_name,<<"userdb-.-">>}} in context start_error
[error] 2019-10-31T14:28:37.770164Z nonode@nohost <0.413.0> -------- CRASH REPORT Process  (<0.413.0>) with 0 neighbors exited with reason: {{shutdown,{failed_to_start_child,couch_peruser,{bad_return_value,{error,{illegal_database_name,<<"userdb-.-">>}}}}},{couch_peruser_app,start,[normal,[]]}} at application_master:init/4(line:134) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {application_master,init,['Argument__1','Argument__2',...]}, ancestors: [<0.412.0>], messages: [{'EXIT',<0.414.0>,normal}], links: [<0.412.0>,<0.9.0>], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 27, reductions: 105
[info] 2019-10-31T14:28:37.770459Z nonode@nohost <0.9.0> -------- Application couch_peruser exited with reason: {{shutdown,{failed_to_start_child,couch_peruser,{bad_return_value,{error,{illegal_database_name,<<"userdb-.-">>}}}}},{couch_peruser_app,start,[normal,[]]}}

Expected Behaviour

Setting couch_peruser.database_prefix to a value with invalid database characters will throw an error.

Your Environment

  • CouchDB Version used: 2.3.1
  • Operating System and version: Debain 10 (buster)
@mnxumalo
Copy link

mnxumalo commented Aug 9, 2020

Hi,
Can I work on this bug?

@mnxumalo
Copy link

@wohali is there anyone working on this bug?

@wohali
Copy link
Member

wohali commented Aug 11, 2020

If you don't see a pull request open for it, then no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants