Skip to content

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

Description

@loewenheim

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions