Skip to content

Commit

Permalink
Merge pull request #108 from AikidoSec/rename-to-aikido-block
Browse files Browse the repository at this point in the history
Rename AIKIDO_BLOCKING to AIKIDO_BLOCK
  • Loading branch information
bitterpanda63 authored Jan 28, 2025
2 parents 16ad60b + ba5ad50 commit 1a90bd8
Show file tree
Hide file tree
Showing 29 changed files with 101 additions and 101 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.aikido.agent_api.helpers.env;

public class BlockingEnv extends BooleanEnv {
private static final String environmentName = "AIKIDO_BLOCKING";
private static final String environmentName = "AIKIDO_BLOCK";
private static final boolean defaultValue = false;

public BlockingEnv() {
Expand Down
12 changes: 6 additions & 6 deletions agent_api/src/test/java/collectors/FileCollectorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void setup() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testStrings() {
isPathTraversalAttack("/etc/home/../../test.txt.js");
Expand All @@ -42,7 +42,7 @@ public void testStrings() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testPaths() {
isPathTraversalAttack(filePath1);
Expand All @@ -53,7 +53,7 @@ public void testPaths() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testStringArrays() {
isPathTraversalAttack(new String[]{"/etc/home/../../test.txt.js"});
Expand All @@ -65,7 +65,7 @@ public void testStringArrays() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testFileURIs() throws URISyntaxException {
isPathTraversalAttack(new URI("file:///etc/home/../../test.txt.js"));
Expand All @@ -79,7 +79,7 @@ public void testFileURIs() throws URISyntaxException {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testNotRecognizedObjects() throws MalformedURLException {
isNotPathTraversalAttack(true);
Expand All @@ -104,7 +104,7 @@ public void isNotPathTraversalAttack(Object filePath) {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testMaxRecursion() {
isPathTraversalAttack(new Object[]{new Object[]{"/etc/home/../../test.txt.js"}}); // Depth of 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public SampleContextObject() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "1")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "1")
@Test
public void testHostnameSameWithContextAsAttack() {
ThreadCacheObject myThreadCache = mock(ThreadCacheObject.class);
Expand Down
8 changes: 4 additions & 4 deletions agent_api/src/test/java/collectors/URLCollectorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private void setContextAndLifecycle(String url) {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testNewUrlConnectionWithPort() throws IOException {
setContextAndLifecycle("");
Expand All @@ -46,7 +46,7 @@ public void testNewUrlConnectionWithPort() throws IOException {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testNewUrlConnectionWithHttp() throws IOException {
setContextAndLifecycle("");
Expand All @@ -58,7 +58,7 @@ public void testNewUrlConnectionWithHttp() throws IOException {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testNewUrlConnectionHttps() throws IOException {
setContextAndLifecycle("");
Expand All @@ -70,7 +70,7 @@ public void testNewUrlConnectionHttps() throws IOException {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testNewUrlConnectionFaultyProtocol() throws IOException {
setContextAndLifecycle("");
Expand Down
4 changes: 2 additions & 2 deletions agent_api/src/test/java/helpers/ShouldBlockHelperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public class ShouldBlockHelperTest {

@Test
@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
public void testWithInvalidAikidoTokenTrue() {
assertTrue(ShouldBlockHelper.shouldBlock());
}

@Test
@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "false")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "false")
public void testWithInvalidAikidoTokenFalse() {
assertFalse(ShouldBlockHelper.shouldBlock());
}
Expand Down
10 changes: 5 additions & 5 deletions agent_api/src/test/java/vulnerabilities/ScannerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void testScanForGivenVulnerability_ContextIsNull() {

// Disable IPC :
@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "improper-access-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
void testScanSafeSQLCode() {
// Safe :
Expand All @@ -98,7 +98,7 @@ void testScanSafeSQLCode() {

// Disable IPC :
@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "improper-access-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
void testBypassedIPs() {
// Thread cache does not force any protection off :
Expand Down Expand Up @@ -131,7 +131,7 @@ void testBypassedIPs() {

// Disable IPC :
@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "improper-access-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
void testForceProtectionOff() {
// Thread cache does not force any protection off :
Expand All @@ -156,7 +156,7 @@ void testForceProtectionOff() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "improper-access-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
void testDoesNotRunWithContextNull() {
Context.set(null);
Expand All @@ -166,7 +166,7 @@ void testDoesNotRunWithContextNull() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "improper-access-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
void TestStillThrowsWithThreadCacheUndefined() {
ThreadCache.set(null);
Expand Down
8 changes: 4 additions & 4 deletions agent_api/src/test/java/wrappers/ApacheHttpClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void setContextAndLifecycle(String url) {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSSRFLocalhostValid() throws Exception {
setContextAndLifecycle("http://localhost:5000");
Expand Down Expand Up @@ -67,7 +67,7 @@ public void testSSRFLocalhostValid() throws Exception {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSSRFWithoutPort() throws Exception {
setContextAndLifecycle("http://localhost:80");
Expand All @@ -78,7 +78,7 @@ public void testSSRFWithoutPort() throws Exception {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSSRFWithoutPortAndWithoutContext() throws Exception {
setContextAndLifecycle("http://localhost:80");
Expand All @@ -89,7 +89,7 @@ public void testSSRFWithoutPortAndWithoutContext() throws Exception {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSSRFWithoutPortAndWithoutThreadCache() throws Exception {
setContextAndLifecycle("http://localhost:80");
Expand Down
4 changes: 2 additions & 2 deletions agent_api/src/test/java/wrappers/FileReaderWriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private void setContextAndLifecycle(String url) {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testFileReader() throws Exception {
setContextAndLifecycle("../file.txt");
Expand All @@ -57,7 +57,7 @@ public void testFileReader() throws Exception {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testFileWriter() throws Exception {
setContextAndLifecycle("../file.txt");
Expand Down
2 changes: 1 addition & 1 deletion agent_api/src/test/java/wrappers/FileWrapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private void setContextAndLifecycle(String url) {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testPathTraversalString() throws Exception {
setContextAndLifecycle("../file.txt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private void setContextAndLifecycle(String url) {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSrrfTest() {
setContextAndLifecycle(SSRF_TEST);
Expand All @@ -60,7 +60,7 @@ public void testSrrfTest() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSrrfTestTwice() {
setContextAndLifecycle(SSRF_TEST_TWICE);
Expand All @@ -79,7 +79,7 @@ public void testSrrfTestTwice() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSrrfTestDomain() {
setContextAndLifecycle(SSRF_TEST_DOMAIN);
Expand All @@ -98,7 +98,7 @@ public void testSrrfTestDomain() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSrrfTestDomainTwice() {
setContextAndLifecycle(SSRF_TEST_DOMAIN_TWICE);
Expand All @@ -117,7 +117,7 @@ public void testSrrfTestDomainTwice() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSsrfCrossDomain() {
setContextAndLifecycle(CROSS_DOMAIN_TEST);
Expand All @@ -136,7 +136,7 @@ public void testSsrfCrossDomain() {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSsrfCrossDomainTwice() {
setContextAndLifecycle(CROSS_DOMAIN_TEST_DOMAIN_TWICE);
Expand Down
10 changes: 5 additions & 5 deletions agent_api/src/test/java/wrappers/InetAddressTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private void setContextAndLifecycle(String url) {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSSRFLocalhostValid() throws Exception {
setContextAndLifecycle("http://localhost:5000");
Expand Down Expand Up @@ -67,7 +67,7 @@ public void testSSRFLocalhostValid() throws Exception {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSSRFWithoutPort() throws Exception {
setContextAndLifecycle("http://localhost:80");
Expand All @@ -78,7 +78,7 @@ public void testSSRFWithoutPort() throws Exception {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSSRFWithoutPortAndWithoutContext() throws Exception {
setContextAndLifecycle("http://localhost:80");
Expand All @@ -89,7 +89,7 @@ public void testSSRFWithoutPortAndWithoutContext() throws Exception {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSSRFWithoutPortAndWithoutThreadCache() throws Exception {
setContextAndLifecycle("http://localhost:80");
Expand All @@ -100,7 +100,7 @@ public void testSSRFWithoutPortAndWithoutThreadCache() throws Exception {
}

@SetEnvironmentVariable(key = "AIKIDO_TOKEN", value = "invalid-token-2")
@SetEnvironmentVariable(key = "AIKIDO_BLOCKING", value = "true")
@SetEnvironmentVariable(key = "AIKIDO_BLOCK", value = "true")
@Test
public void testSSRFWithHttpClient() {
setContextAndLifecycle("http://localhost:5000/");
Expand Down
Loading

0 comments on commit 1a90bd8

Please sign in to comment.