Skip to content

wrong hash lenght for password on project creation #1406

@mduret

Description

@mduret

First of all, thank you for maintaining this project. I am using it since many years with pleasure.

I show the new version (7.0.0) and I tried it before using it in production.

target version:

7.0.0

with postgresql backend:

SQLALCHEMY_DATABASE_URI = 'postgresql://<user>:<password>@<host>/<base>?client_encoding=utf8'

on this form:

POST https://ihatemoney.example.org/create

logs contents:

Feb 03 10:19:17 ihatemoney gunicorn[7090]: sqlalchemy.exc.DataError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
Feb 03 10:19:17 ihatemoney gunicorn[7090]: (psycopg2.errors.StringDataRightTruncation) value too long for type character varying(128)
Feb 03 10:19:17 ihatemoney gunicorn[7090]: [SQL: INSERT INTO project_version (id, name, password, contact_email, logging_preference, default_currency, transaction_id, end_transaction_id, operation_type) VALUES (%(id)s, %(name)s, %(password)s, %(contact_email)s, %(logging_preference)s, %(default_currency)s, %(transaction_id)s, %(end_transaction_id)s, %(operation_type)s)]
Feb 03 10:19:17 ihatemoney gunicorn[7090]: [parameters: {'id': 'toto', 'name': 'tutu', 'password': 'scrypt:32768:8:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'contact_email': 'toto.tutu@example.org', 'logging_preference': 'ENABLED', 'default_currency': 'XXX', 'transaction_id': 17, 'end_transaction_id': None, 'operation_type': 0}]
Feb 03 10:19:17 ihatemoney gunicorn[7090]: (Background on this error at: https://sqlalche.me/e/20/9h9h)

precision:

  • the hash value is blanked but its length is keep

this is the manual workaround I founded:

ALTER TABLE project ALTER COLUMN password TYPE varchar(256);
ALTER TABLE project_version ALTER COLUMN password TYPE varchar(256);

Would you prefer me to create an pull request?

thank you in advance and have a good day

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions