Skip to content

Validation always fails on encrypted custom fields #9511

@fabricat

Description

@fabricat

Please confirm you have done the following before posting your bug report:

Describe the bug
Validation always fail on custom fields that are encrypted on database.
I have tested using the NUMERIC and CUSTOM REGEX formats: both are failing (maybe also other formats are affected).

Also an empty value is not accepted.

To Reproduce
Steps to reproduce the behavior:

  1. go to 'Manage Custom Fields'
  2. click on the 'New Custom Field' button
  3. set 'test' as Field Name and 'Text Box' as Field Element
  4. choose NUMERIC as Format (or any other format but ANY)
  5. enable the Encrypt the value of this field in the database option
  6. click on 'Save'
  7. add the new field to an existing Fieldset (or create one ad-hoc) - do not flag it as 'Required'
  8. make sure the Fieldset is applied to some Asset Model (so the 'test' field is applied)
  9. create a new asset of a model matching the above Fieldset
  10. write '123' on the 'test' field value (or any other number, or leave it empty)
  11. fill in other required fields
  12. click 'Save'
  13. see the error The test 3 must be a number.

Expected behavior
The value for the 'test' custom field should be accepted as valid.
The same should happen when no value is provided.

Screenshots
Validation fails on the 'test' field (encrypted), while is successful on the other non-encrypted field.
Both fields are configured as NUMERIC format.
validation-failed

Server (please complete the following information):

  • Snipe-IT Version: 5.1.5 (docker official image)

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version: 87

Smartphone (please complete the following information):
n/a

Error Messages

  • no errors appear on the phpdebugbar
  • no errors appear in browser's error console
  • the error is reproducible on the demo: https://snipeitapp.com/demo.
  • no entries appear on docker container's logs

Additional context

  • Server has been upgraded, but the error was present also on the previous version (5.1.4)
  • the server is deployed using the official docker image
  • no errors so far
  • no manually edited data directly in the database

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions