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

Model for list.append not working in version 0.9.23 #940

Open
draftyfrog opened this issue Nov 13, 2024 · 1 comment
Open

Model for list.append not working in version 0.9.23 #940

draftyfrog opened this issue Nov 13, 2024 · 1 comment

Comments

@draftyfrog
Copy link

Pysa Bug

Pre-submission checklist
[x] I've checked the list of common issues and mine does not appear

Bug description
I have a model to trace taint along lists, just as described in #163 Tainted lists.

def list.append(self, data: TaintInTaintOut[Updates[self]]): ...

This worked up until including pyre-check Version: 0.9.22. But now with version 0.9.23 I get the following error message:

general.pysa:2:0 Model signature parameters for `list.append` do not match implementation `(list[_T], _T) -> None`. Reason: unexpected named parameter: `self`.

What can I do to make this work again?

@arthaud
Copy link
Contributor

arthaud commented Nov 17, 2024

Hi @draftyfrog, thanks for reaching out.

If you look at typeshed, this is how list.append is defined:

def append(self, object: _T, /) -> None: ...

The additional / means that parameters up until that point are unnamed, i.e x.append(object=1) will not work.
You need to make the taint stub match the signature:

def list.append(self, data: TaintInTaintOut[Updates[self]], /): ...

Note that by default, pysa should include the stubs/taint directory, which already includes that model (in a more precise version):

def list.append(self, object: TaintInTaintOut[Updates[self], UpdatePath[_.all()], NoCollapse], /): ...

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