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

Semantic differences in Taint-Aware Properties class compared to original #29

Open
leeN opened this issue Aug 26, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@leeN
Copy link
Collaborator

leeN commented Aug 26, 2024

The Properties class is some weird custom code/inherited HashMap amalgamation. It mostly behaves the same, but during debugging crashing dacapo benchmarks, I found the following incompatibility:

In the eclipse benchmark we have a class that inherits from Properties and overrides the put method, which is inherited from Hashmap. It then fills the Properties object with the built-in loading (i.e., calling load()) functionality.

class MyProperties extends Properties {

    public synchronized Object put(Object var1, Object var2) {
        System.out.printf("Putting: %s -> %s\n", var1, var2);
        return null;
    }
}

class Main {
    public static void main(String[] args) throws Exception {
        FileInputStream fis = new FileInputStream("./msgs.properties");
        MyProperties props = new MyProperties();
        props.load(fis);
    }
}

Without tainting, this will print all key-value pairs from msgs.properties. With tainting, it does not print anything. This is because we are wrapping a Properties object and delegating the load call to said object. Consequently, the overridden put method is not called during loading, as the overridden put method is for the wrapper class.

Generally, this is quite nasty code, but the Eclipse people think it's reasonable, so we have to support it, I suppose.

@leeN leeN added the bug Something isn't working label Aug 26, 2024
@leeN leeN self-assigned this Aug 26, 2024
@leeN
Copy link
Collaborator Author

leeN commented Aug 26, 2024

Our options are to override all Properties methods or derive from Properties directly. The latter option seems suboptimal, as the Properties object is somewhat insane :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
@leeN and others