HaikuDepotServer + SSO - Follow-on discussion

Hello @nephele ;

I’m bringing this over into this separate thread so I can keep the original thread focussed on getting users linked for SSO.

Some high level stats; as of now, there are 23 user who admin packages and 432 users who have ever made a rating.

I’m curious, I’ve never registered for the HDS service.

There’s a plan for the whole project here which you can read over. It’s going to take a long time to complete as it covers two major changes. Currently it’s early in phase 3. Happy to clarify anything there.

Is a SSO account now automatically a HDS account aswell?

Not yet, but after phase 3 of that plan yes!

Also what “flow” will the desktop HaikuDepot application allow then to login? do we need the web-based flow? or can there be a nicer flow for this

It will use OIDC Device Flow; probably with polling checks from HaikuDepot. This flow uses a web browser where the web browser and authentication could progress on a different computing device to where HaikuDepot is running so that if the Haiku computer has no browser itself, it’s still possible to authenticate.

Sticking with the web based UI is the better strategy. The SSO system has an established web UI surface and re-implementing this native creates room for security issues and will be complex because it may need to deal with multi-factor authentication including TOTP capture, hardware MFA, Passkeys, email-verification etc… depending on how the SSO and/or user is configured. The mental model is that SSO “owns” the interaction with the user to authenticate and then hands back to the application.

3 Likes

Thanks for the reply :smiley:

The web based flow is concerning to me, as it stands right now the UI is quite horrible, and with possible 2fa this does not promise to get better.
I have to use some web based flows at work and these flows are so slow they want me to throw the tablet at the wall. Granted, our SSO is not quite as bad. But it still has major deficiencies like having to have the password on a whole second page, no way to use tab to switch to the password field, wierdly large dialogs, no dark mode or Native looking controls, etc. (EDIT2: granted, fixable with some CSS or html edits. I offered to help out here months ago, but accesibility and dark mode in our sites seems to be an after-the-fact thing… and the css is in no repo I can access to fix it)

Personally if I have to use this flow on the desktop in addition to the “Web” (for gerrit) I would probably then not use it in haikudepot at all.

Ok, sure. But the Web is similarily insecure. Just that now It is on me to support this in WebBrowser :smiley: (and quite frankly I’m not looking forward to WebPositive beeing in any way required for “security” infrastructure, that just screams bad to me, EDIT: especially in webkit1 where basic memory segmentation between tabs in the same BApplication cannot be guranteed. Any native software would atleast have the basic “can’t read your adress space” gurantee… not that this is very strong gurantee with debugging apis available)
I figure supporting a Fido key or something in native software would be easier than having to support it in native software and then also in the webrowser. TOTP, MFA etc (and passkeys) are also prime examples for me as things that would first have to be implemented in native apis to be properly usefull, before we consider hooking this up to a webrowser.

I very much apreciate the possibility to complete the flow on another device, though I fear this will not ultimately lead to a good user experience. Though still much better than having to complete it on Haiku only.

Granted, our SSO is not quite as bad.

The Haiku SSO interactions seem totally fine to me and once somebody has authenticated then their renewal token will be stored to re-authenticate next time so it’s not something which somebody will do frequently. If you really can’t trust the browser you are using for some reason then there are options off-device as I’ve mentioned.

as it stands right now the UI is quite horrible

Entirely separately from what I’m doing, if somebody wanted to customize the KeyCloak login page, there are online resources covering this; here and here for example. I’m guessing you could download it, install and play around. I’ve installed it locally for dev which was fairly easy.

A native interface however I really don’t think makes sense. It would require the Resource Owner Password Flow and you’ll find most/all IDP products will echo something like this industry body advice;

The resource owner password credentials grant [RFC6749] MUST NOT be used. This grant type insecurely exposes the credentials of the resource owner to the client. Even if the client is benign, this results in an increased attack surface (credentials can leak in more places than just the authorization server) and users are trained to enter their credentials in places other than the authorization server.

