From 1639822d2bd217d9e7872086442f6bc3b6f4df15 Mon Sep 17 00:00:00 2001 From: Richard Gomez Date: Thu, 25 Apr 2024 08:27:13 -0400 Subject: [PATCH] chore(detectors): remove match len check --- pkg/detectors/abbysale/abbysale.go | 3 --- pkg/detectors/abstract/abstract.go | 3 --- pkg/detectors/abuseipdb/abuseipdb.go | 3 --- pkg/detectors/accuweather/accuweather.go | 3 --- pkg/detectors/adafruitio/adafruitio.go | 3 --- pkg/detectors/adobeio/adobeio.go | 9 ++------- pkg/detectors/adzuna/adzuna.go | 9 ++------- pkg/detectors/aeroworkflow/aeroworkflow.go | 6 ------ pkg/detectors/agora/agora.go | 6 ------ pkg/detectors/aha/aha.go | 6 ------ .../airbrakeprojectkey/airbrakeprojectkey.go | 6 ------ pkg/detectors/airbrakeuserkey/airbrakeuserkey.go | 3 --- pkg/detectors/airship/airship.go | 3 --- pkg/detectors/airtableapikey/airtableapikey.go | 6 ------ pkg/detectors/airvisual/airvisual.go | 3 --- pkg/detectors/aiven/aiven.go | 3 --- pkg/detectors/alconost/alconost.go | 3 --- pkg/detectors/alegra/alegra.go | 6 ------ pkg/detectors/aletheiaapi/aletheiaapi.go | 3 --- pkg/detectors/algoliaadminkey/algoliaadminkey.go | 6 ------ pkg/detectors/alibaba/alibaba.go | 6 ------ pkg/detectors/alienvault/alienvault.go | 3 --- pkg/detectors/allsports/allsports.go | 3 --- pkg/detectors/amadeus/amadeus.go | 9 ++------- pkg/detectors/ambee/ambee.go | 3 --- pkg/detectors/amplitudeapikey/amplitudeapikey.go | 6 ------ pkg/detectors/anthropic/anthropic.go | 3 --- pkg/detectors/anypoint/anypoint.go | 9 ++------- pkg/detectors/apacta/apacta.go | 3 --- pkg/detectors/api2cart/api2cart.go | 3 --- pkg/detectors/apideck/apideck.go | 9 ++------- pkg/detectors/apiflash/apiflash.go | 9 ++------- pkg/detectors/apifonica/apifonica.go | 6 ------ pkg/detectors/apify/apify.go | 3 --- pkg/detectors/apilayer/apilayer.go | 3 --- pkg/detectors/apimatic/apimatic.go | 9 ++------- pkg/detectors/apiscience/apiscience.go | 3 --- pkg/detectors/apitemplate/apitemplate.go | 3 --- pkg/detectors/apollo/apollo.go | 3 --- pkg/detectors/appcues/appcues.go | 12 ++---------- pkg/detectors/appfollow/appfollow.go | 3 --- pkg/detectors/appointedd/appointedd.go | 3 --- pkg/detectors/appoptics/appoptics.go | 3 --- pkg/detectors/appsynergy/appsynergy.go | 3 --- pkg/detectors/apptivo/apptivo.go | 9 ++------- pkg/detectors/artifactory/artifactory.go | 6 ------ pkg/detectors/artsy/artsy.go | 9 ++------- pkg/detectors/asanaoauth/asanaoauth.go | 3 --- .../asanapersonalaccesstoken.go | 3 --- pkg/detectors/assemblyai/assemblyai.go | 3 --- pkg/detectors/atera/atera.go | 3 --- pkg/detectors/audd/audd.go | 3 --- .../auth0managementapitoken.go | 6 ------ pkg/detectors/auth0oauth/auth0oauth.go | 9 --------- pkg/detectors/autodesk/autodesk.go | 9 ++------- pkg/detectors/autoklose/autoklose.go | 3 --- pkg/detectors/autopilot/autopilot.go | 3 --- .../avazapersonalaccesstoken.go | 3 --- pkg/detectors/aviationstack/aviationstack.go | 3 --- pkg/detectors/aws/aws.go | 6 ------ pkg/detectors/awssessionkeys/awssessionkey.go | 9 --------- pkg/detectors/axonaut/axonaut.go | 3 --- pkg/detectors/aylien/aylien.go | 9 ++------- pkg/detectors/ayrshare/ayrshare.go | 3 --- .../azuredevopspersonalaccesstoken.go | 6 ------ .../azuresearchadminkey/azuresearchadminkey.go | 6 ------ .../azuresearchquerykey/azuresearchquerykey.go | 3 --- pkg/detectors/azurestorage/azurestorage.go | 3 --- pkg/detectors/bannerbear/bannerbear.go | 3 --- pkg/detectors/baremetrics/baremetrics.go | 3 --- pkg/detectors/beamer/beamer.go | 3 --- pkg/detectors/beebole/beebole.go | 3 --- pkg/detectors/besnappy/besnappy.go | 3 --- pkg/detectors/besttime/besttime.go | 3 --- pkg/detectors/betterstack/betterstack.go | 3 --- pkg/detectors/billomat/billomat.go | 9 ++------- pkg/detectors/bitbar/bitbar.go | 3 --- pkg/detectors/bitcoinaverage/bitcoinaverage.go | 3 --- pkg/detectors/bitfinex/bitfinex.go | 10 +++------- pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go | 3 --- pkg/detectors/bitmex/bitmex.go | 9 ++------- pkg/detectors/blazemeter/blazemeter.go | 3 --- pkg/detectors/blitapp/blitapp.go | 3 --- pkg/detectors/blocknative/blocknative.go | 3 --- pkg/detectors/blogger/blogger.go | 3 --- pkg/detectors/bombbomb/bombbomb.go | 3 --- pkg/detectors/boostnote/boostnote.go | 3 --- pkg/detectors/borgbase/borgbase.go | 3 --- pkg/detectors/braintreepayments/braintreepayments.go | 6 ------ pkg/detectors/brandfetch/brandfetch.go | 3 --- pkg/detectors/browserstack/browserstack.go | 6 ------ pkg/detectors/browshot/browshot.go | 3 --- pkg/detectors/bscscan/bscscan.go | 3 --- pkg/detectors/buddyns/buddyns.go | 3 --- pkg/detectors/budibase/budibase.go | 3 --- pkg/detectors/bugherd/bugherd.go | 3 --- pkg/detectors/bugsnag/bugsnag.go | 3 --- pkg/detectors/buildkite/buildkite.go | 3 --- pkg/detectors/buildkitev2/buildkite.go | 3 --- pkg/detectors/bulbul/bulbul.go | 3 --- pkg/detectors/bulksms/bulksms.go | 6 ------ pkg/detectors/buttercms/buttercms.go | 3 --- pkg/detectors/caflou/caflou.go | 3 --- pkg/detectors/calendarific/calendarific.go | 3 --- pkg/detectors/calendlyapikey/calendlyapikey.go | 3 --- pkg/detectors/calorieninja/calorieninja.go | 3 --- pkg/detectors/campayn/campayn.go | 3 --- pkg/detectors/cannyio/cannyio.go | 3 --- pkg/detectors/capsulecrm/capsulecrm.go | 3 --- pkg/detectors/captaindata/captaindata.go | 6 ------ pkg/detectors/carboninterface/carboninterface.go | 3 --- pkg/detectors/cashboard/cashboard.go | 6 ------ pkg/detectors/caspio/caspio.go | 12 ++---------- pkg/detectors/censys/censys.go | 6 ------ pkg/detectors/centralstationcrm/centralstationcrm.go | 3 --- pkg/detectors/cexio/cexio.go | 9 --------- pkg/detectors/chartmogul/chartmogul.go | 3 --- pkg/detectors/chatbot/chatbot.go | 3 --- pkg/detectors/chatfule/chatfule.go | 3 --- pkg/detectors/checio/checio.go | 3 --- pkg/detectors/checklyhq/checklyhq.go | 3 --- pkg/detectors/checkout/checkout.go | 6 ------ pkg/detectors/checkvist/checkvist.go | 6 ------ pkg/detectors/cicero/cicero.go | 3 --- pkg/detectors/clarifai/clarifai.go | 3 --- pkg/detectors/clearbit/clearbit.go | 3 --- pkg/detectors/clickhelp/clickhelp.go | 9 --------- pkg/detectors/clicksendsms/clicksendsms.go | 3 --- .../clickuppersonaltoken/clickuppersonaltoken.go | 3 --- pkg/detectors/cliengo/cliengo.go | 3 --- pkg/detectors/clinchpad/clinchpad.go | 3 --- pkg/detectors/clockify/clockify.go | 3 --- pkg/detectors/clockworksms/clockworksms.go | 6 ------ pkg/detectors/closecrm/close.go | 3 --- pkg/detectors/cloudconvert/cloudconvert.go | 3 --- pkg/detectors/cloudelements/cloudelements.go | 6 ------ .../cloudflareapitoken/cloudflareapitoken.go | 3 --- pkg/detectors/cloudflarecakey/cloudflarecakey.go | 6 ++---- .../cloudflareglobalapikey/cloudflareglobalapikey.go | 6 ------ pkg/detectors/cloudimage/cloudimage.go | 3 --- pkg/detectors/cloudmersive/cloudmersive.go | 3 --- pkg/detectors/cloudplan/cloudplan.go | 3 --- pkg/detectors/cloudsmith/cloudsmith.go | 3 --- pkg/detectors/cloverly/cloverly.go | 3 --- pkg/detectors/cloze/cloze.go | 6 ------ pkg/detectors/clustdoc/clustdoc.go | 3 --- pkg/detectors/coda/coda.go | 3 --- pkg/detectors/codacy/codacy.go | 3 --- pkg/detectors/codeclimate/codeclimate.go | 3 --- pkg/detectors/codemagic/codemagic.go | 3 --- pkg/detectors/codequiry/codequiry.go | 3 --- pkg/detectors/coinapi/coinapi.go | 3 --- pkg/detectors/coinbase/coinbase.go | 3 --- pkg/detectors/coinlayer/coinlayer.go | 3 --- pkg/detectors/coinlib/coinlib.go | 3 --- pkg/detectors/collect2/collect2.go | 3 --- pkg/detectors/column/column.go | 3 --- pkg/detectors/commercejs/commercejs.go | 3 --- pkg/detectors/commodities/commodities.go | 3 --- pkg/detectors/companyhub/companyhub.go | 6 ------ pkg/detectors/confluent/confluent.go | 6 ------ .../contentfulpersonalaccesstoken.go | 6 ++---- pkg/detectors/conversiontools/conversiontools.go | 6 ++---- pkg/detectors/convertapi/convertapi.go | 3 --- pkg/detectors/convertkit/convertkit.go | 3 --- pkg/detectors/convier/convier.go | 3 --- pkg/detectors/copper/copper.go | 6 ------ pkg/detectors/countrylayer/countrylayer.go | 3 --- pkg/detectors/courier/courier.go | 3 --- pkg/detectors/coveralls/coveralls.go | 3 --- pkg/detectors/craftmypdf/craftmypdf.go | 3 --- pkg/detectors/crowdin/crowdin.go | 3 --- pkg/detectors/cryptocompare/cryptocompare.go | 3 --- pkg/detectors/currencycloud/currencycloud.go | 6 ------ pkg/detectors/currencyfreaks/currencyfreaks.go | 3 --- pkg/detectors/currencylayer/currencylayer.go | 3 --- pkg/detectors/currencyscoop/currencyscoop.go | 3 --- pkg/detectors/currentsapi/currentsapi.go | 3 --- pkg/detectors/customerguru/customerguru.go | 6 ------ pkg/detectors/customerio/customerio.go | 6 ------ pkg/detectors/d7network/d7network.go | 3 --- pkg/detectors/dailyco/dailyco.go | 3 --- pkg/detectors/dandelion/dandelion.go | 3 --- pkg/detectors/dareboost/dareboost.go | 3 --- pkg/detectors/databox/databox.go | 3 --- pkg/detectors/datadogtoken/datadogtoken.go | 6 ------ pkg/detectors/datagov/datagov.go | 3 --- pkg/detectors/debounce/debounce.go | 3 --- pkg/detectors/deepai/deepai.go | 3 --- pkg/detectors/deepgram/deepgram.go | 3 --- pkg/detectors/delighted/delighted.go | 3 --- pkg/detectors/demio/demio.go | 6 ------ pkg/detectors/deputy/deputy.go | 6 ------ pkg/detectors/detectify/detectify.go | 3 --- pkg/detectors/detectlanguage/detectlanguage.go | 3 --- pkg/detectors/dfuse/dfuse.go | 3 --- pkg/detectors/diffbot/diffbot.go | 3 --- pkg/detectors/diggernaut/diggernaut.go | 3 --- pkg/detectors/digitaloceantoken/digitaloceantoken.go | 6 ++---- pkg/detectors/digitaloceanv2/digitaloceanv2.go | 3 --- pkg/detectors/discordbottoken/discordbottoken.go | 9 ++------- pkg/detectors/discordwebhook/discordwebhook.go | 3 --- pkg/detectors/disqus/disqus.go | 3 --- pkg/detectors/ditto/ditto.go | 3 --- pkg/detectors/dnscheck/dnscheck.go | 6 ------ pkg/detectors/docparser/docparser.go | 3 --- pkg/detectors/documo/documo.go | 3 --- pkg/detectors/docusign/docusign.go | 6 ------ pkg/detectors/doppler/doppler.go | 3 --- pkg/detectors/dotmailer/dotmailer.go | 6 ------ pkg/detectors/dovico/dovico.go | 6 ------ pkg/detectors/dronahq/dronahq.go | 3 --- pkg/detectors/droneci/droneci.go | 3 --- pkg/detectors/duply/duply.go | 6 ------ pkg/detectors/dwolla/dwolla.go | 6 ------ pkg/detectors/dynalist/dynalist.go | 3 --- pkg/detectors/dyspatch/dyspatch.go | 3 --- pkg/detectors/eagleeyenetworks/eagleeyenetworks.go | 9 ++------- pkg/detectors/easyinsight/easyinsight.go | 6 ------ pkg/detectors/ecostruxureit/ecostruxureit.go | 3 --- pkg/detectors/edamam/edamam.go | 6 ------ pkg/detectors/edenai/edenai.go | 3 --- pkg/detectors/eightxeight/eightxeight.go | 6 ------ pkg/detectors/elasticemail/elasticemail.go | 3 --- pkg/detectors/enablex/enablex.go | 6 ------ pkg/detectors/enigma/enigma.go | 3 --- pkg/detectors/envoyapikey/envoyapikey.go | 3 --- pkg/detectors/etherscan/etherscan.go | 3 --- pkg/detectors/ethplorer/ethplorer.go | 3 --- pkg/detectors/eventbrite/eventbrite.go | 3 --- pkg/detectors/everhour/everhour.go | 3 --- pkg/detectors/exchangerateapi/exchangerateapi.go | 6 ++---- pkg/detectors/exchangeratesapi/exchangeratesapi.go | 6 ++---- pkg/detectors/exportsdk/exportsdk.go | 6 ------ pkg/detectors/extractorapi/extractorapi.go | 3 --- pkg/detectors/facebookoauth/facebookoauth.go | 6 ------ pkg/detectors/faceplusplus/faceplusplus.go | 6 ------ pkg/detectors/fastforex/fastforex.go | 3 --- .../fastlypersonaltoken/fastlypersonaltoken.go | 6 ++---- pkg/detectors/feedier/feedier.go | 3 --- pkg/detectors/fetchrss/fetchrss.go | 3 --- pkg/detectors/fibery/fibery.go | 6 ------ .../v1/figmapersonalaccesstoken.go | 3 --- .../v2/figmapersonalaccesstoken_v2.go | 3 --- pkg/detectors/fileio/fileio.go | 3 --- pkg/detectors/finage/finage.go | 3 --- .../financialmodelingprep/financialmodelingprep.go | 6 ++---- pkg/detectors/findl/findl.go | 3 --- pkg/detectors/finnhub/finnhub.go | 3 --- pkg/detectors/fixerio/fixerio.go | 3 --- pkg/detectors/flatio/flatio.go | 3 --- pkg/detectors/fleetbase/fleetbase.go | 3 --- pkg/detectors/flickr/flickr.go | 3 --- pkg/detectors/flightapi/flightapi.go | 3 --- pkg/detectors/flightlabs/flightlabs.go | 3 --- pkg/detectors/flightstats/flightstats.go | 6 ------ pkg/detectors/float/float.go | 3 --- pkg/detectors/flowflu/flowflu.go | 6 ------ pkg/detectors/flutterwave/flutterwave.go | 3 --- pkg/detectors/fmfw/fmfw.go | 6 ------ pkg/detectors/formbucket/formbucket.go | 3 --- pkg/detectors/formcraft/formcraft.go | 3 --- pkg/detectors/formio/formio.go | 3 --- pkg/detectors/formsite/formsite.go | 9 --------- pkg/detectors/foursquare/foursquare.go | 6 ------ pkg/detectors/frameio/frameio.go | 3 --- pkg/detectors/freshbooks/freshbooks.go | 6 ------ pkg/detectors/freshdesk/freshdesk.go | 6 ------ pkg/detectors/front/front.go | 3 --- pkg/detectors/fulcrum/fulcrum.go | 3 --- pkg/detectors/fullstory/v1/fullstory.go | 3 --- pkg/detectors/fullstory/v2/fullstory_v2.go | 3 --- pkg/detectors/fxmarket/fxmarket.go | 3 --- pkg/detectors/geckoboard/geckoboard.go | 3 --- pkg/detectors/gemini/gemini.go | 3 --- pkg/detectors/gengo/gengo.go | 6 ------ pkg/detectors/geoapify/geoapify.go | 3 --- pkg/detectors/geocode/geocode.go | 3 --- pkg/detectors/geocodify/geocodify.go | 3 --- pkg/detectors/geocodio/geocodio.go | 6 ------ pkg/detectors/geoipifi/geoipifi.go | 3 --- pkg/detectors/getemail/getemail.go | 3 --- pkg/detectors/getemails/getemails.go | 6 ------ pkg/detectors/getgeoapi/getgeoapi.go | 3 --- pkg/detectors/getgist/getgist.go | 3 --- pkg/detectors/getresponse/getresponse.go | 3 --- pkg/detectors/getsandbox/getsandbox.go | 6 ------ pkg/detectors/github/v1/github_old.go | 3 --- pkg/detectors/github/v2/github.go | 3 --- pkg/detectors/github_oauth2/github_oauth2.go | 6 ------ pkg/detectors/githubapp/githubapp.go | 6 ------ pkg/detectors/gitlab/v1/gitlab.go | 3 --- pkg/detectors/gitlab/v2/gitlab_v2.go | 3 --- pkg/detectors/gitter/gitter.go | 3 --- pkg/detectors/glassnode/glassnode.go | 3 --- pkg/detectors/gocanvas/gocanvas.go | 6 ------ pkg/detectors/gocardless/gocardless.go | 3 --- pkg/detectors/goodday/goodday.go | 3 --- pkg/detectors/grafana/grafana.go | 3 --- .../grafanaserviceaccount/grafanaserviceaccount.go | 9 ++------- pkg/detectors/graphcms/graphcms.go | 6 ------ pkg/detectors/graphhopper/graphhopper.go | 3 --- pkg/detectors/groovehq/groovehq.go | 3 --- pkg/detectors/gtmetrix/gtmetrix.go | 3 --- pkg/detectors/guardianapi/guardianapi.go | 3 --- pkg/detectors/gumroad/gumroad.go | 3 --- pkg/detectors/guru/guru.go | 6 ------ pkg/detectors/gyazo/gyazo.go | 3 --- pkg/detectors/happyscribe/happyscribe.go | 3 --- pkg/detectors/harvest/harvest.go | 6 ------ pkg/detectors/hellosign/hellosign.go | 3 --- pkg/detectors/helpcrunch/helpcrunch.go | 3 --- pkg/detectors/helpscout/helpscout.go | 3 --- pkg/detectors/hereapi/hereapi.go | 3 --- pkg/detectors/heroku/heroku.go | 3 --- pkg/detectors/hive/hive.go | 6 ------ pkg/detectors/hiveage/hiveage.go | 3 --- pkg/detectors/holidayapi/holidayapi.go | 3 --- pkg/detectors/holistic/holistic.go | 3 --- pkg/detectors/honeycomb/honeycomb.go | 3 --- pkg/detectors/host/host.go | 3 --- pkg/detectors/html2pdf/html2pdf.go | 3 --- pkg/detectors/hubspotapikey/hubspotapikey.go | 3 --- pkg/detectors/huggingface/huggingface.go | 3 --- pkg/detectors/humanity/humanity.go | 3 --- pkg/detectors/hunter/hunter.go | 3 --- pkg/detectors/hybiscus/hybiscus.go | 3 --- pkg/detectors/hypertrack/hypertrack.go | 7 ------- pkg/detectors/ibmclouduserkey/ibmclouduserkey.go | 6 ++---- pkg/detectors/iconfinder/iconfinder.go | 3 --- pkg/detectors/iexapis/iexapis.go | 3 --- pkg/detectors/iexcloud/iexcloud.go | 3 --- pkg/detectors/imagekit/imagekit.go | 3 --- pkg/detectors/imagga/imagga.go | 3 --- pkg/detectors/impala/impala.go | 3 --- pkg/detectors/infura/infura.go | 3 --- pkg/detectors/insightly/insightly.go | 3 --- pkg/detectors/instabot/instabot.go | 3 --- pkg/detectors/instamojo/instamojo.go | 6 ------ pkg/detectors/intercom/intercom.go | 3 --- pkg/detectors/interseller/interseller.go | 3 --- pkg/detectors/intrinio/intrinio.go | 3 --- pkg/detectors/invoiceocean/invoiceocean.go | 6 ------ pkg/detectors/ip2location/ip2location.go | 3 --- pkg/detectors/ipapi/ipapi.go | 3 --- pkg/detectors/ipgeolocation/ipgeolocation.go | 3 --- pkg/detectors/ipinfo/ipinfo.go | 3 --- pkg/detectors/ipinfodb/ipinfodb.go | 3 --- pkg/detectors/ipquality/ipquality.go | 3 --- pkg/detectors/ipstack/ipstack.go | 3 --- pkg/detectors/jiratoken/v1/jiratoken.go | 9 --------- pkg/detectors/jiratoken/v2/jiratoken_v2.go | 6 ------ pkg/detectors/jotform/jotform.go | 3 --- pkg/detectors/jumpcloud/jumpcloud.go | 3 --- pkg/detectors/jupiterone/jupiterone.go | 3 --- pkg/detectors/juro/juro.go | 3 --- pkg/detectors/kanban/kanban.go | 6 ------ pkg/detectors/kanbantool/kanbantool.go | 6 ------ pkg/detectors/karmacrm/karmacrm.go | 3 --- pkg/detectors/keenio/keenio.go | 6 ------ pkg/detectors/kickbox/kickbox.go | 3 --- pkg/detectors/klaviyo/klaviyo.go | 3 --- pkg/detectors/klipfolio/klipfolio.go | 3 --- pkg/detectors/knapsackpro/knapsackpro.go | 3 --- pkg/detectors/kontent/kontent.go | 3 --- pkg/detectors/kraken/kraken.go | 6 ------ pkg/detectors/kucoin/kucoin.go | 9 --------- pkg/detectors/kylas/kylas.go | 3 --- pkg/detectors/languagelayer/languagelayer.go | 3 --- pkg/detectors/launchdarkly/launchdarkly.go | 3 --- pkg/detectors/leadfeeder/leadfeeder.go | 3 --- pkg/detectors/lemlist/lemlist.go | 3 --- pkg/detectors/lemonsqueezy/lemonsqueezy.go | 3 --- pkg/detectors/lendflow/lendflow.go | 3 --- pkg/detectors/lessannoyingcrm/lessannoyingcrm.go | 3 --- pkg/detectors/lexigram/lexigram.go | 3 --- pkg/detectors/linearapi/linearapi.go | 3 --- pkg/detectors/linemessaging/linemessaging.go | 3 --- pkg/detectors/linenotify/linenotify.go | 3 --- pkg/detectors/linkpreview/linkpreview.go | 3 --- pkg/detectors/liveagent/liveagent.go | 6 ------ pkg/detectors/livestorm/livestorm.go | 3 --- pkg/detectors/loadmill/loadmill.go | 3 --- pkg/detectors/lob/lob.go | 3 --- pkg/detectors/locationiq/locationiq.go | 3 --- pkg/detectors/loggly/loggly.go | 6 ------ pkg/detectors/loginradius/loginradius.go | 3 --- pkg/detectors/logzio/logzio.go | 3 --- pkg/detectors/lokalisetoken/lokalisetoken.go | 3 --- pkg/detectors/loyverse/loyverse.go | 3 --- pkg/detectors/lunchmoney/lunchmoney.go | 3 --- pkg/detectors/luno/luno.go | 6 ------ pkg/detectors/m3o/m3o.go | 3 --- pkg/detectors/madkudu/madkudu.go | 3 --- pkg/detectors/magicbell/magicbell.go | 6 ------ pkg/detectors/magnetic/magnetic.go | 3 --- pkg/detectors/mailboxlayer/mailboxlayer.go | 3 --- pkg/detectors/mailerlite/mailerlite.go | 3 --- pkg/detectors/mailgun/mailgun.go | 3 --- pkg/detectors/mailjetbasicauth/mailjetbasicauth.go | 6 ++---- pkg/detectors/mailjetsms/mailjetsms.go | 3 --- pkg/detectors/mailmodo/mailmodo.go | 3 --- pkg/detectors/mailsac/mailsac.go | 3 --- pkg/detectors/mandrill/mandrill.go | 3 --- pkg/detectors/manifest/manifest.go | 3 --- pkg/detectors/mapbox/mapbox.go | 3 --- pkg/detectors/mapquest/mapquest.go | 3 --- pkg/detectors/marketstack/marketstack.go | 3 --- .../mattermostpersonaltoken.go | 9 ++------- pkg/detectors/mavenlink/mavenlink.go | 3 --- pkg/detectors/maxmindlicense/v1/maxmindlicense.go | 3 --- pkg/detectors/meaningcloud/meaningcloud.go | 3 --- pkg/detectors/mediastack/mediastack.go | 3 --- pkg/detectors/meistertask/meistertask.go | 3 --- pkg/detectors/mesibo/mesibo.go | 3 --- pkg/detectors/messagebird/messagebird.go | 3 --- pkg/detectors/metaapi/metaapi.go | 6 ------ pkg/detectors/metabase/metabase.go | 6 ------ pkg/detectors/metrilo/metrilo.go | 3 --- .../microsoftteamswebhook/microsoftteamswebhook.go | 3 --- pkg/detectors/mindmeister/mindmeister.go | 3 --- pkg/detectors/miro/miro.go | 3 --- pkg/detectors/mite/mite.go | 6 ------ pkg/detectors/mixmax/mixmax.go | 3 --- pkg/detectors/mixpanel/mixpanel.go | 6 ------ pkg/detectors/mockaroo/mockaroo.go | 3 --- pkg/detectors/moderation/moderation.go | 3 --- pkg/detectors/monday/monday.go | 3 --- pkg/detectors/monkeylearn/monkeylearn.go | 3 --- pkg/detectors/moonclerk/moonclerk.go | 3 --- pkg/detectors/moosend/moosend.go | 3 --- pkg/detectors/moralis/moralis.go | 3 --- pkg/detectors/mrticktock/mrticktock.go | 6 ------ pkg/detectors/mux/mux.go | 6 ------ pkg/detectors/myfreshworks/myfreshworks.go | 6 ------ pkg/detectors/myintervals/myintervals.go | 3 --- pkg/detectors/nasdaqdatalink/nasdaqdatalink.go | 3 --- pkg/detectors/nethunt/nethunt.go | 6 ------ pkg/detectors/netlify/netlify.go | 3 --- pkg/detectors/neutrinoapi/neutrinoapi.go | 6 ------ .../newrelicpersonalapikey/newrelicpersonalapikey.go | 6 ++---- pkg/detectors/newsapi/newsapi.go | 3 --- pkg/detectors/newscatcher/newscatcher.go | 3 --- pkg/detectors/nexmoapikey/nexmoapikey.go | 6 ------ pkg/detectors/nftport/nftport.go | 3 --- pkg/detectors/ngc/ngc.go | 3 --- pkg/detectors/ngrok/ngrok.go | 3 --- pkg/detectors/nicereply/nicereply.go | 3 --- pkg/detectors/nightfall/nightfall.go | 3 --- pkg/detectors/nimble/nimble.go | 3 --- pkg/detectors/noticeable/noticeable.go | 3 --- pkg/detectors/notion/notion.go | 3 --- pkg/detectors/nozbeteams/nozbeteams.go | 3 --- pkg/detectors/npmtoken/npmtoken.go | 3 --- pkg/detectors/npmtokenv2/npmtokenv2.go | 3 --- pkg/detectors/nugetapikey/nugetapikey.go | 3 --- pkg/detectors/numverify/numverify.go | 3 --- pkg/detectors/nutritionix/nutritionix.go | 6 ------ pkg/detectors/nylas/nylas.go | 3 --- pkg/detectors/oanda/oanda.go | 3 --- pkg/detectors/omnisend/omnisend.go | 3 --- pkg/detectors/onedesk/onedesk.go | 6 ------ pkg/detectors/onelogin/onelogin.go | 6 ------ pkg/detectors/onepagecrm/onepagecrm.go | 6 ------ pkg/detectors/onesignal/onesignal.go | 3 --- pkg/detectors/onwaterio/onwaterio.go | 3 --- pkg/detectors/oopspam/oopspam.go | 3 --- pkg/detectors/opencagedata/opencagedata.go | 3 --- pkg/detectors/openuv/openuv.go | 3 --- pkg/detectors/openweather/openweather.go | 3 --- pkg/detectors/opsgenie/opsgenie.go | 3 --- pkg/detectors/optimizely/optimizely.go | 3 --- pkg/detectors/overloop/overloop.go | 3 --- pkg/detectors/owlbot/owlbot.go | 3 --- pkg/detectors/packagecloud/packagecloud.go | 3 --- pkg/detectors/pagerdutyapikey/pagerdutyapikey.go | 6 ++---- pkg/detectors/pandadoc/pandadoc.go | 3 --- pkg/detectors/pandascore/pandascore.go | 3 --- pkg/detectors/paperform/paperform.go | 3 --- pkg/detectors/paralleldots/paralleldots.go | 3 --- pkg/detectors/parsehub/parsehub.go | 3 --- pkg/detectors/parsers/parsers.go | 3 --- pkg/detectors/parseur/parseur.go | 3 --- pkg/detectors/partnerstack/partnerstack.go | 3 --- pkg/detectors/pastebin/pastebin.go | 3 --- pkg/detectors/paydirtapp/paydirtapp.go | 3 --- pkg/detectors/paymoapp/paymoapp.go | 3 --- pkg/detectors/paymongo/paymongo.go | 3 --- pkg/detectors/paypaloauth/paypaloauth.go | 6 ------ pkg/detectors/paystack/paystack.go | 3 --- pkg/detectors/pdflayer/pdflayer.go | 3 --- pkg/detectors/pdfshift/pdfshift.go | 3 --- pkg/detectors/peopledatalabs/peopledatalabs.go | 3 --- pkg/detectors/pepipost/pepipost.go | 3 --- pkg/detectors/percy/percy.go | 3 --- pkg/detectors/pinata/pinata.go | 6 ------ pkg/detectors/pipedream/pipedream.go | 3 --- pkg/detectors/pipedrive/pipedrive.go | 3 --- pkg/detectors/pivotaltracker/pivotaltracker.go | 3 --- pkg/detectors/pixabay/pixabay.go | 3 --- pkg/detectors/plaidkey/plaidkey.go | 6 ------ pkg/detectors/planviewleankit/planviewleankit.go | 9 ++------- pkg/detectors/planyo/planyo.go | 3 --- pkg/detectors/plivo/plivo.go | 6 ------ pkg/detectors/podio/podio.go | 3 --- pkg/detectors/pollsapi/pollsapi.go | 3 --- pkg/detectors/poloniex/poloniex.go | 6 ------ pkg/detectors/polygon/polygon.go | 3 --- pkg/detectors/portainer/portainer.go | 3 --- pkg/detectors/portainertoken/portainertoken.go | 3 --- pkg/detectors/positionstack/positionstack.go | 3 --- pkg/detectors/postageapp/postageapp.go | 3 --- pkg/detectors/postbacks/postbacks.go | 3 --- pkg/detectors/posthog/posthog.go | 3 --- pkg/detectors/postman/postman.go | 3 --- pkg/detectors/postmark/postmark.go | 3 --- pkg/detectors/powrbot/powrbot.go | 3 --- pkg/detectors/prefect/prefect.go | 3 --- pkg/detectors/privacy/privacy.go | 3 --- pkg/detectors/prodpad/prodpad.go | 3 --- pkg/detectors/prospectcrm/prospectcrm.go | 3 --- pkg/detectors/protocolsio/protocolsio.go | 3 --- pkg/detectors/proxycrawl/proxycrawl.go | 3 --- pkg/detectors/pubnubpublishkey/pubnubpublishkey.go | 9 ++------- .../pubnubsubscriptionkey/pubnubsubscriptionkey.go | 6 ++---- pkg/detectors/pulumi/pulumi.go | 3 --- pkg/detectors/purestake/purestake.go | 3 --- pkg/detectors/pushbulletapikey/pushbulletapikey.go | 6 ++---- pkg/detectors/pusherchannelkey/pusherchannelkey.go | 9 --------- pkg/detectors/qase/qase.go | 3 --- pkg/detectors/qualaroo/qualaroo.go | 3 --- pkg/detectors/qubole/qubole.go | 3 --- pkg/detectors/ramp/ramp.go | 10 ++-------- pkg/detectors/rapidapi/rapidapi.go | 3 --- pkg/detectors/raven/raven.go | 3 --- pkg/detectors/rawg/rawg.go | 3 --- pkg/detectors/reachmail/reachmail.go | 3 --- pkg/detectors/readme/readme.go | 3 --- .../reallysimplesystems/reallysimplesystems.go | 6 ++---- pkg/detectors/rebrandly/rebrandly.go | 3 --- pkg/detectors/refiner/refiner.go | 3 --- pkg/detectors/rentman/rentman.go | 3 --- pkg/detectors/repairshopr/repairshopr.go | 6 ------ pkg/detectors/replicate/replicate.go | 3 --- pkg/detectors/replyio/replyio.go | 3 --- pkg/detectors/requestfinance/requestfinance.go | 6 ++---- pkg/detectors/restpack/restpack.go | 3 --- .../restpackhtmltopdfapi/restpackhtmltopdfapi.go | 6 ++---- .../restpackscreenshotapi/restpackscreenshotapi.go | 6 ++---- pkg/detectors/rev/rev.go | 6 ------ pkg/detectors/revampcrm/revampcrm.go | 6 ------ pkg/detectors/ringcentral/ringcentral.go | 6 ------ pkg/detectors/ritekit/ritekit.go | 3 --- pkg/detectors/roaring/roaring.go | 6 ------ pkg/detectors/rocketreach/rocketreach.go | 3 --- pkg/detectors/rockset/rockset.go | 3 --- pkg/detectors/roninapp/roninapp.go | 6 ------ pkg/detectors/route4me/route4me.go | 3 --- pkg/detectors/rownd/rownd.go | 9 --------- pkg/detectors/rubygems/rubygems.go | 3 --- pkg/detectors/runrunit/runrunit.go | 6 ------ pkg/detectors/salesblink/salesblink.go | 3 --- pkg/detectors/salescookie/salescookie.go | 3 --- pkg/detectors/salesflare/salesflare.go | 3 --- pkg/detectors/salesforce/salesforce.go | 6 ------ pkg/detectors/salesmate/salesmate.go | 6 ------ .../satismeterprojectkey/satismeterprojectkey.go | 12 ++---------- .../satismeterwritekey/satismeterwritekey.go | 6 ++---- pkg/detectors/saucelabs/saucelabs.go | 6 ------ pkg/detectors/scalewaykey/scalewaykey.go | 3 --- pkg/detectors/scalr/scalr.go | 6 ------ pkg/detectors/scrapeowl/scrapeowl.go | 3 --- pkg/detectors/scraperapi/scraperapi.go | 3 --- pkg/detectors/scraperbox/scraperbox.go | 3 --- pkg/detectors/scrapestack/scrapestack.go | 3 --- pkg/detectors/scrapfly/scrapfly.go | 3 --- pkg/detectors/scrapingant/scrapingant.go | 3 --- pkg/detectors/scrapingbee/scrapingbee.go | 3 --- pkg/detectors/screenshotapi/screenshotapi.go | 3 --- pkg/detectors/screenshotlayer/screenshotlayer.go | 3 --- pkg/detectors/scrutinizerci/scrutinizerci.go | 3 --- pkg/detectors/securitytrails/securitytrails.go | 3 --- pkg/detectors/segmentapikey/segmentapikey.go | 3 --- pkg/detectors/selectpdf/selectpdf.go | 3 --- pkg/detectors/semaphore/semaphore.go | 3 --- pkg/detectors/sendbird/sendbird.go | 6 ------ .../sendbirdorganizationapi.go | 6 ++---- pkg/detectors/sendinbluev2/sendinbluev2.go | 3 --- pkg/detectors/sentrytoken/sentrytoken.go | 3 --- pkg/detectors/serphouse/serphouse.go | 3 --- pkg/detectors/serpstack/serpstack.go | 3 --- pkg/detectors/sheety/sheety.go | 6 ------ pkg/detectors/sherpadesk/sherpadesk.go | 3 --- pkg/detectors/shipday/shipday.go | 3 --- pkg/detectors/shodankey/shodankey.go | 3 --- pkg/detectors/shortcut/shortcut.go | 3 --- pkg/detectors/shotstack/shotstack.go | 3 --- pkg/detectors/shutterstock/shutterstock.go | 6 ------ pkg/detectors/shutterstockoauth/shutterstockoauth.go | 6 ++---- pkg/detectors/signable/signable.go | 3 --- pkg/detectors/signalwire/signalwire.go | 9 --------- pkg/detectors/signaturit/signaturit.go | 3 --- pkg/detectors/signupgenius/signupgenius.go | 3 --- pkg/detectors/sigopt/sigopt.go | 3 --- pkg/detectors/simfin/simfin.go | 3 --- pkg/detectors/simplesat/simplesat.go | 3 --- pkg/detectors/simplynoted/simplynoted.go | 3 --- pkg/detectors/simvoly/simvoly.go | 3 --- pkg/detectors/sinchmessage/sinchmessage.go | 6 ------ pkg/detectors/sirv/sirv.go | 6 ------ pkg/detectors/siteleaf/siteleaf.go | 6 ------ pkg/detectors/skrappio/skrappio.go | 3 --- pkg/detectors/skybiometry/skybiometry.go | 6 ------ pkg/detectors/slackwebhook/slackwebhook.go | 3 --- pkg/detectors/smartsheets/smartsheets.go | 3 --- pkg/detectors/smartystreets/smartystreets.go | 6 ------ pkg/detectors/smooch/smooch.go | 6 ------ pkg/detectors/snipcart/snipcart.go | 3 --- pkg/detectors/snowflake/snowflake.go | 3 --- pkg/detectors/sonarcloud/sonarcloud.go | 3 --- pkg/detectors/sourcegraph/sourcegraph.go | 3 --- pkg/detectors/sourcegraphcody/sourcegraphcody.go | 6 ++---- pkg/detectors/sparkpost/sparkpost.go | 3 --- pkg/detectors/speechtextai/speechtextai.go | 3 --- .../splunkobservabilitytoken.go | 8 +++----- pkg/detectors/spoonacular/spoonacular.go | 3 --- pkg/detectors/sportsmonk/sportsmonk.go | 3 --- pkg/detectors/spotifykey/spotifykey.go | 6 ------ pkg/detectors/square/square.go | 3 --- pkg/detectors/squarespace/squarespace.go | 3 --- pkg/detectors/squareup/squareup.go | 3 --- pkg/detectors/sslmate/sslmate.go | 3 --- pkg/detectors/statuscake/statuscake.go | 3 --- pkg/detectors/statuspage/statuspage.go | 3 --- pkg/detectors/statuspal/statuspal.go | 3 --- pkg/detectors/stitchdata/stitchdata.go | 3 --- pkg/detectors/stockdata/stockdata.go | 3 --- pkg/detectors/storecove/storecove.go | 3 --- pkg/detectors/stormboard/stormboard.go | 3 --- pkg/detectors/stormglass/stormglass.go | 3 --- pkg/detectors/storyblok/storyblok.go | 3 --- pkg/detectors/storychief/storychief.go | 3 --- pkg/detectors/strava/strava.go | 9 --------- pkg/detectors/streak/streak.go | 3 --- pkg/detectors/stripo/stripo.go | 3 --- pkg/detectors/stytch/stytch.go | 6 ------ pkg/detectors/sugester/sugester.go | 6 ------ pkg/detectors/sumologickey/sumologickey.go | 6 ------ pkg/detectors/supabasetoken/supabasetoken.go | 3 --- pkg/detectors/supernotesapi/supernotesapi.go | 3 --- pkg/detectors/surveyanyplace/surveyanyplace.go | 6 ------ pkg/detectors/surveybot/surveybot.go | 3 --- pkg/detectors/surveysparrow/surveysparrow.go | 3 --- pkg/detectors/survicate/survicate.go | 3 --- pkg/detectors/swell/swell.go | 6 ------ pkg/detectors/swiftype/swiftype.go | 3 --- pkg/detectors/tallyfy/tallyfy.go | 3 --- pkg/detectors/tatumio/tatumio.go | 3 --- pkg/detectors/taxjar/taxjar.go | 3 --- pkg/detectors/teamgate/teamgate.go | 6 ------ pkg/detectors/teamworkcrm/teamworkcrm.go | 3 --- pkg/detectors/teamworkdesk/teamworkdesk.go | 3 --- pkg/detectors/teamworkspaces/teamworkspaces.go | 3 --- .../technicalanalysisapi/technicalanalysisapi.go | 3 --- pkg/detectors/tefter/tefter.go | 3 --- pkg/detectors/telegrambottoken/telegrambottoken.go | 8 +++----- pkg/detectors/teletype/teletype.go | 3 --- pkg/detectors/telnyx/telnyx.go | 3 --- .../terraformcloudpersonaltoken.go | 6 ++---- pkg/detectors/testingbot/testingbot.go | 6 ------ pkg/detectors/textmagic/textmagic.go | 6 ------ pkg/detectors/theoddsapi/theoddsapi.go | 3 --- pkg/detectors/thinkific/thinkific.go | 7 ------- pkg/detectors/thousandeyes/thousandeyes.go | 6 ------ pkg/detectors/ticketmaster/ticketmaster.go | 3 --- pkg/detectors/tickettailor/tickettailor.go | 3 --- pkg/detectors/tiingo/tiingo.go | 3 --- pkg/detectors/timecamp/timecamp.go | 3 --- pkg/detectors/timezoneapi/timezoneapi.go | 3 --- pkg/detectors/tineswebhook/tineswebhook.go | 3 --- pkg/detectors/tly/tly.go | 3 --- pkg/detectors/tmetric/tmetric.go | 3 --- pkg/detectors/todoist/todoist.go | 3 --- pkg/detectors/toggltrack/toggltrack.go | 3 --- pkg/detectors/tokeet/tokeet.go | 6 ------ pkg/detectors/tomorrowio/tomorrowio.go | 3 --- pkg/detectors/tomtom/tomtom.go | 3 --- pkg/detectors/tradier/tradier.go | 3 --- pkg/detectors/transferwise/transferwise.go | 3 --- pkg/detectors/travelpayouts/travelpayouts.go | 3 --- pkg/detectors/travisci/travisci.go | 3 --- pkg/detectors/trelloapikey/trelloapikey.go | 3 --- pkg/detectors/tru/tru.go | 6 ------ .../trufflehogenterprise/trufflehogenterprise.go | 10 ---------- pkg/detectors/twelvedata/twelvedata.go | 3 --- pkg/detectors/twist/twist.go | 3 --- pkg/detectors/twitch/twitch.go | 6 ------ pkg/detectors/twitter/twitter.go | 3 --- pkg/detectors/tyntec/tyntec.go | 3 --- pkg/detectors/typeform/typeform.go | 3 --- pkg/detectors/typetalk/typetalk.go | 6 ------ pkg/detectors/ubidots/ubidots.go | 3 --- pkg/detectors/uclassify/uclassify.go | 3 --- pkg/detectors/unifyid/unifyid.go | 3 --- pkg/detectors/unplugg/unplugg.go | 3 --- pkg/detectors/unsplash/unsplash.go | 3 --- pkg/detectors/upcdatabase/upcdatabase.go | 3 --- pkg/detectors/uplead/uplead.go | 3 --- pkg/detectors/uploadcare/uploadcare.go | 6 ------ pkg/detectors/uptimerobot/uptimerobot.go | 3 --- pkg/detectors/upwave/upwave.go | 3 --- pkg/detectors/urlscan/urlscan.go | 3 --- pkg/detectors/user/user.go | 3 --- pkg/detectors/userflow/userflow.go | 3 --- pkg/detectors/userstack/userstack.go | 3 --- .../vagrantcloudpersonaltoken.go | 6 ++---- pkg/detectors/vatlayer/vatlayer.go | 3 --- pkg/detectors/vbout/vbout.go | 3 --- pkg/detectors/vercel/vercel.go | 3 --- pkg/detectors/verifier/verifier.go | 6 ------ pkg/detectors/verimail/verimail.go | 3 --- pkg/detectors/veriphone/veriphone.go | 3 --- pkg/detectors/versioneye/versioneye.go | 3 --- pkg/detectors/viewneo/viewneo.go | 3 --- pkg/detectors/virustotal/virustotal.go | 3 --- pkg/detectors/visualcrossing/visualcrossing.go | 6 ++---- pkg/detectors/voiceflow/voiceflow.go | 3 --- pkg/detectors/voicegain/voicegain.go | 3 --- pkg/detectors/voodoosms/voodoosms.go | 3 --- pkg/detectors/vouchery/vouchery.go | 6 ------ pkg/detectors/vpnapi/vpnapi.go | 3 --- pkg/detectors/vultrapikey/vultrapikey.go | 3 --- pkg/detectors/vyte/vyte.go | 3 --- pkg/detectors/walkscore/walkscore.go | 3 --- pkg/detectors/weatherbit/weatherbit.go | 3 --- pkg/detectors/weatherstack/weatherstack.go | 3 --- pkg/detectors/web3storage/web3storage.go | 3 --- pkg/detectors/webex/webex.go | 7 ------- pkg/detectors/webflow/webflow.go | 3 --- pkg/detectors/webscraper/webscraper.go | 3 --- pkg/detectors/webscraping/webscraping.go | 3 --- pkg/detectors/websitepulse/websitepulse.go | 6 ------ pkg/detectors/wepay/wepay.go | 6 ------ pkg/detectors/whoxy/whoxy.go | 3 --- pkg/detectors/wistia/wistia.go | 3 --- pkg/detectors/wit/wit.go | 3 --- pkg/detectors/worksnaps/worksnaps.go | 3 --- pkg/detectors/workstack/workstack.go | 3 --- pkg/detectors/worldcoinindex/worldcoinindex.go | 3 --- pkg/detectors/worldweather/worldweather.go | 3 --- pkg/detectors/wrike/wrike.go | 3 --- pkg/detectors/yandex/yandex.go | 3 --- pkg/detectors/yelp/yelp.go | 3 --- pkg/detectors/youneedabudget/youneedabudget.go | 3 --- pkg/detectors/yousign/yousign.go | 3 --- pkg/detectors/youtubeapikey/youtubeapikey.go | 6 ------ pkg/detectors/zapierwebhook/zapierwebhook.go | 3 --- pkg/detectors/zendeskapi/zendeskapi.go | 9 --------- pkg/detectors/zenkitapi/zenkitapi.go | 3 --- pkg/detectors/zenrows/zenrows.go | 3 --- pkg/detectors/zenscrape/zenscrape.go | 3 --- pkg/detectors/zenserp/zenserp.go | 3 --- pkg/detectors/zeplin/zeplin.go | 3 --- pkg/detectors/zerobounce/zerobounce.go | 3 --- pkg/detectors/zerotier/zerotier.go | 3 --- pkg/detectors/zipapi/zipapi.go | 9 --------- pkg/detectors/zipbooks/zipbooks.go | 6 ------ pkg/detectors/zipcodeapi/zipcodeapi.go | 3 --- pkg/detectors/zipcodebase/zipcodebase.go | 3 --- pkg/detectors/zonkafeedback/zonkafeedback.go | 3 --- pkg/detectors/zulipchat/zulipchat.go | 6 ------ 771 files changed, 105 insertions(+), 2962 deletions(-) diff --git a/pkg/detectors/abbysale/abbysale.go b/pkg/detectors/abbysale/abbysale.go index 047c89d0822f..e2927992ba42 100644 --- a/pkg/detectors/abbysale/abbysale.go +++ b/pkg/detectors/abbysale/abbysale.go @@ -49,9 +49,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/abstract/abstract.go b/pkg/detectors/abstract/abstract.go index d6db71a9fa49..431a828cdb81 100644 --- a/pkg/detectors/abstract/abstract.go +++ b/pkg/detectors/abstract/abstract.go @@ -48,9 +48,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/abuseipdb/abuseipdb.go b/pkg/detectors/abuseipdb/abuseipdb.go index 238f59530218..15b4c5b426ab 100644 --- a/pkg/detectors/abuseipdb/abuseipdb.go +++ b/pkg/detectors/abuseipdb/abuseipdb.go @@ -51,9 +51,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/accuweather/accuweather.go b/pkg/detectors/accuweather/accuweather.go index 7fdac2635b58..1938af6be7cc 100644 --- a/pkg/detectors/accuweather/accuweather.go +++ b/pkg/detectors/accuweather/accuweather.go @@ -49,9 +49,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/adafruitio/adafruitio.go b/pkg/detectors/adafruitio/adafruitio.go index 612879b24122..8db10d14be5a 100644 --- a/pkg/detectors/adafruitio/adafruitio.go +++ b/pkg/detectors/adafruitio/adafruitio.go @@ -49,9 +49,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/adobeio/adobeio.go b/pkg/detectors/adobeio/adobeio.go index 0e8667e81062..5c01b7b28c31 100644 --- a/pkg/detectors/adobeio/adobeio.go +++ b/pkg/detectors/adobeio/adobeio.go @@ -2,10 +2,11 @@ package adobeio import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -40,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/adzuna/adzuna.go b/pkg/detectors/adzuna/adzuna.go index 71ac40a1bbee..b1513791ee68 100644 --- a/pkg/detectors/adzuna/adzuna.go +++ b/pkg/detectors/adzuna/adzuna.go @@ -3,10 +3,11 @@ package adzuna import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -50,15 +51,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aeroworkflow/aeroworkflow.go b/pkg/detectors/aeroworkflow/aeroworkflow.go index 6c015ac88f59..6fd7b685b3fb 100644 --- a/pkg/detectors/aeroworkflow/aeroworkflow.go +++ b/pkg/detectors/aeroworkflow/aeroworkflow.go @@ -52,15 +52,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/agora/agora.go b/pkg/detectors/agora/agora.go index 8a2a6d6fea65..84227d9cb6c8 100644 --- a/pkg/detectors/agora/agora.go +++ b/pkg/detectors/agora/agora.go @@ -52,16 +52,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secret := range secretMatches { - if len(secret) != 2 { - continue - } resSecret := strings.TrimSpace(secret[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aha/aha.go b/pkg/detectors/aha/aha.go index 6788794aa59c..562cb972be55 100644 --- a/pkg/detectors/aha/aha.go +++ b/pkg/detectors/aha/aha.go @@ -50,16 +50,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result resURLMatch := "aha.io" for _, URLmatch := range URLmatches { - if len(URLmatch) != 2 { - continue - } resURLMatch = strings.TrimSpace(URLmatch[1]) } for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go b/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go index 82efb1de165e..5f8701d21276 100644 --- a/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go +++ b/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go b/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go index 5f1a916d1e1c..443bd2a95692 100644 --- a/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go +++ b/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/airship/airship.go b/pkg/detectors/airship/airship.go index 8479fe75cefd..5780f564cced 100644 --- a/pkg/detectors/airship/airship.go +++ b/pkg/detectors/airship/airship.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/airtableapikey/airtableapikey.go b/pkg/detectors/airtableapikey/airtableapikey.go index 38b98d640092..5320a4e4466c 100644 --- a/pkg/detectors/airtableapikey/airtableapikey.go +++ b/pkg/detectors/airtableapikey/airtableapikey.go @@ -55,16 +55,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } keyRes := strings.TrimSpace(keyMatch[1]) for _, appMatch := range appMatches { - if len(appMatch) != 2 { - continue - } appRes := strings.TrimSpace(appMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/airvisual/airvisual.go b/pkg/detectors/airvisual/airvisual.go index ee2ac2978187..241d9b35df2d 100644 --- a/pkg/detectors/airvisual/airvisual.go +++ b/pkg/detectors/airvisual/airvisual.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aiven/aiven.go b/pkg/detectors/aiven/aiven.go index 9f514c73bda6..1499d3b17d96 100644 --- a/pkg/detectors/aiven/aiven.go +++ b/pkg/detectors/aiven/aiven.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/alconost/alconost.go b/pkg/detectors/alconost/alconost.go index 1a7faf98db97..26346db89f43 100644 --- a/pkg/detectors/alconost/alconost.go +++ b/pkg/detectors/alconost/alconost.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/alegra/alegra.go b/pkg/detectors/alegra/alegra.go index 3e6355dd1caf..284aa0bd4e1f 100644 --- a/pkg/detectors/alegra/alegra.go +++ b/pkg/detectors/alegra/alegra.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/aletheiaapi/aletheiaapi.go b/pkg/detectors/aletheiaapi/aletheiaapi.go index 1c83a01f6b37..356634c18653 100644 --- a/pkg/detectors/aletheiaapi/aletheiaapi.go +++ b/pkg/detectors/aletheiaapi/aletheiaapi.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/algoliaadminkey/algoliaadminkey.go b/pkg/detectors/algoliaadminkey/algoliaadminkey.go index 0287589aeb40..527dc1d5c908 100644 --- a/pkg/detectors/algoliaadminkey/algoliaadminkey.go +++ b/pkg/detectors/algoliaadminkey/algoliaadminkey.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/alibaba/alibaba.go b/pkg/detectors/alibaba/alibaba.go index f98f9ff826bc..d9f13323cb73 100644 --- a/pkg/detectors/alibaba/alibaba.go +++ b/pkg/detectors/alibaba/alibaba.go @@ -92,15 +92,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/alienvault/alienvault.go b/pkg/detectors/alienvault/alienvault.go index 15e281c074f2..3c4ca8de0e44 100644 --- a/pkg/detectors/alienvault/alienvault.go +++ b/pkg/detectors/alienvault/alienvault.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/allsports/allsports.go b/pkg/detectors/allsports/allsports.go index e71ebdeafaeb..012d4d9e6d48 100644 --- a/pkg/detectors/allsports/allsports.go +++ b/pkg/detectors/allsports/allsports.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/amadeus/amadeus.go b/pkg/detectors/amadeus/amadeus.go index 6f994dcae6f3..1011f49f463e 100644 --- a/pkg/detectors/amadeus/amadeus.go +++ b/pkg/detectors/amadeus/amadeus.go @@ -2,11 +2,12 @@ package amadeus import ( "context" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ambee/ambee.go b/pkg/detectors/ambee/ambee.go index 3f2d498dfb8d..3c72a75d9d22 100644 --- a/pkg/detectors/ambee/ambee.go +++ b/pkg/detectors/ambee/ambee.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/amplitudeapikey/amplitudeapikey.go b/pkg/detectors/amplitudeapikey/amplitudeapikey.go index 25e3a9e45128..02c9a2306c55 100644 --- a/pkg/detectors/amplitudeapikey/amplitudeapikey.go +++ b/pkg/detectors/amplitudeapikey/amplitudeapikey.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/anthropic/anthropic.go b/pkg/detectors/anthropic/anthropic.go index a68cd90be103..643afa2efe79 100644 --- a/pkg/detectors/anthropic/anthropic.go +++ b/pkg/detectors/anthropic/anthropic.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/anypoint/anypoint.go b/pkg/detectors/anypoint/anypoint.go index c30e69709ae1..5c8bebdf2cef 100644 --- a/pkg/detectors/anypoint/anypoint.go +++ b/pkg/detectors/anypoint/anypoint.go @@ -3,10 +3,11 @@ package anypoint import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result orgMatches := orgPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, orgMatch := range orgMatches { - if len(orgMatch) != 2 { - continue - } orgRes := strings.TrimSpace(orgMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apacta/apacta.go b/pkg/detectors/apacta/apacta.go index 9b43384f68fb..e8c2cefad7bb 100644 --- a/pkg/detectors/apacta/apacta.go +++ b/pkg/detectors/apacta/apacta.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/api2cart/api2cart.go b/pkg/detectors/api2cart/api2cart.go index 050614e03e8a..17c49f3851b7 100644 --- a/pkg/detectors/api2cart/api2cart.go +++ b/pkg/detectors/api2cart/api2cart.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apideck/apideck.go b/pkg/detectors/apideck/apideck.go index 655ee86c953d..85910c2d8139 100644 --- a/pkg/detectors/apideck/apideck.go +++ b/pkg/detectors/apideck/apideck.go @@ -3,10 +3,11 @@ package apideck import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idMatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apiflash/apiflash.go b/pkg/detectors/apiflash/apiflash.go index 50dc97ccb75f..4797fa08af22 100644 --- a/pkg/detectors/apiflash/apiflash.go +++ b/pkg/detectors/apiflash/apiflash.go @@ -3,10 +3,11 @@ package apiflash import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -40,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resUrlMatch := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apifonica/apifonica.go b/pkg/detectors/apifonica/apifonica.go index 0f50379db3e8..fd612d67e58d 100644 --- a/pkg/detectors/apifonica/apifonica.go +++ b/pkg/detectors/apifonica/apifonica.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result tokenMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, tokenMatch := range tokenMatches { - if len(tokenMatch) != 2 { - continue - } resToken := strings.TrimSpace(tokenMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apify/apify.go b/pkg/detectors/apify/apify.go index f612c217bad5..680afc7e2c9f 100644 --- a/pkg/detectors/apify/apify.go +++ b/pkg/detectors/apify/apify.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apilayer/apilayer.go b/pkg/detectors/apilayer/apilayer.go index 07d673db325e..6b6093699bf9 100644 --- a/pkg/detectors/apilayer/apilayer.go +++ b/pkg/detectors/apilayer/apilayer.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apimatic/apimatic.go b/pkg/detectors/apimatic/apimatic.go index d55508fc931a..67a00ac20524 100644 --- a/pkg/detectors/apimatic/apimatic.go +++ b/pkg/detectors/apimatic/apimatic.go @@ -2,11 +2,12 @@ package apimatic import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" "time" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passMatches := passPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } userPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range passMatches { - if len(idMatch) != 2 { - continue - } passPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/apiscience/apiscience.go b/pkg/detectors/apiscience/apiscience.go index a813b36c72a1..0f744f2f0768 100644 --- a/pkg/detectors/apiscience/apiscience.go +++ b/pkg/detectors/apiscience/apiscience.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apitemplate/apitemplate.go b/pkg/detectors/apitemplate/apitemplate.go index 8cc24b064a4a..57f56a37bb49 100644 --- a/pkg/detectors/apitemplate/apitemplate.go +++ b/pkg/detectors/apitemplate/apitemplate.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apollo/apollo.go b/pkg/detectors/apollo/apollo.go index 6e8dedcc3da1..d52590e681a3 100644 --- a/pkg/detectors/apollo/apollo.go +++ b/pkg/detectors/apollo/apollo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/appcues/appcues.go b/pkg/detectors/appcues/appcues.go index 51e27841c21b..06a181fc02de 100644 --- a/pkg/detectors/appcues/appcues.go +++ b/pkg/detectors/appcues/appcues.go @@ -3,10 +3,11 @@ package appcues import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -43,22 +44,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, userMatch := range userMatches { - if len(userMatch) != 2 { - continue - } resUserMatch := strings.TrimSpace(userMatch[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/appfollow/appfollow.go b/pkg/detectors/appfollow/appfollow.go index 962278df8fef..948c0a12871e 100644 --- a/pkg/detectors/appfollow/appfollow.go +++ b/pkg/detectors/appfollow/appfollow.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/appointedd/appointedd.go b/pkg/detectors/appointedd/appointedd.go index dedc59c93f87..d250f7780b3d 100644 --- a/pkg/detectors/appointedd/appointedd.go +++ b/pkg/detectors/appointedd/appointedd.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/appoptics/appoptics.go b/pkg/detectors/appoptics/appoptics.go index aed6875e0150..bf0034ef71e6 100644 --- a/pkg/detectors/appoptics/appoptics.go +++ b/pkg/detectors/appoptics/appoptics.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/appsynergy/appsynergy.go b/pkg/detectors/appsynergy/appsynergy.go index 4aaf50269120..6d5cb2057294 100644 --- a/pkg/detectors/appsynergy/appsynergy.go +++ b/pkg/detectors/appsynergy/appsynergy.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apptivo/apptivo.go b/pkg/detectors/apptivo/apptivo.go index 07010e04450f..c6f3255ba921 100644 --- a/pkg/detectors/apptivo/apptivo.go +++ b/pkg/detectors/apptivo/apptivo.go @@ -3,11 +3,12 @@ package apptivo import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -42,14 +43,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/artifactory/artifactory.go b/pkg/detectors/artifactory/artifactory.go index afe9dd123ef0..c85496d40a7a 100644 --- a/pkg/detectors/artifactory/artifactory.go +++ b/pkg/detectors/artifactory/artifactory.go @@ -50,16 +50,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result resURLMatch := "" for _, URLmatch := range URLmatches { - if len(URLmatch) != 2 { - continue - } resURLMatch = strings.TrimSpace(URLmatch[1]) } for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/artsy/artsy.go b/pkg/detectors/artsy/artsy.go index bc0ed80418fc..4c91dfe5f40b 100644 --- a/pkg/detectors/artsy/artsy.go +++ b/pkg/detectors/artsy/artsy.go @@ -2,10 +2,11 @@ package artsy import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -40,16 +41,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/asanaoauth/asanaoauth.go b/pkg/detectors/asanaoauth/asanaoauth.go index ee7df3d2d714..6ee968fc90a4 100644 --- a/pkg/detectors/asanaoauth/asanaoauth.go +++ b/pkg/detectors/asanaoauth/asanaoauth.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go b/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go index 3e7342d474b6..1018fe32de48 100644 --- a/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go +++ b/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/assemblyai/assemblyai.go b/pkg/detectors/assemblyai/assemblyai.go index 4788823e5bdd..78973115d31f 100644 --- a/pkg/detectors/assemblyai/assemblyai.go +++ b/pkg/detectors/assemblyai/assemblyai.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/atera/atera.go b/pkg/detectors/atera/atera.go index d7f8d6257cf7..1aafdacef4fa 100644 --- a/pkg/detectors/atera/atera.go +++ b/pkg/detectors/atera/atera.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/audd/audd.go b/pkg/detectors/audd/audd.go index 58ecc17a8598..ae03b425a823 100644 --- a/pkg/detectors/audd/audd.go +++ b/pkg/detectors/audd/audd.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go b/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go index 82b78697f716..2881846221ca 100644 --- a/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go +++ b/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go @@ -46,18 +46,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, managementApiTokenMatch := range managementAPITokenMatches { - if len(managementApiTokenMatch) != 2 { - continue - } managementAPITokenRes := strings.TrimSpace(managementApiTokenMatch[1]) if len(managementAPITokenRes) < 2000 || len(managementAPITokenRes) > 5000 { continue } for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } domainRes := strings.TrimSpace(domainMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/auth0oauth/auth0oauth.go b/pkg/detectors/auth0oauth/auth0oauth.go index c35e14e4eb71..568c47f9daa6 100644 --- a/pkg/detectors/auth0oauth/auth0oauth.go +++ b/pkg/detectors/auth0oauth/auth0oauth.go @@ -43,21 +43,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, clientIdMatch := range clientIdMatches { - if len(clientIdMatch) != 2 { - continue - } clientIdRes := strings.TrimSpace(clientIdMatch[1]) for _, clientSecretMatch := range clientSecretMatches { - if len(clientSecretMatch) != 2 { - continue - } clientSecretRes := strings.TrimSpace(clientSecretMatch[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } domainRes := strings.TrimSpace(domainMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/autodesk/autodesk.go b/pkg/detectors/autodesk/autodesk.go index 75abd2aae593..49dee39a294c 100644 --- a/pkg/detectors/autodesk/autodesk.go +++ b/pkg/detectors/autodesk/autodesk.go @@ -3,10 +3,11 @@ package autodesk import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/autoklose/autoklose.go b/pkg/detectors/autoklose/autoklose.go index b538b7948630..bf661f5d416f 100644 --- a/pkg/detectors/autoklose/autoklose.go +++ b/pkg/detectors/autoklose/autoklose.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/autopilot/autopilot.go b/pkg/detectors/autopilot/autopilot.go index cc913278695d..532a61e87552 100644 --- a/pkg/detectors/autopilot/autopilot.go +++ b/pkg/detectors/autopilot/autopilot.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go b/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go index b0b7a806ba48..64f9454eb1fa 100644 --- a/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go +++ b/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aviationstack/aviationstack.go b/pkg/detectors/aviationstack/aviationstack.go index ddefb6b3ddef..f49913bf49f3 100644 --- a/pkg/detectors/aviationstack/aviationstack.go +++ b/pkg/detectors/aviationstack/aviationstack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aws/aws.go b/pkg/detectors/aws/aws.go index cf0cff0f7fc7..9e0a1d8a8526 100644 --- a/pkg/detectors/aws/aws.go +++ b/pkg/detectors/aws/aws.go @@ -149,9 +149,6 @@ func (s scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idMatches { - if len(idMatch) != 3 { - continue - } resIDMatch := strings.TrimSpace(idMatch[1]) if s.skipIDs != nil { @@ -161,9 +158,6 @@ func (s scanner) FromData(ctx context.Context, verify bool, data []byte) (result } for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/awssessionkeys/awssessionkey.go b/pkg/detectors/awssessionkeys/awssessionkey.go index 4974f3d76a53..be29f648e3b3 100644 --- a/pkg/detectors/awssessionkeys/awssessionkey.go +++ b/pkg/detectors/awssessionkeys/awssessionkey.go @@ -102,9 +102,6 @@ func (s scanner) FromData(ctx context.Context, verify bool, data []byte) (result sessionMatches := sessionPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIDMatch := strings.TrimSpace(idMatch[1]) if s.skipIDs != nil { @@ -114,15 +111,9 @@ func (s scanner) FromData(ctx context.Context, verify bool, data []byte) (result } for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) for _, sessionMatch := range sessionMatches { - if len(sessionMatch) != 2 { - continue - } resSessionMatch := strings.TrimSpace(sessionMatch[1]) if !checkSessionToken(resSessionMatch, resSecretMatch) { continue diff --git a/pkg/detectors/axonaut/axonaut.go b/pkg/detectors/axonaut/axonaut.go index 03e14683b395..a975e19957af 100644 --- a/pkg/detectors/axonaut/axonaut.go +++ b/pkg/detectors/axonaut/axonaut.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aylien/aylien.go b/pkg/detectors/aylien/aylien.go index 28195ecaa555..f2501b61bfb8 100644 --- a/pkg/detectors/aylien/aylien.go +++ b/pkg/detectors/aylien/aylien.go @@ -2,10 +2,11 @@ package aylien import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/ayrshare/ayrshare.go b/pkg/detectors/ayrshare/ayrshare.go index ca3be88647fd..da8d801a387e 100644 --- a/pkg/detectors/ayrshare/ayrshare.go +++ b/pkg/detectors/ayrshare/ayrshare.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go b/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go index 6f8fe078285f..c35e4c25d471 100644 --- a/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go +++ b/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go @@ -42,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result orgMatches := orgPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, orgMatch := range orgMatches { - if len(orgMatch) != 2 { - continue - } resOrgMatch := strings.TrimSpace(orgMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go b/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go index f20271b19fc5..b3c141d354dc 100644 --- a/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go +++ b/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go @@ -42,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result serviceMatches := servicePat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, serviceMatch := range serviceMatches { - if len(serviceMatch) != 2 { - continue - } resServiceMatch := strings.TrimSpace(serviceMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go b/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go index 5e7b9497e77f..e1519110cd0a 100644 --- a/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go +++ b/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { diff --git a/pkg/detectors/azurestorage/azurestorage.go b/pkg/detectors/azurestorage/azurestorage.go index 6aa0791edf8f..3691897010ef 100644 --- a/pkg/detectors/azurestorage/azurestorage.go +++ b/pkg/detectors/azurestorage/azurestorage.go @@ -56,9 +56,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 3 { - continue - } accountName := strings.TrimSpace(match[1]) accountKey := strings.TrimSpace(match[2]) diff --git a/pkg/detectors/bannerbear/bannerbear.go b/pkg/detectors/bannerbear/bannerbear.go index ba6c9e1570ed..f8fae8c3674c 100644 --- a/pkg/detectors/bannerbear/bannerbear.go +++ b/pkg/detectors/bannerbear/bannerbear.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/baremetrics/baremetrics.go b/pkg/detectors/baremetrics/baremetrics.go index c1e942904497..6f4f5e8d810e 100644 --- a/pkg/detectors/baremetrics/baremetrics.go +++ b/pkg/detectors/baremetrics/baremetrics.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/beamer/beamer.go b/pkg/detectors/beamer/beamer.go index bad69b3f8a03..39d0db02c49f 100644 --- a/pkg/detectors/beamer/beamer.go +++ b/pkg/detectors/beamer/beamer.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/beebole/beebole.go b/pkg/detectors/beebole/beebole.go index 4d67e25bb1fe..84aefc91797f 100644 --- a/pkg/detectors/beebole/beebole.go +++ b/pkg/detectors/beebole/beebole.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/besnappy/besnappy.go b/pkg/detectors/besnappy/besnappy.go index 6ad3fd57f8d0..cc18201e70eb 100644 --- a/pkg/detectors/besnappy/besnappy.go +++ b/pkg/detectors/besnappy/besnappy.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/besttime/besttime.go b/pkg/detectors/besttime/besttime.go index a0b19118d436..570479bfd317 100644 --- a/pkg/detectors/besttime/besttime.go +++ b/pkg/detectors/besttime/besttime.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/betterstack/betterstack.go b/pkg/detectors/betterstack/betterstack.go index 3770dacd8f65..3d8391314759 100644 --- a/pkg/detectors/betterstack/betterstack.go +++ b/pkg/detectors/betterstack/betterstack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/billomat/billomat.go b/pkg/detectors/billomat/billomat.go index a431c9f7e46f..762bcfb8a86e 100644 --- a/pkg/detectors/billomat/billomat.go +++ b/pkg/detectors/billomat/billomat.go @@ -3,10 +3,11 @@ package billomat import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resId := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bitbar/bitbar.go b/pkg/detectors/bitbar/bitbar.go index 9eca133784d0..0efeb18b7cfe 100644 --- a/pkg/detectors/bitbar/bitbar.go +++ b/pkg/detectors/bitbar/bitbar.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bitcoinaverage/bitcoinaverage.go b/pkg/detectors/bitcoinaverage/bitcoinaverage.go index 3e05dddf0228..022169b3b795 100644 --- a/pkg/detectors/bitcoinaverage/bitcoinaverage.go +++ b/pkg/detectors/bitcoinaverage/bitcoinaverage.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bitfinex/bitfinex.go b/pkg/detectors/bitfinex/bitfinex.go index 534d886d8a1b..6f26af0256c1 100644 --- a/pkg/detectors/bitfinex/bitfinex.go +++ b/pkg/detectors/bitfinex/bitfinex.go @@ -3,11 +3,13 @@ package bitfinex import ( "context" "flag" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/bitfinexcom/bitfinex-api-go/v2/rest" + "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/common" @@ -47,9 +49,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result apiSecretMatches := apiSecretPat.FindAllStringSubmatch(dataStr, -1) for _, apiKeyMatch := range apiKeyMatches { - if len(apiKeyMatch) != 2 { - continue - } apiKeyRes := strings.TrimSpace(apiKeyMatch[1]) s1 := detectors.Result{ @@ -58,9 +57,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } for _, apiSecretMatch := range apiSecretMatches { - if len(apiSecretMatch) != 2 { - continue - } apiSecretRes := strings.TrimSpace(apiSecretMatch[1]) if apiKeyRes == apiSecretRes { diff --git a/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go b/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go index 7b72d899e69e..e8dd069fba21 100644 --- a/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go +++ b/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bitmex/bitmex.go b/pkg/detectors/bitmex/bitmex.go index b82bee561a93..cda5adc8c606 100644 --- a/pkg/detectors/bitmex/bitmex.go +++ b/pkg/detectors/bitmex/bitmex.go @@ -5,13 +5,14 @@ import ( "crypto/hmac" "crypto/sha256" "encoding/hex" - regexp "github.com/wasilibs/go-re2" "net/http" "net/url" "strconv" "strings" "time" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -46,15 +47,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/blazemeter/blazemeter.go b/pkg/detectors/blazemeter/blazemeter.go index 51acf8c9de6f..7c72b956a8a1 100644 --- a/pkg/detectors/blazemeter/blazemeter.go +++ b/pkg/detectors/blazemeter/blazemeter.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/blitapp/blitapp.go b/pkg/detectors/blitapp/blitapp.go index 077c443a1ac4..8ccc49cab719 100644 --- a/pkg/detectors/blitapp/blitapp.go +++ b/pkg/detectors/blitapp/blitapp.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/blocknative/blocknative.go b/pkg/detectors/blocknative/blocknative.go index d65b44672639..fea4727fdbfc 100644 --- a/pkg/detectors/blocknative/blocknative.go +++ b/pkg/detectors/blocknative/blocknative.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/blogger/blogger.go b/pkg/detectors/blogger/blogger.go index a3c46155b0b5..f464b0d02098 100644 --- a/pkg/detectors/blogger/blogger.go +++ b/pkg/detectors/blogger/blogger.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bombbomb/bombbomb.go b/pkg/detectors/bombbomb/bombbomb.go index 612e39855bee..e8fab2d83e11 100644 --- a/pkg/detectors/bombbomb/bombbomb.go +++ b/pkg/detectors/bombbomb/bombbomb.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/boostnote/boostnote.go b/pkg/detectors/boostnote/boostnote.go index a6fd6363bacb..85965e7c9ab6 100644 --- a/pkg/detectors/boostnote/boostnote.go +++ b/pkg/detectors/boostnote/boostnote.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/borgbase/borgbase.go b/pkg/detectors/borgbase/borgbase.go index d44a6c06d03d..c0ab13174cfc 100644 --- a/pkg/detectors/borgbase/borgbase.go +++ b/pkg/detectors/borgbase/borgbase.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/braintreepayments/braintreepayments.go b/pkg/detectors/braintreepayments/braintreepayments.go index 2a8daf39160d..adcdf9d1cde2 100644 --- a/pkg/detectors/braintreepayments/braintreepayments.go +++ b/pkg/detectors/braintreepayments/braintreepayments.go @@ -48,15 +48,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/brandfetch/brandfetch.go b/pkg/detectors/brandfetch/brandfetch.go index 7ad508641016..329be91f4b5d 100644 --- a/pkg/detectors/brandfetch/brandfetch.go +++ b/pkg/detectors/brandfetch/brandfetch.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/browserstack/browserstack.go b/pkg/detectors/browserstack/browserstack.go index 4d2947789ce7..8b99d28d120f 100644 --- a/pkg/detectors/browserstack/browserstack.go +++ b/pkg/detectors/browserstack/browserstack.go @@ -54,15 +54,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userMatches := userPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, userMatch := range userMatches { - if len(userMatch) != 2 { - continue - } resUserMatch := strings.TrimSpace(userMatch[1]) diff --git a/pkg/detectors/browshot/browshot.go b/pkg/detectors/browshot/browshot.go index f57d67819374..3812a49825e3 100644 --- a/pkg/detectors/browshot/browshot.go +++ b/pkg/detectors/browshot/browshot.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bscscan/bscscan.go b/pkg/detectors/bscscan/bscscan.go index 9051b4de0208..0b948916fb3c 100644 --- a/pkg/detectors/bscscan/bscscan.go +++ b/pkg/detectors/bscscan/bscscan.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/buddyns/buddyns.go b/pkg/detectors/buddyns/buddyns.go index df61159b671b..e4df1ef1cfee 100644 --- a/pkg/detectors/buddyns/buddyns.go +++ b/pkg/detectors/buddyns/buddyns.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/budibase/budibase.go b/pkg/detectors/budibase/budibase.go index 50b3fc19414a..0392ee706fb0 100644 --- a/pkg/detectors/budibase/budibase.go +++ b/pkg/detectors/budibase/budibase.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bugherd/bugherd.go b/pkg/detectors/bugherd/bugherd.go index cf81e1328b8c..db6047d6a579 100644 --- a/pkg/detectors/bugherd/bugherd.go +++ b/pkg/detectors/bugherd/bugherd.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bugsnag/bugsnag.go b/pkg/detectors/bugsnag/bugsnag.go index 11e2f63c18d5..ded71337a251 100644 --- a/pkg/detectors/bugsnag/bugsnag.go +++ b/pkg/detectors/bugsnag/bugsnag.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/buildkite/buildkite.go b/pkg/detectors/buildkite/buildkite.go index 92bd1a5a7a22..b106d3b7a209 100644 --- a/pkg/detectors/buildkite/buildkite.go +++ b/pkg/detectors/buildkite/buildkite.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/buildkitev2/buildkite.go b/pkg/detectors/buildkitev2/buildkite.go index e5eca0491440..ab493eefa283 100644 --- a/pkg/detectors/buildkitev2/buildkite.go +++ b/pkg/detectors/buildkitev2/buildkite.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bulbul/bulbul.go b/pkg/detectors/bulbul/bulbul.go index a3fc6c92c828..2d652192a337 100644 --- a/pkg/detectors/bulbul/bulbul.go +++ b/pkg/detectors/bulbul/bulbul.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bulksms/bulksms.go b/pkg/detectors/bulksms/bulksms.go index a55122230426..8ba4a34e4319 100644 --- a/pkg/detectors/bulksms/bulksms.go +++ b/pkg/detectors/bulksms/bulksms.go @@ -42,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idMatches { - if len(match) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/buttercms/buttercms.go b/pkg/detectors/buttercms/buttercms.go index 4910eec60ce2..1cbce8170fad 100644 --- a/pkg/detectors/buttercms/buttercms.go +++ b/pkg/detectors/buttercms/buttercms.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/caflou/caflou.go b/pkg/detectors/caflou/caflou.go index c831d56f5d24..93665a3e0cbd 100644 --- a/pkg/detectors/caflou/caflou.go +++ b/pkg/detectors/caflou/caflou.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/calendarific/calendarific.go b/pkg/detectors/calendarific/calendarific.go index 7930c68ee2fa..13fc48592e65 100644 --- a/pkg/detectors/calendarific/calendarific.go +++ b/pkg/detectors/calendarific/calendarific.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/calendlyapikey/calendlyapikey.go b/pkg/detectors/calendlyapikey/calendlyapikey.go index 4428bb4a576a..aa00157541d0 100644 --- a/pkg/detectors/calendlyapikey/calendlyapikey.go +++ b/pkg/detectors/calendlyapikey/calendlyapikey.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/calorieninja/calorieninja.go b/pkg/detectors/calorieninja/calorieninja.go index 7019d224a36a..5515eeedb8c7 100644 --- a/pkg/detectors/calorieninja/calorieninja.go +++ b/pkg/detectors/calorieninja/calorieninja.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/campayn/campayn.go b/pkg/detectors/campayn/campayn.go index 4f6838bd6692..a1915b247284 100644 --- a/pkg/detectors/campayn/campayn.go +++ b/pkg/detectors/campayn/campayn.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cannyio/cannyio.go b/pkg/detectors/cannyio/cannyio.go index 0a5631e8798e..a2ece4752ce5 100644 --- a/pkg/detectors/cannyio/cannyio.go +++ b/pkg/detectors/cannyio/cannyio.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/capsulecrm/capsulecrm.go b/pkg/detectors/capsulecrm/capsulecrm.go index ca631f4ddc03..3a2f82baebbb 100644 --- a/pkg/detectors/capsulecrm/capsulecrm.go +++ b/pkg/detectors/capsulecrm/capsulecrm.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/captaindata/captaindata.go b/pkg/detectors/captaindata/captaindata.go index 6e12a59d8790..a87734696007 100644 --- a/pkg/detectors/captaindata/captaindata.go +++ b/pkg/detectors/captaindata/captaindata.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result projIdMatches := projIdPat.FindAllStringSubmatch(dataStr, -1) for _, projIdMatch := range projIdMatches { - if len(projIdMatch) != 2 { - continue - } resProjIdMatch := strings.TrimSpace(projIdMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/carboninterface/carboninterface.go b/pkg/detectors/carboninterface/carboninterface.go index 0b0b69c5d2d2..801190e72f96 100644 --- a/pkg/detectors/carboninterface/carboninterface.go +++ b/pkg/detectors/carboninterface/carboninterface.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cashboard/cashboard.go b/pkg/detectors/cashboard/cashboard.go index d3f444fa70f7..34c7adfdc9e7 100644 --- a/pkg/detectors/cashboard/cashboard.go +++ b/pkg/detectors/cashboard/cashboard.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userMatches := userPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, userMatch := range userMatches { - if len(userMatch) != 2 { - continue - } resUser := strings.TrimSpace(userMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/caspio/caspio.go b/pkg/detectors/caspio/caspio.go index b022e1123187..2ffc01534bcf 100644 --- a/pkg/detectors/caspio/caspio.go +++ b/pkg/detectors/caspio/caspio.go @@ -3,10 +3,11 @@ package caspio import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -43,22 +44,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainMatch[1]) diff --git a/pkg/detectors/censys/censys.go b/pkg/detectors/censys/censys.go index 83f8d7fa99c4..256ddd36b113 100644 --- a/pkg/detectors/censys/censys.go +++ b/pkg/detectors/censys/censys.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/centralstationcrm/centralstationcrm.go b/pkg/detectors/centralstationcrm/centralstationcrm.go index 72b3f78ca489..bc4cef8df95f 100644 --- a/pkg/detectors/centralstationcrm/centralstationcrm.go +++ b/pkg/detectors/centralstationcrm/centralstationcrm.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cexio/cexio.go b/pkg/detectors/cexio/cexio.go index c4390260f8b7..dc11c20d0b80 100644 --- a/pkg/detectors/cexio/cexio.go +++ b/pkg/detectors/cexio/cexio.go @@ -50,21 +50,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userIdMatches := userIdPat.FindAllStringSubmatch(dataStr, -1) for _, userIdMatch := range userIdMatches { - if len(userIdMatch) != 2 { - continue - } resUserIdMatch := strings.TrimSpace(userIdMatch[1]) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } resKeyMatch := strings.TrimSpace(keyMatch[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/chartmogul/chartmogul.go b/pkg/detectors/chartmogul/chartmogul.go index 20e313f12448..229e2bce0b93 100644 --- a/pkg/detectors/chartmogul/chartmogul.go +++ b/pkg/detectors/chartmogul/chartmogul.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/chatbot/chatbot.go b/pkg/detectors/chatbot/chatbot.go index 709c828a8aed..7d1a6e6cd57f 100644 --- a/pkg/detectors/chatbot/chatbot.go +++ b/pkg/detectors/chatbot/chatbot.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/chatfule/chatfule.go b/pkg/detectors/chatfule/chatfule.go index 41cdeca43b9c..77cf3864bdda 100644 --- a/pkg/detectors/chatfule/chatfule.go +++ b/pkg/detectors/chatfule/chatfule.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/checio/checio.go b/pkg/detectors/checio/checio.go index 082d1c98f2ca..4c8eef601b22 100644 --- a/pkg/detectors/checio/checio.go +++ b/pkg/detectors/checio/checio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/checklyhq/checklyhq.go b/pkg/detectors/checklyhq/checklyhq.go index 370c348caeeb..415c0c537b05 100644 --- a/pkg/detectors/checklyhq/checklyhq.go +++ b/pkg/detectors/checklyhq/checklyhq.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/checkout/checkout.go b/pkg/detectors/checkout/checkout.go index 9bf8ac3c3077..c3c4313cedcc 100644 --- a/pkg/detectors/checkout/checkout.go +++ b/pkg/detectors/checkout/checkout.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 3 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/checkvist/checkvist.go b/pkg/detectors/checkvist/checkvist.go index ce470dcfec91..e28894d3904b 100644 --- a/pkg/detectors/checkvist/checkvist.go +++ b/pkg/detectors/checkvist/checkvist.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmailMatch := strings.TrimSpace(emailMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cicero/cicero.go b/pkg/detectors/cicero/cicero.go index 7f7393415a90..47070201495e 100644 --- a/pkg/detectors/cicero/cicero.go +++ b/pkg/detectors/cicero/cicero.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clarifai/clarifai.go b/pkg/detectors/clarifai/clarifai.go index b9885a4094e5..7a3151b1738f 100644 --- a/pkg/detectors/clarifai/clarifai.go +++ b/pkg/detectors/clarifai/clarifai.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clearbit/clearbit.go b/pkg/detectors/clearbit/clearbit.go index 469ba200ee54..a1b498356ac9 100644 --- a/pkg/detectors/clearbit/clearbit.go +++ b/pkg/detectors/clearbit/clearbit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clickhelp/clickhelp.go b/pkg/detectors/clickhelp/clickhelp.go index 6ea90af11ad1..7c78d67fd6ec 100644 --- a/pkg/detectors/clickhelp/clickhelp.go +++ b/pkg/detectors/clickhelp/clickhelp.go @@ -44,20 +44,11 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range serverMatches { - if len(match) != 2 { - continue - } resServer := strings.TrimSpace(match[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmail := strings.TrimSpace(emailMatch[1]) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } resKey := strings.TrimSpace(keyMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clicksendsms/clicksendsms.go b/pkg/detectors/clicksendsms/clicksendsms.go index b2f96fb69e3c..a8d4dcfe2dfb 100644 --- a/pkg/detectors/clicksendsms/clicksendsms.go +++ b/pkg/detectors/clicksendsms/clicksendsms.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { resIdMatch := strings.TrimSpace(idMatch[0][strings.LastIndex(idMatch[0], " ")+1:]) diff --git a/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go b/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go index d8058fbd3d66..a8bd0a3f686e 100644 --- a/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go +++ b/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cliengo/cliengo.go b/pkg/detectors/cliengo/cliengo.go index 6713786c7ed2..bbe40938f078 100644 --- a/pkg/detectors/cliengo/cliengo.go +++ b/pkg/detectors/cliengo/cliengo.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clinchpad/clinchpad.go b/pkg/detectors/clinchpad/clinchpad.go index e1b927a69684..44f7460e45a9 100644 --- a/pkg/detectors/clinchpad/clinchpad.go +++ b/pkg/detectors/clinchpad/clinchpad.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clockify/clockify.go b/pkg/detectors/clockify/clockify.go index 92acf73ec4af..404ade042c9d 100644 --- a/pkg/detectors/clockify/clockify.go +++ b/pkg/detectors/clockify/clockify.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clockworksms/clockworksms.go b/pkg/detectors/clockworksms/clockworksms.go index 37a12d5afff6..18dafead57f8 100644 --- a/pkg/detectors/clockworksms/clockworksms.go +++ b/pkg/detectors/clockworksms/clockworksms.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result tokenMatches := tokenPat.FindAllStringSubmatch(dataStr, -1) for _, match := range userKeyMatches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, tokenMatch := range tokenMatches { - if len(tokenMatch) != 2 { - continue - } tokenRes := strings.TrimSpace(tokenMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/closecrm/close.go b/pkg/detectors/closecrm/close.go index 1bdb8ea4a26e..eaa77f264c56 100644 --- a/pkg/detectors/closecrm/close.go +++ b/pkg/detectors/closecrm/close.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudconvert/cloudconvert.go b/pkg/detectors/cloudconvert/cloudconvert.go index 8f47162dc643..ad7c38f9beb4 100644 --- a/pkg/detectors/cloudconvert/cloudconvert.go +++ b/pkg/detectors/cloudconvert/cloudconvert.go @@ -43,9 +43,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudelements/cloudelements.go b/pkg/detectors/cloudelements/cloudelements.go index 4c1181b5dca8..e6ba9f0023b3 100644 --- a/pkg/detectors/cloudelements/cloudelements.go +++ b/pkg/detectors/cloudelements/cloudelements.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result orgMatches := orgPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, orgMatch := range orgMatches { - if len(orgMatch) != 2 { - continue - } resOrgMatch := strings.TrimSpace(orgMatch[1]) diff --git a/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go b/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go index 51d9ca50ef4b..f20f19c5e9f7 100644 --- a/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go +++ b/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudflarecakey/cloudflarecakey.go b/pkg/detectors/cloudflarecakey/cloudflarecakey.go index ce8703ac3816..c92315c0d9b1 100644 --- a/pkg/detectors/cloudflarecakey/cloudflarecakey.go +++ b/pkg/detectors/cloudflarecakey/cloudflarecakey.go @@ -5,10 +5,11 @@ import ( "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" - regexp "github.com/wasilibs/go-re2" ) type Scanner struct{} @@ -35,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go b/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go index 850aa92a298d..3fca25f38edc 100644 --- a/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go +++ b/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go @@ -45,15 +45,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, apiKeyMatch := range apiKeyMatches { - if len(apiKeyMatch) != 2 { - continue - } apiKeyRes := strings.TrimSpace(apiKeyMatch[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } emailRes := strings.TrimSpace(emailMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudimage/cloudimage.go b/pkg/detectors/cloudimage/cloudimage.go index 7bd518913e32..f0773d8d28c0 100644 --- a/pkg/detectors/cloudimage/cloudimage.go +++ b/pkg/detectors/cloudimage/cloudimage.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudmersive/cloudmersive.go b/pkg/detectors/cloudmersive/cloudmersive.go index 4a2d5e0b5173..93b575dba024 100644 --- a/pkg/detectors/cloudmersive/cloudmersive.go +++ b/pkg/detectors/cloudmersive/cloudmersive.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudplan/cloudplan.go b/pkg/detectors/cloudplan/cloudplan.go index 30ac902b4ca5..a95b0d4860d0 100644 --- a/pkg/detectors/cloudplan/cloudplan.go +++ b/pkg/detectors/cloudplan/cloudplan.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudsmith/cloudsmith.go b/pkg/detectors/cloudsmith/cloudsmith.go index bca1eeaa350b..371ec1145c8e 100644 --- a/pkg/detectors/cloudsmith/cloudsmith.go +++ b/pkg/detectors/cloudsmith/cloudsmith.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloverly/cloverly.go b/pkg/detectors/cloverly/cloverly.go index 8793d84e88eb..4062ab30a36a 100644 --- a/pkg/detectors/cloverly/cloverly.go +++ b/pkg/detectors/cloverly/cloverly.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloze/cloze.go b/pkg/detectors/cloze/cloze.go index cc94e13e6933..fc1642cd5257 100644 --- a/pkg/detectors/cloze/cloze.go +++ b/pkg/detectors/cloze/cloze.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmailMatch := strings.TrimSpace(emailMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clustdoc/clustdoc.go b/pkg/detectors/clustdoc/clustdoc.go index 0ec9ab16a7a4..25d569406f21 100644 --- a/pkg/detectors/clustdoc/clustdoc.go +++ b/pkg/detectors/clustdoc/clustdoc.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coda/coda.go b/pkg/detectors/coda/coda.go index 2b0fa89837cc..82dd6ac6a38f 100644 --- a/pkg/detectors/coda/coda.go +++ b/pkg/detectors/coda/coda.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/codacy/codacy.go b/pkg/detectors/codacy/codacy.go index 13326f54012f..2bc1642c148b 100644 --- a/pkg/detectors/codacy/codacy.go +++ b/pkg/detectors/codacy/codacy.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/codeclimate/codeclimate.go b/pkg/detectors/codeclimate/codeclimate.go index 52f1f739b93c..d54ee02589c2 100644 --- a/pkg/detectors/codeclimate/codeclimate.go +++ b/pkg/detectors/codeclimate/codeclimate.go @@ -44,9 +44,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/codemagic/codemagic.go b/pkg/detectors/codemagic/codemagic.go index 4ab971d0bf86..2caa39112d6e 100644 --- a/pkg/detectors/codemagic/codemagic.go +++ b/pkg/detectors/codemagic/codemagic.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/codequiry/codequiry.go b/pkg/detectors/codequiry/codequiry.go index a16a9ef3ee20..ee1a64a61d8a 100644 --- a/pkg/detectors/codequiry/codequiry.go +++ b/pkg/detectors/codequiry/codequiry.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coinapi/coinapi.go b/pkg/detectors/coinapi/coinapi.go index 52eaa9313c55..ebf026dfcabd 100644 --- a/pkg/detectors/coinapi/coinapi.go +++ b/pkg/detectors/coinapi/coinapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coinbase/coinbase.go b/pkg/detectors/coinbase/coinbase.go index bc93208a68bb..ada6fc741003 100644 --- a/pkg/detectors/coinbase/coinbase.go +++ b/pkg/detectors/coinbase/coinbase.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coinlayer/coinlayer.go b/pkg/detectors/coinlayer/coinlayer.go index 0fa4cd0d1719..e8309a204913 100644 --- a/pkg/detectors/coinlayer/coinlayer.go +++ b/pkg/detectors/coinlayer/coinlayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coinlib/coinlib.go b/pkg/detectors/coinlib/coinlib.go index 383fc419b53a..f18e7c440632 100644 --- a/pkg/detectors/coinlib/coinlib.go +++ b/pkg/detectors/coinlib/coinlib.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/collect2/collect2.go b/pkg/detectors/collect2/collect2.go index 51f2eaac6ffc..bd9047013554 100644 --- a/pkg/detectors/collect2/collect2.go +++ b/pkg/detectors/collect2/collect2.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/column/column.go b/pkg/detectors/column/column.go index b8bf106b256a..7bcd6ad95c04 100644 --- a/pkg/detectors/column/column.go +++ b/pkg/detectors/column/column.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/commercejs/commercejs.go b/pkg/detectors/commercejs/commercejs.go index c77bc80ae0f9..6b77919c101a 100644 --- a/pkg/detectors/commercejs/commercejs.go +++ b/pkg/detectors/commercejs/commercejs.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/commodities/commodities.go b/pkg/detectors/commodities/commodities.go index 113551abb2ec..7e8d3b7ac625 100644 --- a/pkg/detectors/commodities/commodities.go +++ b/pkg/detectors/commodities/commodities.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/companyhub/companyhub.go b/pkg/detectors/companyhub/companyhub.go index 08763bddef71..b540fb8ee60a 100644 --- a/pkg/detectors/companyhub/companyhub.go +++ b/pkg/detectors/companyhub/companyhub.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/confluent/confluent.go b/pkg/detectors/confluent/confluent.go index 0e1f2d2235dc..7923ecbae6bc 100644 --- a/pkg/detectors/confluent/confluent.go +++ b/pkg/detectors/confluent/confluent.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secret := range secretMatches { - if len(secret) != 2 { - continue - } resSecret := strings.TrimSpace(secret[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go b/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go index b75ace2b4bb3..3ac8b1862593 100644 --- a/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go +++ b/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go @@ -3,10 +3,11 @@ package contentfulpersonalaccesstoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -35,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range keyMatches { - if len(match) != 2 { - continue - } keyRes := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/conversiontools/conversiontools.go b/pkg/detectors/conversiontools/conversiontools.go index 27b42823a03a..f08b5f6d28de 100644 --- a/pkg/detectors/conversiontools/conversiontools.go +++ b/pkg/detectors/conversiontools/conversiontools.go @@ -3,10 +3,11 @@ package conversiontools import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/convertapi/convertapi.go b/pkg/detectors/convertapi/convertapi.go index 8e443bfffef9..114e28e7a0c4 100644 --- a/pkg/detectors/convertapi/convertapi.go +++ b/pkg/detectors/convertapi/convertapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/convertkit/convertkit.go b/pkg/detectors/convertkit/convertkit.go index 3417dabe5e3b..ffa7d2be121e 100644 --- a/pkg/detectors/convertkit/convertkit.go +++ b/pkg/detectors/convertkit/convertkit.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/convier/convier.go b/pkg/detectors/convier/convier.go index ff17d32b51ae..b4eada75c9e7 100644 --- a/pkg/detectors/convier/convier.go +++ b/pkg/detectors/convier/convier.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/copper/copper.go b/pkg/detectors/copper/copper.go index d0d1f3770453..6387c84a8a27 100644 --- a/pkg/detectors/copper/copper.go +++ b/pkg/detectors/copper/copper.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/countrylayer/countrylayer.go b/pkg/detectors/countrylayer/countrylayer.go index 36a872b0d5a8..3938fd90a9b2 100644 --- a/pkg/detectors/countrylayer/countrylayer.go +++ b/pkg/detectors/countrylayer/countrylayer.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/courier/courier.go b/pkg/detectors/courier/courier.go index 0519a0334b28..b13e3fd2c0f2 100644 --- a/pkg/detectors/courier/courier.go +++ b/pkg/detectors/courier/courier.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coveralls/coveralls.go b/pkg/detectors/coveralls/coveralls.go index 164c47af5bdb..94186eb38517 100644 --- a/pkg/detectors/coveralls/coveralls.go +++ b/pkg/detectors/coveralls/coveralls.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/craftmypdf/craftmypdf.go b/pkg/detectors/craftmypdf/craftmypdf.go index 36482c0233e4..6bb77c23fb18 100644 --- a/pkg/detectors/craftmypdf/craftmypdf.go +++ b/pkg/detectors/craftmypdf/craftmypdf.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/crowdin/crowdin.go b/pkg/detectors/crowdin/crowdin.go index 8a13a3b6c20e..66737709af1f 100644 --- a/pkg/detectors/crowdin/crowdin.go +++ b/pkg/detectors/crowdin/crowdin.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cryptocompare/cryptocompare.go b/pkg/detectors/cryptocompare/cryptocompare.go index 262e6234664f..20ef6e88bc58 100644 --- a/pkg/detectors/cryptocompare/cryptocompare.go +++ b/pkg/detectors/cryptocompare/cryptocompare.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/currencycloud/currencycloud.go b/pkg/detectors/currencycloud/currencycloud.go index 7775cb645c8c..b0e97ab0b95b 100644 --- a/pkg/detectors/currencycloud/currencycloud.go +++ b/pkg/detectors/currencycloud/currencycloud.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, emailmatch := range emailMatches { - if len(emailmatch) != 2 { - continue - } resEmailMatch := strings.TrimSpace(emailmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/currencyfreaks/currencyfreaks.go b/pkg/detectors/currencyfreaks/currencyfreaks.go index 4465a51ba33d..69ac6bbe4d8e 100644 --- a/pkg/detectors/currencyfreaks/currencyfreaks.go +++ b/pkg/detectors/currencyfreaks/currencyfreaks.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/currencylayer/currencylayer.go b/pkg/detectors/currencylayer/currencylayer.go index a8a1a1ded406..262128bcd469 100644 --- a/pkg/detectors/currencylayer/currencylayer.go +++ b/pkg/detectors/currencylayer/currencylayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/currencyscoop/currencyscoop.go b/pkg/detectors/currencyscoop/currencyscoop.go index 1ae2615144c5..4cd3ce5da3e1 100644 --- a/pkg/detectors/currencyscoop/currencyscoop.go +++ b/pkg/detectors/currencyscoop/currencyscoop.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/currentsapi/currentsapi.go b/pkg/detectors/currentsapi/currentsapi.go index 093d6c35187b..2a06b8d61707 100644 --- a/pkg/detectors/currentsapi/currentsapi.go +++ b/pkg/detectors/currentsapi/currentsapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/customerguru/customerguru.go b/pkg/detectors/customerguru/customerguru.go index 8c6c3e135425..a333f933811e 100644 --- a/pkg/detectors/customerguru/customerguru.go +++ b/pkg/detectors/customerguru/customerguru.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/customerio/customerio.go b/pkg/detectors/customerio/customerio.go index 13804cae2a11..2c0c36cafc86 100644 --- a/pkg/detectors/customerio/customerio.go +++ b/pkg/detectors/customerio/customerio.go @@ -42,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_CustomerIO, diff --git a/pkg/detectors/d7network/d7network.go b/pkg/detectors/d7network/d7network.go index 2cdfa8c406ba..1be55898e80e 100644 --- a/pkg/detectors/d7network/d7network.go +++ b/pkg/detectors/d7network/d7network.go @@ -33,9 +33,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dailyco/dailyco.go b/pkg/detectors/dailyco/dailyco.go index 54bd589ddeeb..779e88cd61c4 100644 --- a/pkg/detectors/dailyco/dailyco.go +++ b/pkg/detectors/dailyco/dailyco.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dandelion/dandelion.go b/pkg/detectors/dandelion/dandelion.go index 32878c5dc3af..2092e71cdebb 100644 --- a/pkg/detectors/dandelion/dandelion.go +++ b/pkg/detectors/dandelion/dandelion.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dareboost/dareboost.go b/pkg/detectors/dareboost/dareboost.go index 02fdf791e66e..4124d3fbd245 100644 --- a/pkg/detectors/dareboost/dareboost.go +++ b/pkg/detectors/dareboost/dareboost.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/databox/databox.go b/pkg/detectors/databox/databox.go index e6e250e82d31..a4e3cb50da94 100644 --- a/pkg/detectors/databox/databox.go +++ b/pkg/detectors/databox/databox.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/datadogtoken/datadogtoken.go b/pkg/detectors/datadogtoken/datadogtoken.go index e4743701ca97..f0b37585f26f 100644 --- a/pkg/detectors/datadogtoken/datadogtoken.go +++ b/pkg/detectors/datadogtoken/datadogtoken.go @@ -105,15 +105,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result apiMatches := apiPat.FindAllStringSubmatch(dataStr, -1) for _, apiMatch := range apiMatches { - if len(apiMatch) != 2 { - continue - } resApiMatch := strings.TrimSpace(apiMatch[1]) appIncluded := false for _, appMatch := range appMatches { - if len(appMatch) != 2 { - continue - } resAppMatch := strings.TrimSpace(appMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/datagov/datagov.go b/pkg/detectors/datagov/datagov.go index eb927a30fe10..4450f7dff904 100644 --- a/pkg/detectors/datagov/datagov.go +++ b/pkg/detectors/datagov/datagov.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/debounce/debounce.go b/pkg/detectors/debounce/debounce.go index dffcbaf7f282..dd129a8b2c4a 100644 --- a/pkg/detectors/debounce/debounce.go +++ b/pkg/detectors/debounce/debounce.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/deepai/deepai.go b/pkg/detectors/deepai/deepai.go index 335e77847e3a..dbea07c5d9b5 100644 --- a/pkg/detectors/deepai/deepai.go +++ b/pkg/detectors/deepai/deepai.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/deepgram/deepgram.go b/pkg/detectors/deepgram/deepgram.go index b0f42c8523e6..5e8cc18256f0 100644 --- a/pkg/detectors/deepgram/deepgram.go +++ b/pkg/detectors/deepgram/deepgram.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/delighted/delighted.go b/pkg/detectors/delighted/delighted.go index bcc49126704a..ad1d613c6020 100644 --- a/pkg/detectors/delighted/delighted.go +++ b/pkg/detectors/delighted/delighted.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/demio/demio.go b/pkg/detectors/demio/demio.go index 32aadf9a30c3..e2455559271c 100644 --- a/pkg/detectors/demio/demio.go +++ b/pkg/detectors/demio/demio.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) idMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idMatches { - if len(match) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/deputy/deputy.go b/pkg/detectors/deputy/deputy.go index ed0438fa5910..c7c9388a14d4 100644 --- a/pkg/detectors/deputy/deputy.go +++ b/pkg/detectors/deputy/deputy.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/detectify/detectify.go b/pkg/detectors/detectify/detectify.go index 8824e16cf6b0..c3904d7f5f02 100644 --- a/pkg/detectors/detectify/detectify.go +++ b/pkg/detectors/detectify/detectify.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/detectlanguage/detectlanguage.go b/pkg/detectors/detectlanguage/detectlanguage.go index 214c75743ec8..517d940b0a99 100644 --- a/pkg/detectors/detectlanguage/detectlanguage.go +++ b/pkg/detectors/detectlanguage/detectlanguage.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dfuse/dfuse.go b/pkg/detectors/dfuse/dfuse.go index 08777a70f5d9..24861a6fd2ee 100644 --- a/pkg/detectors/dfuse/dfuse.go +++ b/pkg/detectors/dfuse/dfuse.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/diffbot/diffbot.go b/pkg/detectors/diffbot/diffbot.go index e4e7197c5c69..e8df050c82a1 100644 --- a/pkg/detectors/diffbot/diffbot.go +++ b/pkg/detectors/diffbot/diffbot.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/diggernaut/diggernaut.go b/pkg/detectors/diggernaut/diggernaut.go index 221cd5c25523..13fb5ec543ad 100644 --- a/pkg/detectors/diggernaut/diggernaut.go +++ b/pkg/detectors/diggernaut/diggernaut.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/digitaloceantoken/digitaloceantoken.go b/pkg/detectors/digitaloceantoken/digitaloceantoken.go index e866c71d9027..24e2c4c84ce6 100644 --- a/pkg/detectors/digitaloceantoken/digitaloceantoken.go +++ b/pkg/detectors/digitaloceantoken/digitaloceantoken.go @@ -3,10 +3,11 @@ package digitaloceantoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/digitaloceanv2/digitaloceanv2.go b/pkg/detectors/digitaloceanv2/digitaloceanv2.go index 81e3610c024e..dae4ff734ca2 100644 --- a/pkg/detectors/digitaloceanv2/digitaloceanv2.go +++ b/pkg/detectors/digitaloceanv2/digitaloceanv2.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/discordbottoken/discordbottoken.go b/pkg/detectors/discordbottoken/discordbottoken.go index fd6384160046..38fdbfdcdc20 100644 --- a/pkg/detectors/discordbottoken/discordbottoken.go +++ b/pkg/detectors/discordbottoken/discordbottoken.go @@ -3,10 +3,11 @@ package discordbottoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatch := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idMatch { - if len(match) != 2 { - continue - } resId := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_DiscordBotToken, diff --git a/pkg/detectors/discordwebhook/discordwebhook.go b/pkg/detectors/discordwebhook/discordwebhook.go index e05a0fba2897..d4979bfea8dd 100644 --- a/pkg/detectors/discordwebhook/discordwebhook.go +++ b/pkg/detectors/discordwebhook/discordwebhook.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_DiscordWebhook, diff --git a/pkg/detectors/disqus/disqus.go b/pkg/detectors/disqus/disqus.go index e8635f3b00e6..a62873b239e8 100644 --- a/pkg/detectors/disqus/disqus.go +++ b/pkg/detectors/disqus/disqus.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ditto/ditto.go b/pkg/detectors/ditto/ditto.go index c2def8852b33..8a567d9c1a1a 100644 --- a/pkg/detectors/ditto/ditto.go +++ b/pkg/detectors/ditto/ditto.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dnscheck/dnscheck.go b/pkg/detectors/dnscheck/dnscheck.go index fcb38ce54f3c..c615696618c8 100644 --- a/pkg/detectors/dnscheck/dnscheck.go +++ b/pkg/detectors/dnscheck/dnscheck.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/docparser/docparser.go b/pkg/detectors/docparser/docparser.go index 96cb6dc0567a..32a856eb39da 100644 --- a/pkg/detectors/docparser/docparser.go +++ b/pkg/detectors/docparser/docparser.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/documo/documo.go b/pkg/detectors/documo/documo.go index d24fd223adb4..41b49231301a 100644 --- a/pkg/detectors/documo/documo.go +++ b/pkg/detectors/documo/documo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/docusign/docusign.go b/pkg/detectors/docusign/docusign.go index 7c25d9272b3c..147d01995074 100644 --- a/pkg/detectors/docusign/docusign.go +++ b/pkg/detectors/docusign/docusign.go @@ -47,15 +47,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIDMatch := strings.TrimSpace(idMatch[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/doppler/doppler.go b/pkg/detectors/doppler/doppler.go index 3bca3506e739..09942a19a265 100644 --- a/pkg/detectors/doppler/doppler.go +++ b/pkg/detectors/doppler/doppler.go @@ -54,9 +54,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dotmailer/dotmailer.go b/pkg/detectors/dotmailer/dotmailer.go index a5c81e432657..2e63de370e43 100644 --- a/pkg/detectors/dotmailer/dotmailer.go +++ b/pkg/detectors/dotmailer/dotmailer.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passMatches := passPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range passMatches { - if len(idMatch) != 2 { - continue - } resPassMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/dovico/dovico.go b/pkg/detectors/dovico/dovico.go index 05b1290c38e5..13450e858a30 100644 --- a/pkg/detectors/dovico/dovico.go +++ b/pkg/detectors/dovico/dovico.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userMatches := userPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, user := range userMatches { - if len(user) != 2 { - continue - } resUser := strings.TrimSpace(user[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dronahq/dronahq.go b/pkg/detectors/dronahq/dronahq.go index b2c813bcaf0d..b74a5d5757a6 100644 --- a/pkg/detectors/dronahq/dronahq.go +++ b/pkg/detectors/dronahq/dronahq.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/droneci/droneci.go b/pkg/detectors/droneci/droneci.go index 99fb8ece756d..0632c1ae4db2 100644 --- a/pkg/detectors/droneci/droneci.go +++ b/pkg/detectors/droneci/droneci.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/duply/duply.go b/pkg/detectors/duply/duply.go index 1ae732aa00e7..545a4c30cbed 100644 --- a/pkg/detectors/duply/duply.go +++ b/pkg/detectors/duply/duply.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dwolla/dwolla.go b/pkg/detectors/dwolla/dwolla.go index e558162f4b3f..850cebbee1d3 100644 --- a/pkg/detectors/dwolla/dwolla.go +++ b/pkg/detectors/dwolla/dwolla.go @@ -42,16 +42,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range idMatches { - if len(match) != 2 { - continue - } idMatch := strings.TrimSpace(match[1]) for _, secret := range secretMatches { - if len(secret) != 2 { - continue - } secretMatch := strings.TrimSpace(secret[1]) diff --git a/pkg/detectors/dynalist/dynalist.go b/pkg/detectors/dynalist/dynalist.go index 03af2edc191b..c18d6c2524e0 100644 --- a/pkg/detectors/dynalist/dynalist.go +++ b/pkg/detectors/dynalist/dynalist.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dyspatch/dyspatch.go b/pkg/detectors/dyspatch/dyspatch.go index b51ea74493e1..3bca9c46168d 100644 --- a/pkg/detectors/dyspatch/dyspatch.go +++ b/pkg/detectors/dyspatch/dyspatch.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go b/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go index 5a8de5597e9b..c74781f8ebed 100644 --- a/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go +++ b/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go @@ -3,10 +3,11 @@ package eagleeyenetworks import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -40,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) emailMatches := email.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmailPatMatch := strings.TrimSpace(emailMatch[1]) diff --git a/pkg/detectors/easyinsight/easyinsight.go b/pkg/detectors/easyinsight/easyinsight.go index fdaf3858f98b..d84f7820e9d9 100644 --- a/pkg/detectors/easyinsight/easyinsight.go +++ b/pkg/detectors/easyinsight/easyinsight.go @@ -43,14 +43,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ecostruxureit/ecostruxureit.go b/pkg/detectors/ecostruxureit/ecostruxureit.go index a52deecf3aba..b664777ca6fa 100644 --- a/pkg/detectors/ecostruxureit/ecostruxureit.go +++ b/pkg/detectors/ecostruxureit/ecostruxureit.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/edamam/edamam.go b/pkg/detectors/edamam/edamam.go index 4a836da93328..6cff54240f81 100644 --- a/pkg/detectors/edamam/edamam.go +++ b/pkg/detectors/edamam/edamam.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(match) != 2 { - continue - } resId := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Edamam, diff --git a/pkg/detectors/edenai/edenai.go b/pkg/detectors/edenai/edenai.go index 2d1a2d5c7099..86c7ad4a0234 100644 --- a/pkg/detectors/edenai/edenai.go +++ b/pkg/detectors/edenai/edenai.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/eightxeight/eightxeight.go b/pkg/detectors/eightxeight/eightxeight.go index b7020a5e4f7b..eb1a76880b89 100644 --- a/pkg/detectors/eightxeight/eightxeight.go +++ b/pkg/detectors/eightxeight/eightxeight.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/elasticemail/elasticemail.go b/pkg/detectors/elasticemail/elasticemail.go index 1a287cef0f94..40c77c466827 100644 --- a/pkg/detectors/elasticemail/elasticemail.go +++ b/pkg/detectors/elasticemail/elasticemail.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/enablex/enablex.go b/pkg/detectors/enablex/enablex.go index bba8301db459..b591091c4af6 100644 --- a/pkg/detectors/enablex/enablex.go +++ b/pkg/detectors/enablex/enablex.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/enigma/enigma.go b/pkg/detectors/enigma/enigma.go index c58463cb0351..fa92ffc1177d 100644 --- a/pkg/detectors/enigma/enigma.go +++ b/pkg/detectors/enigma/enigma.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/envoyapikey/envoyapikey.go b/pkg/detectors/envoyapikey/envoyapikey.go index 9279344ae5cd..f74b5c31c93c 100644 --- a/pkg/detectors/envoyapikey/envoyapikey.go +++ b/pkg/detectors/envoyapikey/envoyapikey.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/etherscan/etherscan.go b/pkg/detectors/etherscan/etherscan.go index 11e375fa94a8..a6a3a342eedd 100644 --- a/pkg/detectors/etherscan/etherscan.go +++ b/pkg/detectors/etherscan/etherscan.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ethplorer/ethplorer.go b/pkg/detectors/ethplorer/ethplorer.go index 5731ae2464e1..ceeadfdd8689 100644 --- a/pkg/detectors/ethplorer/ethplorer.go +++ b/pkg/detectors/ethplorer/ethplorer.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/eventbrite/eventbrite.go b/pkg/detectors/eventbrite/eventbrite.go index dfbfbdd67ed0..c2816d184ba5 100644 --- a/pkg/detectors/eventbrite/eventbrite.go +++ b/pkg/detectors/eventbrite/eventbrite.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/everhour/everhour.go b/pkg/detectors/everhour/everhour.go index 4a5e8e2d06ad..6857bd8fbf67 100644 --- a/pkg/detectors/everhour/everhour.go +++ b/pkg/detectors/everhour/everhour.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/exchangerateapi/exchangerateapi.go b/pkg/detectors/exchangerateapi/exchangerateapi.go index 7598278585e6..db9c5e1f24c4 100644 --- a/pkg/detectors/exchangerateapi/exchangerateapi.go +++ b/pkg/detectors/exchangerateapi/exchangerateapi.go @@ -3,10 +3,11 @@ package exchangerateapi import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/exchangeratesapi/exchangeratesapi.go b/pkg/detectors/exchangeratesapi/exchangeratesapi.go index 8c3ae9565213..08de4cfb6e63 100644 --- a/pkg/detectors/exchangeratesapi/exchangeratesapi.go +++ b/pkg/detectors/exchangeratesapi/exchangeratesapi.go @@ -3,10 +3,11 @@ package exchangeratesapi import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/exportsdk/exportsdk.go b/pkg/detectors/exportsdk/exportsdk.go index 70e65438bdbe..2e006e85acc2 100644 --- a/pkg/detectors/exportsdk/exportsdk.go +++ b/pkg/detectors/exportsdk/exportsdk.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/extractorapi/extractorapi.go b/pkg/detectors/extractorapi/extractorapi.go index b00e37390747..f0a8d5a079aa 100644 --- a/pkg/detectors/extractorapi/extractorapi.go +++ b/pkg/detectors/extractorapi/extractorapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/facebookoauth/facebookoauth.go b/pkg/detectors/facebookoauth/facebookoauth.go index 9985f3f7a684..f5525d89b4a9 100644 --- a/pkg/detectors/facebookoauth/facebookoauth.go +++ b/pkg/detectors/facebookoauth/facebookoauth.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result apiSecretMatches := apiSecretPat.FindAllStringSubmatch(dataStr, -1) for _, apiIdMatch := range apiIdMatches { - if len(apiIdMatch) != 2 { - continue - } apiIdRes := strings.TrimSpace(apiIdMatch[1]) for _, apiSecretMatch := range apiSecretMatches { - if len(apiSecretMatch) != 2 { - continue - } apiSecretRes := strings.TrimSpace(apiSecretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/faceplusplus/faceplusplus.go b/pkg/detectors/faceplusplus/faceplusplus.go index a88d55f33d63..1ea7cc062067 100644 --- a/pkg/detectors/faceplusplus/faceplusplus.go +++ b/pkg/detectors/faceplusplus/faceplusplus.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fastforex/fastforex.go b/pkg/detectors/fastforex/fastforex.go index f4373dc2c512..a1acdc0c2ff7 100644 --- a/pkg/detectors/fastforex/fastforex.go +++ b/pkg/detectors/fastforex/fastforex.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go b/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go index 8981db540044..cd96c3cb9f16 100644 --- a/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go +++ b/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go @@ -4,11 +4,12 @@ import ( "context" "encoding/json" "fmt" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -46,9 +47,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/feedier/feedier.go b/pkg/detectors/feedier/feedier.go index 01a58d975cc6..ff926807399f 100644 --- a/pkg/detectors/feedier/feedier.go +++ b/pkg/detectors/feedier/feedier.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fetchrss/fetchrss.go b/pkg/detectors/fetchrss/fetchrss.go index 38b036dea0c0..910e1221174f 100644 --- a/pkg/detectors/fetchrss/fetchrss.go +++ b/pkg/detectors/fetchrss/fetchrss.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fibery/fibery.go b/pkg/detectors/fibery/fibery.go index dbccd03c1ec2..83769e735ed9 100644 --- a/pkg/detectors/fibery/fibery.go +++ b/pkg/detectors/fibery/fibery.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainMatch[1]) diff --git a/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go b/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go index 4546e1705602..121b02e4e517 100644 --- a/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go +++ b/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go b/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go index da23c49ded8a..5dbad5ee16d4 100644 --- a/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go +++ b/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fileio/fileio.go b/pkg/detectors/fileio/fileio.go index 5d1fae8c267f..5da6732581d1 100644 --- a/pkg/detectors/fileio/fileio.go +++ b/pkg/detectors/fileio/fileio.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/finage/finage.go b/pkg/detectors/finage/finage.go index bd0dca0fa49d..7648179d7739 100644 --- a/pkg/detectors/finage/finage.go +++ b/pkg/detectors/finage/finage.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/financialmodelingprep/financialmodelingprep.go b/pkg/detectors/financialmodelingprep/financialmodelingprep.go index 5783c15a9852..0c2d7c421255 100644 --- a/pkg/detectors/financialmodelingprep/financialmodelingprep.go +++ b/pkg/detectors/financialmodelingprep/financialmodelingprep.go @@ -3,11 +3,12 @@ package financialmodelingprep import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -38,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/findl/findl.go b/pkg/detectors/findl/findl.go index 921c98596baa..ccf056657ad6 100644 --- a/pkg/detectors/findl/findl.go +++ b/pkg/detectors/findl/findl.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/finnhub/finnhub.go b/pkg/detectors/finnhub/finnhub.go index 3d542973390e..aa0e89d8ff85 100644 --- a/pkg/detectors/finnhub/finnhub.go +++ b/pkg/detectors/finnhub/finnhub.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fixerio/fixerio.go b/pkg/detectors/fixerio/fixerio.go index e2a77bbd3e59..d440cb121401 100644 --- a/pkg/detectors/fixerio/fixerio.go +++ b/pkg/detectors/fixerio/fixerio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flatio/flatio.go b/pkg/detectors/flatio/flatio.go index 4743b2996517..206825a9d7ec 100644 --- a/pkg/detectors/flatio/flatio.go +++ b/pkg/detectors/flatio/flatio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fleetbase/fleetbase.go b/pkg/detectors/fleetbase/fleetbase.go index 05e7bb12b4a7..a3d855513b0d 100644 --- a/pkg/detectors/fleetbase/fleetbase.go +++ b/pkg/detectors/fleetbase/fleetbase.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flickr/flickr.go b/pkg/detectors/flickr/flickr.go index 5049678c1993..609aaedf9499 100644 --- a/pkg/detectors/flickr/flickr.go +++ b/pkg/detectors/flickr/flickr.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flightapi/flightapi.go b/pkg/detectors/flightapi/flightapi.go index 90bb89d5ef24..bf8ebbfec0d6 100644 --- a/pkg/detectors/flightapi/flightapi.go +++ b/pkg/detectors/flightapi/flightapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flightlabs/flightlabs.go b/pkg/detectors/flightlabs/flightlabs.go index 230321d85171..575853ca93a8 100644 --- a/pkg/detectors/flightlabs/flightlabs.go +++ b/pkg/detectors/flightlabs/flightlabs.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flightstats/flightstats.go b/pkg/detectors/flightstats/flightstats.go index 871abcdb8b69..00f4e3732139 100644 --- a/pkg/detectors/flightstats/flightstats.go +++ b/pkg/detectors/flightstats/flightstats.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resId := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/float/float.go b/pkg/detectors/float/float.go index cb8a0ed90a46..28d39ce6a9d6 100644 --- a/pkg/detectors/float/float.go +++ b/pkg/detectors/float/float.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flowflu/flowflu.go b/pkg/detectors/flowflu/flowflu.go index f8637cfe602f..2e386503b496 100644 --- a/pkg/detectors/flowflu/flowflu.go +++ b/pkg/detectors/flowflu/flowflu.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result accountMatches := accountPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, accountMatch := range accountMatches { - if len(accountMatch) != 2 { - continue - } resAccount := strings.TrimSpace(accountMatch[1]) diff --git a/pkg/detectors/flutterwave/flutterwave.go b/pkg/detectors/flutterwave/flutterwave.go index 32bc69e6d9e5..38802142c8fa 100644 --- a/pkg/detectors/flutterwave/flutterwave.go +++ b/pkg/detectors/flutterwave/flutterwave.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fmfw/fmfw.go b/pkg/detectors/fmfw/fmfw.go index d5aa9633de13..38ac40e67bdd 100644 --- a/pkg/detectors/fmfw/fmfw.go +++ b/pkg/detectors/fmfw/fmfw.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/formbucket/formbucket.go b/pkg/detectors/formbucket/formbucket.go index 926e7e2d7479..cc44e91d5570 100644 --- a/pkg/detectors/formbucket/formbucket.go +++ b/pkg/detectors/formbucket/formbucket.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/formcraft/formcraft.go b/pkg/detectors/formcraft/formcraft.go index 1f09769d8f61..b5f3abaf6bd2 100644 --- a/pkg/detectors/formcraft/formcraft.go +++ b/pkg/detectors/formcraft/formcraft.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/formio/formio.go b/pkg/detectors/formio/formio.go index b562dd3ed331..e6b1ba441424 100644 --- a/pkg/detectors/formio/formio.go +++ b/pkg/detectors/formio/formio.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/formsite/formsite.go b/pkg/detectors/formsite/formsite.go index a69cc2ab286b..50ecf95608aa 100644 --- a/pkg/detectors/formsite/formsite.go +++ b/pkg/detectors/formsite/formsite.go @@ -43,19 +43,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userMatches := userPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, serverMatch := range serverMatches { - if len(serverMatch) != 2 { - continue - } resServerMatch := strings.TrimSpace(serverMatch[1]) for _, userMatch := range userMatches { - if len(userMatch) != 2 { - continue - } resUserMatch := strings.TrimSpace(userMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Formsite, diff --git a/pkg/detectors/foursquare/foursquare.go b/pkg/detectors/foursquare/foursquare.go index 7005970538a8..d2981f2c3177 100644 --- a/pkg/detectors/foursquare/foursquare.go +++ b/pkg/detectors/foursquare/foursquare.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretMatch.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_FourSquare, diff --git a/pkg/detectors/frameio/frameio.go b/pkg/detectors/frameio/frameio.go index 80bb3f174c71..09fe6b600eb9 100644 --- a/pkg/detectors/frameio/frameio.go +++ b/pkg/detectors/frameio/frameio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/freshbooks/freshbooks.go b/pkg/detectors/freshbooks/freshbooks.go index 75e65ce4d971..7ad375f4987d 100644 --- a/pkg/detectors/freshbooks/freshbooks.go +++ b/pkg/detectors/freshbooks/freshbooks.go @@ -42,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result uriMatches := uriPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, uriMatch := range uriMatches { - if len(uriMatch) != 2 { - continue - } resURI := strings.TrimSpace(uriMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/freshdesk/freshdesk.go b/pkg/detectors/freshdesk/freshdesk.go index 0abdacc3015c..89721ea69cc8 100644 --- a/pkg/detectors/freshdesk/freshdesk.go +++ b/pkg/detectors/freshdesk/freshdesk.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Freshdesk, diff --git a/pkg/detectors/front/front.go b/pkg/detectors/front/front.go index 303e42f23ede..f5054756dab4 100644 --- a/pkg/detectors/front/front.go +++ b/pkg/detectors/front/front.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fulcrum/fulcrum.go b/pkg/detectors/fulcrum/fulcrum.go index c99a2bcd870a..39a601a8b087 100644 --- a/pkg/detectors/fulcrum/fulcrum.go +++ b/pkg/detectors/fulcrum/fulcrum.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fullstory/v1/fullstory.go b/pkg/detectors/fullstory/v1/fullstory.go index d051af0b68fd..9c74acdac21d 100644 --- a/pkg/detectors/fullstory/v1/fullstory.go +++ b/pkg/detectors/fullstory/v1/fullstory.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fullstory/v2/fullstory_v2.go b/pkg/detectors/fullstory/v2/fullstory_v2.go index 0b9184d628da..5d34e0dfb9f4 100644 --- a/pkg/detectors/fullstory/v2/fullstory_v2.go +++ b/pkg/detectors/fullstory/v2/fullstory_v2.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fxmarket/fxmarket.go b/pkg/detectors/fxmarket/fxmarket.go index 598858545797..971f790a8186 100644 --- a/pkg/detectors/fxmarket/fxmarket.go +++ b/pkg/detectors/fxmarket/fxmarket.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geckoboard/geckoboard.go b/pkg/detectors/geckoboard/geckoboard.go index 2bd56e33fe21..9ad93b925ebc 100644 --- a/pkg/detectors/geckoboard/geckoboard.go +++ b/pkg/detectors/geckoboard/geckoboard.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gemini/gemini.go b/pkg/detectors/gemini/gemini.go index 949cd6fe0778..6f328375489b 100644 --- a/pkg/detectors/gemini/gemini.go +++ b/pkg/detectors/gemini/gemini.go @@ -54,9 +54,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range idMatches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { diff --git a/pkg/detectors/gengo/gengo.go b/pkg/detectors/gengo/gengo.go index 2c10adfdafed..c9d58339a06c 100644 --- a/pkg/detectors/gengo/gengo.go +++ b/pkg/detectors/gengo/gengo.go @@ -49,15 +49,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geoapify/geoapify.go b/pkg/detectors/geoapify/geoapify.go index 83c1d3cbca46..f44ede1b8a8e 100644 --- a/pkg/detectors/geoapify/geoapify.go +++ b/pkg/detectors/geoapify/geoapify.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geocode/geocode.go b/pkg/detectors/geocode/geocode.go index 8d4c5c068e20..053940a3fe8e 100644 --- a/pkg/detectors/geocode/geocode.go +++ b/pkg/detectors/geocode/geocode.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geocodify/geocodify.go b/pkg/detectors/geocodify/geocodify.go index 4cdd71af788d..d7347ffda90f 100644 --- a/pkg/detectors/geocodify/geocodify.go +++ b/pkg/detectors/geocodify/geocodify.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geocodio/geocodio.go b/pkg/detectors/geocodio/geocodio.go index fbee186f02e1..982eb916c5e6 100644 --- a/pkg/detectors/geocodio/geocodio.go +++ b/pkg/detectors/geocodio/geocodio.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result searchMatches := searchPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, searchMatch := range searchMatches { - if len(searchMatch) != 2 { - continue - } resSearchMatch := strings.TrimSpace(searchMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geoipifi/geoipifi.go b/pkg/detectors/geoipifi/geoipifi.go index 868ea260c335..c26a638e0387 100644 --- a/pkg/detectors/geoipifi/geoipifi.go +++ b/pkg/detectors/geoipifi/geoipifi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/getemail/getemail.go b/pkg/detectors/getemail/getemail.go index 3f0b224990b9..7631511172e1 100644 --- a/pkg/detectors/getemail/getemail.go +++ b/pkg/detectors/getemail/getemail.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/getemails/getemails.go b/pkg/detectors/getemails/getemails.go index 694b0eac1a92..6d4e7d092009 100644 --- a/pkg/detectors/getemails/getemails.go +++ b/pkg/detectors/getemails/getemails.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/getgeoapi/getgeoapi.go b/pkg/detectors/getgeoapi/getgeoapi.go index c3cd69ebf877..906e07debd35 100644 --- a/pkg/detectors/getgeoapi/getgeoapi.go +++ b/pkg/detectors/getgeoapi/getgeoapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/getgist/getgist.go b/pkg/detectors/getgist/getgist.go index 77daa21df3d3..441e5290d00f 100644 --- a/pkg/detectors/getgist/getgist.go +++ b/pkg/detectors/getgist/getgist.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/getresponse/getresponse.go b/pkg/detectors/getresponse/getresponse.go index ee0573a442c0..b11d6b7dee4a 100644 --- a/pkg/detectors/getresponse/getresponse.go +++ b/pkg/detectors/getresponse/getresponse.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/getsandbox/getsandbox.go b/pkg/detectors/getsandbox/getsandbox.go index 152b6a7384cf..a6ae9eae60e8 100644 --- a/pkg/detectors/getsandbox/getsandbox.go +++ b/pkg/detectors/getsandbox/getsandbox.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/github/v1/github_old.go b/pkg/detectors/github/v1/github_old.go index b5eb37e9a88c..0e51e7ab8387 100644 --- a/pkg/detectors/github/v1/github_old.go +++ b/pkg/detectors/github/v1/github_old.go @@ -65,9 +65,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, match := range matches { // First match is entire regex, second is the first group. - if len(match) != 2 { - continue - } token := match[1] diff --git a/pkg/detectors/github/v2/github.go b/pkg/detectors/github/v2/github.go index 2c21a3ce4129..9ee3f4174363 100644 --- a/pkg/detectors/github/v2/github.go +++ b/pkg/detectors/github/v2/github.go @@ -53,9 +53,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, match := range matches { // First match is entire regex, second is the first group. - if len(match) != 2 { - continue - } token := match[1] diff --git a/pkg/detectors/github_oauth2/github_oauth2.go b/pkg/detectors/github_oauth2/github_oauth2.go index c1203433f574..6f4c228210d0 100644 --- a/pkg/detectors/github_oauth2/github_oauth2.go +++ b/pkg/detectors/github_oauth2/github_oauth2.go @@ -46,13 +46,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result oauth2ClientSecretMatches := oauth2ClientSecretPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range oauth2ClientIDMatches { - if len(idMatch) != 2 { - continue - } for _, secretMatch := range oauth2ClientSecretMatches { - if len(secretMatch) != 2 { - continue - } s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_GitHubOauth2, diff --git a/pkg/detectors/githubapp/githubapp.go b/pkg/detectors/githubapp/githubapp.go index bbddd92ccd79..e69002d0d532 100644 --- a/pkg/detectors/githubapp/githubapp.go +++ b/pkg/detectors/githubapp/githubapp.go @@ -45,15 +45,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result appMatches := appPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, appMatch := range appMatches { - if len(appMatch) != 2 { - continue - } appResMatch := strings.TrimSpace(appMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_GitHubApp, diff --git a/pkg/detectors/gitlab/v1/gitlab.go b/pkg/detectors/gitlab/v1/gitlab.go index c718366222a0..93befbf7794f 100644 --- a/pkg/detectors/gitlab/v1/gitlab.go +++ b/pkg/detectors/gitlab/v1/gitlab.go @@ -47,9 +47,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } // ignore v2 detectors which have a prefix of `glpat-` if strings.Contains(match[0], "glpat-") { continue diff --git a/pkg/detectors/gitlab/v2/gitlab_v2.go b/pkg/detectors/gitlab/v2/gitlab_v2.go index d0d413c60ea5..068e52ec705b 100644 --- a/pkg/detectors/gitlab/v2/gitlab_v2.go +++ b/pkg/detectors/gitlab/v2/gitlab_v2.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gitter/gitter.go b/pkg/detectors/gitter/gitter.go index a0924bf2c108..716346f06d80 100644 --- a/pkg/detectors/gitter/gitter.go +++ b/pkg/detectors/gitter/gitter.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/glassnode/glassnode.go b/pkg/detectors/glassnode/glassnode.go index e20516c4d445..af45eae00e39 100644 --- a/pkg/detectors/glassnode/glassnode.go +++ b/pkg/detectors/glassnode/glassnode.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gocanvas/gocanvas.go b/pkg/detectors/gocanvas/gocanvas.go index c795debe000d..927e20a3fbcd 100644 --- a/pkg/detectors/gocanvas/gocanvas.go +++ b/pkg/detectors/gocanvas/gocanvas.go @@ -44,15 +44,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmailMatch := strings.TrimSpace(emailMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gocardless/gocardless.go b/pkg/detectors/gocardless/gocardless.go index 3b139a20cac0..bc2db419f179 100644 --- a/pkg/detectors/gocardless/gocardless.go +++ b/pkg/detectors/gocardless/gocardless.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/goodday/goodday.go b/pkg/detectors/goodday/goodday.go index e51f91fafbe3..965b32aefd58 100644 --- a/pkg/detectors/goodday/goodday.go +++ b/pkg/detectors/goodday/goodday.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/grafana/grafana.go b/pkg/detectors/grafana/grafana.go index 182453af0d09..f241ce0521da 100644 --- a/pkg/detectors/grafana/grafana.go +++ b/pkg/detectors/grafana/grafana.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go b/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go index 6df3aaf890b6..2b4f5e73aa98 100644 --- a/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go +++ b/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go @@ -3,10 +3,11 @@ package grafanaserviceaccount import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range keyMatches { - if len(match) != 2 { - continue - } key := strings.TrimSpace(match[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } domainRes := strings.TrimSpace(domainMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/graphcms/graphcms.go b/pkg/detectors/graphcms/graphcms.go index ad5307a08ef5..87d218af597d 100644 --- a/pkg/detectors/graphcms/graphcms.go +++ b/pkg/detectors/graphcms/graphcms.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/graphhopper/graphhopper.go b/pkg/detectors/graphhopper/graphhopper.go index 363891894abc..8f97138e02ec 100644 --- a/pkg/detectors/graphhopper/graphhopper.go +++ b/pkg/detectors/graphhopper/graphhopper.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Graphhopper, diff --git a/pkg/detectors/groovehq/groovehq.go b/pkg/detectors/groovehq/groovehq.go index 0dee1c3d60c6..9018be0789a1 100644 --- a/pkg/detectors/groovehq/groovehq.go +++ b/pkg/detectors/groovehq/groovehq.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gtmetrix/gtmetrix.go b/pkg/detectors/gtmetrix/gtmetrix.go index 96ce3d2827da..d9baba1f42b8 100644 --- a/pkg/detectors/gtmetrix/gtmetrix.go +++ b/pkg/detectors/gtmetrix/gtmetrix.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/guardianapi/guardianapi.go b/pkg/detectors/guardianapi/guardianapi.go index 9da39d446dd6..899052d7f65d 100644 --- a/pkg/detectors/guardianapi/guardianapi.go +++ b/pkg/detectors/guardianapi/guardianapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gumroad/gumroad.go b/pkg/detectors/gumroad/gumroad.go index 243f3204d061..44526c313950 100644 --- a/pkg/detectors/gumroad/gumroad.go +++ b/pkg/detectors/gumroad/gumroad.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/guru/guru.go b/pkg/detectors/guru/guru.go index 88cc8dab9e8d..7b04ac74ddc9 100644 --- a/pkg/detectors/guru/guru.go +++ b/pkg/detectors/guru/guru.go @@ -42,16 +42,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range unameMatches { - if len(match) != 2 { - continue - } unameMatch := strings.TrimSpace(match[1]) for _, secret := range keyMatches { - if len(secret) != 2 { - continue - } keyMatch := strings.TrimSpace(secret[1]) diff --git a/pkg/detectors/gyazo/gyazo.go b/pkg/detectors/gyazo/gyazo.go index a058d7b37ba1..b25ef3939ff2 100644 --- a/pkg/detectors/gyazo/gyazo.go +++ b/pkg/detectors/gyazo/gyazo.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/happyscribe/happyscribe.go b/pkg/detectors/happyscribe/happyscribe.go index a5b49b1b236b..3ac52c2d643f 100644 --- a/pkg/detectors/happyscribe/happyscribe.go +++ b/pkg/detectors/happyscribe/happyscribe.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/harvest/harvest.go b/pkg/detectors/harvest/harvest.go index 7078e10b59d6..9c3d83c7f6dc 100644 --- a/pkg/detectors/harvest/harvest.go +++ b/pkg/detectors/harvest/harvest.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hellosign/hellosign.go b/pkg/detectors/hellosign/hellosign.go index 24b6548dfe21..26413818dd70 100644 --- a/pkg/detectors/hellosign/hellosign.go +++ b/pkg/detectors/hellosign/hellosign.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/helpcrunch/helpcrunch.go b/pkg/detectors/helpcrunch/helpcrunch.go index d8396c788217..051accc938b6 100644 --- a/pkg/detectors/helpcrunch/helpcrunch.go +++ b/pkg/detectors/helpcrunch/helpcrunch.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/helpscout/helpscout.go b/pkg/detectors/helpscout/helpscout.go index 842a6dece5b7..11c04ca4c605 100644 --- a/pkg/detectors/helpscout/helpscout.go +++ b/pkg/detectors/helpscout/helpscout.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hereapi/hereapi.go b/pkg/detectors/hereapi/hereapi.go index bfb5e48119e1..ff4256549092 100644 --- a/pkg/detectors/hereapi/hereapi.go +++ b/pkg/detectors/hereapi/hereapi.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/heroku/heroku.go b/pkg/detectors/heroku/heroku.go index 6fdee217b77c..d147c6d699d4 100644 --- a/pkg/detectors/heroku/heroku.go +++ b/pkg/detectors/heroku/heroku.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hive/hive.go b/pkg/detectors/hive/hive.go index 0aeec88a7499..0a71cfb4dc2d 100644 --- a/pkg/detectors/hive/hive.go +++ b/pkg/detectors/hive/hive.go @@ -40,16 +40,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range idMatches { - if len(match) != 2 { - continue - } idMatch := strings.TrimSpace(match[1]) for _, match := range keyMatches { - if len(match) != 2 { - continue - } keyMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hiveage/hiveage.go b/pkg/detectors/hiveage/hiveage.go index c797cbe30a18..c5d25ca90a2e 100644 --- a/pkg/detectors/hiveage/hiveage.go +++ b/pkg/detectors/hiveage/hiveage.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/holidayapi/holidayapi.go b/pkg/detectors/holidayapi/holidayapi.go index 1e24be439d54..44ad94afd2c8 100644 --- a/pkg/detectors/holidayapi/holidayapi.go +++ b/pkg/detectors/holidayapi/holidayapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/holistic/holistic.go b/pkg/detectors/holistic/holistic.go index 42fb87a5df74..7f67791a2ee7 100644 --- a/pkg/detectors/holistic/holistic.go +++ b/pkg/detectors/holistic/holistic.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/honeycomb/honeycomb.go b/pkg/detectors/honeycomb/honeycomb.go index c52beae7b4e6..b0140ddc8f69 100644 --- a/pkg/detectors/honeycomb/honeycomb.go +++ b/pkg/detectors/honeycomb/honeycomb.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/host/host.go b/pkg/detectors/host/host.go index 416bb457fc45..9d5f00390b3e 100644 --- a/pkg/detectors/host/host.go +++ b/pkg/detectors/host/host.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/html2pdf/html2pdf.go b/pkg/detectors/html2pdf/html2pdf.go index 20f8328bdd6f..07298a539402 100644 --- a/pkg/detectors/html2pdf/html2pdf.go +++ b/pkg/detectors/html2pdf/html2pdf.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hubspotapikey/hubspotapikey.go b/pkg/detectors/hubspotapikey/hubspotapikey.go index e912dea44096..fd785cd1f80c 100644 --- a/pkg/detectors/hubspotapikey/hubspotapikey.go +++ b/pkg/detectors/hubspotapikey/hubspotapikey.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/huggingface/huggingface.go b/pkg/detectors/huggingface/huggingface.go index f836def20f92..a38018087234 100644 --- a/pkg/detectors/huggingface/huggingface.go +++ b/pkg/detectors/huggingface/huggingface.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 1 { - continue - } resMatch := strings.TrimSpace(match[0]) s1 := detectors.Result{ diff --git a/pkg/detectors/humanity/humanity.go b/pkg/detectors/humanity/humanity.go index 57e987d95673..13170bd00f3a 100644 --- a/pkg/detectors/humanity/humanity.go +++ b/pkg/detectors/humanity/humanity.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hunter/hunter.go b/pkg/detectors/hunter/hunter.go index 2c2949ab4337..a480dfced386 100644 --- a/pkg/detectors/hunter/hunter.go +++ b/pkg/detectors/hunter/hunter.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hybiscus/hybiscus.go b/pkg/detectors/hybiscus/hybiscus.go index 1ccbade48b05..b741febb1374 100644 --- a/pkg/detectors/hybiscus/hybiscus.go +++ b/pkg/detectors/hybiscus/hybiscus.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hypertrack/hypertrack.go b/pkg/detectors/hypertrack/hypertrack.go index 418ae89377ea..6212599a4e27 100644 --- a/pkg/detectors/hypertrack/hypertrack.go +++ b/pkg/detectors/hypertrack/hypertrack.go @@ -40,16 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, accMatch := range accMatches { - - if len(accMatch) != 2 { - continue - } resAccMatch := strings.TrimSpace(accMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go b/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go index af8c57166952..fc2524a195bd 100644 --- a/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go +++ b/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go @@ -2,10 +2,11 @@ package ibmclouduserkey import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/iconfinder/iconfinder.go b/pkg/detectors/iconfinder/iconfinder.go index 08aef96f21c7..785f394f3d2d 100644 --- a/pkg/detectors/iconfinder/iconfinder.go +++ b/pkg/detectors/iconfinder/iconfinder.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/iexapis/iexapis.go b/pkg/detectors/iexapis/iexapis.go index d4735f0d670e..8159321dccea 100644 --- a/pkg/detectors/iexapis/iexapis.go +++ b/pkg/detectors/iexapis/iexapis.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/iexcloud/iexcloud.go b/pkg/detectors/iexcloud/iexcloud.go index 57ed64208c55..7a19d752fc85 100644 --- a/pkg/detectors/iexcloud/iexcloud.go +++ b/pkg/detectors/iexcloud/iexcloud.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/imagekit/imagekit.go b/pkg/detectors/imagekit/imagekit.go index 549291a17d3f..76492efee101 100644 --- a/pkg/detectors/imagekit/imagekit.go +++ b/pkg/detectors/imagekit/imagekit.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/imagga/imagga.go b/pkg/detectors/imagga/imagga.go index 4c7130c65bb8..79ad0c9e930f 100644 --- a/pkg/detectors/imagga/imagga.go +++ b/pkg/detectors/imagga/imagga.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/impala/impala.go b/pkg/detectors/impala/impala.go index 0705954d6832..cd226650eaed 100644 --- a/pkg/detectors/impala/impala.go +++ b/pkg/detectors/impala/impala.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/infura/infura.go b/pkg/detectors/infura/infura.go index 653c5135182a..6fc62413394b 100644 --- a/pkg/detectors/infura/infura.go +++ b/pkg/detectors/infura/infura.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/insightly/insightly.go b/pkg/detectors/insightly/insightly.go index 1f298d8475c1..2fc08523536e 100644 --- a/pkg/detectors/insightly/insightly.go +++ b/pkg/detectors/insightly/insightly.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/instabot/instabot.go b/pkg/detectors/instabot/instabot.go index 24b5b3b92bce..397c1d474ddd 100644 --- a/pkg/detectors/instabot/instabot.go +++ b/pkg/detectors/instabot/instabot.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/instamojo/instamojo.go b/pkg/detectors/instamojo/instamojo.go index 82c158b23a7e..078165b51d57 100644 --- a/pkg/detectors/instamojo/instamojo.go +++ b/pkg/detectors/instamojo/instamojo.go @@ -45,15 +45,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result clientIdmatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range secretMatches { - if len(match) != 2 { - continue - } resSecret := strings.TrimSpace(match[1]) for _, clientIdMatch := range clientIdmatches { - if len(clientIdMatch) != 2 { - continue - } resClientId := strings.TrimSpace(clientIdMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/intercom/intercom.go b/pkg/detectors/intercom/intercom.go index ad820bf7c291..2dd911027a22 100644 --- a/pkg/detectors/intercom/intercom.go +++ b/pkg/detectors/intercom/intercom.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) dec, err := base64.StdEncoding.DecodeString(resMatch) diff --git a/pkg/detectors/interseller/interseller.go b/pkg/detectors/interseller/interseller.go index fe96b67dbeab..908d6077e6a1 100644 --- a/pkg/detectors/interseller/interseller.go +++ b/pkg/detectors/interseller/interseller.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/intrinio/intrinio.go b/pkg/detectors/intrinio/intrinio.go index fb6a33bfcdbf..d600af0ae113 100644 --- a/pkg/detectors/intrinio/intrinio.go +++ b/pkg/detectors/intrinio/intrinio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/invoiceocean/invoiceocean.go b/pkg/detectors/invoiceocean/invoiceocean.go index f95a4ec4c929..74b1fffec424 100644 --- a/pkg/detectors/invoiceocean/invoiceocean.go +++ b/pkg/detectors/invoiceocean/invoiceocean.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ip2location/ip2location.go b/pkg/detectors/ip2location/ip2location.go index 72dc862d29a2..380e619ee40b 100644 --- a/pkg/detectors/ip2location/ip2location.go +++ b/pkg/detectors/ip2location/ip2location.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipapi/ipapi.go b/pkg/detectors/ipapi/ipapi.go index 7c00fcb2fd8f..5549b4be744e 100644 --- a/pkg/detectors/ipapi/ipapi.go +++ b/pkg/detectors/ipapi/ipapi.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipgeolocation/ipgeolocation.go b/pkg/detectors/ipgeolocation/ipgeolocation.go index c70162f79549..fbbabcd53dce 100644 --- a/pkg/detectors/ipgeolocation/ipgeolocation.go +++ b/pkg/detectors/ipgeolocation/ipgeolocation.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipinfo/ipinfo.go b/pkg/detectors/ipinfo/ipinfo.go index f36abaae34df..65c47f4a1b79 100644 --- a/pkg/detectors/ipinfo/ipinfo.go +++ b/pkg/detectors/ipinfo/ipinfo.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipinfodb/ipinfodb.go b/pkg/detectors/ipinfodb/ipinfodb.go index f056faf3fd65..6d32ec084252 100644 --- a/pkg/detectors/ipinfodb/ipinfodb.go +++ b/pkg/detectors/ipinfodb/ipinfodb.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipquality/ipquality.go b/pkg/detectors/ipquality/ipquality.go index dfa4b1a2180a..453937e250e6 100644 --- a/pkg/detectors/ipquality/ipquality.go +++ b/pkg/detectors/ipquality/ipquality.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipstack/ipstack.go b/pkg/detectors/ipstack/ipstack.go index b09a0ab8d924..b1f43ee6a4c6 100644 --- a/pkg/detectors/ipstack/ipstack.go +++ b/pkg/detectors/ipstack/ipstack.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_IpStack, diff --git a/pkg/detectors/jiratoken/v1/jiratoken.go b/pkg/detectors/jiratoken/v1/jiratoken.go index ae23754e5645..16e738907a98 100644 --- a/pkg/detectors/jiratoken/v1/jiratoken.go +++ b/pkg/detectors/jiratoken/v1/jiratoken.go @@ -55,19 +55,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, email := range emails { email = strings.Split(email[0], " ") - if len(email) != 2 { - continue - } resEmail := strings.TrimSpace(email[1]) for _, token := range tokens { - if len(token) != 2 { - continue - } resToken := strings.TrimSpace(token[1]) for _, domain := range domains { - if len(domain) != 2 { - continue - } resDomain := strings.TrimSpace(domain[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/jiratoken/v2/jiratoken_v2.go b/pkg/detectors/jiratoken/v2/jiratoken_v2.go index 3501bde9b369..d12f64c8c9de 100644 --- a/pkg/detectors/jiratoken/v2/jiratoken_v2.go +++ b/pkg/detectors/jiratoken/v2/jiratoken_v2.go @@ -61,14 +61,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } resEmail := strings.TrimSpace(email[1]) for _, token := range tokens { - if len(token) != 2 { - continue - } resToken := strings.TrimSpace(token[1]) for _, domain := range domains { - if len(domain) != 2 { - continue - } resDomain := strings.TrimSpace(domain[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/jotform/jotform.go b/pkg/detectors/jotform/jotform.go index d8005be54be4..13a289124563 100644 --- a/pkg/detectors/jotform/jotform.go +++ b/pkg/detectors/jotform/jotform.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/jumpcloud/jumpcloud.go b/pkg/detectors/jumpcloud/jumpcloud.go index cbd5b0ef2105..d1772bf5d157 100644 --- a/pkg/detectors/jumpcloud/jumpcloud.go +++ b/pkg/detectors/jumpcloud/jumpcloud.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Jumpcloud, diff --git a/pkg/detectors/jupiterone/jupiterone.go b/pkg/detectors/jupiterone/jupiterone.go index 2bf322bb15be..6f0528c6463a 100644 --- a/pkg/detectors/jupiterone/jupiterone.go +++ b/pkg/detectors/jupiterone/jupiterone.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/juro/juro.go b/pkg/detectors/juro/juro.go index c35dac3e4d1c..2683200416fd 100644 --- a/pkg/detectors/juro/juro.go +++ b/pkg/detectors/juro/juro.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kanban/kanban.go b/pkg/detectors/kanban/kanban.go index d3fb775ea775..f7aa1ef3795a 100644 --- a/pkg/detectors/kanban/kanban.go +++ b/pkg/detectors/kanban/kanban.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kanbantool/kanbantool.go b/pkg/detectors/kanbantool/kanbantool.go index a6bb8e23e036..d4bc302df5dc 100644 --- a/pkg/detectors/kanbantool/kanbantool.go +++ b/pkg/detectors/kanbantool/kanbantool.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) idMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/karmacrm/karmacrm.go b/pkg/detectors/karmacrm/karmacrm.go index 0fb783f27643..3f89ad0d2790 100644 --- a/pkg/detectors/karmacrm/karmacrm.go +++ b/pkg/detectors/karmacrm/karmacrm.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/keenio/keenio.go b/pkg/detectors/keenio/keenio.go index d2f76cb0fc21..46006e2c0e27 100644 --- a/pkg/detectors/keenio/keenio.go +++ b/pkg/detectors/keenio/keenio.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kickbox/kickbox.go b/pkg/detectors/kickbox/kickbox.go index a2c3df79b5a2..194dcb77ac28 100644 --- a/pkg/detectors/kickbox/kickbox.go +++ b/pkg/detectors/kickbox/kickbox.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/klaviyo/klaviyo.go b/pkg/detectors/klaviyo/klaviyo.go index 40495604226e..0133e55cb49e 100644 --- a/pkg/detectors/klaviyo/klaviyo.go +++ b/pkg/detectors/klaviyo/klaviyo.go @@ -52,9 +52,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/klipfolio/klipfolio.go b/pkg/detectors/klipfolio/klipfolio.go index b6d1078d222b..dbba62e21fe8 100644 --- a/pkg/detectors/klipfolio/klipfolio.go +++ b/pkg/detectors/klipfolio/klipfolio.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/knapsackpro/knapsackpro.go b/pkg/detectors/knapsackpro/knapsackpro.go index fa37e0ba540e..058b76b7fe4f 100644 --- a/pkg/detectors/knapsackpro/knapsackpro.go +++ b/pkg/detectors/knapsackpro/knapsackpro.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kontent/kontent.go b/pkg/detectors/kontent/kontent.go index af97f7ed94b9..00b92b208867 100644 --- a/pkg/detectors/kontent/kontent.go +++ b/pkg/detectors/kontent/kontent.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kraken/kraken.go b/pkg/detectors/kraken/kraken.go index d6db8e5695f5..b3f0617a72bf 100644 --- a/pkg/detectors/kraken/kraken.go +++ b/pkg/detectors/kraken/kraken.go @@ -49,15 +49,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result privKeyMatches := privKeyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, privKeyMatch := range privKeyMatches { - if len(privKeyMatch) != 2 { - continue - } resPrivKeyMatch := strings.TrimSpace(privKeyMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kucoin/kucoin.go b/pkg/detectors/kucoin/kucoin.go index d19329a6e958..0cd30c0fcfd4 100644 --- a/pkg/detectors/kucoin/kucoin.go +++ b/pkg/detectors/kucoin/kucoin.go @@ -47,21 +47,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passphraseMatches := passphrasePat.FindAllStringSubmatch(dataStr, -1) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } resKeyMatch := strings.TrimSpace(keyMatch[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) for _, passphraseMatch := range passphraseMatches { - if len(passphraseMatch) != 2 { - continue - } resPassphraseMatch := strings.TrimSpace(passphraseMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kylas/kylas.go b/pkg/detectors/kylas/kylas.go index c81235da6462..bab28495697b 100644 --- a/pkg/detectors/kylas/kylas.go +++ b/pkg/detectors/kylas/kylas.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/languagelayer/languagelayer.go b/pkg/detectors/languagelayer/languagelayer.go index 5f3c856b52bc..1ccbc29c47be 100644 --- a/pkg/detectors/languagelayer/languagelayer.go +++ b/pkg/detectors/languagelayer/languagelayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/launchdarkly/launchdarkly.go b/pkg/detectors/launchdarkly/launchdarkly.go index f6bbe9f3667f..f7f4ac15c0e1 100644 --- a/pkg/detectors/launchdarkly/launchdarkly.go +++ b/pkg/detectors/launchdarkly/launchdarkly.go @@ -64,9 +64,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/leadfeeder/leadfeeder.go b/pkg/detectors/leadfeeder/leadfeeder.go index 44ca3feb3bcb..a1eef71a4ac6 100644 --- a/pkg/detectors/leadfeeder/leadfeeder.go +++ b/pkg/detectors/leadfeeder/leadfeeder.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lemlist/lemlist.go b/pkg/detectors/lemlist/lemlist.go index af21db0b9f90..3f7af7e20641 100644 --- a/pkg/detectors/lemlist/lemlist.go +++ b/pkg/detectors/lemlist/lemlist.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lemonsqueezy/lemonsqueezy.go b/pkg/detectors/lemonsqueezy/lemonsqueezy.go index ca6b08a53356..4d5afc7b4d76 100644 --- a/pkg/detectors/lemonsqueezy/lemonsqueezy.go +++ b/pkg/detectors/lemonsqueezy/lemonsqueezy.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lendflow/lendflow.go b/pkg/detectors/lendflow/lendflow.go index 81f110e7eab1..b4b4e6697646 100644 --- a/pkg/detectors/lendflow/lendflow.go +++ b/pkg/detectors/lendflow/lendflow.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go b/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go index 04ecf9117067..f78d485aa4ea 100644 --- a/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go +++ b/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lexigram/lexigram.go b/pkg/detectors/lexigram/lexigram.go index 4af5b9b6bc67..61c91596586f 100644 --- a/pkg/detectors/lexigram/lexigram.go +++ b/pkg/detectors/lexigram/lexigram.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/linearapi/linearapi.go b/pkg/detectors/linearapi/linearapi.go index d17194cc72a9..748b0167eb12 100644 --- a/pkg/detectors/linearapi/linearapi.go +++ b/pkg/detectors/linearapi/linearapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/linemessaging/linemessaging.go b/pkg/detectors/linemessaging/linemessaging.go index c5405c06a8f7..00a515b96cd5 100644 --- a/pkg/detectors/linemessaging/linemessaging.go +++ b/pkg/detectors/linemessaging/linemessaging.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/linenotify/linenotify.go b/pkg/detectors/linenotify/linenotify.go index 2fd52104c262..d14614894cfb 100644 --- a/pkg/detectors/linenotify/linenotify.go +++ b/pkg/detectors/linenotify/linenotify.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/linkpreview/linkpreview.go b/pkg/detectors/linkpreview/linkpreview.go index 75cd7891c59e..eda10b4c20c8 100644 --- a/pkg/detectors/linkpreview/linkpreview.go +++ b/pkg/detectors/linkpreview/linkpreview.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/liveagent/liveagent.go b/pkg/detectors/liveagent/liveagent.go index a4ed7f394d5d..f0f80b946162 100644 --- a/pkg/detectors/liveagent/liveagent.go +++ b/pkg/detectors/liveagent/liveagent.go @@ -45,16 +45,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } domainRes := strings.TrimSpace(domainMatch[0]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_LiveAgent, diff --git a/pkg/detectors/livestorm/livestorm.go b/pkg/detectors/livestorm/livestorm.go index 92e6afcdc88b..036c1e0b9682 100644 --- a/pkg/detectors/livestorm/livestorm.go +++ b/pkg/detectors/livestorm/livestorm.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/loadmill/loadmill.go b/pkg/detectors/loadmill/loadmill.go index b2a5dbb65ed4..8afaa1e2be1d 100644 --- a/pkg/detectors/loadmill/loadmill.go +++ b/pkg/detectors/loadmill/loadmill.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lob/lob.go b/pkg/detectors/lob/lob.go index 438fcc010ac5..7002a7138652 100644 --- a/pkg/detectors/lob/lob.go +++ b/pkg/detectors/lob/lob.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/locationiq/locationiq.go b/pkg/detectors/locationiq/locationiq.go index 5c96ecb73d5a..04e05b47fbf1 100644 --- a/pkg/detectors/locationiq/locationiq.go +++ b/pkg/detectors/locationiq/locationiq.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/loggly/loggly.go b/pkg/detectors/loggly/loggly.go index 4de7e41d6619..fb8ca7bcf439 100644 --- a/pkg/detectors/loggly/loggly.go +++ b/pkg/detectors/loggly/loggly.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range keyMatches { - if len(match) != 2 { - continue - } key := strings.TrimSpace(match[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } domainRes := strings.TrimSpace(domainMatch[1]) diff --git a/pkg/detectors/loginradius/loginradius.go b/pkg/detectors/loginradius/loginradius.go index 690b9f84d210..de8539551610 100644 --- a/pkg/detectors/loginradius/loginradius.go +++ b/pkg/detectors/loginradius/loginradius.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/logzio/logzio.go b/pkg/detectors/logzio/logzio.go index 58b8f4f472c6..1c1d3353913e 100644 --- a/pkg/detectors/logzio/logzio.go +++ b/pkg/detectors/logzio/logzio.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lokalisetoken/lokalisetoken.go b/pkg/detectors/lokalisetoken/lokalisetoken.go index 213890bdbbb8..5c69a7d4b69c 100644 --- a/pkg/detectors/lokalisetoken/lokalisetoken.go +++ b/pkg/detectors/lokalisetoken/lokalisetoken.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/loyverse/loyverse.go b/pkg/detectors/loyverse/loyverse.go index 2ec5076959b1..d5e64604acd9 100644 --- a/pkg/detectors/loyverse/loyverse.go +++ b/pkg/detectors/loyverse/loyverse.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lunchmoney/lunchmoney.go b/pkg/detectors/lunchmoney/lunchmoney.go index 44b4aa7ab254..a5c2231f6f07 100644 --- a/pkg/detectors/lunchmoney/lunchmoney.go +++ b/pkg/detectors/lunchmoney/lunchmoney.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/luno/luno.go b/pkg/detectors/luno/luno.go index 1282d3f16512..9344b0491044 100644 --- a/pkg/detectors/luno/luno.go +++ b/pkg/detectors/luno/luno.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/m3o/m3o.go b/pkg/detectors/m3o/m3o.go index 2ec5ca4c4773..ac68a1792620 100644 --- a/pkg/detectors/m3o/m3o.go +++ b/pkg/detectors/m3o/m3o.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/madkudu/madkudu.go b/pkg/detectors/madkudu/madkudu.go index 398514891283..295617562846 100644 --- a/pkg/detectors/madkudu/madkudu.go +++ b/pkg/detectors/madkudu/madkudu.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/magicbell/magicbell.go b/pkg/detectors/magicbell/magicbell.go index 2405445042de..39e3753e7d6c 100644 --- a/pkg/detectors/magicbell/magicbell.go +++ b/pkg/detectors/magicbell/magicbell.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, keyMatch := range apiKeyMatches { - if len(keyMatch) != 2 { - continue - } apiKeyRes := strings.TrimSpace(keyMatch[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } emailRes := strings.TrimSpace(emailMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/magnetic/magnetic.go b/pkg/detectors/magnetic/magnetic.go index d6b1f1ef7534..49d8d7d3cb79 100644 --- a/pkg/detectors/magnetic/magnetic.go +++ b/pkg/detectors/magnetic/magnetic.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailboxlayer/mailboxlayer.go b/pkg/detectors/mailboxlayer/mailboxlayer.go index dd4112b5b1cb..3eb0e77532b8 100644 --- a/pkg/detectors/mailboxlayer/mailboxlayer.go +++ b/pkg/detectors/mailboxlayer/mailboxlayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailerlite/mailerlite.go b/pkg/detectors/mailerlite/mailerlite.go index bf757bff5445..56b95f4c05f9 100644 --- a/pkg/detectors/mailerlite/mailerlite.go +++ b/pkg/detectors/mailerlite/mailerlite.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailgun/mailgun.go b/pkg/detectors/mailgun/mailgun.go index 3d0f9e30a1cb..186b54b3f0bd 100644 --- a/pkg/detectors/mailgun/mailgun.go +++ b/pkg/detectors/mailgun/mailgun.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, tokenPat := range tokenPats { matches := tokenPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go b/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go index 6eca7efb06af..1f87e4d80daf 100644 --- a/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go +++ b/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go @@ -3,10 +3,11 @@ package mailjetbasicauth import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailjetsms/mailjetsms.go b/pkg/detectors/mailjetsms/mailjetsms.go index 0118f2ff607e..8845ae26311e 100644 --- a/pkg/detectors/mailjetsms/mailjetsms.go +++ b/pkg/detectors/mailjetsms/mailjetsms.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailmodo/mailmodo.go b/pkg/detectors/mailmodo/mailmodo.go index 58291b02c895..c04bce506f83 100644 --- a/pkg/detectors/mailmodo/mailmodo.go +++ b/pkg/detectors/mailmodo/mailmodo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailsac/mailsac.go b/pkg/detectors/mailsac/mailsac.go index c758c173f2ca..efd32438d454 100644 --- a/pkg/detectors/mailsac/mailsac.go +++ b/pkg/detectors/mailsac/mailsac.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mandrill/mandrill.go b/pkg/detectors/mandrill/mandrill.go index df33889be648..b872ffcc8df8 100644 --- a/pkg/detectors/mandrill/mandrill.go +++ b/pkg/detectors/mandrill/mandrill.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/manifest/manifest.go b/pkg/detectors/manifest/manifest.go index 6a11688a5af5..927319e5e2c2 100644 --- a/pkg/detectors/manifest/manifest.go +++ b/pkg/detectors/manifest/manifest.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mapbox/mapbox.go b/pkg/detectors/mapbox/mapbox.go index 8c5a7153f5b2..ac87a8045e8d 100644 --- a/pkg/detectors/mapbox/mapbox.go +++ b/pkg/detectors/mapbox/mapbox.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result resMatch := strings.TrimSpace(match[1]) for i, idMatch := range idMatches { if i == 11 { - if len(idMatch) != 2 { - continue - } resId := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mapquest/mapquest.go b/pkg/detectors/mapquest/mapquest.go index 78807166f4c2..8b8c4dbad46a 100644 --- a/pkg/detectors/mapquest/mapquest.go +++ b/pkg/detectors/mapquest/mapquest.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/marketstack/marketstack.go b/pkg/detectors/marketstack/marketstack.go index 903f750bfdb8..e7a4ae2fdd6c 100644 --- a/pkg/detectors/marketstack/marketstack.go +++ b/pkg/detectors/marketstack/marketstack.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go b/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go index 31b72e7d3b3c..f912e951a08b 100644 --- a/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go +++ b/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go @@ -3,10 +3,11 @@ package mattermostpersonaltoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result serverMatches := serverPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, serverMatch := range serverMatches { - if len(serverMatch) != 2 { - continue - } serverRes := strings.TrimSpace(serverMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mavenlink/mavenlink.go b/pkg/detectors/mavenlink/mavenlink.go index b6f6296f2caf..cbae29d0a682 100644 --- a/pkg/detectors/mavenlink/mavenlink.go +++ b/pkg/detectors/mavenlink/mavenlink.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/maxmindlicense/v1/maxmindlicense.go b/pkg/detectors/maxmindlicense/v1/maxmindlicense.go index de0e73dff7cb..0a6de4687049 100644 --- a/pkg/detectors/maxmindlicense/v1/maxmindlicense.go +++ b/pkg/detectors/maxmindlicense/v1/maxmindlicense.go @@ -46,9 +46,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyRes := strings.TrimSpace(keyMatch[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } idRes := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/meaningcloud/meaningcloud.go b/pkg/detectors/meaningcloud/meaningcloud.go index 50ce02f65b38..0089aa48a2a3 100644 --- a/pkg/detectors/meaningcloud/meaningcloud.go +++ b/pkg/detectors/meaningcloud/meaningcloud.go @@ -44,9 +44,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mediastack/mediastack.go b/pkg/detectors/mediastack/mediastack.go index d8116e0e4b2e..c4846782eb98 100644 --- a/pkg/detectors/mediastack/mediastack.go +++ b/pkg/detectors/mediastack/mediastack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/meistertask/meistertask.go b/pkg/detectors/meistertask/meistertask.go index 205ac3b03ed2..12f0d73f5495 100644 --- a/pkg/detectors/meistertask/meistertask.go +++ b/pkg/detectors/meistertask/meistertask.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mesibo/mesibo.go b/pkg/detectors/mesibo/mesibo.go index e2daed88492a..84daf381ca1a 100644 --- a/pkg/detectors/mesibo/mesibo.go +++ b/pkg/detectors/mesibo/mesibo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/messagebird/messagebird.go b/pkg/detectors/messagebird/messagebird.go index 5bc2f84857ef..88d9c2dd5676 100644 --- a/pkg/detectors/messagebird/messagebird.go +++ b/pkg/detectors/messagebird/messagebird.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/metaapi/metaapi.go b/pkg/detectors/metaapi/metaapi.go index 3f7ee1ade630..98830df571d2 100644 --- a/pkg/detectors/metaapi/metaapi.go +++ b/pkg/detectors/metaapi/metaapi.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result spellMatches := spellPat.FindAllStringSubmatch(dataStr, -1) for _, spellMatch := range spellMatches { - if len(spellMatch) != 2 { - continue - } resSpellMatch := strings.TrimSpace(spellMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/metabase/metabase.go b/pkg/detectors/metabase/metabase.go index 66fd9dc9a1b7..001c4a170fe2 100644 --- a/pkg/detectors/metabase/metabase.go +++ b/pkg/detectors/metabase/metabase.go @@ -43,15 +43,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := baseURL.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURLMatch := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/metrilo/metrilo.go b/pkg/detectors/metrilo/metrilo.go index cee0e2bc47c9..90e3cc4f1e11 100644 --- a/pkg/detectors/metrilo/metrilo.go +++ b/pkg/detectors/metrilo/metrilo.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go b/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go index 446da7a8157d..53972fc0a62f 100644 --- a/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go +++ b/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go @@ -43,9 +43,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mindmeister/mindmeister.go b/pkg/detectors/mindmeister/mindmeister.go index f11ed882f5e7..7d98611ac637 100644 --- a/pkg/detectors/mindmeister/mindmeister.go +++ b/pkg/detectors/mindmeister/mindmeister.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/miro/miro.go b/pkg/detectors/miro/miro.go index 3e5bd2cfbc01..a6998b35861f 100644 --- a/pkg/detectors/miro/miro.go +++ b/pkg/detectors/miro/miro.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mite/mite.go b/pkg/detectors/mite/mite.go index 9d98c76a67b0..2ffa912b144b 100644 --- a/pkg/detectors/mite/mite.go +++ b/pkg/detectors/mite/mite.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mixmax/mixmax.go b/pkg/detectors/mixmax/mixmax.go index 9bc4d62283dd..843a3d837ddf 100644 --- a/pkg/detectors/mixmax/mixmax.go +++ b/pkg/detectors/mixmax/mixmax.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mixpanel/mixpanel.go b/pkg/detectors/mixpanel/mixpanel.go index b346090bf71c..5b6e76459f5c 100644 --- a/pkg/detectors/mixpanel/mixpanel.go +++ b/pkg/detectors/mixpanel/mixpanel.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/mockaroo/mockaroo.go b/pkg/detectors/mockaroo/mockaroo.go index 0fe00c1b1765..509260f7c556 100644 --- a/pkg/detectors/mockaroo/mockaroo.go +++ b/pkg/detectors/mockaroo/mockaroo.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/moderation/moderation.go b/pkg/detectors/moderation/moderation.go index 726489944174..08a1e26a854f 100644 --- a/pkg/detectors/moderation/moderation.go +++ b/pkg/detectors/moderation/moderation.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/monday/monday.go b/pkg/detectors/monday/monday.go index 55e649140ccc..3296e62df5b8 100644 --- a/pkg/detectors/monday/monday.go +++ b/pkg/detectors/monday/monday.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/monkeylearn/monkeylearn.go b/pkg/detectors/monkeylearn/monkeylearn.go index 773fc7f48217..4403046ccb28 100644 --- a/pkg/detectors/monkeylearn/monkeylearn.go +++ b/pkg/detectors/monkeylearn/monkeylearn.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/moonclerk/moonclerk.go b/pkg/detectors/moonclerk/moonclerk.go index 083f3bc2f127..33462379c8e3 100644 --- a/pkg/detectors/moonclerk/moonclerk.go +++ b/pkg/detectors/moonclerk/moonclerk.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/moosend/moosend.go b/pkg/detectors/moosend/moosend.go index cbbb7079499a..f9779632be25 100644 --- a/pkg/detectors/moosend/moosend.go +++ b/pkg/detectors/moosend/moosend.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/moralis/moralis.go b/pkg/detectors/moralis/moralis.go index 59a647ff7cb8..1ff2de16af2f 100644 --- a/pkg/detectors/moralis/moralis.go +++ b/pkg/detectors/moralis/moralis.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mrticktock/mrticktock.go b/pkg/detectors/mrticktock/mrticktock.go index d88b0c222009..7ed9cffaf0a8 100644 --- a/pkg/detectors/mrticktock/mrticktock.go +++ b/pkg/detectors/mrticktock/mrticktock.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passwordMatches := pwordPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, passwordMatch := range passwordMatches { - if len(passwordMatch) != 2 { - continue - } resPassword := strings.TrimSpace(passwordMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mux/mux.go b/pkg/detectors/mux/mux.go index 80febdaef5a4..2015a83013d4 100644 --- a/pkg/detectors/mux/mux.go +++ b/pkg/detectors/mux/mux.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/myfreshworks/myfreshworks.go b/pkg/detectors/myfreshworks/myfreshworks.go index 4d1c76682834..a0713bcf7637 100644 --- a/pkg/detectors/myfreshworks/myfreshworks.go +++ b/pkg/detectors/myfreshworks/myfreshworks.go @@ -43,14 +43,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/myintervals/myintervals.go b/pkg/detectors/myintervals/myintervals.go index 2bac40d341ad..7860fbae4513 100644 --- a/pkg/detectors/myintervals/myintervals.go +++ b/pkg/detectors/myintervals/myintervals.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go b/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go index 877373e90348..bfcb8df2f483 100644 --- a/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go +++ b/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nethunt/nethunt.go b/pkg/detectors/nethunt/nethunt.go index e5c026e0bf2d..fbb8174ea536 100644 --- a/pkg/detectors/nethunt/nethunt.go +++ b/pkg/detectors/nethunt/nethunt.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/netlify/netlify.go b/pkg/detectors/netlify/netlify.go index fdfde21aba98..f25a639b705b 100644 --- a/pkg/detectors/netlify/netlify.go +++ b/pkg/detectors/netlify/netlify.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/neutrinoapi/neutrinoapi.go b/pkg/detectors/neutrinoapi/neutrinoapi.go index 9da7d71ccbd2..2998c21ae413 100644 --- a/pkg/detectors/neutrinoapi/neutrinoapi.go +++ b/pkg/detectors/neutrinoapi/neutrinoapi.go @@ -44,15 +44,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go b/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go index c5e7025451d8..1f48435d0b3e 100644 --- a/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go +++ b/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go @@ -2,10 +2,11 @@ package newrelicpersonalapikey import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/newsapi/newsapi.go b/pkg/detectors/newsapi/newsapi.go index 1864376b7c23..36f4a13edb8c 100644 --- a/pkg/detectors/newsapi/newsapi.go +++ b/pkg/detectors/newsapi/newsapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/newscatcher/newscatcher.go b/pkg/detectors/newscatcher/newscatcher.go index ccddc5b9cf4f..c7252b8fa9db 100644 --- a/pkg/detectors/newscatcher/newscatcher.go +++ b/pkg/detectors/newscatcher/newscatcher.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nexmoapikey/nexmoapikey.go b/pkg/detectors/nexmoapikey/nexmoapikey.go index 1ea684d089ff..b54ee4301f5c 100644 --- a/pkg/detectors/nexmoapikey/nexmoapikey.go +++ b/pkg/detectors/nexmoapikey/nexmoapikey.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretPat := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretPat { - if len(match) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nftport/nftport.go b/pkg/detectors/nftport/nftport.go index 820392cd47fb..0396f81076ee 100644 --- a/pkg/detectors/nftport/nftport.go +++ b/pkg/detectors/nftport/nftport.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ngc/ngc.go b/pkg/detectors/ngc/ngc.go index acfb22a6282a..875abc87d9df 100644 --- a/pkg/detectors/ngc/ngc.go +++ b/pkg/detectors/ngc/ngc.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat1.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) decode, _ := base64.StdEncoding.DecodeString(resMatch) diff --git a/pkg/detectors/ngrok/ngrok.go b/pkg/detectors/ngrok/ngrok.go index 752882daa418..68ea826e7d8c 100644 --- a/pkg/detectors/ngrok/ngrok.go +++ b/pkg/detectors/ngrok/ngrok.go @@ -34,9 +34,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nicereply/nicereply.go b/pkg/detectors/nicereply/nicereply.go index 12bb87cb7c69..6c37034f1fd7 100644 --- a/pkg/detectors/nicereply/nicereply.go +++ b/pkg/detectors/nicereply/nicereply.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nightfall/nightfall.go b/pkg/detectors/nightfall/nightfall.go index 3fc22196e1a3..f1b104a9a989 100644 --- a/pkg/detectors/nightfall/nightfall.go +++ b/pkg/detectors/nightfall/nightfall.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nimble/nimble.go b/pkg/detectors/nimble/nimble.go index dab1a194acb7..4d1c4784a33e 100644 --- a/pkg/detectors/nimble/nimble.go +++ b/pkg/detectors/nimble/nimble.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/noticeable/noticeable.go b/pkg/detectors/noticeable/noticeable.go index 52aa4ab6bb66..68d4134b1e91 100644 --- a/pkg/detectors/noticeable/noticeable.go +++ b/pkg/detectors/noticeable/noticeable.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/notion/notion.go b/pkg/detectors/notion/notion.go index dea8a9ea231f..9d79bba9eef2 100644 --- a/pkg/detectors/notion/notion.go +++ b/pkg/detectors/notion/notion.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Notion, diff --git a/pkg/detectors/nozbeteams/nozbeteams.go b/pkg/detectors/nozbeteams/nozbeteams.go index a5d85f37680d..3b2278d60dff 100644 --- a/pkg/detectors/nozbeteams/nozbeteams.go +++ b/pkg/detectors/nozbeteams/nozbeteams.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/npmtoken/npmtoken.go b/pkg/detectors/npmtoken/npmtoken.go index 73a0f9800ccc..87b5c78ef8bb 100644 --- a/pkg/detectors/npmtoken/npmtoken.go +++ b/pkg/detectors/npmtoken/npmtoken.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/npmtokenv2/npmtokenv2.go b/pkg/detectors/npmtokenv2/npmtokenv2.go index 15d54ba66606..84ea6c94457e 100644 --- a/pkg/detectors/npmtokenv2/npmtokenv2.go +++ b/pkg/detectors/npmtokenv2/npmtokenv2.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := match[1] s1 := detectors.Result{ diff --git a/pkg/detectors/nugetapikey/nugetapikey.go b/pkg/detectors/nugetapikey/nugetapikey.go index 4a7c6af99eab..63cd05f38d23 100644 --- a/pkg/detectors/nugetapikey/nugetapikey.go +++ b/pkg/detectors/nugetapikey/nugetapikey.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/numverify/numverify.go b/pkg/detectors/numverify/numverify.go index 420668491d1f..9ae299c78672 100644 --- a/pkg/detectors/numverify/numverify.go +++ b/pkg/detectors/numverify/numverify.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Numverify, diff --git a/pkg/detectors/nutritionix/nutritionix.go b/pkg/detectors/nutritionix/nutritionix.go index a22ca99a68c2..ae849b5394ce 100644 --- a/pkg/detectors/nutritionix/nutritionix.go +++ b/pkg/detectors/nutritionix/nutritionix.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/nylas/nylas.go b/pkg/detectors/nylas/nylas.go index c05e53460488..7e0d59e7a79e 100644 --- a/pkg/detectors/nylas/nylas.go +++ b/pkg/detectors/nylas/nylas.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/oanda/oanda.go b/pkg/detectors/oanda/oanda.go index de31ae0c0e5d..ffab5baa761d 100644 --- a/pkg/detectors/oanda/oanda.go +++ b/pkg/detectors/oanda/oanda.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/omnisend/omnisend.go b/pkg/detectors/omnisend/omnisend.go index c058f07b74ac..73e90192bb16 100644 --- a/pkg/detectors/omnisend/omnisend.go +++ b/pkg/detectors/omnisend/omnisend.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/onedesk/onedesk.go b/pkg/detectors/onedesk/onedesk.go index 597f16694e36..6bd09aa80181 100644 --- a/pkg/detectors/onedesk/onedesk.go +++ b/pkg/detectors/onedesk/onedesk.go @@ -43,14 +43,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result pwordMatches := pwordPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, pwordMatch := range pwordMatches { - if len(pwordMatch) != 2 { - continue - } resPword := strings.TrimSpace(pwordMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/onelogin/onelogin.go b/pkg/detectors/onelogin/onelogin.go index 16ff03093788..554e51c12fb8 100644 --- a/pkg/detectors/onelogin/onelogin.go +++ b/pkg/detectors/onelogin/onelogin.go @@ -41,13 +41,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) for _, clientID := range oauthClientIDPat.FindAllStringSubmatch(dataStr, -1) { - if len(clientID) != 2 { - continue - } for _, clientSecret := range oauthClientSecretPat.FindAllStringSubmatch(dataStr, -1) { - if len(clientSecret) != 2 { - continue - } s := detectors.Result{ DetectorType: detectorspb.DetectorType_OneLogin, diff --git a/pkg/detectors/onepagecrm/onepagecrm.go b/pkg/detectors/onepagecrm/onepagecrm.go index fe21cbf508ba..91e07314dcb3 100644 --- a/pkg/detectors/onepagecrm/onepagecrm.go +++ b/pkg/detectors/onepagecrm/onepagecrm.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/onesignal/onesignal.go b/pkg/detectors/onesignal/onesignal.go index 1829a2188c10..057f09edf865 100644 --- a/pkg/detectors/onesignal/onesignal.go +++ b/pkg/detectors/onesignal/onesignal.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/onwaterio/onwaterio.go b/pkg/detectors/onwaterio/onwaterio.go index 725451a459f4..618f0a19dfea 100644 --- a/pkg/detectors/onwaterio/onwaterio.go +++ b/pkg/detectors/onwaterio/onwaterio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/oopspam/oopspam.go b/pkg/detectors/oopspam/oopspam.go index 0199c2b46d53..00385f248462 100644 --- a/pkg/detectors/oopspam/oopspam.go +++ b/pkg/detectors/oopspam/oopspam.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/opencagedata/opencagedata.go b/pkg/detectors/opencagedata/opencagedata.go index 9b21e81e8f74..10a44e986a0c 100644 --- a/pkg/detectors/opencagedata/opencagedata.go +++ b/pkg/detectors/opencagedata/opencagedata.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/openuv/openuv.go b/pkg/detectors/openuv/openuv.go index 1a9f4bb8f2aa..58f9f6d341fc 100644 --- a/pkg/detectors/openuv/openuv.go +++ b/pkg/detectors/openuv/openuv.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/openweather/openweather.go b/pkg/detectors/openweather/openweather.go index 747a373191a2..9702983985f1 100644 --- a/pkg/detectors/openweather/openweather.go +++ b/pkg/detectors/openweather/openweather.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/opsgenie/opsgenie.go b/pkg/detectors/opsgenie/opsgenie.go index 5f2938c13d94..f0b85293d8d5 100644 --- a/pkg/detectors/opsgenie/opsgenie.go +++ b/pkg/detectors/opsgenie/opsgenie.go @@ -43,9 +43,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/optimizely/optimizely.go b/pkg/detectors/optimizely/optimizely.go index f3a90e2b3a98..014b4e252dfa 100644 --- a/pkg/detectors/optimizely/optimizely.go +++ b/pkg/detectors/optimizely/optimizely.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/overloop/overloop.go b/pkg/detectors/overloop/overloop.go index 61310545c034..2a38895f4907 100644 --- a/pkg/detectors/overloop/overloop.go +++ b/pkg/detectors/overloop/overloop.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/owlbot/owlbot.go b/pkg/detectors/owlbot/owlbot.go index d8ca5fea1c09..7b68828af724 100644 --- a/pkg/detectors/owlbot/owlbot.go +++ b/pkg/detectors/owlbot/owlbot.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/packagecloud/packagecloud.go b/pkg/detectors/packagecloud/packagecloud.go index f7ec0ffb05ba..0eb9e71c30f0 100644 --- a/pkg/detectors/packagecloud/packagecloud.go +++ b/pkg/detectors/packagecloud/packagecloud.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go b/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go index 815641c7acec..8acd8f16d06c 100644 --- a/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go +++ b/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go @@ -3,10 +3,11 @@ package pagerdutyapikey import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pandadoc/pandadoc.go b/pkg/detectors/pandadoc/pandadoc.go index 2c8a579c64c2..12aec603e5e6 100644 --- a/pkg/detectors/pandadoc/pandadoc.go +++ b/pkg/detectors/pandadoc/pandadoc.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pandascore/pandascore.go b/pkg/detectors/pandascore/pandascore.go index 23e54577e817..0988e9295f74 100644 --- a/pkg/detectors/pandascore/pandascore.go +++ b/pkg/detectors/pandascore/pandascore.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paperform/paperform.go b/pkg/detectors/paperform/paperform.go index 06e364a5c328..0120aa1d1b6d 100644 --- a/pkg/detectors/paperform/paperform.go +++ b/pkg/detectors/paperform/paperform.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paralleldots/paralleldots.go b/pkg/detectors/paralleldots/paralleldots.go index 1af81ee282af..738b6df21414 100644 --- a/pkg/detectors/paralleldots/paralleldots.go +++ b/pkg/detectors/paralleldots/paralleldots.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/parsehub/parsehub.go b/pkg/detectors/parsehub/parsehub.go index 7da8861ae136..f0d9db845c25 100644 --- a/pkg/detectors/parsehub/parsehub.go +++ b/pkg/detectors/parsehub/parsehub.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/parsers/parsers.go b/pkg/detectors/parsers/parsers.go index 3114283418cf..8dbf9ca71ecf 100644 --- a/pkg/detectors/parsers/parsers.go +++ b/pkg/detectors/parsers/parsers.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/parseur/parseur.go b/pkg/detectors/parseur/parseur.go index f0e7dce37122..c73f731cea22 100644 --- a/pkg/detectors/parseur/parseur.go +++ b/pkg/detectors/parseur/parseur.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/partnerstack/partnerstack.go b/pkg/detectors/partnerstack/partnerstack.go index a0a81cc0be99..f8e1f30f9ed5 100644 --- a/pkg/detectors/partnerstack/partnerstack.go +++ b/pkg/detectors/partnerstack/partnerstack.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pastebin/pastebin.go b/pkg/detectors/pastebin/pastebin.go index 7e1abaaced38..657aac0eaec3 100644 --- a/pkg/detectors/pastebin/pastebin.go +++ b/pkg/detectors/pastebin/pastebin.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paydirtapp/paydirtapp.go b/pkg/detectors/paydirtapp/paydirtapp.go index d74acd9d2b4d..4f88a76a3b0e 100644 --- a/pkg/detectors/paydirtapp/paydirtapp.go +++ b/pkg/detectors/paydirtapp/paydirtapp.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paymoapp/paymoapp.go b/pkg/detectors/paymoapp/paymoapp.go index 13a9f4b413d5..eb19cbec6cf3 100644 --- a/pkg/detectors/paymoapp/paymoapp.go +++ b/pkg/detectors/paymoapp/paymoapp.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paymongo/paymongo.go b/pkg/detectors/paymongo/paymongo.go index ee3d555fc295..b87fbc2a581c 100644 --- a/pkg/detectors/paymongo/paymongo.go +++ b/pkg/detectors/paymongo/paymongo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paypaloauth/paypaloauth.go b/pkg/detectors/paypaloauth/paypaloauth.go index d656f86064ec..2275c4d32471 100644 --- a/pkg/detectors/paypaloauth/paypaloauth.go +++ b/pkg/detectors/paypaloauth/paypaloauth.go @@ -42,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idmatches { - if len(idMatch) != 2 { - continue - } resIDMatch := strings.TrimSpace(idMatch[1]) for _, secretMatch := range matches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paystack/paystack.go b/pkg/detectors/paystack/paystack.go index f7ee3c37da97..c03f4c1fd4fa 100644 --- a/pkg/detectors/paystack/paystack.go +++ b/pkg/detectors/paystack/paystack.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pdflayer/pdflayer.go b/pkg/detectors/pdflayer/pdflayer.go index e83d98957ec5..bae3d47b69bd 100644 --- a/pkg/detectors/pdflayer/pdflayer.go +++ b/pkg/detectors/pdflayer/pdflayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pdfshift/pdfshift.go b/pkg/detectors/pdfshift/pdfshift.go index 9b480bcad279..aa74f81f9022 100644 --- a/pkg/detectors/pdfshift/pdfshift.go +++ b/pkg/detectors/pdfshift/pdfshift.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/peopledatalabs/peopledatalabs.go b/pkg/detectors/peopledatalabs/peopledatalabs.go index bb406e373a2c..a4bfc66639d7 100644 --- a/pkg/detectors/peopledatalabs/peopledatalabs.go +++ b/pkg/detectors/peopledatalabs/peopledatalabs.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pepipost/pepipost.go b/pkg/detectors/pepipost/pepipost.go index 7a62e68045c0..5e51c49fb0be 100644 --- a/pkg/detectors/pepipost/pepipost.go +++ b/pkg/detectors/pepipost/pepipost.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/percy/percy.go b/pkg/detectors/percy/percy.go index ca6e64ae757a..33444a736493 100644 --- a/pkg/detectors/percy/percy.go +++ b/pkg/detectors/percy/percy.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pinata/pinata.go b/pkg/detectors/pinata/pinata.go index 7a4865d650e8..558a91b5013b 100644 --- a/pkg/detectors/pinata/pinata.go +++ b/pkg/detectors/pinata/pinata.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pipedream/pipedream.go b/pkg/detectors/pipedream/pipedream.go index ea0d4d8aaa9d..e61ec3a126e7 100644 --- a/pkg/detectors/pipedream/pipedream.go +++ b/pkg/detectors/pipedream/pipedream.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pipedrive/pipedrive.go b/pkg/detectors/pipedrive/pipedrive.go index 09ef200ba92e..593579ffc734 100644 --- a/pkg/detectors/pipedrive/pipedrive.go +++ b/pkg/detectors/pipedrive/pipedrive.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pivotaltracker/pivotaltracker.go b/pkg/detectors/pivotaltracker/pivotaltracker.go index d0e37ce4f187..172ebc25499c 100644 --- a/pkg/detectors/pivotaltracker/pivotaltracker.go +++ b/pkg/detectors/pivotaltracker/pivotaltracker.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, match := range matches { // First match is entire regex, second is the first group. - if len(match) != 2 { - continue - } token := match[1] diff --git a/pkg/detectors/pixabay/pixabay.go b/pkg/detectors/pixabay/pixabay.go index df09f2f05b74..1d653a44ffed 100644 --- a/pkg/detectors/pixabay/pixabay.go +++ b/pkg/detectors/pixabay/pixabay.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/plaidkey/plaidkey.go b/pkg/detectors/plaidkey/plaidkey.go index c94ff26a7577..5d62a5b7d697 100644 --- a/pkg/detectors/plaidkey/plaidkey.go +++ b/pkg/detectors/plaidkey/plaidkey.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } idresMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/planviewleankit/planviewleankit.go b/pkg/detectors/planviewleankit/planviewleankit.go index f4547dc19a90..ec776f905763 100644 --- a/pkg/detectors/planviewleankit/planviewleankit.go +++ b/pkg/detectors/planviewleankit/planviewleankit.go @@ -3,10 +3,11 @@ package planviewleankit import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result subdomainMatches := subDomainPat.FindAllStringSubmatch(dataStr, -1) for _, subdomainMatch := range subdomainMatches { - if len(subdomainMatch) != 2 { - continue - } resSubdomainMatch := strings.TrimSpace(subdomainMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/planyo/planyo.go b/pkg/detectors/planyo/planyo.go index e5a33be83c59..89c23d0597b7 100644 --- a/pkg/detectors/planyo/planyo.go +++ b/pkg/detectors/planyo/planyo.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/plivo/plivo.go b/pkg/detectors/plivo/plivo.go index 81fdfde55082..f2c756244239 100644 --- a/pkg/detectors/plivo/plivo.go +++ b/pkg/detectors/plivo/plivo.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } id := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/podio/podio.go b/pkg/detectors/podio/podio.go index 3978c4266cb3..e43e53cf90e3 100644 --- a/pkg/detectors/podio/podio.go +++ b/pkg/detectors/podio/podio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pollsapi/pollsapi.go b/pkg/detectors/pollsapi/pollsapi.go index 562f734821f0..fb7ab2186c34 100644 --- a/pkg/detectors/pollsapi/pollsapi.go +++ b/pkg/detectors/pollsapi/pollsapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/poloniex/poloniex.go b/pkg/detectors/poloniex/poloniex.go index 2514c92ad89a..e3dd5440c0a9 100644 --- a/pkg/detectors/poloniex/poloniex.go +++ b/pkg/detectors/poloniex/poloniex.go @@ -46,15 +46,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/polygon/polygon.go b/pkg/detectors/polygon/polygon.go index d3da6a4ce06f..4dd6a587f273 100644 --- a/pkg/detectors/polygon/polygon.go +++ b/pkg/detectors/polygon/polygon.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/portainer/portainer.go b/pkg/detectors/portainer/portainer.go index aee0be138707..a4d98b2207bf 100644 --- a/pkg/detectors/portainer/portainer.go +++ b/pkg/detectors/portainer/portainer.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result endpointMatches := endpointPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, endpointMatch := range endpointMatches { diff --git a/pkg/detectors/portainertoken/portainertoken.go b/pkg/detectors/portainertoken/portainertoken.go index 54ad63c1d6c7..c1e814457ecd 100644 --- a/pkg/detectors/portainertoken/portainertoken.go +++ b/pkg/detectors/portainertoken/portainertoken.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result endpointMatches := endpointPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, endpointMatch := range endpointMatches { diff --git a/pkg/detectors/positionstack/positionstack.go b/pkg/detectors/positionstack/positionstack.go index 7001be4516a9..e46dd2c70da4 100644 --- a/pkg/detectors/positionstack/positionstack.go +++ b/pkg/detectors/positionstack/positionstack.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/postageapp/postageapp.go b/pkg/detectors/postageapp/postageapp.go index 3f119e824d04..11f56f83c845 100644 --- a/pkg/detectors/postageapp/postageapp.go +++ b/pkg/detectors/postageapp/postageapp.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/postbacks/postbacks.go b/pkg/detectors/postbacks/postbacks.go index 8c4c00f22903..afa39c06bc74 100644 --- a/pkg/detectors/postbacks/postbacks.go +++ b/pkg/detectors/postbacks/postbacks.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/posthog/posthog.go b/pkg/detectors/posthog/posthog.go index ca47572c478e..6dbbf43ba8c3 100644 --- a/pkg/detectors/posthog/posthog.go +++ b/pkg/detectors/posthog/posthog.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/postman/postman.go b/pkg/detectors/postman/postman.go index bc25323f4f60..e24c541bfca0 100644 --- a/pkg/detectors/postman/postman.go +++ b/pkg/detectors/postman/postman.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/postmark/postmark.go b/pkg/detectors/postmark/postmark.go index 1ffe18df0707..a12dda902784 100644 --- a/pkg/detectors/postmark/postmark.go +++ b/pkg/detectors/postmark/postmark.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/powrbot/powrbot.go b/pkg/detectors/powrbot/powrbot.go index 16b7790fd9a2..8941ee5860a9 100644 --- a/pkg/detectors/powrbot/powrbot.go +++ b/pkg/detectors/powrbot/powrbot.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/prefect/prefect.go b/pkg/detectors/prefect/prefect.go index c9d6dc0a215a..1f31d335ecca 100644 --- a/pkg/detectors/prefect/prefect.go +++ b/pkg/detectors/prefect/prefect.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/privacy/privacy.go b/pkg/detectors/privacy/privacy.go index f85a3ad6215d..fb520a18e4e9 100644 --- a/pkg/detectors/privacy/privacy.go +++ b/pkg/detectors/privacy/privacy.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/prodpad/prodpad.go b/pkg/detectors/prodpad/prodpad.go index 384ff3e21627..e159109cf4d9 100644 --- a/pkg/detectors/prodpad/prodpad.go +++ b/pkg/detectors/prodpad/prodpad.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/prospectcrm/prospectcrm.go b/pkg/detectors/prospectcrm/prospectcrm.go index c82cba508db1..e3103afa2e15 100644 --- a/pkg/detectors/prospectcrm/prospectcrm.go +++ b/pkg/detectors/prospectcrm/prospectcrm.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/protocolsio/protocolsio.go b/pkg/detectors/protocolsio/protocolsio.go index 4ffa176e8209..2c4a264209f1 100644 --- a/pkg/detectors/protocolsio/protocolsio.go +++ b/pkg/detectors/protocolsio/protocolsio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/proxycrawl/proxycrawl.go b/pkg/detectors/proxycrawl/proxycrawl.go index 86b56ebb2f77..4e6b79b66ee5 100644 --- a/pkg/detectors/proxycrawl/proxycrawl.go +++ b/pkg/detectors/proxycrawl/proxycrawl.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go b/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go index 0c10b6aaf561..e457306776fa 100644 --- a/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go +++ b/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go @@ -3,10 +3,11 @@ package pubnubpublishkey import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -42,15 +43,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result subMatches := subPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, subMatch := range subMatches { - if len(subMatch) != 2 { - continue - } ressubMatch := strings.TrimSpace(subMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go b/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go index f5017000f515..6926b1b4f0e0 100644 --- a/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go +++ b/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go @@ -2,10 +2,11 @@ package pubnubsubscriptionkey import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pulumi/pulumi.go b/pkg/detectors/pulumi/pulumi.go index 27ce74f789a6..9a0fd78e45fb 100644 --- a/pkg/detectors/pulumi/pulumi.go +++ b/pkg/detectors/pulumi/pulumi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/purestake/purestake.go b/pkg/detectors/purestake/purestake.go index 831fa5b18880..be35e92daf8e 100644 --- a/pkg/detectors/purestake/purestake.go +++ b/pkg/detectors/purestake/purestake.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pushbulletapikey/pushbulletapikey.go b/pkg/detectors/pushbulletapikey/pushbulletapikey.go index 715c6c49f193..d3d515f5e47e 100644 --- a/pkg/detectors/pushbulletapikey/pushbulletapikey.go +++ b/pkg/detectors/pushbulletapikey/pushbulletapikey.go @@ -2,10 +2,11 @@ package pushbulletapikey import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pusherchannelkey/pusherchannelkey.go b/pkg/detectors/pusherchannelkey/pusherchannelkey.go index d5bed66668f5..a284f0b36174 100644 --- a/pkg/detectors/pusherchannelkey/pusherchannelkey.go +++ b/pkg/detectors/pusherchannelkey/pusherchannelkey.go @@ -54,21 +54,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, appMatch := range appMatches { - if len(appMatch) != 2 { - continue - } resappMatch := strings.TrimSpace(appMatch[1]) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } reskeyMatch := strings.TrimSpace(keyMatch[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } ressecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/qase/qase.go b/pkg/detectors/qase/qase.go index d4eaf50df157..90008e2cc928 100644 --- a/pkg/detectors/qase/qase.go +++ b/pkg/detectors/qase/qase.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/qualaroo/qualaroo.go b/pkg/detectors/qualaroo/qualaroo.go index 2a5341d34adb..8a8d746b68f6 100644 --- a/pkg/detectors/qualaroo/qualaroo.go +++ b/pkg/detectors/qualaroo/qualaroo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/qubole/qubole.go b/pkg/detectors/qubole/qubole.go index 39932a72a255..d9e433c6b08c 100644 --- a/pkg/detectors/qubole/qubole.go +++ b/pkg/detectors/qubole/qubole.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ramp/ramp.go b/pkg/detectors/ramp/ramp.go index 9100c880b9a9..92757e9366ee 100644 --- a/pkg/detectors/ramp/ramp.go +++ b/pkg/detectors/ramp/ramp.go @@ -3,11 +3,12 @@ package ramp import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "net/url" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -42,16 +43,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } - resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) diff --git a/pkg/detectors/rapidapi/rapidapi.go b/pkg/detectors/rapidapi/rapidapi.go index 38ee1791d822..87b58d074a32 100644 --- a/pkg/detectors/rapidapi/rapidapi.go +++ b/pkg/detectors/rapidapi/rapidapi.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/raven/raven.go b/pkg/detectors/raven/raven.go index 92bce8be0e21..383ce5fa4e1b 100644 --- a/pkg/detectors/raven/raven.go +++ b/pkg/detectors/raven/raven.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rawg/rawg.go b/pkg/detectors/rawg/rawg.go index 464e0eca0261..9285f984f648 100644 --- a/pkg/detectors/rawg/rawg.go +++ b/pkg/detectors/rawg/rawg.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/reachmail/reachmail.go b/pkg/detectors/reachmail/reachmail.go index 7756c5099baa..b5bfb61bd514 100644 --- a/pkg/detectors/reachmail/reachmail.go +++ b/pkg/detectors/reachmail/reachmail.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/readme/readme.go b/pkg/detectors/readme/readme.go index ecb4826f5950..d762e4ccda0e 100644 --- a/pkg/detectors/readme/readme.go +++ b/pkg/detectors/readme/readme.go @@ -34,9 +34,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/reallysimplesystems/reallysimplesystems.go b/pkg/detectors/reallysimplesystems/reallysimplesystems.go index a8eb0cbe7233..a47d9ca2c32d 100644 --- a/pkg/detectors/reallysimplesystems/reallysimplesystems.go +++ b/pkg/detectors/reallysimplesystems/reallysimplesystems.go @@ -4,11 +4,12 @@ import ( "context" "encoding/json" "fmt" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rebrandly/rebrandly.go b/pkg/detectors/rebrandly/rebrandly.go index 16057153ba3c..073d5a9fe756 100644 --- a/pkg/detectors/rebrandly/rebrandly.go +++ b/pkg/detectors/rebrandly/rebrandly.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/refiner/refiner.go b/pkg/detectors/refiner/refiner.go index 924fc000b0d0..13a98c57a577 100644 --- a/pkg/detectors/refiner/refiner.go +++ b/pkg/detectors/refiner/refiner.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rentman/rentman.go b/pkg/detectors/rentman/rentman.go index d7f23577feb1..798f352b50dd 100644 --- a/pkg/detectors/rentman/rentman.go +++ b/pkg/detectors/rentman/rentman.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/repairshopr/repairshopr.go b/pkg/detectors/repairshopr/repairshopr.go index 47976fa9d418..3c675c83e12e 100644 --- a/pkg/detectors/repairshopr/repairshopr.go +++ b/pkg/detectors/repairshopr/repairshopr.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, domainmatch := range domainMatches { - if len(match) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Repairshopr, diff --git a/pkg/detectors/replicate/replicate.go b/pkg/detectors/replicate/replicate.go index 229083ef562a..4af6b258caf4 100644 --- a/pkg/detectors/replicate/replicate.go +++ b/pkg/detectors/replicate/replicate.go @@ -34,9 +34,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/replyio/replyio.go b/pkg/detectors/replyio/replyio.go index 4d1164a1b8b4..ef4c28613656 100644 --- a/pkg/detectors/replyio/replyio.go +++ b/pkg/detectors/replyio/replyio.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/requestfinance/requestfinance.go b/pkg/detectors/requestfinance/requestfinance.go index 815362520ef2..bc7c0ff96fe6 100644 --- a/pkg/detectors/requestfinance/requestfinance.go +++ b/pkg/detectors/requestfinance/requestfinance.go @@ -3,10 +3,11 @@ package requestfinance import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/restpack/restpack.go b/pkg/detectors/restpack/restpack.go index 2f2e43804c09..a916bc5bf20d 100644 --- a/pkg/detectors/restpack/restpack.go +++ b/pkg/detectors/restpack/restpack.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go b/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go index 2935df58687b..0c1c6d9ab7c6 100644 --- a/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go +++ b/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go @@ -2,10 +2,11 @@ package restpackhtmltopdfapi import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go b/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go index 2e62c04cf51c..8ed4aa41a237 100644 --- a/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go +++ b/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go @@ -2,10 +2,11 @@ package restpackscreenshotapi import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rev/rev.go b/pkg/detectors/rev/rev.go index b376deefbb3b..517207c1ff04 100644 --- a/pkg/detectors/rev/rev.go +++ b/pkg/detectors/rev/rev.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result clientMatches := clientKeyPat.FindAllStringSubmatch(dataStr, -1) for _, userMatch := range userMatches { - if len(userMatch) != 2 { - continue - } resUserMatch := strings.TrimSpace(userMatch[1]) for _, clientMatch := range clientMatches { - if len(clientMatch) != 2 { - continue - } resClientMatch := strings.TrimSpace(clientMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/revampcrm/revampcrm.go b/pkg/detectors/revampcrm/revampcrm.go index 0a61b65f21a9..9481474c9c1b 100644 --- a/pkg/detectors/revampcrm/revampcrm.go +++ b/pkg/detectors/revampcrm/revampcrm.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/ringcentral/ringcentral.go b/pkg/detectors/ringcentral/ringcentral.go index a710755128b1..abeeb02f22f3 100644 --- a/pkg/detectors/ringcentral/ringcentral.go +++ b/pkg/detectors/ringcentral/ringcentral.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result uriMatches := uriPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, uriMatch := range uriMatches { - if len(uriMatch) != 2 { - continue - } resURI := strings.TrimSpace(uriMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_RingCentral, diff --git a/pkg/detectors/ritekit/ritekit.go b/pkg/detectors/ritekit/ritekit.go index 5fdd7d24133f..cd851619bf92 100644 --- a/pkg/detectors/ritekit/ritekit.go +++ b/pkg/detectors/ritekit/ritekit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/roaring/roaring.go b/pkg/detectors/roaring/roaring.go index 65f3567f567a..aba325c50bf2 100644 --- a/pkg/detectors/roaring/roaring.go +++ b/pkg/detectors/roaring/roaring.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, clientMatch := range clientMatches { - if len(clientMatch) != 2 { - continue - } resClient := strings.TrimSpace(clientMatch[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rocketreach/rocketreach.go b/pkg/detectors/rocketreach/rocketreach.go index f706e791bb24..dda8c93220f7 100644 --- a/pkg/detectors/rocketreach/rocketreach.go +++ b/pkg/detectors/rocketreach/rocketreach.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rockset/rockset.go b/pkg/detectors/rockset/rockset.go index de3baa50748f..318968d24543 100644 --- a/pkg/detectors/rockset/rockset.go +++ b/pkg/detectors/rockset/rockset.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/roninapp/roninapp.go b/pkg/detectors/roninapp/roninapp.go index db817dd8a445..2f64b06cd4c2 100644 --- a/pkg/detectors/roninapp/roninapp.go +++ b/pkg/detectors/roninapp/roninapp.go @@ -43,15 +43,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_RoninApp, diff --git a/pkg/detectors/route4me/route4me.go b/pkg/detectors/route4me/route4me.go index dbebd51304e1..2058dc5f179c 100644 --- a/pkg/detectors/route4me/route4me.go +++ b/pkg/detectors/route4me/route4me.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rownd/rownd.go b/pkg/detectors/rownd/rownd.go index ea79d239986c..b37f963ca5b7 100644 --- a/pkg/detectors/rownd/rownd.go +++ b/pkg/detectors/rownd/rownd.go @@ -42,21 +42,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resId := strings.TrimSpace(idMatch[1]) for _, match := range keyMatches { - if len(match) != 2 { - continue - } keyMatch := strings.TrimSpace(match[1]) for _, secret := range secretMatches { - if len(secret) != 2 { - continue - } secretMatch := strings.TrimSpace(secret[1]) diff --git a/pkg/detectors/rubygems/rubygems.go b/pkg/detectors/rubygems/rubygems.go index c90da120ce4d..e017da8fd50f 100644 --- a/pkg/detectors/rubygems/rubygems.go +++ b/pkg/detectors/rubygems/rubygems.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/runrunit/runrunit.go b/pkg/detectors/runrunit/runrunit.go index fe015f722006..61a77a8b566e 100644 --- a/pkg/detectors/runrunit/runrunit.go +++ b/pkg/detectors/runrunit/runrunit.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userTokenMatches := userTokenPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, userTokenMatch := range userTokenMatches { - if len(userTokenMatch) != 2 { - continue - } resUserTokenMatch := strings.TrimSpace(userTokenMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/salesblink/salesblink.go b/pkg/detectors/salesblink/salesblink.go index 0a8a07633ba5..4b3666d52eef 100644 --- a/pkg/detectors/salesblink/salesblink.go +++ b/pkg/detectors/salesblink/salesblink.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/salescookie/salescookie.go b/pkg/detectors/salescookie/salescookie.go index 9cd4a071a35b..a8ce79c30c58 100644 --- a/pkg/detectors/salescookie/salescookie.go +++ b/pkg/detectors/salescookie/salescookie.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/salesflare/salesflare.go b/pkg/detectors/salesflare/salesflare.go index ee62c241a588..766412413613 100644 --- a/pkg/detectors/salesflare/salesflare.go +++ b/pkg/detectors/salesflare/salesflare.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/salesforce/salesforce.go b/pkg/detectors/salesforce/salesforce.go index e220ad5ca898..b0f530cea115 100644 --- a/pkg/detectors/salesforce/salesforce.go +++ b/pkg/detectors/salesforce/salesforce.go @@ -45,16 +45,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result tokenMatches := accessTokenPat.FindAllStringSubmatch(dataStr, -1) for _, instance := range instanceMatches { - if len(instance) != 1 { - continue - } instanceMatch := strings.TrimSpace(instance[0]) for _, token := range tokenMatches { - if len(token) != 1 { - continue - } tokenMatch := strings.TrimSpace(token[0]) diff --git a/pkg/detectors/salesmate/salesmate.go b/pkg/detectors/salesmate/salesmate.go index 141502d72ee4..420daca23785 100644 --- a/pkg/detectors/salesmate/salesmate.go +++ b/pkg/detectors/salesmate/salesmate.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Salesmate, diff --git a/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go b/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go index a9b6c857e752..865eb4eb2e95 100644 --- a/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go +++ b/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go @@ -4,10 +4,11 @@ import ( "context" b64 "encoding/base64" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -44,21 +45,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passmatches := passPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, emailmatch := range emailmatches { - if len(emailmatch) != 2 { - continue - } resEmailMatch := strings.TrimSpace(emailmatch[1]) for _, passmatch := range passmatches { - if len(passmatch) != 2 { - continue - } resPassMatch := strings.TrimSpace(passmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/satismeterwritekey/satismeterwritekey.go b/pkg/detectors/satismeterwritekey/satismeterwritekey.go index d49aa91b9e2f..c55ea5e54d29 100644 --- a/pkg/detectors/satismeterwritekey/satismeterwritekey.go +++ b/pkg/detectors/satismeterwritekey/satismeterwritekey.go @@ -2,10 +2,11 @@ package satismeterwritekey import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/saucelabs/saucelabs.go b/pkg/detectors/saucelabs/saucelabs.go index 548b1768051b..d3ee5ed02296 100644 --- a/pkg/detectors/saucelabs/saucelabs.go +++ b/pkg/detectors/saucelabs/saucelabs.go @@ -42,16 +42,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range idMatches { - if len(match) != 2 { - continue - } idMatch := strings.TrimSpace(match[1]) for _, secret := range keyMatches { - if len(secret) != 2 { - continue - } keyMatch := strings.TrimSpace(secret[1]) diff --git a/pkg/detectors/scalewaykey/scalewaykey.go b/pkg/detectors/scalewaykey/scalewaykey.go index daaf76d205ce..06e527b0356d 100644 --- a/pkg/detectors/scalewaykey/scalewaykey.go +++ b/pkg/detectors/scalewaykey/scalewaykey.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scalr/scalr.go b/pkg/detectors/scalr/scalr.go index 025f846fba5c..0a0fc6331e5e 100644 --- a/pkg/detectors/scalr/scalr.go +++ b/pkg/detectors/scalr/scalr.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Scalr, diff --git a/pkg/detectors/scrapeowl/scrapeowl.go b/pkg/detectors/scrapeowl/scrapeowl.go index 566383b00c09..f2da57eed3e3 100644 --- a/pkg/detectors/scrapeowl/scrapeowl.go +++ b/pkg/detectors/scrapeowl/scrapeowl.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scraperapi/scraperapi.go b/pkg/detectors/scraperapi/scraperapi.go index a693748683be..479da753da09 100644 --- a/pkg/detectors/scraperapi/scraperapi.go +++ b/pkg/detectors/scraperapi/scraperapi.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scraperbox/scraperbox.go b/pkg/detectors/scraperbox/scraperbox.go index 1d5439f8d5cd..f10edf8efdae 100644 --- a/pkg/detectors/scraperbox/scraperbox.go +++ b/pkg/detectors/scraperbox/scraperbox.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scrapestack/scrapestack.go b/pkg/detectors/scrapestack/scrapestack.go index 4f57b751e702..baddaff0621f 100644 --- a/pkg/detectors/scrapestack/scrapestack.go +++ b/pkg/detectors/scrapestack/scrapestack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scrapfly/scrapfly.go b/pkg/detectors/scrapfly/scrapfly.go index ce97f374afbd..006fb34dea98 100644 --- a/pkg/detectors/scrapfly/scrapfly.go +++ b/pkg/detectors/scrapfly/scrapfly.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scrapingant/scrapingant.go b/pkg/detectors/scrapingant/scrapingant.go index 5aba39bfa7db..4c9502fcffa4 100644 --- a/pkg/detectors/scrapingant/scrapingant.go +++ b/pkg/detectors/scrapingant/scrapingant.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scrapingbee/scrapingbee.go b/pkg/detectors/scrapingbee/scrapingbee.go index 9f9c654bd1d7..491b56960837 100644 --- a/pkg/detectors/scrapingbee/scrapingbee.go +++ b/pkg/detectors/scrapingbee/scrapingbee.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/screenshotapi/screenshotapi.go b/pkg/detectors/screenshotapi/screenshotapi.go index dfbbef53c043..78b5a750ced8 100644 --- a/pkg/detectors/screenshotapi/screenshotapi.go +++ b/pkg/detectors/screenshotapi/screenshotapi.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/screenshotlayer/screenshotlayer.go b/pkg/detectors/screenshotlayer/screenshotlayer.go index 39c174e274b3..14a835515b40 100644 --- a/pkg/detectors/screenshotlayer/screenshotlayer.go +++ b/pkg/detectors/screenshotlayer/screenshotlayer.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scrutinizerci/scrutinizerci.go b/pkg/detectors/scrutinizerci/scrutinizerci.go index b662b331ad45..fbafbb329789 100644 --- a/pkg/detectors/scrutinizerci/scrutinizerci.go +++ b/pkg/detectors/scrutinizerci/scrutinizerci.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/securitytrails/securitytrails.go b/pkg/detectors/securitytrails/securitytrails.go index 84bfe0ba6f8d..0ebfeb637db8 100644 --- a/pkg/detectors/securitytrails/securitytrails.go +++ b/pkg/detectors/securitytrails/securitytrails.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/segmentapikey/segmentapikey.go b/pkg/detectors/segmentapikey/segmentapikey.go index f3d2ba891757..02e2c4e090fa 100644 --- a/pkg/detectors/segmentapikey/segmentapikey.go +++ b/pkg/detectors/segmentapikey/segmentapikey.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/selectpdf/selectpdf.go b/pkg/detectors/selectpdf/selectpdf.go index e3993a03ec18..d4dd2d5c8afe 100644 --- a/pkg/detectors/selectpdf/selectpdf.go +++ b/pkg/detectors/selectpdf/selectpdf.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/semaphore/semaphore.go b/pkg/detectors/semaphore/semaphore.go index 098d71bddd72..edfd4ba747f1 100644 --- a/pkg/detectors/semaphore/semaphore.go +++ b/pkg/detectors/semaphore/semaphore.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) if !detectors.HasDigit(resMatch) { diff --git a/pkg/detectors/sendbird/sendbird.go b/pkg/detectors/sendbird/sendbird.go index 641decf08709..362fc88fbb98 100644 --- a/pkg/detectors/sendbird/sendbird.go +++ b/pkg/detectors/sendbird/sendbird.go @@ -47,15 +47,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result appIdMatches := appIdPat.FindAllStringSubmatch(dataStr, -1) for _, appIdMatch := range appIdMatches { - if len(appIdMatch) != 2 { - continue - } resAppIdMatch := strings.TrimSpace(appIdMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go b/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go index 6bc71aa0f7dc..a4939e12b960 100644 --- a/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go +++ b/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go @@ -3,10 +3,11 @@ package sendbirdorganizationapi import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sendinbluev2/sendinbluev2.go b/pkg/detectors/sendinbluev2/sendinbluev2.go index e33eac6c7528..7a60428794ab 100644 --- a/pkg/detectors/sendinbluev2/sendinbluev2.go +++ b/pkg/detectors/sendinbluev2/sendinbluev2.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sentrytoken/sentrytoken.go b/pkg/detectors/sentrytoken/sentrytoken.go index ce73fdd65a72..d1bd0519e507 100644 --- a/pkg/detectors/sentrytoken/sentrytoken.go +++ b/pkg/detectors/sentrytoken/sentrytoken.go @@ -44,9 +44,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_SentryToken, diff --git a/pkg/detectors/serphouse/serphouse.go b/pkg/detectors/serphouse/serphouse.go index 7dfd7ba01d69..3c7f9e01d06e 100644 --- a/pkg/detectors/serphouse/serphouse.go +++ b/pkg/detectors/serphouse/serphouse.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/serpstack/serpstack.go b/pkg/detectors/serpstack/serpstack.go index fb92a530a7a0..b9c94b315951 100644 --- a/pkg/detectors/serpstack/serpstack.go +++ b/pkg/detectors/serpstack/serpstack.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sheety/sheety.go b/pkg/detectors/sheety/sheety.go index 4e860a272412..210cc07779c8 100644 --- a/pkg/detectors/sheety/sheety.go +++ b/pkg/detectors/sheety/sheety.go @@ -42,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sherpadesk/sherpadesk.go b/pkg/detectors/sherpadesk/sherpadesk.go index 79bcee05bf93..e6ae7ae1e169 100644 --- a/pkg/detectors/sherpadesk/sherpadesk.go +++ b/pkg/detectors/sherpadesk/sherpadesk.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shipday/shipday.go b/pkg/detectors/shipday/shipday.go index 97474c345e1a..1c76b0004893 100644 --- a/pkg/detectors/shipday/shipday.go +++ b/pkg/detectors/shipday/shipday.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shodankey/shodankey.go b/pkg/detectors/shodankey/shodankey.go index 58a66b01522a..edcd89b87f46 100644 --- a/pkg/detectors/shodankey/shodankey.go +++ b/pkg/detectors/shodankey/shodankey.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shortcut/shortcut.go b/pkg/detectors/shortcut/shortcut.go index 764e548ef009..8a92f12fdfa1 100644 --- a/pkg/detectors/shortcut/shortcut.go +++ b/pkg/detectors/shortcut/shortcut.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shotstack/shotstack.go b/pkg/detectors/shotstack/shotstack.go index b3d46f752e30..ae6af8dcd1c9 100644 --- a/pkg/detectors/shotstack/shotstack.go +++ b/pkg/detectors/shotstack/shotstack.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shutterstock/shutterstock.go b/pkg/detectors/shutterstock/shutterstock.go index 59a192419517..802b34678e13 100644 --- a/pkg/detectors/shutterstock/shutterstock.go +++ b/pkg/detectors/shutterstock/shutterstock.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shutterstockoauth/shutterstockoauth.go b/pkg/detectors/shutterstockoauth/shutterstockoauth.go index 5f9076b43cba..f9fc1e19c79c 100644 --- a/pkg/detectors/shutterstockoauth/shutterstockoauth.go +++ b/pkg/detectors/shutterstockoauth/shutterstockoauth.go @@ -3,10 +3,11 @@ package shutterstockoauth import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/signable/signable.go b/pkg/detectors/signable/signable.go index c2e8fe48aebe..b59f4c27fe46 100644 --- a/pkg/detectors/signable/signable.go +++ b/pkg/detectors/signable/signable.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := tokenPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } if isCommonFalsePositive(match[0]) { continue diff --git a/pkg/detectors/signalwire/signalwire.go b/pkg/detectors/signalwire/signalwire.go index 743cb5587321..5b8851495cb0 100644 --- a/pkg/detectors/signalwire/signalwire.go +++ b/pkg/detectors/signalwire/signalwire.go @@ -44,21 +44,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resID := strings.TrimSpace(idMatch[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/signaturit/signaturit.go b/pkg/detectors/signaturit/signaturit.go index c34b712b013c..6fb6ea44ccb1 100644 --- a/pkg/detectors/signaturit/signaturit.go +++ b/pkg/detectors/signaturit/signaturit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/signupgenius/signupgenius.go b/pkg/detectors/signupgenius/signupgenius.go index 044e8614b24d..23fc147af592 100644 --- a/pkg/detectors/signupgenius/signupgenius.go +++ b/pkg/detectors/signupgenius/signupgenius.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sigopt/sigopt.go b/pkg/detectors/sigopt/sigopt.go index 0e282c548aad..5c01c9a7a9d0 100644 --- a/pkg/detectors/sigopt/sigopt.go +++ b/pkg/detectors/sigopt/sigopt.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/simfin/simfin.go b/pkg/detectors/simfin/simfin.go index 1fce9b07c449..ed34038438b5 100644 --- a/pkg/detectors/simfin/simfin.go +++ b/pkg/detectors/simfin/simfin.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/simplesat/simplesat.go b/pkg/detectors/simplesat/simplesat.go index 9cea1ae9adb4..7082c8450dae 100644 --- a/pkg/detectors/simplesat/simplesat.go +++ b/pkg/detectors/simplesat/simplesat.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/simplynoted/simplynoted.go b/pkg/detectors/simplynoted/simplynoted.go index ea07439db117..12d4880ab3dd 100644 --- a/pkg/detectors/simplynoted/simplynoted.go +++ b/pkg/detectors/simplynoted/simplynoted.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/simvoly/simvoly.go b/pkg/detectors/simvoly/simvoly.go index 935265f227ac..1cce165788a4 100644 --- a/pkg/detectors/simvoly/simvoly.go +++ b/pkg/detectors/simvoly/simvoly.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sinchmessage/sinchmessage.go b/pkg/detectors/sinchmessage/sinchmessage.go index 5277b7cf293d..9705e638a2ab 100644 --- a/pkg/detectors/sinchmessage/sinchmessage.go +++ b/pkg/detectors/sinchmessage/sinchmessage.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sirv/sirv.go b/pkg/detectors/sirv/sirv.go index 0f5a6657f175..b7aa425ce7ee 100644 --- a/pkg/detectors/sirv/sirv.go +++ b/pkg/detectors/sirv/sirv.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/siteleaf/siteleaf.go b/pkg/detectors/siteleaf/siteleaf.go index f9bf1d0b48ef..d791cf46ea5c 100644 --- a/pkg/detectors/siteleaf/siteleaf.go +++ b/pkg/detectors/siteleaf/siteleaf.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/skrappio/skrappio.go b/pkg/detectors/skrappio/skrappio.go index f23e90fd16a5..1ec3551004dc 100644 --- a/pkg/detectors/skrappio/skrappio.go +++ b/pkg/detectors/skrappio/skrappio.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/skybiometry/skybiometry.go b/pkg/detectors/skybiometry/skybiometry.go index 911edb93d015..e9922f4020d9 100644 --- a/pkg/detectors/skybiometry/skybiometry.go +++ b/pkg/detectors/skybiometry/skybiometry.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/slackwebhook/slackwebhook.go b/pkg/detectors/slackwebhook/slackwebhook.go index d8042114b158..fcf2feda71ad 100644 --- a/pkg/detectors/slackwebhook/slackwebhook.go +++ b/pkg/detectors/slackwebhook/slackwebhook.go @@ -45,9 +45,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/smartsheets/smartsheets.go b/pkg/detectors/smartsheets/smartsheets.go index 0ce964465f37..b014d46d64c0 100644 --- a/pkg/detectors/smartsheets/smartsheets.go +++ b/pkg/detectors/smartsheets/smartsheets.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/smartystreets/smartystreets.go b/pkg/detectors/smartystreets/smartystreets.go index b3a5bee3d191..4d92d35173cb 100644 --- a/pkg/detectors/smartystreets/smartystreets.go +++ b/pkg/detectors/smartystreets/smartystreets.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/smooch/smooch.go b/pkg/detectors/smooch/smooch.go index 9e87cb3be2f5..66dbab7d8f70 100644 --- a/pkg/detectors/smooch/smooch.go +++ b/pkg/detectors/smooch/smooch.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/snipcart/snipcart.go b/pkg/detectors/snipcart/snipcart.go index f0e161a6ef41..0157f5d8386d 100644 --- a/pkg/detectors/snipcart/snipcart.go +++ b/pkg/detectors/snipcart/snipcart.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/snowflake/snowflake.go b/pkg/detectors/snowflake/snowflake.go index a53c72635901..30d823538d7c 100644 --- a/pkg/detectors/snowflake/snowflake.go +++ b/pkg/detectors/snowflake/snowflake.go @@ -80,9 +80,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passwordMatches := passwordRegexState.Matches(data) for _, accountMatch := range accountMatches { - if len(accountMatch) != 2 { - continue - } resAccountMatch := strings.TrimSpace(accountMatch[1]) for _, resUsernameMatch := range usernameMatches { diff --git a/pkg/detectors/sonarcloud/sonarcloud.go b/pkg/detectors/sonarcloud/sonarcloud.go index f7e34cbad46b..16f88bc5ff5c 100644 --- a/pkg/detectors/sonarcloud/sonarcloud.go +++ b/pkg/detectors/sonarcloud/sonarcloud.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sourcegraph/sourcegraph.go b/pkg/detectors/sourcegraph/sourcegraph.go index 08c542f6c9ac..79fbd29c1c0c 100644 --- a/pkg/detectors/sourcegraph/sourcegraph.go +++ b/pkg/detectors/sourcegraph/sourcegraph.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sourcegraphcody/sourcegraphcody.go b/pkg/detectors/sourcegraphcody/sourcegraphcody.go index 46ab53ee77ec..77c1b1219823 100644 --- a/pkg/detectors/sourcegraphcody/sourcegraphcody.go +++ b/pkg/detectors/sourcegraphcody/sourcegraphcody.go @@ -3,10 +3,11 @@ package sourcegraphcody import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -38,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sparkpost/sparkpost.go b/pkg/detectors/sparkpost/sparkpost.go index c605a4479480..eb9f4a1dea02 100644 --- a/pkg/detectors/sparkpost/sparkpost.go +++ b/pkg/detectors/sparkpost/sparkpost.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/speechtextai/speechtextai.go b/pkg/detectors/speechtextai/speechtextai.go index 0fdb0272f1c8..c3f5035740d9 100644 --- a/pkg/detectors/speechtextai/speechtextai.go +++ b/pkg/detectors/speechtextai/speechtextai.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go b/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go index 87a32b457d29..99a29a8dc090 100644 --- a/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go +++ b/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go @@ -2,10 +2,11 @@ package splunkobservabilitytoken import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ @@ -59,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result defer res.Body.Close() if res.StatusCode >= 200 && res.StatusCode < 300 { s1.Verified = true - } + } } } diff --git a/pkg/detectors/spoonacular/spoonacular.go b/pkg/detectors/spoonacular/spoonacular.go index 6c6ec8086f24..63fd705383e8 100644 --- a/pkg/detectors/spoonacular/spoonacular.go +++ b/pkg/detectors/spoonacular/spoonacular.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sportsmonk/sportsmonk.go b/pkg/detectors/sportsmonk/sportsmonk.go index b89347e7af19..e833799f80be 100644 --- a/pkg/detectors/sportsmonk/sportsmonk.go +++ b/pkg/detectors/sportsmonk/sportsmonk.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/spotifykey/spotifykey.go b/pkg/detectors/spotifykey/spotifykey.go index d3d91d22eb44..62ed72abd965 100644 --- a/pkg/detectors/spotifykey/spotifykey.go +++ b/pkg/detectors/spotifykey/spotifykey.go @@ -44,14 +44,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } idresMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_SpotifyKey, diff --git a/pkg/detectors/square/square.go b/pkg/detectors/square/square.go index 08f840ed1092..ab00cc0b9d2c 100644 --- a/pkg/detectors/square/square.go +++ b/pkg/detectors/square/square.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, secMatch := range secMatches { - if len(secMatch) != 2 { - continue - } res := strings.TrimSpace(secMatch[1]) s := detectors.Result{ diff --git a/pkg/detectors/squarespace/squarespace.go b/pkg/detectors/squarespace/squarespace.go index 35b83f44f834..59f89a44a8e3 100644 --- a/pkg/detectors/squarespace/squarespace.go +++ b/pkg/detectors/squarespace/squarespace.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/squareup/squareup.go b/pkg/detectors/squareup/squareup.go index cb3e097ddc86..89181ff4f2ac 100644 --- a/pkg/detectors/squareup/squareup.go +++ b/pkg/detectors/squareup/squareup.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sslmate/sslmate.go b/pkg/detectors/sslmate/sslmate.go index 3dd8c6bab100..be7fd3ffc3eb 100644 --- a/pkg/detectors/sslmate/sslmate.go +++ b/pkg/detectors/sslmate/sslmate.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/statuscake/statuscake.go b/pkg/detectors/statuscake/statuscake.go index e00a2a0b6661..a3f1032bc507 100644 --- a/pkg/detectors/statuscake/statuscake.go +++ b/pkg/detectors/statuscake/statuscake.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/statuspage/statuspage.go b/pkg/detectors/statuspage/statuspage.go index 8bb04b07b48b..3e030054e261 100644 --- a/pkg/detectors/statuspage/statuspage.go +++ b/pkg/detectors/statuspage/statuspage.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/statuspal/statuspal.go b/pkg/detectors/statuspal/statuspal.go index 947a4055b56e..a2edc7ed7a99 100644 --- a/pkg/detectors/statuspal/statuspal.go +++ b/pkg/detectors/statuspal/statuspal.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stitchdata/stitchdata.go b/pkg/detectors/stitchdata/stitchdata.go index 67e7d4d357f6..6693fef4403d 100644 --- a/pkg/detectors/stitchdata/stitchdata.go +++ b/pkg/detectors/stitchdata/stitchdata.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stockdata/stockdata.go b/pkg/detectors/stockdata/stockdata.go index baef2228797d..2b1a96baf85f 100644 --- a/pkg/detectors/stockdata/stockdata.go +++ b/pkg/detectors/stockdata/stockdata.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/storecove/storecove.go b/pkg/detectors/storecove/storecove.go index 4e113e7477d3..16dd606cb590 100644 --- a/pkg/detectors/storecove/storecove.go +++ b/pkg/detectors/storecove/storecove.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stormboard/stormboard.go b/pkg/detectors/stormboard/stormboard.go index 6c2a61528e53..3944ee24a299 100644 --- a/pkg/detectors/stormboard/stormboard.go +++ b/pkg/detectors/stormboard/stormboard.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stormglass/stormglass.go b/pkg/detectors/stormglass/stormglass.go index 83216c6dbaad..5c6b644935c0 100644 --- a/pkg/detectors/stormglass/stormglass.go +++ b/pkg/detectors/stormglass/stormglass.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/storyblok/storyblok.go b/pkg/detectors/storyblok/storyblok.go index c5262d0af096..f102a3159f2c 100644 --- a/pkg/detectors/storyblok/storyblok.go +++ b/pkg/detectors/storyblok/storyblok.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/storychief/storychief.go b/pkg/detectors/storychief/storychief.go index 9e2949a975a3..7c82315d670a 100644 --- a/pkg/detectors/storychief/storychief.go +++ b/pkg/detectors/storychief/storychief.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/strava/strava.go b/pkg/detectors/strava/strava.go index 1f8810c4ff73..8fc690407427 100644 --- a/pkg/detectors/strava/strava.go +++ b/pkg/detectors/strava/strava.go @@ -42,21 +42,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range idMatches { - if len(match) != 2 { - continue - } resId := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } resKey := strings.TrimSpace(keyMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/streak/streak.go b/pkg/detectors/streak/streak.go index f241da304376..08700372a97f 100644 --- a/pkg/detectors/streak/streak.go +++ b/pkg/detectors/streak/streak.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stripo/stripo.go b/pkg/detectors/stripo/stripo.go index 73592efb7c9e..954f7d1ee879 100644 --- a/pkg/detectors/stripo/stripo.go +++ b/pkg/detectors/stripo/stripo.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stytch/stytch.go b/pkg/detectors/stytch/stytch.go index d03cb347be0f..3cb816be82e0 100644 --- a/pkg/detectors/stytch/stytch.go +++ b/pkg/detectors/stytch/stytch.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sugester/sugester.go b/pkg/detectors/sugester/sugester.go index e22be1d9e1a0..605d46858f3e 100644 --- a/pkg/detectors/sugester/sugester.go +++ b/pkg/detectors/sugester/sugester.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, domainmatch := range domainMatches { - if len(match) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Sugester, diff --git a/pkg/detectors/sumologickey/sumologickey.go b/pkg/detectors/sumologickey/sumologickey.go index 28d0b02d9ac6..6cd4087cdb48 100644 --- a/pkg/detectors/sumologickey/sumologickey.go +++ b/pkg/detectors/sumologickey/sumologickey.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/supabasetoken/supabasetoken.go b/pkg/detectors/supabasetoken/supabasetoken.go index 7b08cbfda74e..8ab60c3f7efe 100644 --- a/pkg/detectors/supabasetoken/supabasetoken.go +++ b/pkg/detectors/supabasetoken/supabasetoken.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/supernotesapi/supernotesapi.go b/pkg/detectors/supernotesapi/supernotesapi.go index cb4022a5fa32..691010925493 100644 --- a/pkg/detectors/supernotesapi/supernotesapi.go +++ b/pkg/detectors/supernotesapi/supernotesapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/surveyanyplace/surveyanyplace.go b/pkg/detectors/surveyanyplace/surveyanyplace.go index 464ef75db22b..b9e09609af16 100644 --- a/pkg/detectors/surveyanyplace/surveyanyplace.go +++ b/pkg/detectors/surveyanyplace/surveyanyplace.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/surveybot/surveybot.go b/pkg/detectors/surveybot/surveybot.go index e6e798bc5ef1..90697d7aefd0 100644 --- a/pkg/detectors/surveybot/surveybot.go +++ b/pkg/detectors/surveybot/surveybot.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/surveysparrow/surveysparrow.go b/pkg/detectors/surveysparrow/surveysparrow.go index 7f31317a6326..e047199b8860 100644 --- a/pkg/detectors/surveysparrow/surveysparrow.go +++ b/pkg/detectors/surveysparrow/surveysparrow.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/survicate/survicate.go b/pkg/detectors/survicate/survicate.go index c3b24d59b5a6..eeb31155cdef 100644 --- a/pkg/detectors/survicate/survicate.go +++ b/pkg/detectors/survicate/survicate.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/swell/swell.go b/pkg/detectors/swell/swell.go index 15e737857785..11517ee2560a 100644 --- a/pkg/detectors/swell/swell.go +++ b/pkg/detectors/swell/swell.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/swiftype/swiftype.go b/pkg/detectors/swiftype/swiftype.go index bc6eba41adf9..197572b6e7c2 100644 --- a/pkg/detectors/swiftype/swiftype.go +++ b/pkg/detectors/swiftype/swiftype.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tallyfy/tallyfy.go b/pkg/detectors/tallyfy/tallyfy.go index 44b928e51189..d4982c7cc7d8 100644 --- a/pkg/detectors/tallyfy/tallyfy.go +++ b/pkg/detectors/tallyfy/tallyfy.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tatumio/tatumio.go b/pkg/detectors/tatumio/tatumio.go index 97bc9d128067..4395fab4e2ec 100644 --- a/pkg/detectors/tatumio/tatumio.go +++ b/pkg/detectors/tatumio/tatumio.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/taxjar/taxjar.go b/pkg/detectors/taxjar/taxjar.go index 956318210dec..0fa7b9e72b73 100644 --- a/pkg/detectors/taxjar/taxjar.go +++ b/pkg/detectors/taxjar/taxjar.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/teamgate/teamgate.go b/pkg/detectors/teamgate/teamgate.go index 39dffb5cc0e4..8f34b83585f3 100644 --- a/pkg/detectors/teamgate/teamgate.go +++ b/pkg/detectors/teamgate/teamgate.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } resKeyMatch := strings.TrimSpace(keyMatch[1]) diff --git a/pkg/detectors/teamworkcrm/teamworkcrm.go b/pkg/detectors/teamworkcrm/teamworkcrm.go index 3a5cae84097f..8a7d98491d02 100644 --- a/pkg/detectors/teamworkcrm/teamworkcrm.go +++ b/pkg/detectors/teamworkcrm/teamworkcrm.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/teamworkdesk/teamworkdesk.go b/pkg/detectors/teamworkdesk/teamworkdesk.go index e4e788baab87..084f0b02fd85 100644 --- a/pkg/detectors/teamworkdesk/teamworkdesk.go +++ b/pkg/detectors/teamworkdesk/teamworkdesk.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/teamworkspaces/teamworkspaces.go b/pkg/detectors/teamworkspaces/teamworkspaces.go index 3e4b3aa1c527..6e700ae1466b 100644 --- a/pkg/detectors/teamworkspaces/teamworkspaces.go +++ b/pkg/detectors/teamworkspaces/teamworkspaces.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go b/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go index fbdbda279e38..ba797d5cbb6f 100644 --- a/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go +++ b/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tefter/tefter.go b/pkg/detectors/tefter/tefter.go index 0d5dbf398710..04448256622f 100644 --- a/pkg/detectors/tefter/tefter.go +++ b/pkg/detectors/tefter/tefter.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/telegrambottoken/telegrambottoken.go b/pkg/detectors/telegrambottoken/telegrambottoken.go index 90649da1fb70..464e477f7e35 100644 --- a/pkg/detectors/telegrambottoken/telegrambottoken.go +++ b/pkg/detectors/telegrambottoken/telegrambottoken.go @@ -4,11 +4,12 @@ import ( "context" "encoding/json" - // "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + // "fmt" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -42,9 +43,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } key := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/teletype/teletype.go b/pkg/detectors/teletype/teletype.go index a56c4da6cf8d..354f20b33eb2 100644 --- a/pkg/detectors/teletype/teletype.go +++ b/pkg/detectors/teletype/teletype.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/telnyx/telnyx.go b/pkg/detectors/telnyx/telnyx.go index 4d4e11c31356..b83e0d128384 100644 --- a/pkg/detectors/telnyx/telnyx.go +++ b/pkg/detectors/telnyx/telnyx.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go b/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go index 28cddb17c341..32558b1abdbb 100644 --- a/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go +++ b/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go @@ -3,10 +3,11 @@ package terraformcloudpersonaltoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/testingbot/testingbot.go b/pkg/detectors/testingbot/testingbot.go index 56fb05fdbd33..16f87d6431fe 100644 --- a/pkg/detectors/testingbot/testingbot.go +++ b/pkg/detectors/testingbot/testingbot.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/textmagic/textmagic.go b/pkg/detectors/textmagic/textmagic.go index b543df318197..8ec0e48b215f 100644 --- a/pkg/detectors/textmagic/textmagic.go +++ b/pkg/detectors/textmagic/textmagic.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userMatches := userPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, userMatch := range userMatches { - if len(match) != 2 { - continue - } resUser := strings.TrimSpace(userMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/theoddsapi/theoddsapi.go b/pkg/detectors/theoddsapi/theoddsapi.go index ca0b315cf360..2ba8a22c6530 100644 --- a/pkg/detectors/theoddsapi/theoddsapi.go +++ b/pkg/detectors/theoddsapi/theoddsapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/thinkific/thinkific.go b/pkg/detectors/thinkific/thinkific.go index d0cb6631d300..d15e436078c2 100644 --- a/pkg/detectors/thinkific/thinkific.go +++ b/pkg/detectors/thinkific/thinkific.go @@ -42,15 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, domainMatch := range domainMatches { - - if len(domainMatch) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Thinkific, diff --git a/pkg/detectors/thousandeyes/thousandeyes.go b/pkg/detectors/thousandeyes/thousandeyes.go index 7693e6bc94f4..f68b58909148 100644 --- a/pkg/detectors/thousandeyes/thousandeyes.go +++ b/pkg/detectors/thousandeyes/thousandeyes.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := email.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(emailMatch[1]) diff --git a/pkg/detectors/ticketmaster/ticketmaster.go b/pkg/detectors/ticketmaster/ticketmaster.go index de12b7a04f76..2f5cef4e5043 100644 --- a/pkg/detectors/ticketmaster/ticketmaster.go +++ b/pkg/detectors/ticketmaster/ticketmaster.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tickettailor/tickettailor.go b/pkg/detectors/tickettailor/tickettailor.go index 10d96b551786..bf8803694815 100644 --- a/pkg/detectors/tickettailor/tickettailor.go +++ b/pkg/detectors/tickettailor/tickettailor.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tiingo/tiingo.go b/pkg/detectors/tiingo/tiingo.go index e8aa1da7e5d3..ed4bed518506 100644 --- a/pkg/detectors/tiingo/tiingo.go +++ b/pkg/detectors/tiingo/tiingo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/timecamp/timecamp.go b/pkg/detectors/timecamp/timecamp.go index e3c132ab1d77..ba1327c0a4e1 100644 --- a/pkg/detectors/timecamp/timecamp.go +++ b/pkg/detectors/timecamp/timecamp.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/timezoneapi/timezoneapi.go b/pkg/detectors/timezoneapi/timezoneapi.go index ef7534d3a1cc..f7d691ce562e 100644 --- a/pkg/detectors/timezoneapi/timezoneapi.go +++ b/pkg/detectors/timezoneapi/timezoneapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tineswebhook/tineswebhook.go b/pkg/detectors/tineswebhook/tineswebhook.go index 7126e2d7c91d..0be04b936845 100644 --- a/pkg/detectors/tineswebhook/tineswebhook.go +++ b/pkg/detectors/tineswebhook/tineswebhook.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tly/tly.go b/pkg/detectors/tly/tly.go index 37b7eb6ff1d0..fd7d6c40dadc 100644 --- a/pkg/detectors/tly/tly.go +++ b/pkg/detectors/tly/tly.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tmetric/tmetric.go b/pkg/detectors/tmetric/tmetric.go index 476b5e6fde33..e6174312c555 100644 --- a/pkg/detectors/tmetric/tmetric.go +++ b/pkg/detectors/tmetric/tmetric.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/todoist/todoist.go b/pkg/detectors/todoist/todoist.go index 3461c5e3bf62..a425d9e0fd5e 100644 --- a/pkg/detectors/todoist/todoist.go +++ b/pkg/detectors/todoist/todoist.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/toggltrack/toggltrack.go b/pkg/detectors/toggltrack/toggltrack.go index 883784c7bca0..8ebcb3072e8b 100644 --- a/pkg/detectors/toggltrack/toggltrack.go +++ b/pkg/detectors/toggltrack/toggltrack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tokeet/tokeet.go b/pkg/detectors/tokeet/tokeet.go index a8ac2399858b..e5288c27ea68 100644 --- a/pkg/detectors/tokeet/tokeet.go +++ b/pkg/detectors/tokeet/tokeet.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tomorrowio/tomorrowio.go b/pkg/detectors/tomorrowio/tomorrowio.go index edf5de186032..d80744395d1e 100644 --- a/pkg/detectors/tomorrowio/tomorrowio.go +++ b/pkg/detectors/tomorrowio/tomorrowio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tomtom/tomtom.go b/pkg/detectors/tomtom/tomtom.go index b1e1aff2c867..c0df460f5f21 100644 --- a/pkg/detectors/tomtom/tomtom.go +++ b/pkg/detectors/tomtom/tomtom.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tradier/tradier.go b/pkg/detectors/tradier/tradier.go index c11d0ee1464b..62e713d9090e 100644 --- a/pkg/detectors/tradier/tradier.go +++ b/pkg/detectors/tradier/tradier.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/transferwise/transferwise.go b/pkg/detectors/transferwise/transferwise.go index e49455d2c33d..e52acea4ffca 100644 --- a/pkg/detectors/transferwise/transferwise.go +++ b/pkg/detectors/transferwise/transferwise.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/travelpayouts/travelpayouts.go b/pkg/detectors/travelpayouts/travelpayouts.go index 6aa4b481b785..9d0a1411bd32 100644 --- a/pkg/detectors/travelpayouts/travelpayouts.go +++ b/pkg/detectors/travelpayouts/travelpayouts.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/travisci/travisci.go b/pkg/detectors/travisci/travisci.go index fe7b7a79a9d3..6909a13636af 100644 --- a/pkg/detectors/travisci/travisci.go +++ b/pkg/detectors/travisci/travisci.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/trelloapikey/trelloapikey.go b/pkg/detectors/trelloapikey/trelloapikey.go index d26696d597f1..e28c8013fe09 100644 --- a/pkg/detectors/trelloapikey/trelloapikey.go +++ b/pkg/detectors/trelloapikey/trelloapikey.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if i == 0 { resMatch := strings.TrimSpace(match[1]) for _, tokenMatch := range tokenMatches { - if len(tokenMatch) != 2 { - continue - } token := strings.TrimSpace(tokenMatch[1]) diff --git a/pkg/detectors/tru/tru.go b/pkg/detectors/tru/tru.go index f573a1cff794..ce733f2a0a8c 100644 --- a/pkg/detectors/tru/tru.go +++ b/pkg/detectors/tru/tru.go @@ -42,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secrePat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go b/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go index dfd6263b33ce..9d91815d2f88 100644 --- a/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go +++ b/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go @@ -43,21 +43,11 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result hostnameMatches := hostnamePat.FindAllStringSubmatch(dataStr, -1) for _, keyMatch := range keyMatches { - if len(keyMatch) != 1 { - continue - } resKeyMatch := strings.TrimSpace(keyMatch[0]) for _, secretMatch := range secretMatches { - - if len(secretMatch) != 1 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[0]) for _, hostnameMatch := range hostnameMatches { - if len(hostnameMatch) != 1 { - continue - } resHostnameMatch := strings.TrimSpace(hostnameMatch[0]) diff --git a/pkg/detectors/twelvedata/twelvedata.go b/pkg/detectors/twelvedata/twelvedata.go index 1b684910d20d..625f7d67d52e 100644 --- a/pkg/detectors/twelvedata/twelvedata.go +++ b/pkg/detectors/twelvedata/twelvedata.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/twist/twist.go b/pkg/detectors/twist/twist.go index c99c423d2c30..00153cb59e7f 100644 --- a/pkg/detectors/twist/twist.go +++ b/pkg/detectors/twist/twist.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := accessToken.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) setAuth := resMatch diff --git a/pkg/detectors/twitch/twitch.go b/pkg/detectors/twitch/twitch.go index 994be1ede5e3..b7c940c8fc21 100644 --- a/pkg/detectors/twitch/twitch.go +++ b/pkg/detectors/twitch/twitch.go @@ -46,15 +46,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/twitter/twitter.go b/pkg/detectors/twitter/twitter.go index cc69bb90a396..e00df0716c2a 100644 --- a/pkg/detectors/twitter/twitter.go +++ b/pkg/detectors/twitter/twitter.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tyntec/tyntec.go b/pkg/detectors/tyntec/tyntec.go index 0269f61a1536..dfbf778d03bd 100644 --- a/pkg/detectors/tyntec/tyntec.go +++ b/pkg/detectors/tyntec/tyntec.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/typeform/typeform.go b/pkg/detectors/typeform/typeform.go index 63dfbf41e48d..114135866e39 100644 --- a/pkg/detectors/typeform/typeform.go +++ b/pkg/detectors/typeform/typeform.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/typetalk/typetalk.go b/pkg/detectors/typetalk/typetalk.go index b25b5c824266..4d34864752a0 100644 --- a/pkg/detectors/typetalk/typetalk.go +++ b/pkg/detectors/typetalk/typetalk.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ubidots/ubidots.go b/pkg/detectors/ubidots/ubidots.go index 303de4887197..bfea94a699f0 100644 --- a/pkg/detectors/ubidots/ubidots.go +++ b/pkg/detectors/ubidots/ubidots.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/uclassify/uclassify.go b/pkg/detectors/uclassify/uclassify.go index 29fe57cc62e0..f8f13a8f21a3 100644 --- a/pkg/detectors/uclassify/uclassify.go +++ b/pkg/detectors/uclassify/uclassify.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/unifyid/unifyid.go b/pkg/detectors/unifyid/unifyid.go index 4bb02a18056f..28aae2bd2820 100644 --- a/pkg/detectors/unifyid/unifyid.go +++ b/pkg/detectors/unifyid/unifyid.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/unplugg/unplugg.go b/pkg/detectors/unplugg/unplugg.go index 25c2b59a66f2..a228deb4c1d5 100644 --- a/pkg/detectors/unplugg/unplugg.go +++ b/pkg/detectors/unplugg/unplugg.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/unsplash/unsplash.go b/pkg/detectors/unsplash/unsplash.go index 4b2a758084b0..2ea88926350a 100644 --- a/pkg/detectors/unsplash/unsplash.go +++ b/pkg/detectors/unsplash/unsplash.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/upcdatabase/upcdatabase.go b/pkg/detectors/upcdatabase/upcdatabase.go index c18f34fe9f3f..d8d48b3c88b9 100644 --- a/pkg/detectors/upcdatabase/upcdatabase.go +++ b/pkg/detectors/upcdatabase/upcdatabase.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/uplead/uplead.go b/pkg/detectors/uplead/uplead.go index 6058835c825f..caa391223822 100644 --- a/pkg/detectors/uplead/uplead.go +++ b/pkg/detectors/uplead/uplead.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/uploadcare/uploadcare.go b/pkg/detectors/uploadcare/uploadcare.go index 75497eee1dcd..6320be43f9d4 100644 --- a/pkg/detectors/uploadcare/uploadcare.go +++ b/pkg/detectors/uploadcare/uploadcare.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result publicMatches := publicKeyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, publicMatch := range publicMatches { - if len(publicMatch) != 2 { - continue - } publicKeyMatch := strings.TrimSpace(publicMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_UploadCare, diff --git a/pkg/detectors/uptimerobot/uptimerobot.go b/pkg/detectors/uptimerobot/uptimerobot.go index 00d3b6df6d36..4a74f94b5f32 100644 --- a/pkg/detectors/uptimerobot/uptimerobot.go +++ b/pkg/detectors/uptimerobot/uptimerobot.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/upwave/upwave.go b/pkg/detectors/upwave/upwave.go index c42178d0b84c..86eba28c4639 100644 --- a/pkg/detectors/upwave/upwave.go +++ b/pkg/detectors/upwave/upwave.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/urlscan/urlscan.go b/pkg/detectors/urlscan/urlscan.go index b1236f8708c5..906c4be0cbe8 100644 --- a/pkg/detectors/urlscan/urlscan.go +++ b/pkg/detectors/urlscan/urlscan.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/user/user.go b/pkg/detectors/user/user.go index 7cd92846535d..e49c2b69e5f3 100644 --- a/pkg/detectors/user/user.go +++ b/pkg/detectors/user/user.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/userflow/userflow.go b/pkg/detectors/userflow/userflow.go index 9014b5f5e589..9e4ca92b328c 100644 --- a/pkg/detectors/userflow/userflow.go +++ b/pkg/detectors/userflow/userflow.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/userstack/userstack.go b/pkg/detectors/userstack/userstack.go index 7655a8e805df..e7b65ec0c9e4 100644 --- a/pkg/detectors/userstack/userstack.go +++ b/pkg/detectors/userstack/userstack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go b/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go index 9515301151f3..a2e4f3f16240 100644 --- a/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go +++ b/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go @@ -3,10 +3,11 @@ package vagrantcloudpersonaltoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -38,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vatlayer/vatlayer.go b/pkg/detectors/vatlayer/vatlayer.go index 6951bdf0f889..4dbc2081900a 100644 --- a/pkg/detectors/vatlayer/vatlayer.go +++ b/pkg/detectors/vatlayer/vatlayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vbout/vbout.go b/pkg/detectors/vbout/vbout.go index e8badadc7be3..40cf8560840e 100644 --- a/pkg/detectors/vbout/vbout.go +++ b/pkg/detectors/vbout/vbout.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vercel/vercel.go b/pkg/detectors/vercel/vercel.go index 4b04286b5a68..66001b19f988 100644 --- a/pkg/detectors/vercel/vercel.go +++ b/pkg/detectors/vercel/vercel.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/verifier/verifier.go b/pkg/detectors/verifier/verifier.go index 922506c33111..fd30a22a4246 100644 --- a/pkg/detectors/verifier/verifier.go +++ b/pkg/detectors/verifier/verifier.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/verimail/verimail.go b/pkg/detectors/verimail/verimail.go index 973dcd440d9f..892aa00dc736 100644 --- a/pkg/detectors/verimail/verimail.go +++ b/pkg/detectors/verimail/verimail.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/veriphone/veriphone.go b/pkg/detectors/veriphone/veriphone.go index 944d5c33302f..b175320318db 100644 --- a/pkg/detectors/veriphone/veriphone.go +++ b/pkg/detectors/veriphone/veriphone.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/versioneye/versioneye.go b/pkg/detectors/versioneye/versioneye.go index 74c718f11e0b..9e497d57d7df 100644 --- a/pkg/detectors/versioneye/versioneye.go +++ b/pkg/detectors/versioneye/versioneye.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/viewneo/viewneo.go b/pkg/detectors/viewneo/viewneo.go index 1f1754355a4a..f9a43eb4d291 100644 --- a/pkg/detectors/viewneo/viewneo.go +++ b/pkg/detectors/viewneo/viewneo.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/virustotal/virustotal.go b/pkg/detectors/virustotal/virustotal.go index db78d8a5661a..baaa4603eaa0 100644 --- a/pkg/detectors/virustotal/virustotal.go +++ b/pkg/detectors/virustotal/virustotal.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/visualcrossing/visualcrossing.go b/pkg/detectors/visualcrossing/visualcrossing.go index 81fb62ff00ea..37a5064a42ff 100644 --- a/pkg/detectors/visualcrossing/visualcrossing.go +++ b/pkg/detectors/visualcrossing/visualcrossing.go @@ -3,10 +3,11 @@ package visualcrossing import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/voiceflow/voiceflow.go b/pkg/detectors/voiceflow/voiceflow.go index 1ffb1b11d263..a3a3cd613d8c 100644 --- a/pkg/detectors/voiceflow/voiceflow.go +++ b/pkg/detectors/voiceflow/voiceflow.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/voicegain/voicegain.go b/pkg/detectors/voicegain/voicegain.go index e118b51e3249..98043d0e855f 100644 --- a/pkg/detectors/voicegain/voicegain.go +++ b/pkg/detectors/voicegain/voicegain.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/voodoosms/voodoosms.go b/pkg/detectors/voodoosms/voodoosms.go index 8490d00319cd..0912c26f9268 100644 --- a/pkg/detectors/voodoosms/voodoosms.go +++ b/pkg/detectors/voodoosms/voodoosms.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vouchery/vouchery.go b/pkg/detectors/vouchery/vouchery.go index f143f18987be..a4d0a182af88 100644 --- a/pkg/detectors/vouchery/vouchery.go +++ b/pkg/detectors/vouchery/vouchery.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result subMatches := subPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, subMatch := range subMatches { - if len(subMatch) != 2 { - continue - } subMatch := strings.TrimSpace(subMatch[1]) diff --git a/pkg/detectors/vpnapi/vpnapi.go b/pkg/detectors/vpnapi/vpnapi.go index a53ec3eecfd1..847a8662a9d1 100644 --- a/pkg/detectors/vpnapi/vpnapi.go +++ b/pkg/detectors/vpnapi/vpnapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vultrapikey/vultrapikey.go b/pkg/detectors/vultrapikey/vultrapikey.go index 96029c911902..c4c43f663796 100644 --- a/pkg/detectors/vultrapikey/vultrapikey.go +++ b/pkg/detectors/vultrapikey/vultrapikey.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vyte/vyte.go b/pkg/detectors/vyte/vyte.go index 653e29c2a28c..eb7fd026be22 100644 --- a/pkg/detectors/vyte/vyte.go +++ b/pkg/detectors/vyte/vyte.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/walkscore/walkscore.go b/pkg/detectors/walkscore/walkscore.go index b3d87654f284..2d046e62f0ac 100644 --- a/pkg/detectors/walkscore/walkscore.go +++ b/pkg/detectors/walkscore/walkscore.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/weatherbit/weatherbit.go b/pkg/detectors/weatherbit/weatherbit.go index fbc752cf5005..fb7a98647423 100644 --- a/pkg/detectors/weatherbit/weatherbit.go +++ b/pkg/detectors/weatherbit/weatherbit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/weatherstack/weatherstack.go b/pkg/detectors/weatherstack/weatherstack.go index 234d931e4146..b5d58fcb319b 100644 --- a/pkg/detectors/weatherstack/weatherstack.go +++ b/pkg/detectors/weatherstack/weatherstack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/web3storage/web3storage.go b/pkg/detectors/web3storage/web3storage.go index 3510f0a92697..533f1e344eca 100644 --- a/pkg/detectors/web3storage/web3storage.go +++ b/pkg/detectors/web3storage/web3storage.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/webex/webex.go b/pkg/detectors/webex/webex.go index 049ac9fa28f8..9058041cf5ca 100644 --- a/pkg/detectors/webex/webex.go +++ b/pkg/detectors/webex/webex.go @@ -39,15 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - - if len(idMatch) != 2 { - continue - } id := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/webflow/webflow.go b/pkg/detectors/webflow/webflow.go index b1f69d182285..df170be55bf0 100644 --- a/pkg/detectors/webflow/webflow.go +++ b/pkg/detectors/webflow/webflow.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/webscraper/webscraper.go b/pkg/detectors/webscraper/webscraper.go index 963e3799af35..caec385f80cd 100644 --- a/pkg/detectors/webscraper/webscraper.go +++ b/pkg/detectors/webscraper/webscraper.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/webscraping/webscraping.go b/pkg/detectors/webscraping/webscraping.go index acbb46de9b38..0d8e7186ee73 100644 --- a/pkg/detectors/webscraping/webscraping.go +++ b/pkg/detectors/webscraping/webscraping.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/websitepulse/websitepulse.go b/pkg/detectors/websitepulse/websitepulse.go index 8a704c47b336..a3c850060252 100644 --- a/pkg/detectors/websitepulse/websitepulse.go +++ b/pkg/detectors/websitepulse/websitepulse.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Websitepulse, diff --git a/pkg/detectors/wepay/wepay.go b/pkg/detectors/wepay/wepay.go index df2300cbdaab..4957e8fe5088 100644 --- a/pkg/detectors/wepay/wepay.go +++ b/pkg/detectors/wepay/wepay.go @@ -42,17 +42,11 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result resAppIDMatch := "" for _, appIDMatch := range appIDmatches { - if len(appIDMatch) != 2 { - continue - } resAppIDMatch = strings.TrimSpace(appIDMatch[1]) } for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_WePay, diff --git a/pkg/detectors/whoxy/whoxy.go b/pkg/detectors/whoxy/whoxy.go index 4405a299e032..33a52aea0a95 100644 --- a/pkg/detectors/whoxy/whoxy.go +++ b/pkg/detectors/whoxy/whoxy.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/wistia/wistia.go b/pkg/detectors/wistia/wistia.go index 9efc215a1f5a..fd2537f10a6e 100644 --- a/pkg/detectors/wistia/wistia.go +++ b/pkg/detectors/wistia/wistia.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/wit/wit.go b/pkg/detectors/wit/wit.go index 7f77a2ccb02e..52abdbf83d53 100644 --- a/pkg/detectors/wit/wit.go +++ b/pkg/detectors/wit/wit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/worksnaps/worksnaps.go b/pkg/detectors/worksnaps/worksnaps.go index a8c9872670c8..a9355b7988ed 100644 --- a/pkg/detectors/worksnaps/worksnaps.go +++ b/pkg/detectors/worksnaps/worksnaps.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/workstack/workstack.go b/pkg/detectors/workstack/workstack.go index fb076f84f19c..e3a6c2555062 100644 --- a/pkg/detectors/workstack/workstack.go +++ b/pkg/detectors/workstack/workstack.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/worldcoinindex/worldcoinindex.go b/pkg/detectors/worldcoinindex/worldcoinindex.go index 9e8b4e2f2d94..8281af755c30 100644 --- a/pkg/detectors/worldcoinindex/worldcoinindex.go +++ b/pkg/detectors/worldcoinindex/worldcoinindex.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/worldweather/worldweather.go b/pkg/detectors/worldweather/worldweather.go index 296cb7b78b8a..01d4a56f2ca5 100644 --- a/pkg/detectors/worldweather/worldweather.go +++ b/pkg/detectors/worldweather/worldweather.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/wrike/wrike.go b/pkg/detectors/wrike/wrike.go index de45cd446e99..4affefcdf7cf 100644 --- a/pkg/detectors/wrike/wrike.go +++ b/pkg/detectors/wrike/wrike.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/yandex/yandex.go b/pkg/detectors/yandex/yandex.go index 93603818d63b..fb6e0829a42e 100644 --- a/pkg/detectors/yandex/yandex.go +++ b/pkg/detectors/yandex/yandex.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/yelp/yelp.go b/pkg/detectors/yelp/yelp.go index 58019f4aaec3..13674557527a 100644 --- a/pkg/detectors/yelp/yelp.go +++ b/pkg/detectors/yelp/yelp.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/youneedabudget/youneedabudget.go b/pkg/detectors/youneedabudget/youneedabudget.go index 48e56c4a42d8..785d2f73d41d 100644 --- a/pkg/detectors/youneedabudget/youneedabudget.go +++ b/pkg/detectors/youneedabudget/youneedabudget.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/yousign/yousign.go b/pkg/detectors/yousign/yousign.go index b187879eaff7..c476e38a22ce 100644 --- a/pkg/detectors/yousign/yousign.go +++ b/pkg/detectors/yousign/yousign.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/youtubeapikey/youtubeapikey.go b/pkg/detectors/youtubeapikey/youtubeapikey.go index 534ba0cd5b6e..4076d90effd2 100644 --- a/pkg/detectors/youtubeapikey/youtubeapikey.go +++ b/pkg/detectors/youtubeapikey/youtubeapikey.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idmatches { - if len(idmatch) != 2 { - continue - } resIdmatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zapierwebhook/zapierwebhook.go b/pkg/detectors/zapierwebhook/zapierwebhook.go index 9f1d45ffe8fb..e4ff7a22b242 100644 --- a/pkg/detectors/zapierwebhook/zapierwebhook.go +++ b/pkg/detectors/zapierwebhook/zapierwebhook.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zendeskapi/zendeskapi.go b/pkg/detectors/zendeskapi/zendeskapi.go index 913723a5d154..3e3b0e6c9916 100644 --- a/pkg/detectors/zendeskapi/zendeskapi.go +++ b/pkg/detectors/zendeskapi/zendeskapi.go @@ -43,22 +43,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emails := email.FindAllStringSubmatch(dataStr, -1) for _, token := range tokens { - if len(token) != 2 { - continue - } resMatch := strings.TrimSpace(token[1]) var resDomain string for _, domain := range domains { - if len(domain) != 2 { - continue - } resDomain = strings.TrimSpace(domain[1]) for _, email := range emails { - if len(email) != 2 { - continue - } resEmail := strings.TrimSpace(email[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zenkitapi/zenkitapi.go b/pkg/detectors/zenkitapi/zenkitapi.go index d17a636c5dca..d7c23cc4ffba 100644 --- a/pkg/detectors/zenkitapi/zenkitapi.go +++ b/pkg/detectors/zenkitapi/zenkitapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zenrows/zenrows.go b/pkg/detectors/zenrows/zenrows.go index 5f85f5871d9c..62097a1d6de8 100644 --- a/pkg/detectors/zenrows/zenrows.go +++ b/pkg/detectors/zenrows/zenrows.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zenscrape/zenscrape.go b/pkg/detectors/zenscrape/zenscrape.go index 05d0fb2294bc..aa990f873c83 100644 --- a/pkg/detectors/zenscrape/zenscrape.go +++ b/pkg/detectors/zenscrape/zenscrape.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zenserp/zenserp.go b/pkg/detectors/zenserp/zenserp.go index 84375a5e4c19..520dd73fecae 100644 --- a/pkg/detectors/zenserp/zenserp.go +++ b/pkg/detectors/zenserp/zenserp.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zeplin/zeplin.go b/pkg/detectors/zeplin/zeplin.go index bd3eb38b1b23..f8d9cfb57e98 100644 --- a/pkg/detectors/zeplin/zeplin.go +++ b/pkg/detectors/zeplin/zeplin.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zerobounce/zerobounce.go b/pkg/detectors/zerobounce/zerobounce.go index 23dbd37a1355..07f279b2e8d1 100644 --- a/pkg/detectors/zerobounce/zerobounce.go +++ b/pkg/detectors/zerobounce/zerobounce.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zerotier/zerotier.go b/pkg/detectors/zerotier/zerotier.go index 03433ed2d430..7d70b3065ffa 100644 --- a/pkg/detectors/zerotier/zerotier.go +++ b/pkg/detectors/zerotier/zerotier.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zipapi/zipapi.go b/pkg/detectors/zipapi/zipapi.go index 5eb877f7c9a7..fc7622b590a7 100644 --- a/pkg/detectors/zipapi/zipapi.go +++ b/pkg/detectors/zipapi/zipapi.go @@ -44,19 +44,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result pwordMatches := pwordPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmail := strings.TrimSpace(emailMatch[1]) for _, pwordMatch := range pwordMatches { - if len(pwordMatch) != 2 { - continue - } resPword := strings.TrimSpace(pwordMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zipbooks/zipbooks.go b/pkg/detectors/zipbooks/zipbooks.go index c1651f8e9ba0..5688b0d6d13d 100644 --- a/pkg/detectors/zipbooks/zipbooks.go +++ b/pkg/detectors/zipbooks/zipbooks.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result pwordMatches := pwordPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, pwordMatch := range pwordMatches { - if len(pwordMatch) != 2 { - continue - } resPword := strings.TrimSpace(pwordMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zipcodeapi/zipcodeapi.go b/pkg/detectors/zipcodeapi/zipcodeapi.go index f0f47802eddf..3c0baa180495 100644 --- a/pkg/detectors/zipcodeapi/zipcodeapi.go +++ b/pkg/detectors/zipcodeapi/zipcodeapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zipcodebase/zipcodebase.go b/pkg/detectors/zipcodebase/zipcodebase.go index 3aea7b32b5a3..f995233e0788 100644 --- a/pkg/detectors/zipcodebase/zipcodebase.go +++ b/pkg/detectors/zipcodebase/zipcodebase.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zonkafeedback/zonkafeedback.go b/pkg/detectors/zonkafeedback/zonkafeedback.go index 1379656d0526..863d46240b56 100644 --- a/pkg/detectors/zonkafeedback/zonkafeedback.go +++ b/pkg/detectors/zonkafeedback/zonkafeedback.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zulipchat/zulipchat.go b/pkg/detectors/zulipchat/zulipchat.go index c7980d73d177..943bd834bd7f 100644 --- a/pkg/detectors/zulipchat/zulipchat.go +++ b/pkg/detectors/zulipchat/zulipchat.go @@ -44,9 +44,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { @@ -54,9 +51,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result resIdMatch := strings.TrimSpace(idMatch[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainMatch[1])