Skip to content

fix: don't resolve HOCON includes in config that arrived in a message (#3505) - #3518

Open
pjfanning wants to merge 1 commit into
apache:1.7.xfrom
pjfanning:hocon17
Open

fix: don't resolve HOCON includes in config that arrived in a message (#3505)#3518
pjfanning wants to merge 1 commit into
apache:1.7.xfrom
pjfanning:hocon17

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Motivation

Backport of #3505 to 1.7.x: deserializing a message no longer resolves HOCON include
directives, which gave a peer a blind SSRF primitive and forced reads of local files and
classpath resources — reachable from InitJoin before the sender is a cluster member.

Modification

Cherry-pick of f7b0115, adapted for 1.7.x:

  • WireConfigSpec imports pekko.util.ccompat.JavaConverters instead of
    scala.jdk.CollectionConverters, which 1.7.x provides only for Scala 2.13+.
  • Interpolated strings containing \" rewritten with triple quotes — that escape only
    became valid inside interpolations in Scala 2.13.6, so it does not parse on 2.12.
  • Import-block conflicts in MiscMessageSerializer and the two touched specs resolved
    against the 1.7.x import style.

Result

Same as #3505: includes in wire config resolve to nothing; concise-rendered config from
well-behaved senders is unaffected.

Tests

  • sbt "++ 2.12.21 actor-tests/Test/compile" "++ 2.12.21 cluster/Test/compile" "++ 2.12.21 remote/Test/compile" — clean, validating the Scala 2.12 adaptations
  • scalafmt run on the touched modules — only the cherry-picked files reformatted
  • Test suites intentionally left to CI per the release-prep flow; the tests themselves are
    the ones reviewed and merged in fix: don't resolve HOCON includes in config that arrived in a message #3505

References

Backport of #3505.

…apache#3505)

* fix: don't resolve HOCON includes in config that arrived in a message

Motivation:
Three sites parse HOCON that came off the wire with the default parse
options: InternalClusterAction.InitJoin and InitJoinAck in
ClusterMessageSerializer, and the Config payload in MiscMessageSerializer.
HOCON include directives are resolved by the parser rather than by
resolve(), so include file(...) and include classpath(...) read from the
local filesystem and classpath and include url(...) performs an outbound
request, all while deserializing a peer's message. InitJoin is accepted
from a node that has not joined, in ClusterDaemon's uninitialized state.

Modification:
Add WireConfig (@internalapi), which parses with a ConfigIncluder that
resolves every include to an empty object, and route the three sites
through it. The includer implements ConfigIncluderFile, ConfigIncluderURL
and ConfigIncluderClasspath as well as ConfigIncluder: the parser falls
back to its own handling, which does read the resource, for any of the
typed forms the configured includer does not implement.

Every serializer writes config with ConfigRenderOptions.concise, which
renders JSON and cannot produce an include, so a well-behaved sender is
unaffected.

Result:
Deserializing a message no longer reads local files or issues outbound
requests on behalf of the sender.

* Update WireConfigSpec.scala
@pjfanning pjfanning added this to the 1.7.1 milestone Sep 3, 2026
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.

1 participant