Skip to content

Commit 613d06f

Browse files
committed
refactor: remove command injection demo
1 parent 4636fb5 commit 613d06f

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

src/main/java/com/weather/app/WeatherApp.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ public class WeatherApp {
1313

1414
private static final Logger LOGGER = Logger.getLogger(WeatherApp.class.getName());
1515

16-
// Secret for accessing Atlassian API!! (Not really, it's deprecated)
17-
private static final String SECRET_PAT =
18-
"ATATT3xFfGF0wp8k76Z0Q2Wc2sP0NhHIlTALaCZR_CZxw8vuwsyt5Jijh-Zoem712l0jIAUjzn7hbdQ2" +
19-
"vOz3dUloyFR2oFtU26VjImYu0a5opr5AoCsuiIDKfiWgxwyu_oe-IMYURIQmea5x8CPBXMhkeD9rJbPZGOy-BbrnH74s9Dap_U=4900D7F8";
20-
21-
2216
// Initialize logging configuration
2317
static {
2418
try (InputStream is = WeatherApp.class.getClassLoader().getResourceAsStream("logging.properties")) {
@@ -73,16 +67,6 @@ public static void main(String[] args) {
7367
String city = args[0];
7468
LOGGER.log(Level.INFO, "Weather request for city: {0}", city);
7569

76-
// --- Simpler vulnerability for CodeQL testing: Command injection ---
77-
try {
78-
// BAD: Directly using user input in command execution (for CodeQL demo purposes)
79-
Runtime.getRuntime().exec(city);
80-
LOGGER.log(Level.WARNING, "Executed command with user input (for demo purposes).");
81-
} catch (IOException e) {
82-
LOGGER.log(Level.SEVERE, "Failed to execute command: " + e.getMessage(), e);
83-
}
84-
// --- End of vulnerability block ---
85-
8670
try {
8771
// Get API key from environment or config file
8872
String apiKey = ConfigUtil.getApiKey();

0 commit comments

Comments
 (0)