# Insufficient Type Check leading to Developer ability to delete Project, Repository, Group, ...

GraphQL deleteAnnotation mutation lacked a type check on the global ID, letting a Developer pass a Project GID and delete the project and its repository.

- Payout: $5,000
- Severity: high
- Program: GitLab
- Found by: ledz1996
- Disclosed: 2020-11-02
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/960244
- Library page: https://bugbountylibrary.com/r/h1%3A960244
- Tags: area:web domain:api domain:web impact:data-leak impact:integrity kind:bounty platform:hackerone sev:high tech:graphql technique:chained technique:source-review vuln:access-control

**Target:** GitLab GraphQL API, Metrics::Dashboard::Annotations::DeleteAnnotation mutation
**Root cause:** Base#find_object calls GitlabSchema.object_from_id(id) without verifying the resolved object is an Annotation; the delete service then runs on whatever object the GID resolves to, and the permission check passes for a Developer on a project.
**Steps:**
1. Create private Project A and add User B as Developer.
2. As User B, open /-/graphql-explorer and send `mutation { deleteAnnotation(input: {id: "gid://Gitlab/Project/<project-id>"}) { clientMutationId } }`.
3. The mutation resolves the Project GID as the annotation, passes the :delete_metrics_dashboard_annotation check, and deletes the project and repository.
**How found:** Author noticed the same missing-type-check pattern as prior report #858671, then read base.rb find_object and delete.rb to confirm no type validation before authorized_find! and the delete service.
**Exploitation:** Any Developer on a project submits a single GraphQL mutation with the target Project's global ID in place of an annotation ID; the service deletes the project and its repository without further authorization.
**Insight:** In GraphQL APIs using global IDs, audit every mutation whose find_object/object_from_id lacks a type assertion; a Developer-level permission on the resolved object can be abused to delete arbitrary object types by swapping the GID namespace.

## Proof of concept (copied exactly from the original report)

**GraphQL deleteAnnotation mutation with Project GID**

```
mutation {
  deleteAnnotation(input: {id: "gid://Gitlab/Project/<project-id>"}) {
    clientMutationId
  }
}
```

