Skip to content

Missing API Validation Layer - Results in lost data #1061

@kevin-kline

Description

@kevin-kline

Description:

  • API validation is needed to ensure response data from APIs are consistent with what we expect
  • Every entity we request from an API gets converted from a response to a Go struct prior to saving in our DB
    • Ex. Commits from GitHub
  • If the responses from the API change in any way from what we expect to get back, then we risk losing data
  • This can happen silently because we don’t have validation to ensure the data matches what we expect
  • API responses can vary, or be changed intentionally by the provider, so we must be prepared for this
  • We have discovered this problem exists in our system in the GitHub plugin, so it may exist in others as well. If not now, it could in the future.

Example (tested, proven):

- In the GitHub plugin, only some of our response data contained author data and committer data
- This is because some users are not verified on GitHub
- Some commits were not being saved because of the failed conversion
- We expected certain data, but the responses were inconsistent leading to lost data
- Without validation we have no way to know this is happening, since this error occurs at runtime

Screenshots:

  1. Commit w/ author
    image

  2. Commit w/out author
    image

  3. Proof of why author / committer is not found (no valid user account on GitHub)
    image

  4. Problem in the code
    image

Possible Solutions:

@joncodo Please comment / edit with your understanding if needed

Metadata

Metadata

Assignees

Labels

priority/highThis issue is very importanttype/bugThis issue is a bugtype/refactorThis issue is to refactor existing code

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions