Skip to content
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

test branch #983

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

test branch #983

wants to merge 15 commits into from

Conversation

Korjen97
Copy link
Contributor

By submitting a PR to this repository, you agree to the terms within the Checkmarx Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

Describe the purpose of this PR along with any background information and the impacts of the proposed change.

References

Include supporting link to GitHub Issue/PR number

Testing

Describe how this change was tested. Be specific about anything not tested and reasons why. If this solution has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Checklist

  • I have added documentation for new/changed functionality in this PR (if applicable).
  • I have updated the CLI help for new/changed functionality in this PR (if applicable).
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

Copy link

github-actions bot commented Dec 24, 2024

Logo
Checkmarx One – Scan Summary & Details7f80790f-d81e-4a31-93d2-f8fe3d13637d

New Issues (54)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
CRITICAL CVE-2019-10744 Npm-lodash-4.17.11 Vulnerable Package
CRITICAL Code_Injection /small-project-main/dsvw.py: 25
detailsThe application's do_GET method receives and dynamically executes user-controlled code using exec, at line 57 of /small-project-main/dsvw.py. This ...
Attack Vector
CRITICAL Code_Injection /small-project-main/dsvw.py: 25
detailsThe application's do_GET method receives and dynamically executes user-controlled code using exec, at line 57 of /small-project-main/dsvw.py. This ...
Attack Vector
CRITICAL Code_Injection /small-project-main/dsvw.py: 56
detailsThe application's do_GET method receives and dynamically executes user-controlled code using exec, at line 57 of /small-project-main/dsvw.py. This ...
Attack Vector
CRITICAL Command_Injection /small-project-main/dsvw.py: 25
detailsThe application's do_GET method calls an OS (shell) command with envs, at line 57 of /small-project-main/dsvw.py, using an untrusted string with th...
Attack Vector
CRITICAL Command_Injection /small-project-main/dsvw.py: 25
detailsThe application's do_GET method calls an OS (shell) command with envs, at line 57 of /small-project-main/dsvw.py, using an untrusted string with th...
Attack Vector
CRITICAL Command_Injection /small-project-main/dsvw.py: 56
detailsThe application's do_GET method calls an OS (shell) command with envs, at line 57 of /small-project-main/dsvw.py, using an untrusted string with th...
Attack Vector
CRITICAL Cx042e432f-e0c4 Npm-node-ipc-9.2.2 Vulnerable Package
CRITICAL Cx07931ce7-8224 Npm-ua-parser-js-0.7.29 Vulnerable Package
CRITICAL Cx28bd7545-eb30 Npm-node-ipc-9.2.2 Vulnerable Package
CRITICAL Cx299e146f-5a39 Npm-scs-0.0.1 Vulnerable Package
CRITICAL Cx43050644-3add Npm-momnet-2.29.1 Vulnerable Package
CRITICAL Cx4737011d-347c Npm-ua-parser-js-0.7.29 Vulnerable Package
CRITICAL Cx4a52ebed-4106 Npm-momnet-2.29.1 Vulnerable Package
CRITICAL Cx4ba6c921-c998 Npm-scs-0.0.1 Vulnerable Package
CRITICAL Cx4eb613b4-04e7 Npm-scs-0.0.1 Vulnerable Package
CRITICAL Cx558b006b-f4df Npm-ua-parser-js-0.7.29 Vulnerable Package
CRITICAL Cx6b9a86a5-690c Npm-flow-dev-tools-99.10.9 Vulnerable Package
CRITICAL Cx8ef77360-5422 Npm-node-ipc-9.2.2 Vulnerable Package
CRITICAL Cx8f9b1745-1402 Npm-scs-0.0.1 Vulnerable Package
CRITICAL Cx9c42b5fe-7ada Npm-ua-parser-js-0.7.29 Vulnerable Package
CRITICAL Cx9c42f2c3-f75f Npm-ua-parser-js-0.7.29 Vulnerable Package
CRITICAL Cxa2b7a014-3ccf Npm-flow-dev-tools-99.10.9 Vulnerable Package
CRITICAL Cxadcc9e15-660b Npm-flow-dev-tools-99.10.9 Vulnerable Package
CRITICAL Cxae294227-318d Npm-scs-0.0.1 Vulnerable Package
CRITICAL Cxb548375c-73ad Npm-momnet-2.29.1 Vulnerable Package
CRITICAL Cxbe748a42-4843 Npm-scs-0.0.1 Vulnerable Package
CRITICAL Cxcc09496a-59c8 Npm-js-yaml-3.6.1 Vulnerable Package
CRITICAL Cxd59efdf2-2f00 Npm-ua-parser-js-0.7.29 Vulnerable Package
CRITICAL Cxe3a87c30-9600 Npm-scs-0.0.1 Vulnerable Package
CRITICAL Cxec41bee3-fc56 Npm-ua-parser-js-0.7.29 Vulnerable Package
CRITICAL Cxed2acd22-9b01 Npm-node-ipc-9.2.2 Vulnerable Package
CRITICAL SQL_Injection /small-project-main/SqlInjectionLesson5a.java: 55
detailsThe application's injectableQuery method executes an SQL query with executeQuery, at line 67 of /small-project-main/SqlInjectionLesson5a.java. The ...
Attack Vector
CRITICAL SQL_Injection /small-project-main/SqlInjectionLesson5a.java: 55
detailsThe application's injectableQuery method executes an SQL query with executeQuery, at line 67 of /small-project-main/SqlInjectionLesson5a.java. The ...
Attack Vector
CRITICAL SQL_Injection /small-project-main/SqlInjectionLesson5a.java: 55
detailsThe application's injectableQuery method executes an SQL query with executeQuery, at line 67 of /small-project-main/SqlInjectionLesson5a.java. The ...
Attack Vector
CRITICAL Stored_XSS /small-project-main/dsvw.py: 26
detailsThe method do_GET embeds untrusted data in generated output with write, at line 80 of /small-project-main/dsvw.py. This untrusted data is embedded ...
Attack Vector
CRITICAL Stored_XSS /small-project-main/dsvw.py: 37
detailsThe method do_GET embeds untrusted data in generated output with write, at line 80 of /small-project-main/dsvw.py. This untrusted data is embedded ...
Attack Vector
CRITICAL Stored_XSS /small-project-main/dsvw.py: 35
detailsThe method do_GET embeds untrusted data in generated output with write, at line 80 of /small-project-main/dsvw.py. This untrusted data is embedded ...
Attack Vector
HIGH CVE-2017-1000048 Npm-qs-6.0.0 Vulnerable Package
HIGH CVE-2020-8203 Npm-lodash-4.17.11 Vulnerable Package
HIGH CVE-2021-23337 Npm-lodash-4.17.11 Vulnerable Package
HIGH CVE-2021-4229 Npm-ua-parser-js-0.7.29 Vulnerable Package
HIGH CVE-2022-24999 Npm-qs-6.0.0 Vulnerable Package
HIGH Cx0b414307-5d4b Npm-lodash-4.17.11 Vulnerable Package
HIGH Cxdca8e59f-8bfe Npm-inflight-1.0.6 Vulnerable Package
HIGH Cxec49316b-56df Npm-js-yaml-3.6.1 Vulnerable Package
MEDIUM CVE-2020-28500 Npm-lodash-4.17.11 Vulnerable Package
MEDIUM Cx877cf216-175c Npm-event-pubsub-5.0.3 Vulnerable Package
MEDIUM Cx90bff1cb-7264 Npm-strong-type-0.1.6 Vulnerable Package
MEDIUM Missing_HSTS_Header /small-project-main/dsvw.py: 76
detailsThe web-application does not define an HSTS header, leaving it vulnerable to attack.
Attack Vector
MEDIUM Stored_Command_Injection /small-project-main/dsvw.py: 56
detailsThe application's do_GET method calls an OS (shell) command with program, at line 57 of /small-project-main/dsvw.py, using an untrusted string with...
Attack Vector
MEDIUM Unpinned Package Version in Apk Add /Dockerfile: 6
detailsPackage version pinning reduces the range of versions that can be installed, reducing the chances of failure due to unanticipated changes
LOW Healthcheck Instruction Missing /Dockerfile: 3
detailsEnsure that HEALTHCHECK is being used. The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working
LOW Unpinned Actions Full Length Commit SHA /main.yml: 11
detailsPinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

