sentry-cli icon indicating copy to clipboard operation
sentry-cli copied to clipboard

False negatives in minified file detection cause files to silently be skipped during injection

Open loewenheim opened this issue 2 years ago • 0 comments

See #1813.

The heuristic we use gives the file in question a probability of 0.47 of being minified, whereas the cutoff is at 0.5. The file also doesn't contain a //# sourceMappingURL comment and doesn't have a min.js extension, so sentry-cli thinks it's a non-minified JS file and silently skips it during injection.

Detailed breakdown of the heuristic

might-be-minified estimates the probability that a file is minified based on several different criteria:

  • space-to-code ratio: 0.9
  • median identifier length: 0.2
  • code shape: 0.0
  • longest line: 1.0

These probabilities are averaged with the respective weights 0.1, 0.4, 0.2, 0.3 to arrive at the final probability. There may be room for improvement in this heuristic, but we may also want to make the decision of whether to inject on another basis.

loewenheim avatar Nov 10 '23 14:11 loewenheim