If you're using Ruby on Rails, you should be using a static code analyzer to look for vulnerabilities. Please take a look at Railroader, an OSS tool I maintain that does this (and contributors are wanted!):
<a href="https://railroader.org/" rel="nofollow">https://railroader.org/</a><p>I recommend that you also use a web application scanner like OWASP ZAP and something to scan your dependencies for known vulnerabilities (e.g., bundle audit or GitHub's scanner).<p>That is in addition to normal software development tools like a style checker (like Rubocop) and a test suite with good coverage (e.g., minitest).<p>If you develop software, it's going to get attacked. There are some pretty straightforward ways to help resist attacks, but you have to use them.