De-obfuscate JavaScript with sourcemap in PHP
We have a JavaScript page that catches any exceptions and writes them to our database. This worked a little, but now we are using uglifyjs to obfuscate the code and also obfuscates the stack trace.
I know Firefox and Chrome can de-obfuscate, but that doesn't help us as we want to de-obfuscate the exceptions that were thrown during production.
We have a source map , so I would like our backend (php) to receive an exception and de-obfuscation with the original map before writing it to the database.
I know the Mozilla Source-map project can do this for node.js, but is there a way to do this in PHP
source to share
We found out that the koala-framework has implemented (de) sourcemap obfuscation in PHP.
Add koala-framework / sourcemaps as a dependency via composer ( https://packagist.org/packages/koala-framework/sourcemaps )
https://github.com/koala-framework/sourcemaps
For detraining, you are interested in Kwf_SourceMaps_SourceMap (source_map) and getMappings () afterwards.
source to share