Skip to content

Commit

Permalink
Adding sample vuln code
Browse files Browse the repository at this point in the history
  • Loading branch information
zpavlinovic committed Sep 13, 2023
1 parent 5c20cd0 commit 903d0bb
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 4 deletions.
16 changes: 16 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module golang.org/vuln

go 1.18

require (
// This version has one vulnerability that is imported, and
// one that is called.
github.com/tidwall/gjson v1.6.5
// This version has a vulnerability that is called.
golang.org/x/text v0.3.0
)

require (
github.com/tidwall/match v1.1.0 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/tidwall/gjson v1.6.5 h1:P/K9r+1pt9AK54uap7HcoIp6T3a7AoMg3v18tUis+Cg=
github.com/tidwall/gjson v1.6.5/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.1.0 h1:VfI2e2aXLvytih7WUVyO9uvRC+RcXlaTrMbHuQWnFmk=
github.com/tidwall/match v1.1.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
4 changes: 0 additions & 4 deletions some.js

This file was deleted.

9 changes: 9 additions & 0 deletions subdir/subdir.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package subdir

import (
"golang.org/x/text/language"
)

func Foo() {
language.Parse("")
}
16 changes: 16 additions & 0 deletions vuln.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import (
"encoding/pem"
"fmt"

"github.com/tidwall/gjson"
"golang.org/x/text/language"
)

func main() {
fmt.Println("hello")
language.Parse("")
gjson.Result{}.Get("")
_, _ = pem.Decode([]byte("test"))
}
16 changes: 16 additions & 0 deletions vuln/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module golang.org/vuln

go 1.18

require (
// This version has one vulnerability that is imported, and
// one that is called.
github.com/tidwall/gjson v1.6.5
// This version has a vulnerability that is called.
golang.org/x/text v0.3.0
)

require (
github.com/tidwall/match v1.1.0 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
)
10 changes: 10 additions & 0 deletions vuln/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/tidwall/gjson v1.6.5 h1:P/K9r+1pt9AK54uap7HcoIp6T3a7AoMg3v18tUis+Cg=
github.com/tidwall/gjson v1.6.5/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.1.0 h1:VfI2e2aXLvytih7WUVyO9uvRC+RcXlaTrMbHuQWnFmk=
github.com/tidwall/match v1.1.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
9 changes: 9 additions & 0 deletions vuln/subdir/subdir.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package subdir

import (
"golang.org/x/text/language"
)

func Foo() {
language.Parse("")
}
16 changes: 16 additions & 0 deletions vuln/vuln.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import (
"encoding/pem"
"fmt"

"github.com/tidwall/gjson"
"golang.org/x/text/language"
)

func main() {
fmt.Println("hello")
language.Parse("")
gjson.Result{}.Get("")
_, _ = pem.Decode([]byte("test"))
}

0 comments on commit 903d0bb

Please sign in to comment.