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

Configuration: inline # in grafana.ini is treated as comment #81473

Closed
oliviermichaelis opened this issue Jan 29, 2024 · 2 comments
Closed

Configuration: inline # in grafana.ini is treated as comment #81473

oliviermichaelis opened this issue Jan 29, 2024 · 2 comments

Comments

@oliviermichaelis
Copy link

What happened?

I would like to be able to use the # character in grafana.ini configuration values.
Grafana currently treats # as a comment and breaks the configuration value.

I think this is down to how the ini package parses the configuration file (https://github.com/go-ini/ini). It is apparently possible to escape the # with Cfg, err := ini.LoadSources(ini.LoadOptions{SpaceBeforeInlineComment: true}, source) as shown in go-ini/ini#277.

Is there a possible workaround?

What did you expect to happen?

Inline comments with # are not parsed as a comment. This would allow me to use # in my configuration.

Did this work before?

I don't think so.

How do we reproduce it?

I had this problem with the following grafana.ini:

[auth.okta]
...
role_attribute_path = contains(groups[*], 'example#admin') && 'Admin'

and this user information:

{
  "sub": "test",
  "name": "Alice",
  "locale": "en_US",
  "email": "test@example.com",
  ...
  "groups": [
    "example#admin",
    "test-group"
  ]
}

With the above role_attribute_path, no role was found for the user. I validated the JMESpath expression with multiple tools and it seems to be correct.

The following role_attribute_path worked as expected:

[auth.okta]
...
role_attribute_path = contains(groups[*], 'test-group') && 'Admin'

Is the bug inside a dashboard panel?

No response

Environment (with versions)?

Grafana: 10.2.3
OS: linux

Grafana platform?

Kubernetes

Datasource(s)?

No response

@oliviermichaelis
Copy link
Author

Took me way too long to figure this out, but I was successfully able to override the role_attribute_path with the GF_AUTH_OKTA_ROLE_ATTRIBUTE_PATH environment variable :)

@tonypowa
Copy link
Contributor

hi @oliviermichaelis

thank for sharing your solution to this issue

I'm closing the issue but if you still have comments/concerns or need help please feel free to let us know!

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

2 participants