Skip to content

Provide a single line of vulnerable code

mo khan requested to merge mokhax/406633/too-many-tokens into master

What does this MR do and why?

When an end_line is not provided with a vulnerability finding the Finding#vulnerable_code method was including the start up to the last line of the file. This can cause the error This model's maximum context length is 4097 tokens. However, you requested 5504 tokens (2504 in the messages, 3000 in the completion). Please reduce the length of the messages or completion. if the file has a lot of code.

The change in this MR limits the chunk of code to just the single line of code instead.

#406633 (comment 1359820952)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by mo khan

Merge request reports