-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Ubuntu attempting to edit the salt crashes keepass2 #26
Comments
Oh dear. "Generic Error" sounds super useful, doesn't it? 😂 At least it's not a NotImplentedException. I'll have to set up an environment to take a look at it, but it at least feels fixable! |
Definitely not the most helpful error XD. Appreciate you looking into it; its generally still usable, but for verbally sharable passwords (e.g. wifi), having Latin 1 supplement by default makes them effectively unsaltable. |
I know it's a pain in the butt, but as a temporary workaround, you can edit your KeePass' Also, just checking, you do use the default mate wm, yeah? |
yep! basic mate. Do you happen to have an example of the config settings? I went looking in |
Okay so, it's a bit cumbersome (because when I did the options saving, I used XML serialization so it ends up being escaped XML inside XML.) On my windows machine it's in the But in the config, it should be in the XML Path In that mess is an element (albeit escaped) named Make sure to do this while KeePass is closed, as it doesn't read/write the config file often, and it's easy to end up overwriting it if it's running and losing edits you've made. You can also add any of the other values for sources by using their Let me know if that helps! |
Hello, When opening the However mono can not handle it and crashes. Same issue (also in Keepass) was already reported to mono. But it still seems to not be fixed. Options for a fix until upstream Mono is fixed
I would personally vote for option number 3. It is the simplest fix without much impact. If @nitz is interested in any of the fixes - I can whip up a pull request. |
As per #26, Mono on Ubuntu apparently doesn't handle GDI+ rendering emoji, so this implements a small runtime test to probe that functionality. If it fails, emoji will be excluded from the set of default salt sources offered.
@SecurityCze I overwhelmingly appreciate you digging into this and figuring out the root cause. I did a bit of a twist on your 3 and 4 options there, and was hoping you could give it a shot if you had the time.
(see next comment) |
Maybe this will fix that last point I had without too much complication. At aa663fd, I added a test of each salt source as it will be populated in the config dialog. If it fails, it removes it from the sources put in the dialog, which will then allow the user to save that "safe" configuration. There's still a very small edge case where someone has enabled emoji (or added any sort of character that mono's GDI can't render) via another platform or manually to the config, where I'm assuming it'd fail to render in the actual password dialogs, but I think that's out of scope for this fix, which should hopefully be enough for the vast majority of any mono on Ubuntu users. |
I come bearing bad news... (such a shame, it was a nice solution) It seems that it only throws an exception when actually rendering something on screen in specific conditions. The test KeePassDiceware/SaltSources.cs Line 155 in aa663fd
I just found this comment.
Unless something changed this crash problem is limited to And I can confirm that. When I save the emoji as an advanced string field (in some entry), the text box is rendered as empty. But if I save it as username it crashes when rendering the list. |
Oh dear. What an absolutely bizarre issue to only occur in listviewitems like that. I was gonna just say "well I guess I'll just do the platform/runtime check as duct tape for now," but then I got curious and started digging anyways. The tl;dr: I think the issue may be coming from the custom These were the notes I was taking as I was investigating: Looking at the callstack on that bug you initially linked, the exception looks like it's coming from the I didn't follow the path all the way into cairo, but it is possible it's causing it in the translation from the cairo status to gdip's status, but I'm gonna just imagine that's a red herring at the moment. Stepping a bit further back up the stack, I took a look at the Now it certainly makes sense to me that it would draw the background rectangle before the text (duh, lol) but I can't see anything there that would make sense as to why So at this point, I'm thinking the GDI+ state must get corrupted by a previous Looking at the cairo implementation of string drawing, it seems like the code path can vary greatly depending on formatting flags. This is what gave me the idea to try adding the same string format that the DrawListViewSubItem produces to the test. |
Wow, nice work. I tested it. And it is detecting the crashes correctly this time. Unfortunately it broke indexing of the sources. When the source is removed and you then attempt to add a new source (by clicking on last/empty row) it crashes with ArgumentOutOfRange.
I did not have time to dig deeper (and unfortunately I did not manage to get remote debugging in WSL working). Maybe later in the week I can find a bit of time to find and fix it. And there is also an (unrelated?) bug (even in master branch) that the application crashes when removing a row of salt. It also throws an OutOfRangeException so it might be the same issue? KeePassDiceware/SaltSourcesForm.cs Line 163 in a390e6c
So it might need a bit of rework of how validation and adding/removing of salts is handled. That might fix both issues in one. |
All right, An exception is thrown inside Mono when adding a new row. Usually on windows, when clicked on empty row, default values are prefilled (and that probably means that a new object is created). However on mono, when clicking on empty row, nothing is prefilled. And when you attempt to write to a field it cannot modify an object that it did not yet create. But it does not end here. It only crashes when creating a first new row (for each instance of the form). When you click the empty line and then click away, the correct object is created. After which you can modify it no problem. What is even stranger is that any additional attempts to create a new line (I clicked on the empty row and set the name to "a") cause TWO additional "New source" rows to appear. If you just click on the empty line, and immediately click away, the two "New source" rows are still created. If this is not enough - the row validation is not working on Mono. There appears to be some strange delay where it is considering a state few changes behind. I even reworked SaltSourcesForm (in commit f3f7eb5) to use data bound DataGridView in hopes that it handles it better. As it stands now I do not know how to fix this. The exception (as you can see in the stack trace) is not coming from our code. So I do not even know where we could catch this and implement some workaround. What might help is attaching a debuger when running on Mono. So you can get mode visibility into what is going on. However I was not able to get this to work. So unless anyone has any ideas: I am personally happy with what fixes you did. At least it crashes in only one situation. I would only recommend modifying the warning message with the right ?pronoun? (not sure if that is the correct term for "they are"). Currently even if one salt source was removed it says that "1 salt source was removed because they are not supported..." - it should read it is. |
Glad that this exists, thanks! Kind of a strange error; when I clicked "edit salt" (to set it to get around special character requirements without using the latin 1 supplement), the program crashed. I got an error report the second time:
Maybe something about the way you're constructing that window is relying on a windows environment?
I'm on Ubuntu-Mate 22.04 specifically.
The text was updated successfully, but these errors were encountered: