Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6764453d2d | ||
|
|
0cf50dc6f3 | ||
|
|
acd11d16ce | ||
|
|
d1b0b9476b |
No files matched your search
@@ -1,36 +0,0 @@
|
||||
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,41 +13,38 @@ if ($conn->connect_error) {
|
||||
die("Conexión fallida: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Mitigación: uso de prepared statements y validación de entrada
|
||||
// Vulnerabilidad de SQL Injection (corregida)
|
||||
// Se utiliza una consulta preparada para evitar SQL Injection.
|
||||
if(isset($_GET['id'])) {
|
||||
$id_raw = $_GET['id'];
|
||||
// Validar que el id es un entero
|
||||
if (filter_var($id_raw, FILTER_VALIDATE_INT) === false) {
|
||||
echo "ID inválido";
|
||||
} else {
|
||||
$id = (int)$id_raw;
|
||||
// Preparar consulta con parámetros y seleccionar columnas específicas
|
||||
if ($stmt = $conn->prepare("SELECT id, nombre FROM usuarios WHERE id = ?")) {
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($res_id, $res_nombre);
|
||||
$found = false;
|
||||
while ($stmt->fetch()) {
|
||||
$found = true;
|
||||
// Escapar salida para prevenir XSS
|
||||
echo "id: " . htmlspecialchars($res_id, ENT_QUOTES, 'UTF-8') . " - Nombre: " . htmlspecialchars($res_nombre, ENT_QUOTES, 'UTF-8') . "<br>";
|
||||
$id = $_GET['id']; // Input del usuario tomado directamente desde la URL
|
||||
// Preparar la consulta con un marcador de posición
|
||||
$stmt = $conn->prepare("SELECT * FROM usuarios WHERE id = ?");
|
||||
if ($stmt === false) {
|
||||
die("Error en la preparación de la consulta: " . $conn->error);
|
||||
}
|
||||
if (!$found) {
|
||||
// Vincular el parámetro (tipo 'i' para entero)
|
||||
$stmt->bind_param("i", $id);
|
||||
// Ejecutar la consulta
|
||||
$stmt->execute();
|
||||
// Obtener el resultado
|
||||
$result = $stmt->get_result();
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
echo "id: " . $row["id"]. " - Nombre: " . $row["nombre"]. "<br>";
|
||||
}
|
||||
} else {
|
||||
echo "0 resultados";
|
||||
}
|
||||
// Cerrar la sentencia
|
||||
$stmt->close();
|
||||
} else {
|
||||
// No revelar detalles internos al usuario
|
||||
echo "Error en la consulta";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mitigación de Cross-Site Scripting (XSS)
|
||||
// Escapar la salida del mensaje para evitar ejecución de HTML/JS
|
||||
// Vulnerabilidad de Cross-Site Scripting (XSS)
|
||||
|
||||
if(isset($_GET['mensaje'])) {
|
||||
$mensaje = $_GET['mensaje'];
|
||||
echo "<div>" . htmlspecialchars($mensaje, ENT_QUOTES, 'UTF-8') . "</div>";
|
||||
$mensaje = $_GET['mensaje']; // Input del usuario susceptible a XSS
|
||||
echo "<div>$mensaje</div>"; // Vulnerable a XSS
|
||||
}
|
||||
|
||||
// Cerrar conexión
|
||||
|
||||
Reference in new issue
Block a user