Skip to content

Python: ObjectAPI to ValueAPI: UnguardedNextInGenerator#2991

Merged
RasmusWL merged 5 commits into
github:masterfrom
BekaValentine:python-objectapi-to-valueapi-unguardednextingenerator
Mar 19, 2020
Merged

Python: ObjectAPI to ValueAPI: UnguardedNextInGenerator#2991
RasmusWL merged 5 commits into
github:masterfrom
BekaValentine:python-objectapi-to-valueapi-unguardednextingenerator

Conversation

@BekaValentine

Copy link
Copy Markdown
Contributor

This PR is part of the Exceptions modernization effort.

@BekaValentine
BekaValentine marked this pull request as ready for review March 9, 2020 18:17
@BekaValentine
BekaValentine requested a review from a team as a code owner March 9, 2020 18:17
@BekaValentine
BekaValentine requested review from RasmusWL and removed request for a team March 9, 2020 18:17

@RasmusWL RasmusWL left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This query could use some autoformat 😉

I'm also curious, how would it handle using a default for next, such as next(iter([]), 'foo')?

@BekaValentine

Copy link
Copy Markdown
Contributor Author

I'm also curious, how would it handle using a default for next, such as next(iter([]), 'foo')?

@RasmusWL I suppose it would still flag an error, but this might be undesired. Should we add a new test case to remove false positives?

@RasmusWL

RasmusWL commented Mar 11, 2020

Copy link
Copy Markdown
Member

@RasmusWL I suppose it would still flag an error, but this might be undesired. Should we add a new test case to remove false positives?

Yes. I think we should at least have a test-case for this. (don't know whether we care to handle it with our current security focus). I think handling this should be quite easy, don't alert if the default parameter is present

@BekaValentine
BekaValentine requested a review from RasmusWL March 17, 2020 00:09

@RasmusWL RasmusWL left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!

I could see myself using the keyword argument to highlight was is going on, so I made some suggestions that would handle that 😉

Comment thread python/ql/test/query-tests/Exceptions/generators/test.py
Comment thread python/ql/src/Exceptions/UnguardedNextInGenerator.ql Outdated
BekaValentine and others added 2 commits March 18, 2020 14:15
Co-Authored-By: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
Co-Authored-By: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
@RasmusWL
RasmusWL merged commit f4e5079 into github:master Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants