-
Notifications
You must be signed in to change notification settings - Fork 266
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
Could we help developers detect and prevent issues of trojan source in their projects? #14
Comments
If you are using VSCode (desktop app, online, GitHub codespaces, etc.), I have used the Highlight Bad Chars extension to detect weird dashes and spaces in the past and it does show the BiDi characters. This will at least let you know if there are bad characters there. I've also noted that GitHub is now displaying a warning when viewing BiDi trojan source attacks in the web UI. |
A GitHub action would also be useful for developers to quickly add to their workflows. |
While the VS Code extensions are nice, and even some improvements to the default VS Code settings and on GitHub, it's just not enough and you can't force everyone to download these extensions. Instead, adding the ESLint plugin to surface such issues in the CI and break it before changes are merged is more actionable and secure than trusting that all developers adhere to specific extensions and setups. |
@jhollowe agree about the GitHub Action idea. That would be a super nice thing. Would you like to submit a pull request on the anti-trojan-source repo that creates one? I'll be happy to merge it in and submit to the marketplace. |
Isn't there a "trusting trust" issue with such codes that attempt to identify bidi attacks? |
fyi, I hacked-up a simple GitHub Actions workflow that looks for Unicode characters in the changes made for a given PR If any unicode characters were added in the commits comprising the PR, it adds a comment to the PR with the text
Example PR: If no unicode characters were found in the diff, it adds the comment
EDIT: I published a small write-up about how to use this here: |
I agree that extensions are not the best way to mitigate this, but it’s a good start until the IDE implements checks for this natively. I created the ShaneRay.InvisibleCharacterVisualizer Visual Studio extension awhile back that seems to catch a lot of these. Going to try and update it in the coming weeks to catch the homoglyph-function.csx cases and add support for VS 2022. |
In terms of detection, the to-be-released GCC 12 has a new I wrote a blog post about the detection features here: Hope this is constructive [and not just shameless self-promotion :) ] |
Hi folks,
I wanted to begin by saying thanks for sharing your research insights and raising awareness of potential threats to open source supply chain security.
Given the fact that many folks might be drawn here to the repository (or the website) and would be seeking a way to mitigate these issues, I was wondering if you'd want to update the README here and include a list of tools that help find and fix these issues?
During the weekend, I built a package to detect bidi chars in text anti-trojan-source which is just handy for Node.js / npm folks to run instead of say a regex with grep, but more importantly, the eslint-plugin-anti-trojan-source package which proactivly help developers prevent the cases of malicious commits when they happen.
The text was updated successfully, but these errors were encountered: