Skip to content
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

Go: Promote go/hardcoded-key from experimental #15527

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

atorralba
Copy link
Contributor

Promotes the query go/hardcoded-key from experimental, merging it with go/hardcoded-credentials for consistency with other languages. Where possible, plain CodeQL models have been migrated to models-as-data.

Copy link
Contributor

github-actions bot commented Feb 6, 2024

QHelp previews:

Copy link
Contributor

github-actions bot commented Feb 6, 2024

⚠️ The head of this PR and the base branch were compared for differences in the framework coverage reports. The generated reports are available in the artifacts of this workflow run. The differences will be picked up by the nightly job after the PR gets merged.

Click to show differences in coverage

go

Generated file changes for go

  • Changes to framework-coverage-go.rst:
-    `Standard library <https://pkg.go.dev/std>`_,"````, ``archive/*``, ``bufio``, ``bytes``, ``cmp``, ``compress/*``, ``container/*``, ``context``, ``crypto``, ``crypto/*``, ``database/*``, ``debug/*``, ``embed``, ``encoding``, ``encoding/*``, ``errors``, ``expvar``, ``flag``, ``fmt``, ``go/*``, ``hash``, ``hash/*``, ``html``, ``html/*``, ``image``, ``image/*``, ``index/*``, ``io``, ``io/*``, ``log``, ``log/*``, ``maps``, ``math``, ``math/*``, ``mime``, ``mime/*``, ``net``, ``net/*``, ``os``, ``os/*``, ``path``, ``path/*``, ``plugin``, ``reflect``, ``reflect/*``, ``regexp``, ``regexp/*``, ``slices``, ``sort``, ``strconv``, ``strings``, ``sync``, ``sync/*``, ``syscall``, ``syscall/*``, ``testing``, ``testing/*``, ``text/*``, ``time``, ``time/*``, ``unicode``, ``unicode/*``, ``unsafe``",8,577,
+    `Standard library <https://pkg.go.dev/std>`_,"````, ``archive/*``, ``bufio``, ``bytes``, ``cmp``, ``compress/*``, ``container/*``, ``context``, ``crypto``, ``crypto/*``, ``database/*``, ``debug/*``, ``embed``, ``encoding``, ``encoding/*``, ``errors``, ``expvar``, ``flag``, ``fmt``, ``go/*``, ``hash``, ``hash/*``, ``html``, ``html/*``, ``image``, ``image/*``, ``index/*``, ``io``, ``io/*``, ``log``, ``log/*``, ``maps``, ``math``, ``math/*``, ``mime``, ``mime/*``, ``net``, ``net/*``, ``os``, ``os/*``, ``path``, ``path/*``, ``plugin``, ``reflect``, ``reflect/*``, ``regexp``, ``regexp/*``, ``slices``, ``sort``, ``strconv``, ``strings``, ``sync``, ``sync/*``, ``syscall``, ``syscall/*``, ``testing``, ``testing/*``, ``text/*``, ``time``, ``time/*``, ``unicode``, ``unicode/*``, ``unsafe``",8,578,
+    Others,"``github.com/cristalhq/jwt/$ANYVERSION``, ``github.com/dgrijalva/jwt-go``, ``github.com/form3tech-oss/jwt-go``, ``github.com/go-chi/jwtauth/$ANYVERSION``, ``github.com/go-kit/kit/auth/jwt``, ``github.com/golang-jwt/jwt/$ANYVERSION``, ``github.com/kataras/iris/$ANYVERSION/middleware/jwt``, ``github.com/kataras/jwt``, ``github.com/lestrrat-go/jwx``, ``github.com/lestrrat-go/jwx/$ANYVERSION/jwk``, ``github.com/lestrrat/go-jwx/jwk``, ``github.com/ory/fosite/token/jwt``",,,20
-    Totals,,8,842,
+    Totals,,8,843,20
  • Changes to framework-coverage-go.csv:
- package,source,summary,source:remote,summary:taint,summary:value
+ package,sink,source,summary,sink:credentials-key,source:remote,summary:taint,summary:value
- ,,2,,,2
+ ,,,2,,,,2
- 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/astaxie/beego,,7,,7,
+ github.com/astaxie/beego,,,7,,,7,
- github.com/astaxie/beego/context,,1,,1,
+ github.com/astaxie/beego/context,,,1,,,1,
- github.com/astaxie/beego/utils,,13,,13,
+ github.com/astaxie/beego/utils,,,13,,,13,
- github.com/beego/beego/core/utils,,13,,13,
+ github.com/beego/beego/core/utils,,,13,,,13,
- github.com/beego/beego/server/web,,7,,7,
+ github.com/beego/beego/server/web,,,7,,,7,
- github.com/beego/beego/server/web/context,,1,,1,
+ github.com/beego/beego/server/web/context,,,1,,,1,
- 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/$ANYVERSION,1,,,1,,,
+ github.com/dgrijalva/jwt-go,2,,,2,,,
- github.com/elazarl/goproxy,,2,,2,
+ github.com/elazarl/goproxy,,,2,,,2,
- github.com/evanphx/json-patch,,12,,12,
+ github.com/evanphx/json-patch,,,12,,,12,
+ github.com/form3tech-oss/jwt-go,2,,,2,,,
- github.com/gin-gonic/gin,,2,,2,
+ github.com/gin-gonic/gin,,,2,,,2,
+ github.com/go-chi/jwtauth/$ANYVERSION,1,,,1,,,
+ github.com/go-kit/kit/auth/jwt,1,,,1,,,
- github.com/go-pg/pg/$ANYVERSION/orm,,6,,6,
+ github.com/go-pg/pg/$ANYVERSION/orm,,,6,,,6,
+ github.com/golang-jwt/jwt/$ANYVERSION,2,,,2,,,
- github.com/golang/protobuf/$ANYVERSION/proto,,4,,4,
+ github.com/golang/protobuf/$ANYVERSION/proto,,,4,,,4,
- github.com/json-iterator/go,,4,,4,
+ github.com/json-iterator/go,,,4,,,4,
+ github.com/kataras/iris/$ANYVERSION/middleware/jwt,1,,,1,,,
+ github.com/kataras/jwt,5,,,5,,,
- github.com/labstack/echo,,2,,2,
+ github.com/labstack/echo,,,2,,,2,
+ github.com/lestrrat-go/jwx,1,,,1,,,
+ github.com/lestrrat-go/jwx/$ANYVERSION/jwk,1,,,1,,,
+ github.com/lestrrat/go-jwx/jwk,1,,,1,,,
+ github.com/ory/fosite/token/jwt,2,,,2,,,
- github.com/revel/revel,,10,,10,
+ github.com/revel/revel,,,10,,,10,
- github.com/robfig/revel,,10,,10,
+ github.com/robfig/revel,,,10,,,10,
- github.com/sendgrid/sendgrid-go/$ANYVERSION/helpers/mail,,1,,1,
+ github.com/sendgrid/sendgrid-go/$ANYVERSION/helpers/mail,,,1,,,1,
- github.com/valyala/fasthttp,,5,,5,
+ github.com/valyala/fasthttp,,,5,,,5,
- go.uber.org/zap,,11,,11,
+ go.uber.org/zap,,,11,,,11,
- golang.org/x/net/$ANYVERSION/html,,16,,16,
+ golang.org/x/net/$ANYVERSION/html,,,16,,,16,
- golang.org/x/net/context,,5,,5,
+ golang.org/x/net/context,,,5,,,5,
- google.golang.org/protobuf/$ANYVERSION/internal/encoding/text,,1,,1,
+ google.golang.org/protobuf/$ANYVERSION/internal/encoding/text,,,1,,,1,
- google.golang.org/protobuf/$ANYVERSION/internal/impl,,2,,2,
+ google.golang.org/protobuf/$ANYVERSION/internal/impl,,,2,,,2,
- google.golang.org/protobuf/$ANYVERSION/proto,,8,,8,
+ google.golang.org/protobuf/$ANYVERSION/proto,,,8,,,8,
- google.golang.org/protobuf/$ANYVERSION/reflect/protoreflect,,1,,1,
+ google.golang.org/protobuf/$ANYVERSION/reflect/protoreflect,,,1,,,1,
- gopkg.in/couchbase/gocb,,18,,18,
+ gopkg.in/couchbase/gocb,,,18,,,18,
- gopkg.in/macaron,,1,,1,
+ gopkg.in/macaron,,,1,,,1,
- 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/$ANYVERSION/pkg/runtime,,47,,47,
+ k8s.io/apimachinery/$ANYVERSION/pkg/runtime,,,47,,,47,
- log,,3,,3,
+ log,,,3,,,3,
+ 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,8,22,8,22,
+ net/http,,8,22,,8,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,
- 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,

@atorralba atorralba force-pushed the atorralba/go/promote-hardcoded-key branch from b155fd7 to 39a1537 Compare February 6, 2024 15:07
private class SquareJoseKey extends HardcodedCredentials::Sink {
SquareJoseKey() {
exists(Field f, string pkg |
pkg = ["github.com/square/go-jose/v3", "gopkg.in/square/go-jose.v2"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I use the package predicate here instead of hardcoding v3? I'm not sure it would work in the case of go-jose.v2, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant