Describe the bug
When reading environment properties, Koin assumes that all properties are strings.
|
val propertiesMapValues = properties.toMap() as Map<String, String> |
However, due to legacy java API weirdness, this is not guaranteed to be the case, and both keys and values could be arbitrary objects.
Therefore when Koin does the hard cast to strings, the application might crash.
To Reproduce
- Set non-string properties via
System.setProperties()
- Start Koin framework
Expected behavior
Koin starts up fine, ignoring any invalid properties.
Koin module and version:
koin-core-jvm:4.0.4
Snippet or Sample project to help reproduce
var properties = new Properties();
// save existing properties just in case
properties.putAll(System.getProperties());
// intentionally malformed input
properties.put(new Object(), new Object());
// just replace the existing map
System.setProperties(properties);
// start Koin.....
ref: Up-Mods/HT_DiscordBridge#4
ref: Up-Mods/HT_DiscordBridge#6
Describe the bug
When reading environment properties, Koin assumes that all properties are strings.
koin/projects/core/koin-core/src/jvmMain/kotlin/org/koin/core/registry/PropertyRegistryExt.kt
Line 17 in 461b568
However, due to legacy java API weirdness, this is not guaranteed to be the case, and both keys and values could be arbitrary objects.
Therefore when Koin does the hard cast to strings, the application might crash.
To Reproduce
System.setProperties()Expected behavior
Koin starts up fine, ignoring any invalid properties.
Koin module and version:
koin-core-jvm:4.0.4Snippet or Sample project to help reproduce
ref: Up-Mods/HT_DiscordBridge#4
ref: Up-Mods/HT_DiscordBridge#6