54 points · by pseudolus · 3y ago · 26 comments
Much like with a lot of inexperienced, and unfortunately far too many experienced programmers, you'll get exactly what you ask for - nothing more, nothing less. So if you don't ask for security controls, you won't get security controls.
If you point out in your description what needs controls, you'll get a reasonable attempt at implementing what you've described. You still need to understand the output code enough to know whether you explained those controls clearly enough. Or just update the code manually yourself, akin to pair programming. That also works.
To be fair, this is a lot like reality. I have never seen a shop that doesn't produce insecure code unless you keep on top of them for proper implementation of security controls from the planning on up.
Exactly. The fact that lots of inexperienced programmers who lack the critical thinking and code review abilities will copy-paste what GPT is creating as is, is horrifying.
Would be nice if they interviewed people who knew the absolute basics of how this thing works before commenting on its properties
I really think this sort of research is critical to do more of however as these outputs are going to be used in places where the assumption is that we're looking for these sorts of things.
As others have mentioned however, GPT generates insecure code, but so to most devs. The good thing though is that GPT can be systemically trained not to, while devs being more heterogeneous are more difficult to do the same. ;)
The main takeaway I have when thinking about tooling around GPT is that using it to generate things is fine assuming that you have a means to check the output against sensible criteria.
[1]: https://arxiv.org/abs/2304.09655
[2]: https://github.com/RaphaelKhoury/ProgramsGeneratedByChatGPT/...
The only difference now is the scale and ease to get your example.
The main problem I see with GPT-4 is that it does one small thing at a time. I have to manually drive it making the right requests.