Skip to content

Implicit unpermitted operations should be sandboxed #791 #838

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

Merged

Conversation

Markoutte
Copy link
Collaborator

Description

Adds a sandbox block code when creating a new instance of a model.

Fixes #791

Type of Change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Automated Testing

All tests should work as before

Manual Scenario

Try to run this example. File a.txt should never be created. Try to uncomment static block too. Errors can differ, but operation must be blocked by default.

class A {
    int anInt = 15;

    static {
//        call();
    }

    A () {
    }

    A (int a) {
        anInt = a;
        call();
    }

    static void call() {
        File a = new File("a.txt");
        try {
            a.createNewFile();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

public class ImplicitSecurityManager {
    public int read(A a)  {
        if (a.anInt < 10) {
            return 0;
        }
        return a.anInt;
    }
}

Checklist:

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • New documentation is provided or existed one is altered
  • No new warnings
  • New tests have been added
  • All tests pass locally with my changes

@Markoutte Markoutte force-pushed the 791_Implicit_unpermitted_operations_should_be_sandboxed branch from 4370674 to 49befba Compare September 2, 2022 07:19
@Markoutte Markoutte merged commit 64d1bd3 into main Sep 5, 2022
@Markoutte Markoutte deleted the 791_Implicit_unpermitted_operations_should_be_sandboxed branch September 5, 2022 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Implicit unpermitted operations should be sandboxed
3 participants