KirillOsenkov / MSBuildStructuredLog

A logger for MSBuild that records a structured representation of executed targets, tasks, property and item values.
MIT License
1.46k stars 198 forks source link

Binlog "censoring" rewriter that strips secrets #386

Closed KirillOsenkov closed 11 months ago

KirillOsenkov commented 4 years ago

It should be relatively easy to write a censoring tool that rewrites a binlog to omit certain strings.

Need to think about whether to manually specify strings to exclude or use some heuristic, such as Environment variables.

Related: https://github.com/dotnet/msbuild/issues/3432 - only include environment variables actually used during the build

KirillOsenkov commented 4 years ago

Perhaps we should go over all environment variables and delete the ones that were never mentioned anywhere

KirillOsenkov commented 4 years ago

See also: https://github.com/dotnet/msbuild/issues/3603

aolszowka commented 4 years ago

I assume this is related to #191 or is it slightly different?

KirillOsenkov commented 4 years ago

Oh, yeah ;) I forgot we have a dupe already

MeikTranel commented 3 years ago

we should be very careful about stripping things that dont show up in binary logger events - example: Embarcadero Delphi uses BDS as an environment variable to resolve the compiler dll. It does this internally inside the MSBuild task dll - of course this is a trainwreck for many reasons in of it self but its something i cannot change. If we were to silently remove BDS because its never mentioned inside a task or reused for constructing another value i would not know what version of the compiler was used. In reality BDS is used as a property as well but the general point still stands - i think we should make sure that if something like this would drop we do our best to offer a frontend that does two things:

KirillOsenkov commented 2 years ago

Consider running through a bunch of regexes like here: https://github.com/rodrigoramosrs/fileleaks/blob/main/src/FileLeaks.CLI/regex/all.json

KirillOsenkov commented 1 year ago

A prototype was implemented by @JanKrivanek: https://github.com/KirillOsenkov/MSBuildStructuredLog/pull/711

KirillOsenkov commented 11 months ago

I’ll close this issue as it’s now implemented and we can file new bugs for remaining issues