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

the WriteApi does not check whether a tag value cotains unauthorized characters ("\n","\r"...) #684

Open
AnesBendimerad opened this issue Jun 24, 2020 · 3 comments

Comments

@AnesBendimerad
Copy link

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.

@AnesBendimerad AnesBendimerad changed the title the WriteApi does not check whether a tag cotains unauthorized characters ("\n","\r"...) the WriteApi does not check whether a tag value cotains unauthorized characters ("\n","\r"...) Jun 24, 2020
@majst01
Copy link
Collaborator

majst01 commented Jun 24, 2020

thanks for reporting, nice catch, if you would create a merge request i will review and merge

@BrentonPoke
Copy link

BrentonPoke commented Jul 30, 2020

I think I could do this one once I find the appropriate classes. Has this been started by somebody already? If not, one thing that can help me get started is the spec of allowable characters.

@BrentonPoke
Copy link

thanks for reporting, nice catch, if you would create a merge request i will review and merge

If you or anyone else could provide some feedback on my PR, that'd be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants