influxdata / influxdata/influxdb-java

Newlines in tag values are not escaped

Open
#578 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

difficulty/low kind/bug
Dominant language
Java
Stars
1.2k
Forks
469
PR merge metrics
No merged PRs in 30d

Description

Summary

Newlines in tag values are not escaped.
I'm not exactly sure if they can be escaped (?), but currently bad values are being inserted instead.

Steps to reproduce

Try to insert a point where a tag value contains a newline, e.g:

Point.measurement("measurement")
    .tag("name", "foo\nbar") // Newline here
    .addField("count", 1)
    .time(0, SECONDS);

Actual behaviour

A new measurement bar is created due to the following being sent

measurement,name=foo
bar count=1 0

Expected behaviour

I guess the line protocol sent should look something like this?

measurement,name=foo\
bar count=1 0

If it's not possible to escape newlines, there should be an error instead.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Java client’s line-protocol serialization for tag values and reproduce the provided measurement with a newline in the tag. Confirm whether the protocol supports escaping; done means the value is escaped without creating a second measurement, or the client rejects it with an error, with a regression test covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.