Coder Social home page Coder Social logo

Comments (10)

IanMayo avatar IanMayo commented on May 30, 2024 1

It could be useful for us to think about the business requirements around permissions and user groups.

Here are some initial thoughts:

  • some kind of authentication required for an access to API
  • some users only have some verbs on API (GET), others have more.
  • some users only have some verbs on API for some tables

I wonder if there are any online sources with best practices for securing REST APIs?

from soul.

IanMayo avatar IanMayo commented on May 30, 2024 1

I've just thought of another approach to security. We could introduce a property whereby the API is only available to be called from a Soul Extension. So, users can create a static front-end-only site, host it as an extension, and the REST API is only available from that static site.

In this mode, Soul would not expose any REST routes at all.

That seems pretty bomb-proof :-)

What do you think, @AbegaM ?

from soul.

IanMayo avatar IanMayo commented on May 30, 2024 1

I've just thought of another approach to security. We could introduce a property whereby the API is only available to be called from a Soul Extension. So, users can create a static front-end-only site, host it as an extension, and the REST API is only available from that static site.

In this mode, Soul would not expose any REST routes at all.

That seems pretty bomb-proof :-)

What do you think, @AbegaM ?

FYI @thevahidal , @AbegaM and I are going to try to progress the above in coming weeks. We'll be sure to share design thoughts/plans before we start writing code.

from soul.

thevahidal avatar thevahidal commented on May 30, 2024

We can look for any good practices but there are two things that we must consider, Authentication (Which basically means if the user has access), and Authorization (Which means the level of access that the user has).
I think the something like PocketBase implemented it is really neat, maybe we can adopt their way of doing it.

from soul.

IanMayo avatar IanMayo commented on May 30, 2024

For old-skool web-applications, the hard work was done on the server, including making calls to other backend systems. CORS protection is valid in this context, since we can say Soul should only accept requests from the local server:
image

But, with modern single-page applications, it's code in the user's browser that is making the REST call. This means we have to open CORS for all addresses:
image

Sorry if I'm mistaken in the above @thevahidal , but it does seem that for modern SPAs we can only protect Soul in production via authentication and authorisation.

from soul.

IanMayo avatar IanMayo commented on May 30, 2024

Hello @thevahidal - if you're able to put any more high-level thoughts into here, we'll try to move forward on the further detail, and subsequent implementation.

from soul.

thevahidal avatar thevahidal commented on May 30, 2024

For the CORS thing we only have to tell Soul to trust the frontend web apps origin, so the browsers can't complain about it. But you're right that for true protection we need authentication and authorization.
But as you know it's a heavy feature and we need a good design for it.

from soul.

IanMayo avatar IanMayo commented on May 30, 2024

Here is the approach taken to auth in a similar app (PostGrest) - but it pushes most responsibilities to the database, but we don't have role-based table access in SQLite.

from soul.

AbegaM avatar AbegaM commented on May 30, 2024

@IanMayo That seems like a great idea. I will see how we can make the API only accessible from Soul.

from soul.

thevahidal avatar thevahidal commented on May 30, 2024

@IanMayo That's awesome, man. I can't wait to see your designs!

from soul.

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.