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

Unnecessary encoding of authentication token for influxdb #1131

Closed
duese opened this issue Feb 28, 2022 · 0 comments
Closed

Unnecessary encoding of authentication token for influxdb #1131

duese opened this issue Feb 28, 2022 · 0 comments

Comments

@duese
Copy link
Contributor

duese commented Feb 28, 2022

The code that processes the authentication token for InfluxDB is currently encoded to ISO_8859_1 which is unnecessary as kamon.influxdb.authentication.token must already be provided as a base64 encoded string.

An ISO_8859_1 encoded token also may raise an IllegalArgumentException:

java.lang.IllegalArgumentException: Unexpected char 0x2026 at 84 in Authorization value: Token [size=88 text=68F_F281rk1J68Nui-y1gooWrs55-I-FI9qWIj1phyzn-5KbK7n3tJvQvssPQ3h7?]
	at okhttp3.Headers.checkValue(Headers.java:284)
	at okhttp3.Headers$Builder.set(Headers.java:415)
	at okhttp3.Request$Builder.header(Request.java:184)
	at kamon.influxdb.InfluxDBReporter$$anon$1.intercept(InfluxDBReporter.scala:210)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
	at okhttp3.RealCall.execute(RealCall.java:81)
	at kamon.influxdb.InfluxDBReporter.$anonfun$reportPeriodSnapshot$1(InfluxDBReporter.scala:52)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at scala.util.Try$.apply(Try.scala:213)
	at kamon.influxdb.InfluxDBReporter.reportPeriodSnapshot(InfluxDBReporter.scala:51)
	at kamon.module.ModuleRegistry.$anonfun$scheduleMetricsTick$1(ModuleRegistry.scala:258)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659)
	at scala.util.Success.$anonfun$map$1(Try.scala:255)
	at scala.util.Success.map(Try.scala:213)
	at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
	at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
	at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

with the following application.conf:

kamon {
  instrumentation.akka.filters {
    actors.doomsday-wildcard = on
    actors.track {
      includes = [
         "BpcICSystem/user/SomeService"
      ]
    }
    dispatchers {
      includes = [ "**" ]
      #excludes = [ "**" ]
    }
    routers {
      includes = [ "**" ]
      #excludes = [ "**" ]
    }
  }

  influxdb {
    hostname = "my_hostname"
    protocol = "http"
    database = "my_db"
    
    # Workaround for #1129:
    token = "68F_F281rk1J68Nui-y1gooWrs55-I-FI9qWIj1phyzn-5KbK7n3tJvQvssPQ3h7VkJor0cLSMwsWelBRljuJA=="
    authentication {
      # See PR #1130 
      token = "68F_F281rk1J68Nui-y1gooWrs55-I-FI9qWIj1phyzn-5KbK7n3tJvQvssPQ3h7VkJor0cLSMwsWelBRljuJA=="
    }
  }
}
duese added a commit to duese/Kamon that referenced this issue Feb 28, 2022
Authentication token is already base64 encoded.

Fixes kamon-io#1131
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

1 participant