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

Support taint detection on Throwable::getTraceAsString() #3731

Merged
merged 1 commit into from Jul 2, 2020

Conversation

TysonAndre
Copy link
Contributor

And __toString(), which uses getTraceAsString().

Fixes #3696

function login($username, $password, $secret) {
    throw new RuntimeException('login failure');
}
try {
    login('user', $_GET['pass'], SECRET);
} catch (Exception $e) {
    // This output includes unescaped 'pass' and SECRET
    echo $e, "\n";
    echo $e->getTraceAsString();
}

*/
public final function getTraceAsString() : string {}

/**
* @psalm-mutation-free
Copy link
Collaborator

Choose a reason for hiding this comment

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

Mind removing this? It breaks some downstream packages

And `__toString()`, which uses getTraceAsString().

Fixes vimeo#3696

```php
function login($username, $password, $secret) {
    throw new RuntimeException('login failure');
}
try {
    login('user', $_GET['pass'], SECRET);
} catch (Exception $e) {
    // This output includes unescaped 'pass' and SECRET
    echo $e, "\n";
    echo $e->getTraceAsString();
}
```
@muglug muglug merged commit e3d59bf into vimeo:master Jul 2, 2020
@muglug
Copy link
Collaborator

muglug commented Jul 2, 2020

Thanks!

@TysonAndre TysonAndre deleted the taint-exception branch September 6, 2021 17:32
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.

Idea: Treat Throwable->getTraceAsString() and __toString() as taint source for secrets
2 participants