semgrep-rules icon indicating copy to clipboard operation
semgrep-rules copied to clipboard

Remove Outdated Rails Rules

Open 6f6d6172 opened this issue 2 years ago • 4 comments

Hi folks,

This PR removes some ruby/rails rules we feel are no longer relevant. We maintain a fork of semgrep-rules internally that allowed us to remove these without waiting for upstream changes, but it was suggested to me that I could also open a PR 🙂

  • filter-skipping: This rule is meant to detect dynamically generated routes that with specially crafted inputs could allow the client to access other routes, bypassing any filters on them. See this mailing list post from 2011. This only affects two specific versions of Rails which have long since been patched and EOL'd. Brakeman is able to continue including this rule because they do a runtime check of which version of Rails it's running under.
  • attr-accessible: This rule checks for models that don't explicitly list which of its parameters can be modified by an external caller. This was a big deal back in 2012 when mass assignment bugs were everywhere (see this classic blog post), but now we've got strong params which moves this enforcement into the controller level in modern rails apps.

I suspect there are other similar rules in this directory that could go this route but I haven't run into them yet 🙂

6f6d6172 avatar Mar 04 '24 17:03 6f6d6172

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 04 '24 17:03 CLAassistant

These rules are really important to us on our Rails versions (with Rails LTS), i think it's important that we find a way to keep them for companies that do still use older Rails versions

nightpool avatar Mar 06 '24 17:03 nightpool

Hey @nightpool, that's fair. In that situation rules like these should be opt-in, as opposed to opt-out. e.g. if you need to support a 13 year old version of Rails, you should pull in specific rules as opposed to everyone else being subjected to irrelevant findings 🙂

6f6d6172 avatar Mar 11 '24 20:03 6f6d6172

Well, as an overworked team lead with a lot on my plate (and like 15 GitHub repositories to audit), I'd honestly just appreciate it if Semgrep could figure out my rails version for me 😅

nightpool avatar Mar 12 '24 00:03 nightpool

For now we're going to close this PR since we can't determine the version and people still depend on it

People can exclude the rules if they do not want to use them

LewisArdern avatar Sep 19 '24 07:09 LewisArdern