[go: up one dir, main page]

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

Socket connect should be sandboxed #792

Closed
alisevych opened this issue Aug 25, 2022 · 1 comment
Closed

Socket connect should be sandboxed #792

alisevych opened this issue Aug 25, 2022 · 1 comment
Assignees
Labels
ctg-bug Issue is a bug status-verified Bug fix is verified

Comments

@alisevych
Copy link
Member

Description

Socket.connect method call is not sandboxed by Security Manager as expected.
Default settings, no additional permissions were added.

To Reproduce

Steps to reproduce the behavior:

  1. Open IntelliJ IDEA with installed UTBot plugin (with Security Manager turned on)
  2. Open/create a project with JDK 8/11
  3. Add the following class:
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;

public class SecurityCheck {

    public int connect(Socket socket) throws IOException {
        socket.connect(new InetSocketAddress("0.0.0.0", 22));
        return 0;
    }

}
  1. Generate tests for this class

Expected behavior

Generated test is supposed to be disabled with sandbox-related comment.

Actual behavior

Successful test is generated.

Visual proofs (screenshots, logs, images)

public class SecurityCheckTest {
    ///region Test suites for executable SecurityCheck.connect

    ///region

    @Test
    @DisplayName("connect: socket = Socket(String, int, boolean) -> throw SocketException")
    public void testConnectThrowsSE() throws IOException {
        SecurityCheck securityCheck = new SecurityCheck();
        Socket socket = new Socket("", 0, false);

        assertThrows(SocketException.class, () -> securityCheck.connect(socket));
    }
    ///endregion

    ///region Errors report for connect

    public void testConnect_errors() {
        // Couldn't generate some tests. List of errors:
        // 
        // 4 occurrences of:
        // Default concrete execution failed

    }
    ///endregion

    ///endregion

}

4 InvocationTargetException are present in Concrete executor log

Environment

IntelliJ IDEA 2022.1 - 2022.1.4
JDK 8/11

Additional context

Same result with Fuzzing only and default settings.

@alisevych alisevych added the ctg-bug Issue is a bug label Aug 25, 2022
@alisevych alisevych changed the title Socket usage is not sandboxed Socket connect should be sandboxed Aug 26, 2022
@alisevych alisevych added this to the Release preparation milestone Sep 7, 2022
@Markoutte
Copy link
Collaborator

Should be fixed by #838

@alisevych alisevych added the status-verified Bug fix is verified label Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ctg-bug Issue is a bug status-verified Bug fix is verified
Projects
Archived in project
Development

No branches or pull requests

2 participants