commercetools / commercetools/nodejs
Sanitize user input to prevent SQL injections
- Vorherrschende Sprache
- JavaScript
- Sterne
- 77
- Forks
- 70
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
### Description
It would be great if we have a sanitize() function fo user input tool to prevent SQL injection. Consider this code
```js
{
"anonymousId": some_user_input,
"email": "abc@email.com"
}
```
if user sends SQL injection some_user_input= "0\" or something=1 or anonymousId=\"0", then the result will be
```js
{
"anonymousId": "0\" or something=1 or anonymousId=\"0",
"email": "abc@email.com"
}
```
and the error output will contain secure information about all available fields.
### Expected Behavior
empty result as there is no such anonymous id "0\" or something=1 or anonymousId=\"0"
### Current Behavior
and the output will contain secure information about all available fields.
### Context
This is classical SQL injection which possibly appears in every user controller where controller expects user input
### Possible Solution
Provide sanitize() function which prevent SQL injections
Beitragsleitfaden
Rechercherichtung
Beginne damit, die Benutzer-Controller nachzuverfolgen, die anonymousId akzeptieren, und reproduziere die bereitgestellte Eingabe, um zu bestätigen, ob sensible Felder in der Fehlerausgabe erscheinen. Ermittle die bestehenden Grenzen des Projekts bei der Eingabeverarbeitung und bei Datenbankabfragen, bevor du einen Ansatz auswählst. Als erledigt gilt die Aufgabe, wenn die Injection keine unabhängigen Felder mehr offenlegt und eine nicht vorhandene anonymous ID ein leeres Ergebnis zurückgibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- backend-api-design, security
- Issue-Typ
- Bug
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100