| 1 |
package github |
| 2 |
|
| 3 |
import ( |
| 4 |
"github.com/DefangLabs/secret-detector/pkg/detectors/helpers" |
| 5 |
"github.com/DefangLabs/secret-detector/pkg/secrets" |
| 6 |
) |
| 7 |
|
| 8 |
const ( |
| 9 |
Name = "github" |
| 10 |
secretType = "Github authentication" |
| 11 |
|
| 12 |
|
| 13 |
tokenRegex = `gh[pousr]_[A-Za-z0-9_]{36}` |
| 14 |
) |
| 15 |
|
| 16 |
func init() { |
| 17 |
secrets.GetDetectorFactory().Register(Name, NewDetector) |
| 18 |
} |
| 19 |
|
| 20 |
type detector struct { |
| 21 |
secrets.Detector |
| 22 |
} |
| 23 |
|
| 24 |
func NewDetector(config ...string) secrets.Detector { |
| 25 |
return &detector{ |
| 26 |
Detector: helpers.NewRegexDetectorBuilder(secretType, tokenRegex).Build(), |
| 27 |
} |
| 28 |
} |