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

Missing TaintedSql when using PDOStatement::bindParam or PDOStatement::bindValue #10030

Closed
cgocast opened this issue Jul 21, 2023 · 1 comment

Comments

@cgocast
Copy link
Contributor

cgocast commented Jul 21, 2023

The following code sample does not raises a TaintedSql:

<?php

function deleteBindedUserId(PDO $pdo): void {
    $userId = $_POST['userid'];
    $stmt = $pdo->prepare("delete from users where user_id = :userid");
    $stmt->bindParam(':user_id', $userId);
    $stmt->execute();
}

whereas a very similar piece of code correctly raises a TaintedSql:

<?php

function deleteConcatenedUserId(PDO $pdo): void {
    $userId = $_POST['userid'];
    $stmt = $pdo->prepare("delete from users where user_id = " . $userId);
    $stmt->execute();
}

I'll write a PR fixing the issue.

@psalm-github-bot
Copy link

Hey @cgocast, can you reproduce the issue on https://psalm.dev ?

cgocast added a commit to cgocast/psalm that referenced this issue Jul 21, 2023
orklah added a commit that referenced this issue Jul 23, 2023
@orklah orklah closed this as completed Jul 23, 2023
danog pushed a commit to zoonru/psalm that referenced this issue Jul 24, 2023
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

No branches or pull requests

2 participants