-
Notifications
You must be signed in to change notification settings - Fork 4
CodeQL #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Kirill89
wants to merge
3
commits into
main
Choose a base branch
from
CodeQL
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
CodeQL #38
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,47 @@ | ||
| on: [pull_request] | ||
| permissions: | ||
| actions: write | ||
| checks: write | ||
| contents: write | ||
| pull-requests: write | ||
| statuses: write | ||
|
|
||
| jobs: | ||
| test_codeql: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Setup Java on this machine | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| distribution: "oracle" | ||
| java-version: "19" | ||
| - name: Setup Maven on this machine | ||
| uses: stCarolas/setup-maven@v4.5 | ||
| with: | ||
| maven-version: 3.8.6 | ||
|
|
||
| - name: Checkout repo to get code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@v2 | ||
| with: | ||
| languages: java | ||
|
|
||
| - name: Run CodeQL autobuild | ||
| uses: github/codeql-action/autobuild@v2 | ||
|
|
||
| - name: Run CodeQL SAST scan | ||
| uses: github/codeql-action/analyze@v2 | ||
| with: | ||
| output: ../results | ||
|
|
||
| - name: Run Mobb on the findings and get fixes | ||
| if: always() | ||
| uses: mobb-dev/action@beta0.0.4 | ||
| with: | ||
| report-file: ../results/java.sarif | ||
| api-key: ${{ secrets.MOBB_API_TOKEN }} | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| scanner: codeql | ||
| mobb-project-name: Action |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,38 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>testgroup</groupId> | ||
| <artifactId>testartifact</artifactId> | ||
| <version>1.0-SNAPSHOT</version> | ||
| <packaging>jar</packaging> | ||
| <name>testproj</name> | ||
|
|
||
| <properties> | ||
| <maven.test.skip>true</maven.test.skip> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>javax.servlet</groupId> | ||
| <artifactId>javax.servlet-api</artifactId> | ||
| <version>3.0.1</version> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-compiler-plugin</artifactId> | ||
| <version>2.5.1</version> | ||
| <configuration> | ||
| <source>17</source> | ||
| <target>17</target> | ||
| </configuration> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
This file contains hidden or 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,14 +1,22 @@ | ||
| import java.sql.*; | ||
| import javax.servlet.ServletException; | ||
| import javax.servlet.http.HttpServlet; | ||
| import javax.servlet.http.HttpServletRequest; | ||
| import javax.servlet.http.HttpServletResponse; | ||
| import java.sql.Connection; | ||
| import java.sql.DriverManager; | ||
| import java.sql.Statement; | ||
|
|
||
| public class SQLInjectionExample { | ||
| public static void main(String[] args) throws SQLException { | ||
| String userInputA = args[1]; | ||
| public class SQLInjectionExample extends HttpServlet { | ||
| protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { | ||
| try { | ||
| Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db"); | ||
|
|
||
| Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db"); | ||
|
|
||
| String query = "SELECT * FROM users WHERE username = '" + request.getParameter("username") + "';"; | ||
| Statement stmt = con.createStatement(); | ||
|
|
||
| String query = "SELECT * FROM users WHERE username = '" + userInputA + "';"; | ||
| Statement stmt = con.createStatement(); | ||
| ResultSet rs = stmt.executeQuery(query); | ||
| stmt.executeQuery(query); | ||
| } catch (Exception e) { | ||
| throw new ServletException(e); | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / CodeQL
Query built from user-controlled sources