Aside from being ill-advised, it would also be a huge amount of work. There’s already a huge amount of work in getting all this done so I think it best to stick to standard, recommended integrations using a browser that will function and are less maintenance.

I agree with nephele here.
I don’t like having to use a webbrowser to login in a native application.
I know that it has become a trend over the last years,even some email providers are doing it (causing issues with the Haiku-native Mail) and I hate it.
Requiring a browser for registering or managing the account may be okay,but at least logging in should work directly in the application using a native UI.
I honestly can’t think of it being extremely complicated either.
Maybe Keycloak provides a API for it,I don’t know,but even if it doesn’t,then sending the login form and parsing the resulting response page should work,even if it may not be super elegant.
More generally,I’m not a fan of mixing third-party projects (like Keycloak) with our own server projects (like HDS) at all as that will result in stuff not feeling consistent and perfectly fit together anymore,more like using a Linux system rather than Haiku.

It would be ideal from an aesthetic perspective, but in balance is not worthwhile.

The trend you are noting where projects use Identity Provider (IDP) products like Okta, KeyCloak, Auth-0 etc… etc… are doing so precisely because this area is complicated and difficult to get correct.

It’s called OpenID Connect (OIDC); an widely used, stable and open standard for this purpose. As above; the integration point where the client provides the credentials directly is advised not use for good reason. Simulating an HTML form’s behaviours as an API is not a good idea because the technique is likewise insecure and prone to constantly breaking as the IDP is upgraded.

Generative-AI aside, It would be very rare on a project to have the resources available to correctly implement and maintain a full OIDC solution with MFA etc… Haiku certainly doesn’t have this capacity and attempting such an undertaking would be wasted effort that could go into things that actually matter.

I’d turn this around and say it’s very lucky KeyCloak and OIDC are available and the project should integrate in an industry standard / advised way and avoid doing anything that will cause maintenance burden.

SSOs I’m forced to use in other contexts have me relogin daily. Gerrit also needs me to re-login frequently.

The UI was not fixed or adjusted. Theoretical capabilities do not help me, I already know css et all. This is a commono problem with Haiku infrastructure though, I have to ask for months or years before something like a css theme is deployed; I know you have this problem aswell with HDS deployments. (and on the other hand it seems there is no interest from the infrastructure team to have other people help out)

This is not really accurate. You are going from “We use keycloak, therefore we need X”, usually you first go through the requirements and work backwards from there.
(also to the “user training” part of the quote, this establishes the exact oposite. It trains users to enter credentials in random websites, not native interfaces… I don’t see how this is better)

This standard is also primarily targeted at “the web”, So yes, it obviously comes with all the downsides of the Web, like an unstable api here (if you need to simulate “forms” or whatever)

In any case, the current HDS has auth that works, so you already seem a bit wrong there. There is also solutions like LDAP that work on the serverside directly. (and these systems tend to just use that in the backend anyway)

If this is true, then we also can’t use it in the web. If it is false we can use it in native apps and the web.

1 Like

I am trying to get an HDS account login (“autumnmeowmeow”), but having trouble actually getting it created.

I used the web site to create, it didn’t seem to accept the password, but did create an account? I can email a password reset link and get it, but actually following that link from the browser to get the password reset results in an error.

I appreciate any help! :slight_smile:

Hello; It looks like there’s a bug there from recent changes. In the URL you have received in the email there will be a token;

It will be `__passwordreset/<token>`

Take the <token> and add it into this URL instead;

https://depot.haiku-os.org/#!/completepasswordreset/<token>

Can you do that as soon as possible because the token will expire. If it has expired; try repeat the process. I’ll try get to that soon.

I’m intending to store a refresh token in the client to prevent this. Not saying a re-login won’t be necessary ever but it hopefully won’t be frequent.

Are you able to explain what you mean a bit more - do you mean you had tried to previously re-style the login page and experienced difficulties?

