Code Monkey home page Code Monkey logo

Comments (4)

gabrielecirulli avatar gabrielecirulli commented on May 14, 2024 1

Oh, I think I just got it. Is this just a safeguard to make sure you realize your mistake in case you forgot to authorize your controller action?

Sorry (and feel free to close this issue) if this was just a misunderstanding!

from pundit.

jnicklas avatar jnicklas commented on May 14, 2024 1

@gabrielecirulli precisely!

from pundit.

tomekr avatar tomekr commented on May 14, 2024 1

Hi @jnicklas, I agree with @gabrielecirulli that this method definitely can give a false sense of security. The use of this after_action is a bit confusing/mis-leading. Is the original use case for developers to use this during development only to flag methods that don't call authorize? Is this to catch instances in production that don't call authorize? If the latter is the case, then the vulnerability will still exist for any state-changing controller action. If the former is the case, then does a developer just leave this in their code even though it shouldn't ever have any implications in production code? I went through the same thought process as @gabrielecirulli after reading that section.

I think at the very least, there should be an explicit warning in that section of the README for developers not to rely on this method in production and that state changing actions will persist even after the exception is raised.

from pundit.

jnicklas avatar jnicklas commented on May 14, 2024 1

Is the original use case for developers to use this during development only to flag methods that don't call authorize?

Yes.

If the former is the case, then does a developer just leave this in their code even though it shouldn't ever have any implications in production code?

Yes. Because the whole point is that code changes, and someone else might do something which causes authorization not to be performed. It's a safety net. Removing it removes the safety net.

This method will raise an exception if authorize has not yet been called.

I'm not really sure how we can make this much clearer. If you actually read this section, I think it's pretty clear what this is for. I'd be open to a PR improving the documentation here if you feel strongly about it.

from pundit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.