-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
FdoSecrets: Major Refactor and Code Consolidation #5747
Conversation
Updated the description. Loop in people active in the original PR: @jkloetzke, @Gigadoc2, @einsweniger, @intika, @fushinari @droidmonkey I know this PR touches many files. I tried my best to concentrate one commit to one thing, but the result is still quite messy. Please let me know is there anything I can do to make the review easier. |
a7dc9ba
to
65fe995
Compare
I really like the change to the single point of responsibility ( |
90c886b
to
d068c4d
Compare
All existing tests should be green 🎉. Working on tests for the new confirmation dialog
I'll see later if I can somehow improve this. |
0e7ecbc
to
0041376
Compare
Ready for review. The alarm in CI CodeFactor is a false positive: it's a completely different |
Excellent! Will review this on Wednesday |
Great :) 👍
|
Why not re-use the browser access request dialog? Can rename it to a general "EntryAccessRequest". |
I wanted to. The code was mostly copied from the browser access request dialog. But there are some subtle differences in the auth model between the browser and fdosecrets, e.g. the remember decision in browser is permanent, browser can also remember deny decisions, while in fdosecrets we have at most per client per connection memory. And I think we haven't settle down on what should be in the fdosecrets access dialog, e.g. whether we show warnings or tooltips about the client identity isn't that reliable, and the decision is only remembered for the duration of a connection. So IMHO first iterate the dialog in fdosecrets and then when we know for sure what functionality we need for the auth dialog, we can make the browser auth dialog a generic one. |
sounds good, I just see a whole lot of similarities and would personally have chosen customization flags to the access control dialog over re-implementation. I can see other future uses of this dialog (for example CLI access to a GUI opened database). |
826fc0c
to
4b471aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't get the "Allow all future accesses" to work when using secret-tool to test.
I cleaned up the commits.
4b471aa
to
c85de00
Compare
@droidmonkey After a second thought, the DBusTransaction doesn't make accessing client info explicit without a significant amount of rewrite:
Stepping back a bit, our goal is to make the client info access explicit, so code in the future doesn't accidentally read client info when there's none and also always read the correct one in case of concurrent calls. To achieve this explicitly, it's unavoidable to pass a client parameter around. It is however possible to make this parameter optional, and only use it when the function really needs it. So here's my latest implementation:
Overall, this approach doesn't require much change to the codebase, but removes the need to have a static global context. |
@yan12125 The "remember" feature uses DBus address, which is guaranteed by the DBus spec to be unique. There are some good discussions about PID in #4733, but those are about showing the PID and program name to the user. Reguarding to your issue about the auth dialog shows up twice, could you try to run the unittest and see if there's any failures? There's test making sure the remember feature is working correctly. If the test passes but the issue is still there, then we can investigate in details. |
487a01d
to
3593144
Compare
@Aetf excellent work and that definitely addresses my concern and the assert issues |
3593144
to
d4aa094
Compare
d4aa094
to
c5fe4a7
Compare
Great! Thanks for the information.
With the latest patchset, all tests pass on Arch Linux, but I still got two prompt dialogs for nextcloud-client. Looking into my logs at #5747 (comment), both requests are from the same sender |
Ah, is the "Remember" feature done per entry? Then two prompt dialogs for nextcloud-client are expected as those are for different entries...
Might be better as
|
@yan12125 Yeah it's per entry. I updated the text to be more clear. |
@droidmonkey Ready for another round of review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made final conversion of DBusMgr references to QSharedPointer's. This is ready for squash and merge. Due to the back and forth between all the commits here I am going to squash into one commit with a long message.
d6d3d2f
to
3d7908a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After converting dbusobject to use qsharedpointer, their original parent should save a copy of the pointer. Right now Service only saves non owning raw pointer to collections, so does collection/item and prompt. So new objects are dropped immediately.
Sorry, never mind the above. I was on my phone and missed something and thought you converted every dbusobject to use Qsharedpointer.
3d7908a
to
35e9e8a
Compare
DONE! You earned a cookie for this one 🍪 |
Big thanks to everyone involved! |
Congratulations! |
@Aetf You should post this and other spec issues you've encountered, such as lack of PS: Thanks for all the great work! Also to the maintainers etc! |
This PR is another attempt to implement the optional confirmation for accessing passwords. Different from #4733, this time
QDBusVirtualObject
is used as the bridge between our business logic and the dbus interface, allowing greater access to caller information, so that the per-item locked state is correctly reported depending on the asking client.This replaces #4733 and fixes #3837. The following changes are included:
QDBusVirtualObject
to interact with dbus instead ofQDBusAbstractAdaptor
sDBusReturn
related types and replace with simplerDBusResult
DBusObject
DBusMgr
, moving session cipher negotiation state to per-client stateMoving to
QDBusVirtualObject
The limitation of #4733 is that when using
QDBusAbstractAdaptor
to expose objects on DBus, Qt provides no way to get caller info when accessing object properties, which means we can't properly report locked state.While I'm working on reviving #4733, I found that despite what I said, it's not hard to switch to
QDBusVirtualObject
and it actually helps reduce code complexity and creates cleaner separation between business logic and dbus handling boilerplates.The new
DBusMgr
handles dbus service/path registration, signal relay, and method delivery. It also provides a centralized place to manage caller information. The comment on the class gives more implementation details about method delivery and Qt metatype registration.New auth dialog
The new authentication dialog is similar to the one used in the browser plugin and allows the user to trust the client for all requests or only selected ones. The wording still needs improvements to maybe highlight the remembering only lasts for the duration of a single connection. Suggestions are welcome.
Currently, there is no way to only allow access once. But I think the current functionality is enough for an MVP.
The blocking
prompt
methodIn some cases, the
UnlockPrompt::prompt
is blocking and has the potential to timeout the client. But this problem is not unique to this PR. Other prompts all have the same problem. The proper implementation should probably use aQTimer
to post the actual dialog showing in the event loop and return immediately. This can be left to another PR.TODO
There is something I wanted to finish before I consider this out of WIP, but I want to share it early to get feedback while I'm working on it.All done.Screenshots
Testing strategy
Updated existing tests to match the new internal API. Also added new test cases.
Type of change
While this touches a good number of files, many of them contain only trivial changes (i.e. changes to function parameters and such). Most of the work is in
dbus/*
.