KeyCloak or any other IDP; it’s the same architecture and arrangement. Yes the approach is to use an IDP.

I’m still not sure I see the large downside of using a web browser. The IDP works across platforms and networks and the common denominator for progressing a user authentication independently of a downstream application is a web browser. This seems a sensible approach to me.

Identifying the private interfaces that the IDP uses to drive it’s own UI as an “unstable API” isn’t fair. It’s not an intended integration point; not an API you are supposed to use. It’s by design that an IDP owns the authentication interactions with the user (typically via a web browser) and not the application. There is a well defined open standard for interfacing with an IDP system such as KeyCloak which is OIDC. As I’ve pointed out twice already, there are means in the standard to supply credentials directly to the IDP using defined interfaces but it is strongly discouraged because this approach is prone to security problems and is not the intended architecture.

I implemented LDAP in HDS back in 2013 actually (now removed) for this very reason. However this leaves me still managing the authentication and still writing all the UI surfaces and internal flows such as “create user”, “update user”, “password reset”, “email verification” and possibly “MFA” etc… myself still. It’s an inferior outcome and is not worth the effort.

In the current situation, yes these things are working today (excepting password reset it seems :backhand_index_pointing_up:) but if you read my planning document, you will know that these functions will largely have to be rebuilt. This is a large effort which is absolutely pointless since SSO already does all these things and does them better.

It’s more sensible to use the SSO functions and focus on things that matter such as sorting out the job system in HaikuDepot, implementing Paige text engine, making HaikuDepot work better with high DPI screens, improving the JSON parser, differentiating repositories in the UI, fixing bugs, renaming symbols that are confusing etc… etc…

I’ve offered to help out, but so far have not been provided with and repo, access etc. to do so. I’m not going to make a css change to an internal service again and then have to lobby for a long time to have it included (just so it can then be reverted on a whim by someone else. e.g trac and link colors on the website (which have again turned unreadable in dark mode, as someone changed them, and I can’t submit a fix because someone decided that we have to use github))

The “intended” API here is a full Javascript, WASM, HTML, CSS runtime. This is a huge surface compared to the “proper” flow. If the proper flow is discouraged because it is hard to get right, why do you think it is reasonable to instead mandate that a hugely complex piece of software like a webrowser is required?
The maintenance argument cuts both ways. Currently Haikuwebkit is maintained by Pulkomandy and myself, I don’t want to be responsible for having to ensure some code I can’t control runs in an enviroment I have to maintain with endless specifications.
Having a simple SSO spec would be much, much better. There is not even a rule that this has to be HaikuDepot specific. The OS could provide any api that is required. HaikuDepot already has a lot of homegrown stuff (Like the textview, which I understand you now wish to replace with paige? I’m not sure why we haven’t gotten the textview atleast into libshared yet?)

The server side of all this stuff makes sense in a identity provider sure, but that doesn’t mean we should use a huge and complex flow requiring downloading code at runtime to interpret…

1 Like

Surely that’s already the case - it’s the web! :wink:

In the end I don’t have time to devise, create and maintain a sort of bespoke “Haiku SSO” with custom specifications. I’ve actually barely got time for any of this. Unfortunately this issue has to be dealt with and the SSO will get rid of a chunk of the work by removing duplication and at the same time providing other benefits.

I can see the argument you are making, but I personally don’t see the web browser being involved in the authentication process as a problem. In my opinion, it’s better to do a standard OIDC integration that works robustly with the least on-going maintenance and drama.


If I had the time, I’d be interested to investigate that (there have been some threads in the forums with the owner" of the library) but haven’t had a decent look yet - it might be a good option to get a more full-featured text engine, but I really don’t know TBH.

1 Like

Hi there @AutumnMeowMeow ; that issue with the reset password function is now resolved and a new version of HaikuDepotServer is deployed carrying the fix.

1 Like