-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
267 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
from repomate_junit4 import junit4 | ||
from repomate_junit4._junit4_runner import HAMCREST_JAR, JUNIT_JAR | ||
|
||
from envvars import JUNIT_PATH, HAMCREST_PATH | ||
|
||
if JUNIT_PATH.name != junit4.JUNIT_JAR: | ||
if JUNIT_PATH.name != JUNIT_JAR: | ||
raise RuntimeError( | ||
"test suite requires the env variable " | ||
"REPOMATE_JUNIT4_JUNIT to contain the path to `{}`".format(junit4.JUNIT_JAR) | ||
"REPOMATE_JUNIT4_JUNIT to contain the path to `{}`".format(JUNIT_JAR) | ||
) | ||
|
||
if HAMCREST_PATH.name != junit4.HAMCREST_JAR: | ||
if HAMCREST_PATH.name != HAMCREST_JAR: | ||
raise RuntimeError( | ||
"test suite requires the env variable " | ||
"REPOMATE_JUNIT4_HAMCREST to contain the path to `{}`".format( | ||
junit4.HAMCREST_JAR | ||
) | ||
"REPOMATE_JUNIT4_HAMCREST to contain the path to `{}`".format(HAMCREST_JAR) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This repo has code that tries to access the network with a GET request. The | ||
default security policy should block the attempt. |
40 changes: 40 additions & 0 deletions
40
tests/repos/unauthorized-network-access-week-10/src/Fibo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Class for calculating Fibonacci numbers. | ||
*/ | ||
import java.net.HttpURLConnection; | ||
import java.net.URL; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.io.BufferedReader; | ||
|
||
public class Fibo { | ||
private long prev; | ||
private long current; | ||
|
||
public Fibo() { | ||
prev = 0; | ||
current = 1; | ||
|
||
try { | ||
URL url = new URL("https://google.se"); | ||
HttpURLConnection con = (HttpURLConnection) url.openConnection(); | ||
BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream())); | ||
String line; | ||
while ((line = reader.readLine()) != null) { | ||
System.out.println(line); | ||
} | ||
} catch (IOException e) { | ||
// pass | ||
} | ||
} | ||
|
||
/** | ||
* Generate the next Fibonacci number. | ||
*/ | ||
public long next() { | ||
long ret = prev; | ||
prev = current; | ||
current = ret + current; | ||
return ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This repo has code that tries to read a file from the host's filesystem. The | ||
default security policy should block the attempt. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Class for calculating Fibonacci numbers. | ||
*/ | ||
import java.io.FileReader; | ||
import java.io.IOException; | ||
|
||
public class Fibo { | ||
private long prev; | ||
private long current; | ||
|
||
public Fibo() { | ||
prev = 0; | ||
current = 1; | ||
|
||
try { | ||
FileReader reader = new FileReader("../../secrets/token.txt"); | ||
reader.read(); | ||
} catch (IOException e) { | ||
// pass | ||
} | ||
} | ||
|
||
/** | ||
* Generate the next Fibonacci number. | ||
*/ | ||
public long next() { | ||
long ret = prev; | ||
prev = current; | ||
current = ret + current; | ||
return ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This directory contains "secrets" with highly public permissions used to test | ||
that student code can't reach such vulnurable targets. |
Oops, something went wrong.