Skip to content

Commit

Permalink
Stylistic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lokiuox committed Nov 16, 2024
1 parent 9756354 commit 380d1bc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,21 @@ private boolean isMagento(NetworkService networkService) {
}

// Check status code 200
if (response.status() != HttpStatus.OK) return false;
if (response.status() != HttpStatus.OK) {
return false;
}

// Check if body is JSON
if (response.bodyJson().isEmpty()) return false;
if (response.bodyJson().isEmpty()) {
return false;
}

JsonElement body = response.bodyJson().get();
// Check if JSON body is object
if (!body.isJsonObject()) return false;
if (!body.isJsonObject()) {
return false;
}

// If the body has a known key, e.g. "base_currency_code", it's Magento
return body.getAsJsonObject().has("base_currency_code");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@
import com.google.tsunami.plugin.PluginBootstrapModule;
import com.google.tsunami.plugins.detectors.cves.cve202434102.Annotations.OobSleepDuration;

/** An example Guice module that bootstraps the {@link MagentoCosmicStingXxe}. */
/** A Guice module that bootstraps the {@link MagentoCosmicStingXxe}. */
public final class MagentoCosmicStingXxeBootstrapModule extends PluginBootstrapModule {

@Override
protected void configurePlugin() {
// Tsunami relies heavily on Guice (https://github.com/google/guice). All Guice bindings for
// your plugin should be implemented here.

// registerPlugin method is required in order for the Tsunami scanner to identify your plugin.
registerPlugin(MagentoCosmicStingXxe.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.tsunami.common.data.NetworkEndpointUtils.forHostname;
import static com.google.tsunami.common.data.NetworkEndpointUtils.forHostnameAndPort;
import static com.google.tsunami.plugins.detectors.cves.cve202434102.MagentoCosmicStingXxe.*;
import static com.google.tsunami.plugins.detectors.cves.cve202434102.MagentoCosmicStingXxe.CURRENCY_ENDPOINT_PATH;
import static com.google.tsunami.plugins.detectors.cves.cve202434102.MagentoCosmicStingXxe.VERSION_ENDPOINT_PATH;
import static com.google.tsunami.plugins.detectors.cves.cve202434102.MagentoCosmicStingXxe.VULNERABILITY_REPORT_DESCRIPTION_CALLBACK;
import static com.google.tsunami.plugins.detectors.cves.cve202434102.MagentoCosmicStingXxe.VULNERABILITY_REPORT_DESCRIPTION_RESPONSE_MATCHING;
import static com.google.tsunami.plugins.detectors.cves.cve202434102.MagentoCosmicStingXxe.VULNERABILITY_REPORT_ID;
import static com.google.tsunami.plugins.detectors.cves.cve202434102.MagentoCosmicStingXxe.VULNERABILITY_REPORT_PUBLISHER;
import static com.google.tsunami.plugins.detectors.cves.cve202434102.MagentoCosmicStingXxe.VULNERABILITY_REPORT_RECOMMENDATION;
import static com.google.tsunami.plugins.detectors.cves.cve202434102.MagentoCosmicStingXxe.VULNERABILITY_REPORT_TITLE;
import static com.google.tsunami.plugins.detectors.cves.cve202434102.MagentoCosmicStingXxe.VULNERABLE_ENDPOINT_PATH;

import com.google.common.collect.ImmutableList;
import com.google.inject.Guice;
Expand Down

0 comments on commit 380d1bc

Please sign in to comment.