diff --git a/SECURITY_REPORT.md b/SECURITY_REPORT.md new file mode 100644 index 000000000..4045486b8 --- /dev/null +++ b/SECURITY_REPORT.md @@ -0,0 +1,116 @@ +# 🛡️ AppGenius Security Report + +**Repository:** `nirzaraghure/pipelines-java` +**Scan Date:** 6/3/2026, 12:42:39 PM +**Files Scanned:** 2 +**Issues Found:** 5 + +## 📊 Summary + +| Severity | Count | +|----------|-------| +| 🔴 Critical | 0 | +| 🟠 High | 1 | +| 🟡 Medium | 2 | +| 🔵 Low | 2 | + +## 🔍 Detailed Findings + +### 🔵 1. Potential NullPointerException + +**File:** `Demo.java` +**Type:** NullPointerException +**Severity:** LOW + +**Description:** +The method DoSomething can throw a NullPointerException if the input flag is null. + +**Suggested Fix:** +Add a null check for the flag before using it. + +**Code Example:** +``` +public void DoSomething(Boolean flag){ ... } +``` + +--- + +### 🟡 2. No input validation + +**File:** `Demo.java` +**Type:** Information Disclosure +**Severity:** MEDIUM + +**Description:** +The method DoSomething does not validate the input flag. This could potentially lead to information disclosure. + +**Suggested Fix:** +Validate the input flag before using it. + +**Code Example:** +``` +public void DoSomething(Boolean flag){ ... } +``` + +--- + +### 🔵 3. Lack of logging + +**File:** `Demo.java` +**Type:** Logging +**Severity:** LOW + +**Description:** +The method DoSomething does not log any information. This makes it difficult to track the execution flow of the method. + +**Suggested Fix:** +Add logging statements to track the execution flow. + +**Code Example:** +``` +public void DoSomething(Boolean flag){ ... } +``` + +--- + +### 🟠 4. Missing test case + +**File:** `MyTest.java` +**Type:** Test Coverage +**Severity:** HIGH + +**Description:** +The test class MyTest does not contain a test case for the method DoSomething with a flag set to false. + +**Suggested Fix:** +Add a test case for the method DoSomething with a flag set to false. + +**Code Example:** +``` +@Test public void test_method_3() { Demo d = new Demo(); d.DoSomething(false); } +``` + +--- + +### 🟡 5. Empty test method + +**File:** `MyTest.java` +**Type:** Test Coverage +**Severity:** MEDIUM + +**Description:** +The test method test_method_2 is empty. This means it does not test any functionality. + +**Suggested Fix:** +Add test logic to the test method test_method_2. + +**Code Example:** +``` +@Test public void test_method_2() { ... } +``` + +--- + + +--- +*Generated by AppGenius Headless Security Scanner* diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 000000000..3f7a38da3 --- /dev/null +++ b/azure-pipelines-1.yml @@ -0,0 +1,31 @@ +# Maven +- task: Gradle@4 + inputs: + gradleWrapperFile: 'gradlew' + tasks: 'build' + publishJUnitResults: true + testResultsFiles: '**/TEST-*.xml' + javaHomeOption: 'JDKVersion' + sonarQubeRunAnalysis: false + spotBugsAnalysis: false +# Build your Java project and run tests with Apache Maven. +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/java + +trigger: +- main + +pool: + vmImage: ubuntu-latest + +steps: +- task: Maven@3 + inputs: + mavenPomFile: 'pom.xml' + mavenOptions: '-Xmx3072m' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + goals: 'package' diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..2d5f91327 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,36 @@ +# Maven +- task: Ant@1 + inputs: + buildFile: 'build.xml' + options: + publishJUnitResults: true + testResultsFiles: '**/TEST-*.xml' + javaHomeOption: 'JDKVersion' +# Build your Java project and run tests with Apache Maven. +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/java + +trigger: +- main + +pool: + vmImage: ubuntu-latest + +steps: +- task: Maven@3 + inputs: + mavenPomFile: 'pom.xml' + mavenOptions: '-Xmx3072m' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + goals: 'package' + +steps: +- script: | + echo Starting the build + mvn package + displayName: 'Build with Maven' + \ No newline at end of file diff --git a/src/main/java/com/microsoft/demo/Demo.test.java b/src/main/java/com/microsoft/demo/Demo.test.java new file mode 100644 index 000000000..0b4904282 --- /dev/null +++ b/src/main/java/com/microsoft/demo/Demo.test.java @@ -0,0 +1,35 @@ +package com.microsoft.demo; + +import org.junit.*; + +public class DemoTest { + private Demo demo; + + @Before + public void setUp() throws Exception { + demo = new Demo(); + } + + @After + public void tearDown() throws Exception { + demo = null; + } + + @Test + public void testDoSomethingWithTrueFlag() { + try{ + demo.DoSomething(true); + } catch (Exception e) { + Assert.fail("Expected no exception to be thrown"); + } + } + + @Test + public void testDoSomethingWithFalseFlag() { + try{ + demo.DoSomething(false); + } catch (Exception e) { + Assert.fail("Expected no exception to be thrown"); + } + } +} \ No newline at end of file