snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
10.84k stars 3.14k forks source link

Custom Fields - Encrypted numeric not possible #11763

Open bastianmueller02 opened 2 years ago

bastianmueller02 commented 2 years ago

Debug mode

Describe the bug

When trying to create a new asset with an encrypted numeric field, the following error is shown underneath the field: The must be a number. In the same form, encrypted alphanumeric and unencrypted numeric values get accepted as expected. This bug makes it impossible to check the format of the data and store it encrypted

To me it appears that the validation takes place after the encryption and thus the hash is checked and not the actual data. Which would explain why alphanumeric formats are accepted but numeric not

Reproduction steps

  1. Create custom field (F1) with Form Element: Text Box; Format: ALPHANUMERIC; Encrypt the value of this field in the database: true
  2. Create custom field (F2) with Form Element: Text Box; Format: NUMERIC; Encrypt the value of this field in the database: true
  3. Create custom field (F3) with Form Element: Text Box; Format: NUMERIC; Encrypt the value of this field in the database: false
  4. Add F1, F2, F3 to fieldset (FS1)
  5. Create Asset with this fieldset
  6. Put a number or nothing into F1,F2 and F3
  7. Hit save

Expected behavior

Asset gets normaly created without error-message

Screenshots

No response

Snipe-IT Version

v6.0.9 - build 8587 (master)

Operating System

ubuntu 20.04.4 LTS

Web Server

apache2

PHP Version

7.4.3

Operating System

Windows

Browser

Edge

Version

104.0.1293.63

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

welcome[bot] commented 2 years ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

snipe commented 2 years ago

Are those fields in the fieldset marked as required?

bastianmueller02 commented 2 years ago

Are those fields in the fieldset marked as required?

No, they're not marked as required. Thats very confusing because the error also occurs when i leave the field empty, which shouldn't be a problem.

mauro-miatello commented 6 months ago

I think this is a duplicate of #9511 I have the same error with URL and DATE formats