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

Redacted keystore and truststore passwords break YAML parsing #9

Open
rzvoncek opened this issue Sep 18, 2024 · 0 comments
Open

Redacted keystore and truststore passwords break YAML parsing #9

rzvoncek opened this issue Sep 18, 2024 · 0 comments

Comments

@rzvoncek
Copy link
Collaborator

The yaml files we feed to MC can have this:

server_encryption_options:
    internode_encryption: none
    keystore: /etc/cassandra/keystore.jks
    keystore_password: ****
    truststore: /etc/cassandra/truststore.jks
    truststore_password: ****

The **** literal is not a valid yaml and breaks the parsing:

Exception in thread "main" com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAMLException: while scanning an alias
 in 'reader', line 924, column 24:
        keystore_password: ****
                           ^
unexpected character found *(42)
 in 'reader', line 924, column 25:
        keystore_password: ****
                            ^

 at [Source: (StringReader); line: 924, column: 22]
	at com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAMLException.from(MarkedYAMLException.java:28)
	at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:407)
	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.mapObject(UntypedObjectDeserializer.java:973)
	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.deserialize(UntypedObjectDeserializer.java:718)
	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.mapObject(UntypedObjectDeserializer.java:974)
	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.deserialize(UntypedObjectDeserializer.java:718)
	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.deserialize(UntypedObjectDeserializer.java:701)
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4674)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3629)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3597)
	at com.thelastpickle.montecristo.fileLoaders.parsers.application.CassandraYamlParser.parse(CassandraYamlParser.kt:16)
	at com.thelastpickle.montecristo.fileLoaders.parsers.application.CassandraYamlParser.parse(CassandraYamlParser.kt:11)
	at com.thelastpickle.montecristo.fileLoaders.Artifacts.createNode(Artifacts.kt:159)
	at com.thelastpickle.montecristo.fileLoaders.Artifacts.createCluster(Artifacts.kt:97)
	at com.thelastpickle.montecristo.commands.GenerateDiscoveryReport.execute(GenerateDiscoveryReport.kt:89)
	at com.thelastpickle.montecristo.commands.DiscoveryArgs.execute(DiscoveryArgs.kt:20)
	at com.thelastpickle.montecristo.MontecristoKt.main(Montecristo.kt:38)
Caused by: while scanning an alias
 in 'reader', line 924, column 24:
        keystore_password: ****
                           ^
unexpected character found *(42)
 in 'reader', line 924, column 25:
        keystore_password: ****
                            ^

	at org.yaml.snakeyaml.scanner.ScannerImpl.scanAnchor(ScannerImpl.java:1515)
	at org.yaml.snakeyaml.scanner.ScannerImpl.fetchAlias(ScannerImpl.java:957)
	at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:406)
	at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:251)
	at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce(ParserImpl.java:660)
	at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:166)
	at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:176)
	at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:403)
	... 16 more

Montecristo should handle this by swallowing the exception and moving on.

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