Skip to content
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

[FEATURE]: add safe-mode for sensitive bin files for markdown view #85

Closed
2 tasks done
WarmWelcome opened this issue Jan 21, 2025 · 7 comments · Fixed by #92
Closed
2 tasks done

[FEATURE]: add safe-mode for sensitive bin files for markdown view #85

WarmWelcome opened this issue Jan 21, 2025 · 7 comments · Fixed by #92

Comments

@WarmWelcome
Copy link

WarmWelcome commented Jan 21, 2025

Settings

Absolutely everything disabled or clear (input fields) except for silent errors (enabled) and grouped extensions (enabled, contents below).
markdown: conf>> config> data> logs> json> yaml> yml> csv> txt> reg;

What the essence of the bug

Windows 10, latest build
3.0.2 (Latest version, the highest the dropdown will allow me to select is 3.0.1)

Cannot interact properly with registry (.reg) files properly in markdown view. This is using group mode and the standard extensions mode. Modifying these files in any way will make them unrecognizable to windows for some reason, down to adding a single character to a comment. Removing the change that was made will not fix this, they will be broken after modification in markdown mode. Opening a registry file that has been "tainted" in notepad with the same contents as a regular one, it appears to be completely unchanged from normal. Comparing the hashes of both, however, they are different. You can see when it stops behaving in a working way when the registry preview stops seeing what folder it will be placing a key into. For looking into this, I would recommend getting microsoft powertoys and enabling their registry preview and testing modifications with the "reload" button in the top to see when it breaks the file.

For anyone looking to edit reg files currently, I would suggest you use codeview in groups. It appears to work properly so far. Will update if it ends up having any issues.

TO FIX BROKEN REGISTRY FILES: Open file in windows notepad. Copy contents with ctrl + a, ctrl + c. Create new .reg file and paste with ctrl + v. You cannot paste it in place.

Image

Image

Image

Image

Version of an project's essence

Other (specify in issue)

On what OS you have encountered the bug.

Windows

Code of conduct

  • I agree to follow this project's code of conduct

Issue policy

  • I agree to follow this project's issue policy
@Falcion
Copy link
Owner

Falcion commented Jan 21, 2025

Thanks for opening this discussion-issue, this problem really exists and, unfortunately, the plugin has nothing to do with it, i.e., it can't fix it: OBSIDIAN itself likes to corrupt binary or other similar non-text files (and I don't know why), such a case has already happened with files of the MS Office ecosystem, etc.

It is for such purposes that various warnings were created, and in particular, "codeview", which should at least try to avoid such data distortions.

This topic will remain open for discussion of problems of this or similar nature.

  • I will edit the versions in dropbox: thanks for the comment about them!

@WarmWelcome
Copy link
Author

Okay, thank you for the quick reply. I request that you also prevent registry files (and other files with this issue) from being assigned to the markdown editor altogether, to prevent accidental damage. Anyone who encounters this issue would have an incredibly difficult time figuring out what is wrong if they accidentally mistype an entry and mess up all of their scripts. Can you also include a warning for using md mode with registry files with the grouped extensions, along with whichever other extension assignments will cause severe issues that you have noted?

Additionally, where can I find the list of supported views? Currently, it seems like there is no list for them, which is a problem because these views would normally be defined by their extensions in these boxes. I had to use trial and error to find out that you cannot specify codeview without a space, and markdown instead of md, etc. It should probably be here and possibly have a direct link available next to the grouped extensions setting for ease of use.

Thank you for this project by the way, this is nearly exactly what I was looking for when I wanted to add the ability to edit stuff other than markdown. If only it was easier to find haha

@Falcion
Copy link
Owner

Falcion commented Jan 22, 2025

Okay, thank you for the quick reply. I request that you also prevent registry files (and other files with this issue) from being assigned to the markdown editor altogether, to prevent accidental damage. Anyone who encounters this issue would have an incredibly difficult time figuring out what is wrong if they accidentally mistype an entry and mess up all of their scripts. Can you also include a warning for using md mode with registry files with the grouped extensions, along with whichever other extension assignments will cause severe issues that you have noted?

