-
-
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
"Maximum depth of replacement has been reached" from unknown placeholder (curly bracket pairs in passwords/notes/...) #1741
Comments
This part of the code will be refactored in 2.4, I will keep the issue open to remember about it |
This one actually freezed my OS, I was unable to control it unless rebooted. This is the boot log that caused system freeze:
I didn't paste the |
@dminca do some of your entries/fields have a strange pattern of |
@TheZ3ro yes they have. My db has also been opened with KeeWeb and that one had the option to add references to usernames. I think that's the issue, I gotta hunt the entries down and replace them one by one. |
@dminca If you can, paste some example of those reference so I can reproduce your problem (obviously remove sensisitive data) |
Sure, no problem. This is a username reference: {REF:U@I:F268D4F0E0247219A14F9A525474001D} This is a password reference: {REF:P@I:E0251A47FF33684BBE4E19113A12FF7F} |
I think I have the same problem. I am new to keepassxc and before I used keepass2 with firefox and the addon "Kee". In every entry, which I added from firefox, are fields with {...}. e.g.:
Maybe that helps. |
Hi, This message disappeared, but I still have this one:
|
For me, this error only occurred on entries that had "Auto-Type:" or "Auto-Type-Window:" lines in the notes. Once I eliminated these from those entries, the errors stopped. It had nothing to do with username or password entries. |
I'm still seeing this with the latest Linux AppImage (2.4.3). I do have a bunch of entries that have JSON in the comments field. The annoying part is that the search box clears after a second or so, while spamming the terminal with |
I'm seeing the same message |
Same problem here with keepassxc 2.5.2. It is due to an entry with json. My password or my Notes contain something like that :
Is there a workaround ? |
Don't store json in the notes. Put it in a text atrachment. |
Some other useful tips to workaround this issue:
|
It is a nice coincidence that this very KeePassXC Wiki has entries which look like JSON and trigger the error messages... Is there a list of forbidden character combinations in Notes?
|
Those codes are for Auto-Type |
I needed to put JSON into the Password field, and now the logs are flooded with this Error Message. |
Stop storing json in notes is a workaround, not a solution. Users should be able to store any text in notes. We need to solve the issue instead of giving a workaround. |
I've also been experiencing this issue. I discovered that deleting everything in the Keyring folder solved the issue. Maybe the autogenerated entries in there created the right conditions for this error? |
Thanks for the hint @xlash123. When searching for certain keywords, Keepassxc would freeze for about 30 seconds and show the following messages on the terminal:
When the freeze ends:
Deleting the entry with the corresponding UUID (which had the title |
I recommend you store JSON as file attachments instead of notes. |
Why is JSON parsed at all? KPXC should not care what the content of the fields is, JSON or otherwise. If it is needed for REF handling, pass it through a regex first, to make sure it is actually a reference and not JSON data. Having JSON in fields makes sense in some use cases, particularly passwords stored through Secret Service, where a client application may want to store structured data in some of its secrets. |
If you want to store structured text fields, you should be using individual string fields for that. For anything else, use custom data. |
The Secret Service API does not support multiple (protected) string fields or custom data. The only spec-compatible way to store structured protected data is either shove it all in the single value field (which I think goes to Password in KPXC), or use multiple entries. This is up to each client application to decide, and is entirely out of the user's control. It is quite likely that some applications will choose to use the structured value approach. I think I recall Chromium doing something like that? Note also the And regardless, KPXC should really not try to parse arbitrary JSON, no matter what is the source or use case of it. |
We do not parse JSON. We only detect a reference if the text matches a pretty strict reference pattern. Line 1141 in 61f9221
|
This can happen even without Notes and without JSON anywhere. I just started using keepassxc. With a brand-new install (from the Debian sid repo). I created a database, added two test entries with generated passwords and no Notes, then noticed my terminal was full of these lines, and they just kept coming as long as keepassxc was running. Every time I changed desktop back to the desktop with the keepassxc window, I'd notice several more "Maximum depth" lines on the terminal. But I can't reproduce it. I removed ~/.config/Passwords.kdbx and ~/.config/keepassxc and started over, following the exact same steps, and this time I didn't see anything on the terminal except "QWidget::setWindowModified: The window title does not contain a '[*]' placeholder" (which happens repeatably when clicking Done on the password dialog for creating the database). So I don't know what was causing the "Maximum depth" errors. Is it possible that they're triggered by something in a generated password, and that's why they only happen sometimes? I didn't save the generated passwords from that first run, unfortunately. |
Ooooh possible that a generated password could cause it, especially if you use curly braces in the password. |
I mentioned a tip earlier (#1741 (comment))
Maybe the password generator can be changed to avoid such passwords by default. |
Nah, the better fix is to overhaul the references code. It is quite primitive and wasteful right now. It also doesn't need to even throw these warnings to the console unless in debug mode since they are meaningless. |
Ah, ignore my naive comment :) Looking into reference/placeholder codes, this pull request might be an issue: #1651. It allows |
Same issue here: |
i also see this flooding many dozens to hundreds of times (maybe more) in console, and searching for the relevent code I see two possible matches:
Briefly investigating to figure out how to reproduce, left clicking (default), or using up/down arrows to scroll through password entries (in the right main pane) shows variable 0, 1, or 3 lines in console per selection. I'll have to investigate more later if I have time to figure out what specifically in the entries is responsible for showing the console output, but for now I'm just mentioning here that I see this issue as well. |
@jasonkhanlar I updated the issue title to make it clear about the cause. |
When encountering a {brace-enclosed} substring, the placeholder resolution logic would previously keep recursing until it hit the recursion depth limit (currently 10). This would lead to "Maximum depth of replacement has been reached" messages, and was also wasting CPU cycles. Fixes keepassxreboot#1741.
When encountering a {brace-enclosed} substring, the placeholder resolution logic would previously keep recursing until it hit the recursion depth limit (currently 10). This would lead to "Maximum depth of replacement has been reached" messages, and was also wasting CPU cycles. Fixes keepassxreboot#1741.
* Entry placeholder resolution: don't overdo it After resolving placeholders, previously the code would do it all over again if anything had changed, multiple times up to the recursion limit. This would have the effect of applying a much greater recursion limit, which is confusing and unnecessary, and probably undesired. * Entry tweaks and minor refactoring - Entry::size(): when computing tag size, use same delimiter set as in other places in the code - Factor tag delimiter set regex out into global constant - Placeholder resolution: remove unnecessary special casing for self-referential placeholders (these are taken care of by existing recursion depth limit) - Placeholder resolution: less wasteful string building loop - Move some constants from being public static data members of Entry to being local to Entry.cpp (in anonymous namespace) - Migrate some QRegEx instances to QRegularExpression, the modern alternative - Miscellanous minor code cleanups * Entry: fix hitting recursion limit with {braces} When encountering a {brace-enclosed} substring, the placeholder resolution logic would previously keep recursing until it hit the recursion depth limit (currently 10). This would lead to "Maximum depth of replacement has been reached" messages, and was also wasting CPU cycles. Fixes #1741 --------- Co-authored-by: Jonathan White <[email protected]>
* Entry placeholder resolution: don't overdo it After resolving placeholders, previously the code would do it all over again if anything had changed, multiple times up to the recursion limit. This would have the effect of applying a much greater recursion limit, which is confusing and unnecessary, and probably undesired. * Entry tweaks and minor refactoring - Entry::size(): when computing tag size, use same delimiter set as in other places in the code - Factor tag delimiter set regex out into global constant - Placeholder resolution: remove unnecessary special casing for self-referential placeholders (these are taken care of by existing recursion depth limit) - Placeholder resolution: less wasteful string building loop - Move some constants from being public static data members of Entry to being local to Entry.cpp (in anonymous namespace) - Migrate some QRegEx instances to QRegularExpression, the modern alternative - Miscellanous minor code cleanups * Entry: fix hitting recursion limit with {braces} When encountering a {brace-enclosed} substring, the placeholder resolution logic would previously keep recursing until it hit the recursion depth limit (currently 10). This would lead to "Maximum depth of replacement has been reached" messages, and was also wasting CPU cycles. Fixes keepassxreboot#1741 --------- Co-authored-by: Jonathan White <[email protected]>
Expected Behavior
No errors printed in the console
Current Behavior
Several error messages like this are shown:
Possible Solution
Need brainstorming :) Maybe the same unknown placeholder shouldn't be processed more than once?
Steps to Reproduce (for bugs)
Context
Several long generated passwords contain the pattern {foo}, leading to quite a few error messages in the console, which is somewhat annoying
Debug Info
KeePassXC - 版本 2.3.1-snapshot
Build Type: Snapshot
修訂:46e8e3d
函式庫:
作業系統:Arch Linux
處裡器架構:x86_64
核心:linux 4.15.8-1-ARCH
已啟用的擴充元件:
BTW, I don't remember I got such a message when I was reporting #1137
The text was updated successfully, but these errors were encountered: