This project is archived and is in readonly mode.

#2707 ✓wontfix
Stephan Wehner

dbconsole support password passing through /dev/fd/

Reported by Stephan Wehner | May 24th, 2009 @ 05:32 AM | in 3.x

A comment to the article at

http://dev.mysql.com/doc/refman/5.0/en/password-security-user.html

describes how one can pipe the password to mysql, instead of exposing it to other users when placing the password in the argument list when exec'ing to the mysql executable. Currently script/dbconsole offers the -p / --include-password option, so that the user will not inadvertently disclose their password.

On systems that allow pipes (most UNIX), and have the necessary /dev/fd filesystem support, this -p option is not needed, while still being able to provide the password to mysql. This is the motivation for the submitted patch. The implementation checks for compatibility and uses the feature if it is supported (ignoring the -p option)

In making this change, I found it quite involved, and so I split up all of the existing adapter code into separate ...Console classes.

I also added some new command line options. With this patch the options are


$ script/dbconsole -h
Usage: script/dbconsole [options] [environment] [database.yml]

Default environment is development
Default database.yml file is config/database.yml

Specific options:
    -x, --executable EXECUTABLE      executable to use. Defaults are sqlite, sqlite3, psql, mysql
    -p, --include-password           mysql/postgresql only: Automatically provide the password from database.yml
        --mycnf                      mysql only: Just output my.cnf file
        --mode [MODE]                sqlite3 only: put the database in the specified mode (html, list, line, column)
        --[no-]header                sqlite3 only: Turn headers on or off
    -v, --[no-]verbose               Run verbosely
    -h, --help                       Show this help message

In particular -h is now "help", and not "header". See comment to CommandLineInterfaceTest#test_help_option.

I added unit tests, and a new Rake task test:dbconsole to run these.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages