Handle invalid JSON exceptions when ingesting security reports
Why are we doing this work
As reported in #339076 (closed), Gitlab::Ci::Parsers::Security::Common::SecurityReportParserError
exceptions have an impact in our error budget.
The issue #335789 (closed) will address these by handling the errors and communicating them to users.
This issue is an interim iterative step to address the groupthreat insights error budget.
As part of this issue, we'll rescue the exception(s) caused by invalid JSON and silently ignore the error. This does not impact the user in any way since affected reports are already not being ingested. The difference is that these errors will no longer show-up in our error budget (as they shouldn't because we have no control over what jobs submit as reports).
Relevant links
Non-functional requirements
-
Documentation: -
Feature flag: -
Performance: -
Testing:
Implementation plan
-
backend Determine where JSON::ParserError
is being raised (https://gitlab.com/gitlab-org/gitlab/blob/a1b61286d256e89b8f24f2c1e23cd3991f78fcb1/lib/gitlab/ci/parsers/security/common.rb#L34) -
backend Rescue error and handle it gracefully (see example in https://gitlab.com/gitlab-org/gitlab/blob/5654dbafdd4bafd861dcd9662ad55a259afffa5e/ee/app/models/ee/ci/job_artifact.rb#L102)
Edited by Jonathan Schafer