Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • The idea of apps accessing a database directly instead of going through an API keeps popping up every few years. It never works. And the reason is exactly about authorization. Google CouchApps and read the post they wrote about why doing that is a very bad idea, despite sounding awesome without spending too much thought on it.
  • If people manage their own data, that essentially means each person has their own database. And a database has to be connected to an application. Whenever the database schema changes, the application's CRUD operations have to be updated as well.

    In the end, it seems likely that everyone will develop and maintain their own web application, and if others need access to their data, they'll expose it through APIs.

  • I feel like this blends two discrete things

    1. Can I have access to my data (the side effects of my interaction with an application) in a portable way?

    2. Can I stop or prevent others (like the application author) from having access to my data?

    I wonder which -- if users had to choose -- they care more about? I think for most uses its #1 unless its very personal data, in which its #2. I love the idea as presented in this article but I'm not so sure how practical it is. I don't know how much overlap there is between "author has to run application a central server" (can't just be a local app) and "author must not retain data".

    Seems like a really awkward space to inhabit.

  • (Author here)

    Hello there! I agree users may want one or both of these features in their interaction with an application, and that their preferences likely vary depending on the type of data we're considering. The way I'm reading what you're saying, there's some sort of tension or tradeoff between the two features that I don't fully understand. Can you help me understand it a bit better? Thank you!

  • I really like this concept (though the post is terribly named as others have said). "Databases that are easy to make as documents" is so obvious that you wonder why it isn't more of a thing. Add in "untitled" databases that live in a session/browser so you can "try before you buy", maybe the option for single file databases with no intermediary/service (so you have a Databases folder that is as messy as your Downloads folder... but is that really so bad? better than a password manager full of garbage services IMO), and you basically get EASY seperation between application and data, which is Good for a lot of reasons (lock-in, ownership etc)
  • Not sure this does anything for data portability, since apps will just store the data as encrypted & signed BLOBs.
  • I've been hacking on my own task manager on-and-off for years (https://the.do.zone). It has no database; the primary store is the browser, and you can optionally sync to local file system (if using chrome), dropbox, or google drive (less optimal for my needs, because their js oauth implementation is very conservative about token length.) It has some crude but functional diff resolution, so that you can sync across multiple machines. Browsers _could_ provide better tooling to make this kind of app architecture more convenient to write; and theoretically you could imagine cloud providers providing some kind of standard for datastores. But there's no market for it; non techies really don't care about the location of their data to any great extent.
  • They do care, but not at the right point in the sales cycle. They care about the eventual bait and switch. They care about how in the face of that pack of lies they can't even recover their own data in any capacity whatsoever. They just don't recognize ahead of time that data location is a critical ingredient in preventing recurring pains they definitely know and understand.
  • 1. How do you get around performance issues? If I have a difficult join and you have a slow database, or you have a flaky connection, how can I debug the problem on my end?

    2. What stops me (or any attacker) from exploiting your lack of security? Are you 100% sure you are secure?

    3. You mention collaboration - How does this work at a company level if we have many users and need to control access - the company is the entity with rights to the data in this case.

  • Author here.

    Thank you for your questions. I'll take a stab at answering them: * The underlying databases that ayb fronts are SQLite and DuckDB. Both are relatively battle-hardened RDMBSs. That said, I don't think the approach I'm proposing has any bearing on the difficulty of a query: if a centralized DB would struggle with a query workload, the personal DB is likely to as well. One saving grace is that workloads are slightly more isolated in my approach: someone else's data that's poorly shaped for a query shouldn't affect your queries, which is not something most all-users-in-the-same-database approaches can claim. * I make no special security claims beyond what is listed in the documentation [1]. ayb specifically has been used in production by low single digit numbers of people, so you should absolutely wait to use it for any super-sensitive data, especially in a shared/multi-tenant context. That said, you should be no more confident in the random web app that stores your data for you than you are in ayb's security. * This blog post is focused on personal data: the to-do list, the streaks/goals you've set out for yourself, your database of newsletter subscribers. I think there's some interesting work to be done in the enterprise around access control. In ayb, there are coarse-grained sharing/permissions [2], but I don't think that's enough for most enterprise situations.

    [1] https://github.com/marcua/ayb#isolation [2] https://github.com/marcua/ayb#permissions

  • We are back to File->Open I guess. We could use native applications instead of web apps while we're at it.

    Sadly this approach does not work for a lot of (web) apps.

    by _def
  • yeah, to me this also pretty much sounds like the approach we started with, we bring our data (as a file) into the application and it stores it back if we want to.
    by mqus
  • Author here!

    The solution I'm proposing does not assume the data is local to the user's machine. In the video attached to the blog post, a web application is authorized to access a database hosted by a different service/domain. While the blog post covers collaboration/social data as current limitations, I'm curious what other classes of web apps you think don't work with the proposed approach?

  • So many tools and libraries combine authorization and authentication, and it’s hard to find an authorization server that lets you outsource identity.

    (All too often the underspecified abbreviation “auth” is used to cover both.)

    Shameless plug: My colleagues and I implemented a minimal authorization server that lets you leverage a trusted identity provider of your choice (like Entra ID or even Auth0/Okta) and handle authorization. It looks up what roles and permissions the identified user should be able to have/grant and issues tokens containing that authorization.

    https://github.com/DMGT-TECH/the-usher-server

    by pakl
  • Nice! If it works with Authelia (or Authentik) too then I'm sold. Thanks for sharing.
  • Got drawn to the topic, however usage of authentication and authorization seem like misnomer here, the core topic seems to be data ownership

    The concept on a surface level to have ownership over the data makes a lot of sense and to a large part the support exists in a fragmented manner across the different providers/applications.

    The concrete idea of user having a database and then authorizing that to the service is highly impractical. It might be applied for experimentation purposes in highly controlled environment but cant scale beyond that.

    1. Databases require maintenance, backups, failover

    2. Schema update are nightmares. No one is ever comfortable with it, specially the bigger you are.

    3. Authorization seems to be following one to many pattern here, one database and multiple applications. Its a no go in case of update operations

  • yeah the article is dumb.
  • (Author here)

    Thank you for pushing on this. Some clarifications that might help you see this as more practical than your initial impression: * I totally agree that databases require maintenance, HA, etc. My argument is not that someone running a database magically doesn't have to do these things, but rather that the person running the database doesn't have to be the person running the app. In the video attached to the blog post, you can see that separation in action: marcua.net hosts the Todos app, but thedata.zone hosts an ayb [1] database instance. As the owner of thedata.zone, it's my responsibility to configure the database for stuff like offsite snapshot-based backups (which I've done). * Schema migrations are an application-level concern, and are no more or less challenging in the model I'm proposing. As a convenience, in the ayb.js client I open sourced, I add some utilities for forward-only migrations to make it a little easier for application developers who build around ayb to have migrations fire at the right moment in their application's lifecycle. * Authorization is definitely not assumed to be one database to many apps. In the video, look for how the user already has a streaks.sqlite database (for storing streak data) and creates a new todos.sqlite database for storing their to-dos.

    Thank you for engaging on this! I look forward to hearing your thoughts!

    [1] https://github.com/marcua/ayb

  • Yes, it still does authentication. It's just about hosting the data, which might make sense for niche scenarios with well defined scope. Unfortunately, many data-driven systems need some kind of data sharing. Relying on data from multiple custodians is possible and could be cool but brittle if a single view is pulling data from many custodians. Also it would be impossible to run meaningful analytics on such scattered data... I guess that could be seen as a feature.

    I think this may end up happening naturally over the next decade or so thanks to AI coding. People will just stick web components bound to different data sources on the same page without even realizing it. Data can be joined and chained together on the frontend. Some shared authentication standard like JWT with asymmetric key signatures could potentially facilitate that. Multiple data custodians could verify the same JWT using the user's public key... Account could be hosted on some blockchain so it's not centralized.

  • (c.f. other comments about confusing misuse of security terminology)

    An easy way to remember the difference between the As in AAA:

        Who is your daddy, and what does he do?
        ^ authentication       ^ authorisation
    
    And the all too often forgotten final A is accounting, for which you can imagine Arnold writing down the interaction in his police notepad.

    :-)

    by jdub
  • ah, the tragic truth of there being no daddy at all alive. alice bawled.
  • It seems like your unnecessarily kinky mnemonic also forgot the third "A". Don't mnemonics usually cover the entire list of the thing you want to remember?
  • I have shitty memory and never confused those... something else is amiss here
  • ah, but the confusion in the security model of a more-than-one-daddy family.
  • Simplified:

        Who are you and what do you want?
  • The English isn't that hard to remember though. Authentication == determine whether it is authentic (you are who you say you are). Authorization == are you authorized to do something (I know who you are but you are not authorized to do something). I hope the average reading level hasn't fallen to the point where that is confusing.