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

Fields in Device Details in UI need escaping for SQL query #918

Open
5 of 7 tasks
ingoratsdorf opened this issue Dec 23, 2024 · 1 comment
Open
5 of 7 tasks

Fields in Device Details in UI need escaping for SQL query #918

ingoratsdorf opened this issue Dec 23, 2024 · 1 comment
Labels
bug 🐛 Something isn't working next release/in dev image🚀 This is coming in the next release or was already released if the issue is Closed.

Comments

@ingoratsdorf
Copy link
Contributor

Is there an existing issue for this?

The issue occurs in the following browsers. Select at least 2.

  • Firefox
  • Chrome
  • Edge
  • Safari (unsupported) - PRs welcome
  • N/A - This is an issue with the backend

Current Behavior

"Error executing query (attempts: 10), query: UPDATE Devices SET\n devName = 'X20-DSL',\n devOwner = 'System',\n devType = 'Router',\n devVendor = 'TP-Link Limited',\n devIcon = '',\n devFavorite = '0',\n devGroup = 'System',\n devLocation = 'Ingo's Office',\n devComments = 'New Device',\n devParentMAC = 'Internet',\n devParentPort = '0',\n devSSID = '',\n devSite = '',\n devStaticIP = '0',\n devScan = '1',\n devAlertEvents = '0',\n devAlertDown = '0',\n devSkipRepeated = '1',\n devIsNew = '0',\n devIsArchived = '0'\n WHERE devMac = '28:87:ba:8a:6c:d0'"

Expected Behavior

UPDATE Devices SET\n devName = 'X20-DSL',\n devOwner = 'System',\n devType = 'Router',\n devVendor = 'TP-Link Limited',\n devIcon = '',\n devFavorite = '0',\n devGroup = 'System',\n devLocation = 'Ingo's Office',\n devComments = 'New Device',\n devParentMAC = 'Internet',\n devParentPort = '0',\n devSSID = '',\n devSite = '',\n devStaticIP = '0',\n devScan = '1',\n devAlertEvents = '0',\n devAlertDown = '0',\n devSkipRepeated = '1',\n devIsNew = '0',\n devIsArchived = '0'\n WHERE devMac = '28:87:ba:8a:6c:d0'"

Steps To Reproduce

Open device details page /deviceDetails.php?mac=28:87:ba:8a:6c:d0 and enter a name with a single quote " ' " as location.
SQL times out with error above upon save.

Looks like in EditDeviceDetails.php, name , owner and vendor are having any " ' " removed, but locations (and other fields) have not.

+ '&name=' + encodeURIComponent($('#NEWDEV_devName').val().replace(/'/g, ""))
+ '&owner=' + encodeURIComponent($('#NEWDEV_devOwner').val().replace(/'/g, ""))
+ '&type=' + $('#NEWDEV_devType').val()
+ '&vendor=' + encodeURIComponent($('#NEWDEV_devVendor').val().replace(/'/g, ""))
+ '&icon=' + encodeURIComponent($('#NEWDEV_devIcon').val())
+ '&favorite=' + ($('#NEWDEV_devFavorite')[0].checked * 1)
+ '&group=' + encodeURIComponent($('#NEWDEV_devGroup').val())
+ '&location=' + encodeURIComponent($('#NEWDEV_devLocation').val())

app.conf

No response

docker-compose.yml

No response

What branch are you running?

Production

app.log

No response

Debug enabled

  • I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.
@ingoratsdorf ingoratsdorf added the bug 🐛 Something isn't working label Dec 23, 2024
@jokob-sk
Copy link
Owner

Hey @ingoratsdorf ,

Thanks for the report. This should be fixed in the next release and available in the netalertx-dev image in ~15min.

@jokob-sk jokob-sk added the next release/in dev image🚀 This is coming in the next release or was already released if the issue is Closed. label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working next release/in dev image🚀 This is coming in the next release or was already released if the issue is Closed.
Projects
None yet
Development

No branches or pull requests

2 participants