elastic / elastic/integrations

[Github Audit]: Split the values in the field github.token_scopes into an array

Open
#20,672 1 comment 0 reactions 1 assignee Claimed by @mohitjha-elastic View on GitHub
enhancement Integration:github needs:triage Team:SDE-Crest Team:Security-Service Integrations
Dominant language
Handlebars
Stars
333
Forks
647
Avg merge
3d 4h
Merged PRs (30d)
209

Description

### Integration Name

GitHub [packages/github]

### Dataset Name

github.audit

### Integration Version

unrelated

### Agent Version

unrelated

### OS Version and Architecture

unrelated

### User Goal

The field `github.token_scopes` have information about the scopes of a token being used to make requests to github or when a personal access token is added to an organization.

A token can have multiple scopes and the user should be able to filter by them individually, like `repo`, `read:user`, `read:org` etc, so the field `github.token_scopes` should be an array where every item is a scope of the token being used.

Image

### Existing Features

It is not possible to filter individually by a specific scope as the value is a single string, the workaround is to use wildcard queries instead of searching for the exact scope name.

### What did you see?

Currently the field `github.token_scopes` is a single string containing all the scopes.

Image

### Anything else?

This is a pretty simple improvement, a simple `split` processor in the ingest pipeline like below will work:

```
{
"split": {
"ignore_failure": true,
"ignore_missing": true,
"field": "github.token_scopes",
"separator": ",",
"if": "ctx?.github?.token_scopes != null"
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.