Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b29ecdaaac | ||
|
|
8a4f9f050b | ||
|
|
b03937036e | ||
|
|
211b48ce16 | ||
|
|
30ea310907 | ||
|
|
716277d550 |
No files matched your search
@@ -0,0 +1,36 @@
|
|||||||
|
name: PLEXALYZER Analysis
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
if: ${{ !startsWith(github.head_ref, 'Plexicus-AI-Remediation-') }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Get Changed Files and Save to File
|
||||||
|
id: get_changed_files
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# Capture changed files and save to a temporary file
|
||||||
|
changed_files=$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}")
|
||||||
|
echo "$changed_files" | jq -R -s -c 'split("\n")[:-1]' > files_to_scan.json
|
||||||
|
echo "files_path=$(pwd)/files_to_scan.json" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Run PLEXALYZER Analysis
|
||||||
|
uses: plexicus/plexicus-action@dev
|
||||||
|
with:
|
||||||
|
plexalyzer-token: ${{ secrets.PLEXALYZER_TOKEN }}
|
||||||
|
default-owner: ${{ github.event.repository.owner.login }}
|
||||||
|
repo-id: ${{ vars.COVULOR_REPO_ID }}
|
||||||
|
repo-name: ${{ github.repository }}
|
||||||
|
branch: ${{ github.event.pull_request.base.ref }}
|
||||||
|
url: ${{ github.event.repository.clone_url }}
|
||||||
|
pr-id: ${{ github.event.pull_request.number }}
|
||||||
|
files-path: ${{ env.files_path }}
|
||||||
|
workspace-path: ${{ github.workspace }}
|
||||||
@@ -13,14 +13,17 @@ if ($conn->connect_error) {
|
|||||||
die("Conexión fallida: " . $conn->connect_error);
|
die("Conexión fallida: " . $conn->connect_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vulnerabilidad de SQL Injection
|
/*
|
||||||
// El siguiente código es vulnerable a SQL Injection ya que el input del usuario se concatena directamente en la consulta SQL sin validación o sanitización.
|
Brief analysis - ALEX:
|
||||||
|
This change fixes a SQL Injection vulnerability by using a parameterized prepared statement and strict validation of the 'id' parameter.
|
||||||
|
I will replace the concatenated SQL with a mysqli prepared statement binding the id as an integer; only index.php is modified.
|
||||||
|
*/
|
||||||
if(isset($_GET['id'])) {
|
if(isset($_GET['id'])) {
|
||||||
$id = $_GET['id']; // Input del usuario tomado directamente desde la URL
|
$id = $_GET['id']; // Input del usuario tomado directamente desde la URL
|
||||||
|
|
||||||
// Whitelist validation: ensure the id consists only of digits
|
// Whitelist/validate: allow only digits to prevent injection
|
||||||
if (!ctype_digit($id)) {
|
if (!preg_match('/^\d+$/', $id)) {
|
||||||
echo "0 resultados";
|
echo "Invalid id";
|
||||||
} else {
|
} else {
|
||||||
$id_int = (int)$id;
|
$id_int = (int)$id;
|
||||||
|
|
||||||
@@ -38,10 +41,11 @@ if(isset($_GET['id'])) {
|
|||||||
} else {
|
} else {
|
||||||
echo "0 resultados";
|
echo "0 resultados";
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
} else {
|
} else {
|
||||||
// If prepare fails, do not run an unsafe query; return no results
|
// Do not execute an unsafe query if prepare() failed
|
||||||
echo "0 resultados";
|
echo "Query preparation failed";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user