Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Graphql end-point for vulnerabilities #1831

Open
palexvs opened this issue Feb 29, 2024 · 1 comment
Open

Check Graphql end-point for vulnerabilities #1831

palexvs opened this issue Feb 29, 2024 · 1 comment

Comments

@palexvs
Copy link

palexvs commented Feb 29, 2024

Looks like Brakeman does not check Graphql Mutations and Resolvers for potential vulnerabilities

Example:

# app/graphql/resolvers/user.rb

class Resolvers::User < Resolvers::Base
  argument :id, Integer, required: true

  def resolve(**args)
      User.find(id: args[:id])
...
    end
  end
end

I would expect to get UnscopedFind warning but got nothing

Brakeman version: 6.1.2
Rails version: 7.0.8.1
Ruby version: 3.2.2
``
@presidentbeef
Copy link
Owner

UnscopedFind is an optional check, because it is pretty noisy and has a lot of false positives. Assuming you are running this check (e.g. with -A or --run-all-checks)...

Brakeman only warns about unscoped finds if there is a reason to think the find could/should be scoped. In practice, this means models with a belongs_to relationship. Usually User does not belong to another model.

If I'm incorrect in my guess about User and it does have belongs_to: in it, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants