Unsanitized user input in deserialization method

Description

Deserializing data from untrusted sources, like user inputs or request parameters, without proper verification is a security risk. Attackers can embed malicious code or payloads within serialized data. When your application deserializes this data without checks, it becomes vulnerable to attacks.

Remediations

  • Do not deserialize data from untrusted sources directly. This can lead to security vulnerabilities.
  • Do validate and sanitize all data before deserializing it. Ensure that the data is coming from a trusted source and is in the expected format.

References

Associated CWE

OWASP Top 10

Configuration

To skip this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --skip-rule=go_lang_deserialization_of_user_input

To run only this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --only-rule=go_lang_deserialization_of_user_input