Skip to content

Commit

Permalink
[feat] - Replace regexp pkg w/ go-re2 in detectors (#2324)
Browse files Browse the repository at this point in the history
* update detectors to use go-re regex library replacement

* update go mod and sum

* add tests with invalid utf-8

* revert
  • Loading branch information
ahrav authored Jan 23, 2024
1 parent 80f2696 commit e44802a
Show file tree
Hide file tree
Showing 821 changed files with 914 additions and 845 deletions.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ require (
github.com/launchdarkly/go-semver v1.0.2 // indirect
github.com/launchdarkly/go-server-sdk-evaluation/v2 v2.0.2 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magefile/mage v1.14.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
Expand Down Expand Up @@ -235,9 +236,11 @@ require (
github.com/sahilm/fuzzy v0.1.0 // indirect
github.com/sirupsen/logrus v1.9.1 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/tetratelabs/wazero v1.5.0 // indirect
github.com/therootcompany/xz v1.0.1 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
github.com/wasilibs/go-re2 v1.4.1 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ github.com/lrstanley/bubblezone v0.0.0-20230911164824-e3824f1adde9 h1:+7bxeCzFs4
github.com/lrstanley/bubblezone v0.0.0-20230911164824-e3824f1adde9/go.mod h1:v5lEwWaguF1o2MW/ucO0ZIA/IZymdBYJJ+2cMRLE7LU=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/magefile/mage v1.14.0 h1:6QDX3g6z1YvJ4olPhT1wksUcSa/V0a1B+pJb73fBjyo=
github.com/magefile/mage v1.14.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/marusama/semaphore/v2 v2.5.0 h1:o/1QJD9DBYOWRnDhPwDVAXQn6mQYD0gZaS1Tpx6DJGM=
Expand Down Expand Up @@ -682,6 +684,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502 h1:34icjjmqJ2HPjrSuJYEkdZ+0ItmGQAQ75cRHIiftIyE=
github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8=
github.com/tetratelabs/wazero v1.5.0 h1:Yz3fZHivfDiZFUXnWMPUoiW7s8tC1sjdBtlJn08qYa0=
github.com/tetratelabs/wazero v1.5.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A=
github.com/therootcompany/xz v1.0.1 h1:CmOtsn1CbtmyYiusbfmhmkpAAETj0wBIH6kCYaX+xzw=
github.com/therootcompany/xz v1.0.1/go.mod h1:3K3UH1yCKgBneZYhuQUvJ9HPD19UEXEI0BWbMn8qNMY=
github.com/trufflesecurity/disk-buffer-reader v0.2.1 h1:K9nNpX3xeWT2E6YRjlcc1X5c1NjgV9JS5T9aw2FjA8Q=
Expand All @@ -694,6 +698,8 @@ github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0o
github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8=
github.com/vbatts/tar-split v0.11.3 h1:hLFqsOLQ1SsppQNTMpkpPXClLDfC2A3Zgy9OUU+RVck=
github.com/vbatts/tar-split v0.11.3/go.mod h1:9QlHN18E+fEH7RdG+QAJJcuya3rqT7eXSTY7wGrAokY=
github.com/wasilibs/go-re2 v1.4.1 h1:E5+9O1M8UoGeqLB2A9omeoaWImqpuYDs9cKwvTJq/Oo=
github.com/wasilibs/go-re2 v1.4.1/go.mod h1:ynB8eCwd9JsqUnsk8WlPDk6cEeme8BguZmnqOSURE4Y=
github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0 h1:3UeQBvD0TFrlVjOeLOBz+CPAI8dnbqNSVwUwRrkp7vQ=
github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0/go.mod h1:IXCdmsXIht47RaVFLEdVnh1t+pgYtTAhQGj73kz+2DM=
github.com/xanzy/go-gitlab v0.94.0 h1:GmBl2T5zqUHqyjkxFSvsT7CbelGdAH/dmBqUBqS+4BE=
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/abbysale/abbysale.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package abbysale

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/abstract/abstract.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package abstract
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/abuseipdb/abuseipdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"
"net/http"
// "log"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/accuweather/accuweather.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package accuweather

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/adafruitio/adafruitio.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package adafruitio

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/adobeio/adobeio.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package adobeio

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/adzuna/adzuna.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package adzuna
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/aeroworkflow/aeroworkflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package aeroworkflow

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/agora/agora.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package agora

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/aha/aha.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package aha
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package airbrakeprojectkey

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/airbrakeuserkey/airbrakeuserkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package airbrakeuserkey

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/airship/airship.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package airship
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/airtableapikey/airtableapikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"encoding/json"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/airvisual/airvisual.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package airvisual
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/aiven/aiven.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package aiven
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/alchemy/alchemy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package alchemy
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/alconost/alconost.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
b64 "encoding/base64"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/alegra/alegra.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package alegra

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/aletheiaapi/aletheiaapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package aletheiaapi

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"
"time"

Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/algoliaadminkey/algoliaadminkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package algoliaadminkey

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/alibaba/alibaba.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"crypto/rand"
"crypto/sha1"
"encoding/base64"
regexp "github.com/wasilibs/go-re2"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"time"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/alienvault/alienvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package alienvault

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/allsports/allsports.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"
"net/http"
// "log"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/amadeus/amadeus.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package amadeus

import (
"context"
regexp "github.com/wasilibs/go-re2"
"io"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/ambee/ambee.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package ambee

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/amplitudeapikey/amplitudeapikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package amplitudeapikey

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/anthropic/anthropic.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"context"
"encoding/json"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/anypoint/anypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package anypoint
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/apacta/apacta.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package apacta
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/api2cart/api2cart.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"encoding/json"
"fmt"
regexp "github.com/wasilibs/go-re2"
"io"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/apideck/apideck.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package apideck
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/apiflash/apiflash.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package apiflash
import (
"context"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/apifonica/apifonica.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
b64 "encoding/base64"
"fmt"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/detectors/apify/apify.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package apify

import (
"context"
regexp "github.com/wasilibs/go-re2"
"net/http"
"regexp"
"strings"

"github.com/trufflesecurity/trufflehog/v3/pkg/common"
Expand Down
Loading

0 comments on commit e44802a

Please sign in to comment.