lirantal/anti-trojan-source

Add support for an '--allowedFiles' argument to handle false positives when using `--files`

Open

#5 opened on Nov 19, 2021

 (2 comments) (0 reactions) (1 assignee)JavaScript (11 forks)github user discovery
enhancementgood first issue

Repository metrics

Stars
 (86 stars)
PR merge metrics
 (Avg merge 7m) (1 merged PR in 30d)

Description

Is your feature request related to a problem? Please describe. I would like to be super diligent and be aware if any of our dependencies in the closure (~1500 packages) might be affected. I would therefore like to add a check that runs anti-trojan-source --files=** to our PR validation. Our repo uses many languages (js, ts, jsx, tsx, cpp, c#, cmd, powershell etc) so coming up with an inclusive globby pattern seems fragile. I'd rather maintain a list of false positives. For example running with full wildcards on a repy with anti-trojan-source as a dependency we get a false positive of the README.md file that demonstrates the problem :)

[x] Detected cases of trojan source in the following files:
|
 - node_modules/anti-trojan-source/README.md

Describe the solution you'd like I would love for an extra command line flag that would point to a file that contains a file for each line that is considered a false positibe so we can

Describe alternatives you've considered These are in order of preference for me.

  • Add support for multiple --files arguments and support for response files i.e. anti-trojan-source --files=** @allowList.rsp where the .rsp file is read and each line is fed to meow to be parsed so we can add lines like --files=!this/file/is/okay.md to that file and check it in.
  • Add support for multiple --files arguments, but when no args given std-in will be passed to meow for processing so it could contain --files=... lines.
  • Write our own CLI around anti-trojan-source where we compute the list of files ourselves.
    • This would work for us, but I'd much rather share and add features where more users can benefit.

Final thoughts I'd be happy to contribute this of course, or if you prefer the first or second alternative that would work for us too, and I'd be happy to contribute that one as well. If you prefer us to write our own wrapper feel free to close this issue.

Contributor guide