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

do not render env variables in configs #771

Merged
merged 5 commits into from
Nov 13, 2023

Conversation

pjfanning
Copy link
Contributor

@pjfanning pjfanning commented Nov 1, 2023

see lightbend/config#798

The Akka team issued CVE-2023-45865 for the equivalent of our change but the general consensus on Pekko side is that printing the configs to the logs is not the default behaviour. It is useful to make a change but we don't think this warrants a CVE.

We strongly recommend that log-config-on-start is not enabled in production environments.

Copy link
Member

@He-Pin He-Pin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, do we need to change the code in spec too?

@mdedetrich
Copy link
Contributor

Can we add a simple unit test for this?

@pjfanning pjfanning marked this pull request as draft November 2, 2023 13:14
@pjfanning
Copy link
Contributor Author

I can modify the code to make it easier to test.

@pjfanning
Copy link
Contributor Author

@mdedetrich it looks like the only real way to test this is to set an environment variable. I don't think I can set this in a test itself. I think I would need to set the env variable before calling sbt. I could change one or more of our CI jobs to set a test env var and use it in the test. I can get the test to pass if someone hasn't set this env variable so that we don't make it more complicated for people to run the tests manually.

@mdedetrich
Copy link
Contributor

If it requires too much work we can skip it I guess, its just usually better to have a test for these kinds of things. Isn't sys.env mutable which might make things easier?

@pjfanning
Copy link
Contributor Author

If it requires too much work we can skip it I guess, its just usually better to have a test for these kinds of things. Isn't sys.env mutable which might make things easier?

I can play around with sys.env and see if that work. I also contacted you in Slack about another related issue that I don't want to make public yet.

@pjfanning
Copy link
Contributor Author

pjfanning commented Nov 2, 2023

@mdedetrich It looks like sys env is read only - likewise with System.getenv(). We might need to rely on whether config jar is well tested. I have also added my own code to redact username.

@mdedetrich
Copy link
Contributor

@pjfanning Okay, just ping me when the PR is ready. If its not possible to test then I would just go with the initial implementation (iirc it was simpler)

@pjfanning pjfanning marked this pull request as ready for review November 3, 2023 15:14
@pjfanning
Copy link
Contributor Author

@mdedetrich I've kept the centralised method for rendering with redactions. My code does an additional redaction of the username and may in future do more. The toString of the config is very large and I wouldn't be surprised if we need to do more changes in future.

@mdedetrich
Copy link
Contributor

Thanks ill check it out tomorrow

@pjfanning pjfanning added this to the 1.0.x milestone Nov 10, 2023
@pjfanning
Copy link
Contributor Author

@mdedetrich would you have time to look at this again? I'm hoping to do a v1.0.2 release within the next few weeks.

Copy link
Contributor

@mdedetrich mdedetrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit but otherwise lgtm

@pjfanning pjfanning merged commit 860d016 into apache:main Nov 13, 2023
18 checks passed
@pjfanning pjfanning deleted the do-not-render-env-variables branch November 13, 2023 20:30
pjfanning added a commit to pjfanning/incubator-pekko that referenced this pull request Nov 13, 2023
* do not render env variables in configs

* redact username when logging configs

* Update ActorSystemSpec.scala

* add test

scalafmt

* try/finally
pjfanning added a commit that referenced this pull request Nov 14, 2023
* do not render env variables in configs

* redact username when logging configs

* Update ActorSystemSpec.scala

* add test

scalafmt

* try/finally
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

Successfully merging this pull request may close these issues.

3 participants