@@ -14,6 +14,7 @@ jobs:
with:
go-version-file: go.mod
- run: go version
- run: docker version

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of docker version command seems unrelated to the rest of the workflow. Please provide context for why this is necessary, and ensure it aligns with the workflow's purpose.

@@ -60,7 +60,7 @@ const (
containerVolumeFlag = "-v"
containerNameFlag = "--name"
containerRemove = "--rm"
containerImage = "checkmarx/kics:latest"
containerImage = "checkmarx/kics:2.1.3"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not recommended to replace a 'latest' tag with a specific version in a codebase without a clear rationale. This change could lead to the use of outdated images if not maintained properly. Please ensure that there's a specific reason for using version 2.1.3 and document the reason for this change, or consider using a strategy to keep up to date with the latest version.

@@ -60,7 +60,7 @@ const (
containerVolumeFlag = "-v"
containerNameFlag = "--name"
containerRemove = "--rm"
containerImage = "checkmarx/kics:latest"
containerImage = "checkmarx/kics:v2.1.3"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The container image tag has been changed to include a v prefix. Ensure that the tag v2.1.3 exists in the container registry and is the correct version intended for use. If this is a new tagging convention, update any documentation or scripts that reference the old tag format to prevent confusion.

@@ -5,7 +5,9 @@ on:

jobs:
unit-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runs-on value ubuntu-24.04 may not be a valid GitHub Actions runner label. GitHub Actions typically uses the ubuntu-latest or specific LTS versions like ubuntu-20.04. Please ensure that the runner label is correct and supported by GitHub Actions.

runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container:
image: ubuntu-24.04:20250105.1.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The container image tag ubuntu-24.04:20250105.1.0 seems to reference a future date. Please ensure that the image tag exists and is available for use. Additionally, consider using a stable version of the container image to avoid potential breaks due to future changes.

@@ -5,7 +5,7 @@ on:

jobs:
unit-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-[email protected]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runs-on key does not support specifying an image with a tag using @. You should use the container key to specify the image and tag.

@@ -5,7 +5,7 @@ on:

jobs:
unit-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04:20250105.1.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runs-on value should use the correct syntax for specifying the runner image. It should be [email protected] instead of ubuntu-24.04:20250105.1.0. The colon (:) should be replaced with an at symbol (@).

@@ -1,6 +1,6 @@
module github.com/checkmarx/ast-cli

go 1.23.3
go 1.23.5

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The go version is updated from 1.23.3 to 1.23.5. Please ensure that this minor version bump does not introduce any compatibility issues with the project dependencies and that all tests pass with the new version.

@@ -14,7 +14,17 @@ jobs:
with:
go-version-file: go.mod
- run: go version

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the original docker version command was removed without replacement. If the intention is to verify the Docker installation, consider adding a step to check the Docker version or ensure Docker is properly set up.

uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7 #v1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a commit SHA (dd4fa0671be5250ee6f50aedf4cb05514abda2c7) directly for the docker/login-action is not recommended for maintainability. Prefer using a version tag (like v1) unless there is a specific reason for pinning to a commit.

uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7 #v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: go test with coverage

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shell: bash directive is unnecessary here as bash is the default shell for GitHub Actions runners on Linux and macOS. You can remove this line unless there's a specific need for it.

- name: go test with coverage
shell: bash
run: |
sudo chmod +x ./internal/commands/.scripts/up.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using sudo within the GitHub Actions runner should generally be avoided unless necessary. Check if the chmod command can be run without sudo.

@@ -14,7 +14,24 @@ jobs:
with:
go-version-file: go.mod
- run: go version

- name: Setup Docker on macOS
uses: docker-practice/actions-setup-docker@master

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not recommended to use the master branch of an action as it can introduce breaking changes without notice. Use a specific version or commit hash for docker-practice/actions-setup-docker to ensure stability.


- name: Setup Docker on macOS
uses: docker-practice/actions-setup-docker@master
timeout-minutes: 12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timeout-minutes attribute should be aligned with the uses attribute for consistency and readability.

uses: docker-practice/actions-setup-docker@master
timeout-minutes: 12
- run: |
set -x

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The set -x command will print all executed commands to the terminal, which can clutter the build logs. Consider removing it unless it's necessary for debugging purposes.


docker version

docker run --rm hello-world

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running hello-world Docker image doesn't seem to serve a purpose in the CI workflow. If it's meant for testing the Docker setup, please ensure it's relevant to the project's CI goals.

@@ -158,7 +175,7 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build the project
run: go build -o ./cx ./cmd
run: go build -o ./cx ./cmd

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the -v flag with go build for verbose output to provide more context on the build process in the CI logs.

@@ -175,7 +192,7 @@ jobs:
env:
TRIVY_SKIP_DB_UPDATE: true
TRIVY_SKIP_JAVA_DB_UPDATE: true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like there is an unnecessary change from a tab to a space on this line. Please revert it if it does not serve a specific purpose.

username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Docker Hub

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Login to Docker Hub step appears to be redundant since you've already added a Log in to Docker Hub step above. Consider removing this duplicate step to streamline the workflow.

run: |
sudo chmod +x ./internal/commands/.scripts/up.sh
./internal/commands/.scripts/up.sh
sudo ./internal/commands/.scripts/up.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using sudo to run up.sh might introduce security risks or may not be necessary. Ensure that the script has the appropriate permissions and only use sudo if absolutely required for the script to run correctly.

sudo go test $(go list ./... | grep -v "mock" | grep -v "wrappers" | grep -v "bitbucketserver" | grep -v "logger") -timeout 20m -coverprofile cover.out

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using sudo for running go test is generally not recommended as it can lead to permission issues and is not necessary for most testing scenarios. Please ensure that sudo is actually required for this operation and consider removing it if it's not necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants