influxdata / influxdata/influxdb-java
the WriteApi does not check whether a tag value cotains unauthorized characters ("\n","\r"...)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 1.2k
- Forks
- 469
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
InfluxDB has some restrictions on tag values : they cannot contain some characters such as: line feed (\n), carriage return (\r). Currently, the Java client library does not check whether values of tags are safe (free of unauthorized characters) before writing them into InfluxDB.
For example, I have a measurement classe called `Temperature`, and it contains a tag field `location`. When I put `location="mad\nrid"` and I write it using `WriteApi`, it will throw the following exception: `partial write: unable to parse 'temperature,location=mad': missing fields dropped=0`. So a partial write will be done in the influxDB database: a new measurement `rid` will be mistakenly created, and it will contain only a part of the write.
If a tag value contains '\r', the java client will not even throw an exception, and it will perform an incorrect write into the database.
I think it would be really useful to add a method that ensures that tag values are correct before sending them to InfluxDB through the line protocol, in order to avoid incorrect writes and anomalous behaviors.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den WriteApi-Pfad nachzuverfolgen, der Tag-Werte in das InfluxDB line protocol serialisiert. Überprüfe, wie Werte mit Zeilenvorschub und Wagenrücklauf behandelt werden, und füge anschließend eine Validierung hinzu, damit unsichere Werte keine unvollständigen oder fehlerhaften Writes erzeugen können; verwende, falls vorhanden, die bestehenden WriteApi-Tests, um beide Zeichen abzudecken.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- databases
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100