We have an JavaScript page in production that catches any exceptions and logs them to our database. This worked fine for a while, but now we use uglifyjs to obfuscate the code and this also obfuscates the stack trace.
I know Firefox and Chrome can de-obfuscate but it does not help us since we want to de-obfuscate exceptions that ocured in production.
We have the source-map so what I would like to do is have our backend (php) recive the exception and de-obfuscate it with the source-map before logging it to the database.
I know the Mozilla Source-map project can do this for node.js, but is there a way to do it in PHP ?
We figured out the koala-framework has done an implementation of (de)obfuscating of source maps in PHP.
Add koala-framework/sourcemaps as dependency via composer ( https://packagist.org/packages/koala-framework/sourcemaps )
https://github.com/koala-framework/sourcemaps
For deobfuscating you are interested in Kwf_SourceMaps_SourceMap(source_map) and getMappings() afterwards.