christopherney/Enigma

Fake Key injection does not function for singleton enum classes

Opened this issue · 0 comments

Looking at the source and tracing down what is happening, the Java Parser doesn't know to treat top-level enum classes as a ClassBlock. Since fake injection requires a class block in the array, it fails to pass and thus nothing is actually injected to the class.

I have a singleton handler for secrets in my test example in a class HiddenTreasure.java

This class starts as:

public enum HiddenTreasure {
INSTANCE;

public static final String key = "akfjakgjag";
public static final String iv = "akfkjakgthg";

This is a valid class to provide fake values on, but nothing is added since the parser does not think it can. I do wonder why there is a separate parser to determine things like classes or functions vs just using the reflection API, but this is still an issue regardless. I can address it locally by modifying the class I am 'enigmafying', but it is still a gap in the full solution.