-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Go: convert request-forgery, xpath-injection and credentials sinks to MaD #17072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Request forgery sinks which have `getRequest` different from the sink itself cannot be modeled using models-as-data.
I checked that the tests failed when I removed the classes and passed again when I add the MaD models.
Currently the extra sinks are not detected. This will be fixed in the next commit.
590936c
to
a6cb511
Compare
Click to show differences in coveragegoGenerated file changes for go
- `Go JOSE <https://github.com/go-jose/go-jose>`_,"``github.com/go-jose/go-jose*``, ``github.com/square/go-jose*``, ``gopkg.in/square/go-jose*``",,12,3
+ `Go JOSE <https://github.com/go-jose/go-jose>`_,"``github.com/go-jose/go-jose*``, ``github.com/square/go-jose*``, ``gopkg.in/square/go-jose*``",,12,9
- `Iris <https://www.iris-go.com/>`_,``github.com/kataras/iris*``,,,1
+ `Iris <https://www.iris-go.com/>`_,``github.com/kataras/iris*``,,,2
- `fasthttp <https://github.com/valyala/fasthttp>`_,``github.com/valyala/fasthttp*``,50,5,
+ `fasthttp <https://github.com/valyala/fasthttp>`_,``github.com/valyala/fasthttp*``,50,5,25
- Others,"``github.com/gobwas/ws``, ``github.com/gorilla/websocket``, ``nhooyr.io/websocket``",7,,
+ Others,"``github.com/ChrisTrenkamp/goxpath``, ``github.com/antchfx/htmlquery``, ``github.com/antchfx/jsonquery``, ``github.com/antchfx/xmlquery``, ``github.com/antchfx/xpath``, ``github.com/appleboy/gin-jwt``, ``github.com/go-xmlpath/xmlpath``, ``github.com/gobwas/ws``, ``github.com/gogf/gf-jwt``, ``github.com/gorilla/websocket``, ``github.com/jbowtie/gokogiri/xml``, ``github.com/jbowtie/gokogiri/xpath``, ``github.com/lestrrat-go/libxml2/parser``, ``github.com/santhosh-tekuri/xpathparser``, ``nhooyr.io/websocket``",7,,37
- Totals,,267,902,25
+ Totals,,267,902,94
- package,sink,source,summary,sink:credentials-key,sink:jwt,source:remote,summary:taint,summary:value
+ package,sink,source,summary,sink:credentials-key,sink:jwt,sink:request-forgery,sink:request-forgery[TCP Addr + Port],sink:xpath-injection,source:remote,summary:taint,summary:value
- ,,,8,,,,3,5
+ ,,,8,,,,,,,3,5
- archive/tar,,,5,,,,5,
+ archive/tar,,,5,,,,,,,5,
- archive/zip,,,6,,,,6,
+ archive/zip,,,6,,,,,,,6,
- bufio,,,17,,,,17,
+ bufio,,,17,,,,,,,17,
- bytes,,,43,,,,43,
+ bytes,,,43,,,,,,,43,
- compress/bzip2,,,1,,,,1,
+ compress/bzip2,,,1,,,,,,,1,
- compress/flate,,,4,,,,4,
+ compress/flate,,,4,,,,,,,4,
- compress/gzip,,,3,,,,3,
+ compress/gzip,,,3,,,,,,,3,
- compress/lzw,,,1,,,,1,
+ compress/lzw,,,1,,,,,,,1,
- compress/zlib,,,4,,,,4,
+ compress/zlib,,,4,,,,,,,4,
- container/heap,,,5,,,,5,
+ container/heap,,,5,,,,,,,5,
- container/list,,,20,,,,20,
+ container/list,,,20,,,,,,,20,
- container/ring,,,5,,,,5,
+ container/ring,,,5,,,,,,,5,
- context,,,5,,,,5,
+ context,,,5,,,,,,,5,
- crypto,,,1,,,,1,
+ crypto,,,1,,,,,,,1,
- crypto/cipher,,,3,,,,3,
+ crypto/cipher,,,3,,,,,,,3,
- crypto/rsa,,,2,,,,2,
+ crypto/rsa,,,2,,,,,,,2,
- crypto/tls,,,3,,,,3,
+ crypto/tls,,,3,,,,,,,3,
- crypto/x509,,,1,,,,1,
+ crypto/x509,,,1,,,,,,,1,
- database/sql,,,7,,,,7,
+ database/sql,,,7,,,,,,,7,
- database/sql/driver,,,4,,,,4,
+ database/sql/driver,,,4,,,,,,,4,
- encoding,,,4,,,,4,
+ encoding,,,4,,,,,,,4,
- encoding/ascii85,,,2,,,,2,
+ encoding/ascii85,,,2,,,,,,,2,
- encoding/asn1,,,8,,,,8,
+ encoding/asn1,,,8,,,,,,,8,
- encoding/base32,,,3,,,,3,
+ encoding/base32,,,3,,,,,,,3,
- encoding/base64,,,3,,,,3,
+ encoding/base64,,,3,,,,,,,3,
- encoding/binary,,,2,,,,2,
+ encoding/binary,,,2,,,,,,,2,
- encoding/csv,,,5,,,,5,
+ encoding/csv,,,5,,,,,,,5,
- encoding/gob,,,7,,,,7,
+ encoding/gob,,,7,,,,,,,7,
- encoding/hex,,,3,,,,3,
+ encoding/hex,,,3,,,,,,,3,
- encoding/json,,,14,,,,14,
+ encoding/json,,,14,,,,,,,14,
- encoding/pem,,,3,,,,3,
+ encoding/pem,,,3,,,,,,,3,
- encoding/xml,,,23,,,,23,
+ encoding/xml,,,23,,,,,,,23,
- errors,,,3,,,,3,
+ errors,,,3,,,,,,,3,
- expvar,,,6,,,,6,
+ expvar,,,6,,,,,,,6,
- fmt,,,16,,,,16,
+ fmt,,,16,,,,,,,16,
+ github.com/ChrisTrenkamp/goxpath,3,,,,,,,3,,,
+ github.com/antchfx/htmlquery,4,,,,,,,4,,,
+ github.com/antchfx/jsonquery,4,,,,,,,4,,,
+ github.com/antchfx/xmlquery,8,,,,,,,8,,,
+ github.com/antchfx/xpath,4,,,,,,,4,,,
+ github.com/appleboy/gin-jwt,1,,,1,,,,,,,
- github.com/astaxie/beego,,6,7,,,6,7,
+ github.com/astaxie/beego,,6,7,,,,,,6,7,
- github.com/astaxie/beego/context,,15,1,,,15,1,
+ github.com/astaxie/beego/context,,15,1,,,,,,15,1,
- github.com/astaxie/beego/utils,,,13,,,,13,
+ github.com/astaxie/beego/utils,,,13,,,,,,,13,
- github.com/beego/beego,,6,7,,,6,7,
+ github.com/beego/beego,,6,7,,,,,,6,7,
- github.com/beego/beego/context,,15,1,,,15,1,
+ github.com/beego/beego/context,,15,1,,,,,,15,1,
- github.com/beego/beego/core/utils,,,13,,,,13,
+ github.com/beego/beego/core/utils,,,13,,,,,,,13,
- github.com/beego/beego/server/web,,6,7,,,6,7,
+ github.com/beego/beego/server/web,,6,7,,,,,,6,7,
- github.com/beego/beego/server/web/context,,15,1,,,15,1,
+ github.com/beego/beego/server/web/context,,15,1,,,,,,15,1,
- github.com/beego/beego/utils,,,13,,,,13,
+ github.com/beego/beego/utils,,,13,,,,,,,13,
- github.com/couchbase/gocb,,,18,,,,18,
+ github.com/couchbase/gocb,,,18,,,,,,,18,
- github.com/couchbaselabs/gocb,,,18,,,,18,
+ github.com/couchbaselabs/gocb,,,18,,,,,,,18,
- github.com/cristalhq/jwt,1,,,1,,,,
+ github.com/cristalhq/jwt,1,,,1,,,,,,,
- github.com/dgrijalva/jwt-go,3,,9,2,1,,9,
+ github.com/dgrijalva/jwt-go,3,,9,2,1,,,,,9,
- github.com/elazarl/goproxy,,2,2,,,2,2,
+ github.com/elazarl/goproxy,,2,2,,,,,,2,2,
- github.com/emicklei/go-restful,,7,,,,7,,
+ github.com/emicklei/go-restful,,7,,,,,,,7,,
- github.com/evanphx/json-patch,,,12,,,,12,
+ github.com/evanphx/json-patch,,,12,,,,,,,12,
- github.com/form3tech-oss/jwt-go,2,,,2,,,,
+ github.com/form3tech-oss/jwt-go,2,,,2,,,,,,,
- github.com/gin-gonic/gin,,46,2,,,46,2,
+ github.com/gin-gonic/gin,,46,2,,,,,,46,2,
- github.com/go-chi/chi,,3,,,,3,,
+ github.com/go-chi/chi,,3,,,,,,,3,,
- github.com/go-chi/jwtauth,1,,,1,,,,
+ github.com/go-chi/jwtauth,1,,,1,,,,,,,
+ github.com/go-jose/go-jose,2,,,2,,,,,,,
- github.com/go-jose/go-jose/jwt,1,,4,,1,,4,
+ github.com/go-jose/go-jose/jwt,1,,4,,1,,,,,4,
- github.com/go-kit/kit/auth/jwt,1,,,1,,,,
+ github.com/go-kit/kit/auth/jwt,1,,,1,,,,,,,
- github.com/go-pg/pg/orm,,,6,,,,6,
+ github.com/go-pg/pg/orm,,,6,,,,,,,6,
+ github.com/go-xmlpath/xmlpath,2,,,,,,,2,,,
- github.com/gobwas/ws,,2,,,,2,,
+ github.com/gobwas/ws,,2,,,,,,,2,,
+ github.com/gogf/gf-jwt,1,,,1,,,,,,,
- github.com/golang-jwt/jwt,3,,11,2,1,,11,
+ github.com/golang-jwt/jwt,3,,11,2,1,,,,,11,
- github.com/golang/protobuf/proto,,,4,,,,4,
+ github.com/golang/protobuf/proto,,,4,,,,,,,4,
- github.com/gorilla/mux,,1,,,,1,,
+ github.com/gorilla/mux,,1,,,,,,,1,,
- github.com/gorilla/websocket,,3,,,,3,,
+ github.com/gorilla/websocket,,3,,,,,,,3,,
+ github.com/jbowtie/gokogiri/xml,4,,,,,,,4,,,
+ github.com/jbowtie/gokogiri/xpath,1,,,,,,,1,,,
- github.com/json-iterator/go,,,4,,,,4,
+ github.com/json-iterator/go,,,4,,,,,,,4,
- github.com/kataras/iris/middleware/jwt,1,,,1,,,,
+ github.com/kataras/iris/middleware/jwt,2,,,2,,,,,,,
- github.com/kataras/jwt,5,,,5,,,,
+ github.com/kataras/jwt,5,,,5,,,,,,,
- github.com/labstack/echo,,12,2,,,12,2,
+ github.com/labstack/echo,,12,2,,,,,,12,2,
- github.com/lestrrat-go/jwx,1,,,1,,,,
+ github.com/lestrrat-go/jwx,1,,,1,,,,,,,
- github.com/lestrrat-go/jwx/jwk,1,,,1,,,,
+ github.com/lestrrat-go/jwx/jwk,1,,,1,,,,,,,
+ github.com/lestrrat-go/libxml2/parser,3,,,,,,,3,,,
- github.com/lestrrat/go-jwx/jwk,1,,,1,,,,
+ github.com/lestrrat/go-jwx/jwk,1,,,1,,,,,,,
- github.com/ory/fosite/token/jwt,2,,,2,,,,
+ github.com/ory/fosite/token/jwt,2,,,2,,,,,,,
- github.com/revel/revel,,23,10,,,23,10,
+ github.com/revel/revel,,23,10,,,,,,23,10,
- github.com/robfig/revel,,23,10,,,23,10,
+ github.com/robfig/revel,,23,10,,,,,,23,10,
+ github.com/santhosh-tekuri/xpathparser,2,,,,,,,2,,,
- github.com/sendgrid/sendgrid-go/helpers/mail,,,1,,,,1,
+ github.com/sendgrid/sendgrid-go/helpers/mail,,,1,,,,,,,1,
+ github.com/square/go-jose,2,,,2,,,,,,,
- github.com/square/go-jose/jwt,1,,4,,1,,4,
+ github.com/square/go-jose/jwt,1,,4,,1,,,,,4,
- github.com/valyala/fasthttp,,50,5,,,50,5,
+ github.com/valyala/fasthttp,25,50,5,,,17,8,,50,5,
- go.uber.org/zap,,,11,,,,11,
+ go.uber.org/zap,,,11,,,,,,,11,
- golang.org/x/net/context,,,5,,,,5,
+ golang.org/x/net/context,,,5,,,,,,,5,
- golang.org/x/net/html,,,16,,,,16,
+ golang.org/x/net/html,,,16,,,,,,,16,
- golang.org/x/net/websocket,,2,,,,2,,
+ golang.org/x/net/websocket,,2,,,,,,,2,,
- google.golang.org/protobuf/internal/encoding/text,,,1,,,,1,
+ google.golang.org/protobuf/internal/encoding/text,,,1,,,,,,,1,
- google.golang.org/protobuf/internal/impl,,,2,,,,2,
+ google.golang.org/protobuf/internal/impl,,,2,,,,,,,2,
- google.golang.org/protobuf/proto,,,8,,,,8,
+ google.golang.org/protobuf/proto,,,8,,,,,,,8,
- google.golang.org/protobuf/reflect/protoreflect,,,1,,,,1,
+ google.golang.org/protobuf/reflect/protoreflect,,,1,,,,,,,1,
- gopkg.in/couchbase/gocb,,,18,,,,18,
+ gopkg.in/couchbase/gocb,,,18,,,,,,,18,
- gopkg.in/macaron,,12,1,,,12,1,
+ gopkg.in/macaron,,12,1,,,,,,12,1,
+ gopkg.in/square/go-jose,2,,,2,,,,,,,
- gopkg.in/square/go-jose/jwt,1,,4,,1,,4,
+ gopkg.in/square/go-jose/jwt,1,,4,,1,,,,,4,
- gopkg.in/yaml,,,9,,,,9,
+ gopkg.in/yaml,,,9,,,,,,,9,
- html,,,2,,,,2,
+ html,,,2,,,,,,,2,
- html/template,,,6,,,,6,
+ html/template,,,6,,,,,,,6,
- io,,,19,,,,19,
+ io,,,19,,,,,,,19,
- io/fs,,,12,,,,12,
+ io/fs,,,12,,,,,,,12,
- io/ioutil,,,2,,,,2,
+ io/ioutil,,,2,,,,,,,2,
- k8s.io/api/core,,,10,,,,10,
+ k8s.io/api/core,,,10,,,,,,,10,
- k8s.io/apimachinery/pkg/runtime,,,47,,,,47,
+ k8s.io/apimachinery/pkg/runtime,,,47,,,,,,,47,
- log,,,3,,,,3,
+ log,,,3,,,,,,,3,
- math/big,,,1,,,,1,
+ math/big,,,1,,,,,,,1,
- mime,,,5,,,,5,
+ mime,,,5,,,,,,,5,
- mime/multipart,,,8,,,,8,
+ mime/multipart,,,8,,,,,,,8,
- mime/quotedprintable,,,1,,,,1,
+ mime/quotedprintable,,,1,,,,,,,1,
- net,,,20,,,,20,
+ net,,,20,,,,,,,20,
- net/http,,16,22,,,16,22,
+ net/http,,16,22,,,,,,16,22,
- net/http/httputil,,,10,,,,10,
+ net/http/httputil,,,10,,,,,,,10,
- net/mail,,,6,,,,6,
+ net/mail,,,6,,,,,,,6,
- net/textproto,,,19,,,,19,
+ net/textproto,,,19,,,,,,,19,
- net/url,,,23,,,,23,
+ net/url,,,23,,,,,,,23,
- nhooyr.io/websocket,,2,,,,2,,
+ nhooyr.io/websocket,,2,,,,,,,2,,
- os,,,4,,,,4,
+ os,,,4,,,,,,,4,
- path,,,5,,,,5,
+ path,,,5,,,,,,,5,
- path/filepath,,,13,,,,13,
+ path/filepath,,,13,,,,,,,13,
- reflect,,,37,,,,37,
+ reflect,,,37,,,,,,,37,
- regexp,,,20,,,,20,
+ regexp,,,20,,,,,,,20,
- sort,,,1,,,,1,
+ sort,,,1,,,,,,,1,
- strconv,,,9,,,,9,
+ strconv,,,9,,,,,,,9,
- strings,,,34,,,,34,
+ strings,,,34,,,,,,,34,
- sync,,,10,,,,10,
+ sync,,,10,,,,,,,10,
- sync/atomic,,,24,,,,24,
+ sync/atomic,,,24,,,,,,,24,
- syscall,,,8,,,,8,
+ syscall,,,8,,,,,,,8,
- text/scanner,,,3,,,,3,
+ text/scanner,,,3,,,,,,,3,
- text/tabwriter,,,1,,,,1,
+ text/tabwriter,,,1,,,,,,,1,
- text/template,,,6,,,,6,
+ text/template,,,6,,,,,,,6, |
- ["go-jose", "github.com/go-jose/go-jose"] | ||
- ["go-jose", "gopkg.in/square/go-jose"] | ||
- ["go-jose", "github.com/square/go-jose"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also handle "gopkg.in/square/go-jose.v2"
? Just double checking that the .v2
is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this regex matches .v2
or /v2
, so then this predicate removes either, and that is used here on the imported package name to match it against the string given in the MaD yml file.
This test imports it in that way and it still passes on this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact: I found out recently that the .v2
format is only for gopkg.in
. I guess that site used that syntax before go modules were invented and it was easier to accept it than to make everyone change their imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as the answer to my go-jose.v2
question is that it's fine, this LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proxying @egregius313 review; haven't myself reviewed
Convert request-forgery, xpath-injection and credentials sinks to use MaD.