I agree, such functionality should rather be added, I think to implement it in the form of a "safe mode", which the user will be able to disable in case of extreme necessity (after all, limiting the "sandbox" in the form of OBSIDIAN is not in the philosophy of the project), where this mode will already perform the above-mentioned functionality.

I will add a warning, I will just have to think about how exactly to add it carefully, in order to avoid a "wall of warnings and errors" instead of the plugin settings themselves, but this is understandable on my side.

Additionally, where can I find the list of supported views? Currently, it seems like there is no list for them, which is a problem because these views would normally be defined by their extensions in these boxes. I had to use trial and error to find out that you cannot specify codeview without a space, and markdown instead of md, etc. It should probably be here and possibly have a direct link available next to the grouped extensions setting for ease of use.

In short terms, views can be assigned by their ids (codeview is defined ONLY by "codeview" string-value), list of default views and related extensions you can read in the knowledge base:
https://github.com/Falcion/UNITADE.md/wiki/About-views-and-registries
https://github.com/Falcion/UNITADE.md/wiki/About-views-and-registries#registries

To add about ids of views, OBSIDIAN creates any view with "special type", which is assigned by this function:

// Codemirror's view type:
getViewType(): string {
    return 'mirrorview';
}

"Each view has a unique identifier."
About views and registries, wiki of UNITADE

Yeah, but I think I could add at least a link to the knowledge base for people to find default views and how the work and etc., but grouped extensions also allow you to work with custom views from different plugins (for example, MAKE.md), so I couldn't state every view possible.

I would convert this issue in other and add to the project & milestone of UNITADE's next version.

@Falcion Falcion changed the title [BUG]: .reg file interaction issue [FEATURE]: add safe-mode for sensitive bin files for markdown view Jan 22, 2025
@Falcion Falcion self-assigned this Jan 22, 2025
@Falcion Falcion added this to the v3.1* - UNITADE milestone Jan 22, 2025
@WarmWelcome
Copy link
Author

WarmWelcome commented Jan 22, 2025

Thank you for resolving this so quickly.

I will add a warning, I will just have to think about how exactly to add it carefully, in order to avoid a "wall of warnings and errors" instead of the plugin settings themselves, but this is understandable on my side.

Okay. I do not know how it could be implemented either. It is a difficult task, good luck.

Yeah, but I think I could add at least a link to the knowledge base for people to find default views and how the work and etc., but grouped extensions also allow you to work with custom views from different plugins (for example, MAKE.md), so I couldn't state every view possible.

Yes, I did not know that page existed. I did not know to look for it there. A link to a list of supported views would help greatly

@WarmWelcome
Copy link
Author

Have you considered adding a supported view matrix for when we find these so that they are documented? Something like the following, or just putting which ones and then listing what they are supported by? This way we can see which ones are supported without having a complex list of warnings everywhere, it would be consolidated and easier to update.

md codeview etc
md x x
txt x x x
csv x x
reg x x
bin x

@Falcion
Copy link
Owner

Falcion commented Jan 27, 2025

Sorry for the long wait.

I suspected this format to indicate to users which extensions interact poorly, but not the exact format, I think the matrix will be an interesting solution indeed, thanks for the tip!

I'll add this either to the context or directly to the "safe mode" page on the wiki when I develop this functionality.

@Falcion Falcion moved this to In progress in v3.* - UNITADE Feb 11, 2025
@Falcion
Copy link
Owner

Falcion commented Feb 11, 2025

Functionality already implemented on release branch:
https://github.com/Falcion/UNITADE.md/tree/release/v3.1.0

If you want to check and, possibly, expand "unsafe extensions" registry, see constants file:
https://github.com/Falcion/UNITADE.md/blob/a80d8efda11aafc81de079be583f5a2a079aa079/source/utils/constants.ts

Note

Release will be published when correspondive documentation will be written.

@Falcion Falcion linked a pull request Feb 11, 2025 that will close this issue
3 tasks
@Falcion Falcion moved this from In progress to Ready in v3.* - UNITADE Feb 11, 2025
@github-project-automation github-project-automation bot moved this from Ready to Done in v3.* - UNITADE Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants