Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 }}
|
||||||
@@ -16,23 +16,13 @@ if ($conn->connect_error) {
|
|||||||
// Vulnerabilidad de SQL Injection
|
// 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.
|
// 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.
|
||||||
if(isset($_GET['id'])) {
|
if(isset($_GET['id'])) {
|
||||||
// Analysis: Fix SQL Injection by using a prepared statement with parameter binding.
|
$id = $_GET['id']; // Input del usuario tomado directamente desde la URL
|
||||||
// This prevents user-controlled input from altering the query structure.
|
$sql = "SELECT * FROM usuarios WHERE id = $id"; // Vulnerable a SQL Injection
|
||||||
$id = intval($_GET['id']); // Input del usuario tomado directamente desde la URL (cast to int)
|
$result = $conn->query($sql);
|
||||||
// Use prepared statement to prevent SQL injection
|
|
||||||
$stmt = $conn->prepare("SELECT * FROM usuarios WHERE id = ?");
|
|
||||||
if ($stmt) {
|
|
||||||
$stmt->bind_param("i", $id);
|
|
||||||
$stmt->execute();
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
} else {
|
|
||||||
// If prepare fails, preserve behavior by setting $result to false
|
|
||||||
$result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
while($row = $result->fetch_assoc()) {
|
while($row = $result->fetch_assoc()) {
|
||||||
|
echo "id: " . $row["id"]. " - Nombre: " . $row["nombre"]. "<br>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "0 resultados";
|
echo "0 resultados";
|
||||||
|
|||||||
Reference in new issue
Block a user