From 0b3a04ab14a75cc4e1ce28f986aa2b6f93ae65df Mon Sep 17 00:00:00 2001 From: David Roe Date: Wed, 29 May 2024 12:30:55 +0100 Subject: [PATCH] chore: make engine pluggable --- .envrc.example | 2 +- cmd/bearer/bearer.go | 10 +- e2e/flags/report_flags_test.go | 2 +- external/run/run.go | 97 ++++ internal/commands/process/settings/regexp.go | 26 - .../commands/process/settings/ruleLoader.go | 142 ----- .../process/settings/ruleValidator.go | 68 --- internal/commands/process/settings/rules.go | 485 ------------------ .../TestJavascriptJWT--jwt_insecure.yml | 2 - .../lang/jwt/testdata/jwt_insecure.js | 11 - .../TestRubyLangWeakEncryption--sha1.yml | 44 -- .../lang/weak_encryption/testdata/sha1.rb | 1 - .../report/output/testhelper/testhelper.go | 28 - .../schema/schemahelper/schemahelper.go | 11 - .../classification/classification.go | 16 +- .../classification/db/category_grouping.json | 0 .../db/data_categories/authenticating.json | 0 .../behavioral_information.json | 0 .../db/data_categories/communication.json | 0 .../db/data_categories/computer_device.json | 0 .../db/data_categories/contact.json | 0 .../db/data_categories/credit_history.json | 0 .../db/data_categories/criminal_records.json | 0 .../db/data_categories/demographic.json | 0 .../db/data_categories/ethnicity.json | 0 .../db/data_categories/family.json | 0 .../data_categories/financial_accounts.json | 0 .../db/data_categories/identification.json | 0 .../data_categories/knowledge_and_belief.json | 0 .../db/data_categories/location.json | 0 .../data_categories/medical_and_health.json | 0 .../data_categories/personal_ownership.json | 0 .../physical_characteristic.json | 0 .../db/data_categories/preference.json | 0 .../professional_information.json | 0 .../db/data_categories/public_life.json | 0 .../db/data_categories/sexual.json | 0 .../db/data_categories/social_network.json | 0 .../db/data_categories/transactional.json | 0 .../100_telephone_number.json | 0 .../101_geographic.json | 0 .../102_transactions.json | 0 .../103_browser_fingerprint.json | 0 .../104_emails.json | 0 .../105_links_clicked.json | 0 .../106_race.json | 0 .../107_conversation.json | 0 .../108_vaccine.json | 0 .../109_question.json | 0 .../10_charges.json | 0 .../110_answer.json | 0 .../111_click.json | 0 .../112_tracking.json | 0 .../113_cart.json | 0 .../114_payment.json | 0 .../115_order.json | 0 .../116_purchase.json | 0 .../117_token.json | 0 .../118_invoice.json | 0 .../119_access_token.json | 0 .../11_pardons.json | 0 .../120_billing.json | 0 .../121_bank_transfer.json | 0 .../122_creditcard.json | 0 .../123_paystub.json | 0 .../124_subscription.json | 0 .../125_exam.json | 0 .../126_appointment.json | 0 .../127_consultation.json | 0 .../128_document.json | 0 .../129_file.json | 0 .../12_driving_license.json | 0 .../130_content.json | 0 .../131_device.json | 0 .../132_identification.json | 0 .../133_earning.json | 0 .../134_credentials.json | 0 .../135_message.json | 0 .../136_rating.json | 0 .../137_review.json | 0 .../138_voice.json | 0 .../139_amount.json | 0 .../13_device_identifier.json | 0 .../140_comment.json | 0 .../142_fullname.json | 0 .../143_unique_identifier.json | 0 .../144_disease.json | 0 .../145_genetic.json | 0 .../146_lab_test_results.json | 0 .../147_health_insurance_number.json | 0 .../148_insurance.json | 0 .../149_test.json | 0 .../14_ethnic_origin.json | 0 .../150_medical_conditions.json | 0 .../151_treatment.json | 0 .../152_scan.json | 0 .../153_medication.json | 0 .../154_phi_dates.json | 0 .../155_diagnosis.json | 0 .../156_procedures.json | 0 .../157_risk_assessments.json | 0 .../158_allergies.json | 0 .../159_health_insurance_claim_number.json | 0 .../15_national_origin.json | 0 .../160_health_provider.json | 0 .../161_vital_signs.json | 0 .../162_blood_pressure.json | 0 .../163_bmi.json | 0 .../165_tomography.json | 0 .../166_physical_activity.json | 0 .../167_x-ray.json | 0 .../168_concerns.json | 0 .../169_hospital_admission_date.json | 0 .../16_biometric_data.json | 0 .../170_hospital_discharge_date.json | 0 .../171_cancer.json | 0 .../172_colonoscopy.json | 0 .../173_cholesterol_measurement.json | 0 .../174_blood_glucose.json | 0 .../175_high_low_density_lipoproteins.json | 0 .../176_asthma.json | 0 .../177_hiv.json | 0 .../178_flu.json | 0 .../179_giardiasis.json | 0 .../17_bank_account.json | 0 .../180_diphtheria.json | 0 .../181_pneumonia.json | 0 .../182_tuberculosis.json | 0 .../183_hypertension.json | 0 .../184_illness.json | 0 .../185_therapy.json | 0 .../186_procedure.json | 0 .../187_feedback.json | 0 .../188_agenda.json | 0 .../189_contraception.json | 0 .../18_mothers_maiden_name.json | 0 .../190_physiotherapy.json | 0 .../191_pregnancy.json | 0 .../192_message.json | 0 .../193_symptom.json | 0 .../194_signature.json | 0 .../195_replies.json | 0 .../196_post.json | 0 .../197_purchases.json | 0 .../198_comment.json | 0 .../19_passport_number.json | 0 .../1_email_address.json | 0 .../20_cars.json | 0 .../21_national_identity_number.json | 0 .../22_telephone_recordings.json | 0 .../23_voice_mail.json | 0 .../24_personal_health_history.json | 0 .../25_family_health_history.json | 0 .../26_health_records.json | 0 .../27_disabilities.json | 0 .../28_drugs_test_results.json | 0 .../29_blood_type.json | 0 .../2_email_address.json | 0 .../30_dna_code.json | 0 .../31_prescriptions.json | 0 .../32_place_of_birth.json | 0 .../33_divorces.json | 0 .../34_marriages.json | 0 .../35_friends.json | 0 .../36_martial_status.json | 0 .../37_social_status.json | 0 .../38_student_number.json | 0 .../39_taxpayer_number.json | 0 .../3_age_range.json | 0 .../40_social_security_number.json | 0 .../41_sexual_preferences.json | 0 .../42_sexual_history.json | 0 .../43_disciplinary_actions.json | 0 .../44_interviews.json | 0 .../45_job_titles.json | 0 .../46_work_history.json | 0 .../47_employment_history.json | 0 .../48_salary.json | 0 .../49_certifications.json | 0 .../4_physical_address.json | 0 .../50_group_membership.json | 0 .../51_acquaintances.json | 0 .../52_opinion.json | 0 .../53_favorite_foods.json | 0 .../54_religious_beliefs.json | 0 .../55_philosophical_beliefs.json | 0 .../56_vehicle_registration_number.json | 0 .../57_browsing_behavior.json | 0 .../58_call_logs.json | 0 .../59_links_clicked.json | 0 .../5_country.json | 0 .../60_date_of_birth.json | 0 .../61_date_of_birth.json | 0 .../62_spoken_languages.json | 0 .../63_spoken_languages.json | 0 .../64_accents.json | 0 .../65_race.json | 0 .../66_credit.json | 0 .../67_loan_records.json | 0 .../68_gender_identity.json | 0 .../69_gender.json | 0 .../6_credit_card_number.json | 0 .../70_political_affiliation.json | 0 .../71_religion.json | 0 .../72_interactions.json | 0 .../73_general_reputation.json | 0 .../74_intentions.json | 0 .../75_interests.json | 0 .../76_likes.json | 0 .../77_dislikes.json | 0 .../78_attitude.json | 0 .../79_physical_address.json | 0 .../7_credit_records.json | 0 .../80_id_number.json | 0 .../82_ip_address.json | 0 .../83_mac_address.json | 0 .../84_mac_address.json | 0 .../85_firstname.json | 0 .../86_firstname.json | 0 .../87_lastname.json | 0 .../88_lastname.json | 0 .../8_credit_capacity.json | 0 .../90_fullname.json | 0 .../91_username.json | 0 .../92_physical_and_mental_health.json | 0 .../93_physical_and_mental_health.json | 0 .../94_family_structure.json | 0 .../95_siblings.json | 0 .../96_image.json | 0 .../97_income_brackets.json | 0 .../98_purchases_and_spending_habits.json | 0 .../99_passwords.json | 0 .../9_convictions.json | 0 .../classification/db/data_types/accents.json | 0 .../db/data_types/acquaintances.json | 0 .../classification/db/data_types/age.json | 0 .../db/data_types/age_range.json | 0 .../db/data_types/apartments.json | 0 .../db/data_types/associations.json | 0 .../db/data_types/attitude.json | 0 .../db/data_types/bank_account.json | 0 .../db/data_types/biometric_data.json | 0 .../db/data_types/blood_type.json | 0 .../db/data_types/browser_fingerprint.json | 0 .../db/data_types/browsing_behavior.json | 0 .../db/data_types/call_logs.json | 0 .../classification/db/data_types/cars.json | 0 .../db/data_types/certifications.json | 0 .../db/data_types/character.json | 0 .../classification/db/data_types/charges.json | 0 .../classification/db/data_types/colors.json | 0 .../db/data_types/connections.json | 0 .../db/data_types/convictions.json | 0 .../classification/db/data_types/country.json | 0 .../classification/db/data_types/credit.json | 0 .../db/data_types/credit_capacity.json | 0 .../db/data_types/credit_card_number.json | 0 .../db/data_types/credit_records.json | 0 .../db/data_types/credit_standing.json | 0 .../db/data_types/credit_worthiness.json | 0 .../db/data_types/date_of_birth.json | 0 .../db/data_types/demeanor.json | 0 .../db/data_types/device_identifier.json | 0 .../db/data_types/disabilities.json | 0 .../db/data_types/disciplinary_actions.json | 0 .../db/data_types/dislikes.json | 0 .../db/data_types/divorces.json | 0 .../db/data_types/dna_code.json | 0 .../db/data_types/drugs_test_results.json | 0 .../db/data_types/email_address.json | 0 .../classification/db/data_types/emails.json | 0 .../db/data_types/employee_files.json | 0 .../db/data_types/employment_history.json | 0 .../db/data_types/ethnic_origin.json | 0 .../db/data_types/evaluations.json | 0 .../db/data_types/family_health_history.json | 0 .../db/data_types/family_structure.json | 0 .../db/data_types/favorite_foods.json | 0 .../db/data_types/firstname.json | 0 .../classification/db/data_types/friends.json | 0 .../db/data_types/fullname.json | 0 .../classification/db/data_types/gender.json | 0 .../db/data_types/gender_identity.json | 0 .../db/data_types/general_reputation.json | 0 .../db/data_types/geographic.json | 0 .../db/data_types/gps_coordinate.json | 0 .../db/data_types/group_membership.json | 0 .../db/data_types/hair_color.json | 0 .../db/data_types/health_records.json | 0 .../classification/db/data_types/height.json | 0 .../classification/db/data_types/houses.json | 0 .../db/data_types/id_number.json | 0 .../classification/db/data_types/image.json | 0 .../classification/db/data_types/income.json | 0 .../db/data_types/income_brackets.json | 0 .../db/data_types/intentions.json | 0 .../db/data_types/interactions.json | 0 .../db/data_types/interests.json | 0 .../db/data_types/interviews.json | 0 .../db/data_types/ip_address.json | 0 .../db/data_types/job_titles.json | 0 .../db/data_types/knowledge.json | 0 .../db/data_types/lastname.json | 0 .../classification/db/data_types/likes.json | 0 .../db/data_types/links_clicked.json | 0 .../db/data_types/loan_records.json | 0 .../db/data_types/mac_address.json | 0 .../db/data_types/marriages.json | 0 .../db/data_types/martial_status.json | 0 .../db/data_types/mother_maiden_name.json | 0 .../classification/db/data_types/music.json | 0 .../db/data_types/national_origin.json | 0 .../db/data_types/offspring.json | 0 .../db/data_types/opinions.json | 0 .../classification/db/data_types/pardons.json | 0 .../db/data_types/passport_number.json | 0 .../db/data_types/passwords.json | 0 .../data_types/personal_health_history.json | 0 .../db/data_types/personal_possessions.json | 0 .../db/data_types/philosophical_beliefs.json | 0 .../db/data_types/physical_address.json | 0 .../physical_and_mental_health.json | 0 .../db/data_types/physical_traits.json | 0 .../db/data_types/piercings.json | 0 .../classification/db/data_types/pin.json | 0 .../db/data_types/political_affiliation.json | 0 .../db/data_types/prescriptions.json | 0 .../db/data_types/purchases.json | 0 .../purchases_and_spending_habits.json | 0 .../classification/db/data_types/race.json | 0 .../db/data_types/references.json | 0 .../db/data_types/relationships.json | 0 .../db/data_types/religion.json | 0 .../db/data_types/religious_beliefs.json | 0 .../db/data_types/room_number.json | 0 .../classification/db/data_types/salary.json | 0 .../classification/db/data_types/sales.json | 0 .../db/data_types/school_attended.json | 0 .../db/data_types/sexual_history.json | 0 .../db/data_types/sexual_preferences.json | 0 .../db/data_types/siblings.json | 0 .../db/data_types/skin_tone.json | 0 .../db/data_types/social_status.json | 0 .../db/data_types/spoken_languages.json | 0 .../classification/db/data_types/tattoos.json | 0 .../classification/db/data_types/taxes.json | 0 .../db/data_types/telephone_number.json | 0 .../db/data_types/telephone_recordings.json | 0 .../db/data_types/thoughts.json | 0 .../db/data_types/transactions.json | 0 .../db/data_types/unique_identifier.json | 0 .../db/data_types/username.json | 0 .../db/data_types/voice_mail.json | 0 .../classification/db/data_types/weight.json | 0 .../db/data_types/work_history.json | 0 {internal => pkg}/classification/db/db.go | 4 +- .../known_person_object_patterns/account.json | 0 .../known_person_object_patterns/advisor.json | 0 .../applicant.json | 0 .../known_person_object_patterns/artist.json | 0 .../attendee.json | 0 .../known_person_object_patterns/author.json | 0 .../bank_account.json | 0 .../beneficiar.json | 0 .../known_person_object_patterns/buyer.json | 0 .../known_person_object_patterns/caller.json | 0 .../candidate.json | 0 .../cardholder.json | 0 .../known_person_object_patterns/client.json | 0 .../known_person_object_patterns/coach.json | 0 .../collaborator.json | 0 .../commenter.json | 0 .../committer.json | 0 .../competitor.json | 0 .../consumer.json | 0 .../known_person_object_patterns/contact.json | 0 .../contractor.json | 0 .../contributor.json | 0 .../credentials.json | 0 .../customer.json | 0 .../developer.json | 0 .../known_person_object_patterns/doctor.json | 0 .../known_person_object_patterns/driver.json | 0 .../employee.json | 0 .../employer.json | 0 .../follower.json | 0 .../guardian.json | 0 .../identity.json | 0 .../known_person_object_patterns/insuree.json | 0 .../known_person_object_patterns/invitee.json | 0 .../known_person_object_patterns/issuer.json | 0 .../landlord.json | 0 .../db/known_person_object_patterns/lead.json | 0 .../known_person_object_patterns/learner.json | 0 .../known_person_object_patterns/login.json | 0 .../known_person_object_patterns/member.json | 0 .../known_person_object_patterns/mentor.json | 0 .../moderator.json | 0 .../organizer.json | 0 .../known_person_object_patterns/owner.json | 0 .../panelist.json | 0 .../participant.json | 0 .../known_person_object_patterns/partner.json | 0 .../passenger.json | 0 .../known_person_object_patterns/patient.json | 0 .../known_person_object_patterns/payee.json | 0 .../known_person_object_patterns/payer.json | 0 .../known_person_object_patterns/payor.json | 0 .../known_person_object_patterns/people.json | 0 .../known_person_object_patterns/person.json | 0 .../known_person_object_patterns/player.json | 0 .../known_person_object_patterns/profile.json | 0 .../known_person_object_patterns/reader.json | 0 .../receiver.json | 0 .../recipient.json | 0 .../known_person_object_patterns/recruit.json | 0 .../known_person_object_patterns/referee.json | 0 .../known_person_object_patterns/referer.json | 0 .../registrant.json | 0 .../known_person_object_patterns/seller.json | 0 .../known_person_object_patterns/sender.json | 0 .../shareholder.json | 0 .../known_person_object_patterns/shopper.json | 0 .../known_person_object_patterns/signer.json | 0 .../known_person_object_patterns/student.json | 0 .../subscriber.json | 0 .../supplier.json | 0 .../known_person_object_patterns/teacher.json | 0 .../known_person_object_patterns/trainer.json | 0 .../db/known_person_object_patterns/user.json | 0 .../known_person_object_patterns/veteran.json | 0 .../volunteer.json | 0 .../known_person_object_patterns/winner.json | 0 .../db/recipes/abbyy_cloud_ocr_sdk.json | 0 .../classification/db/recipes/abtasty.json | 0 .../db/recipes/active_directory.json | 0 .../db/recipes/activecampaign.json | 0 .../classification/db/recipes/adictiz.json | 0 .../classification/db/recipes/adjust.json | 0 .../db/recipes/adobe_campaign_neolane.json | 0 .../db/recipes/adobe_scene7.json | 0 .../classification/db/recipes/adotmob.json | 0 .../classification/db/recipes/adroll.json | 0 .../classification/db/recipes/adyen.json | 0 .../classification/db/recipes/aerospike.json | 0 .../classification/db/recipes/airbrake.json | 0 .../classification/db/recipes/airtable.json | 0 .../classification/db/recipes/alexa_com.json | 0 .../classification/db/recipes/algolia.json | 0 .../db/recipes/alibaba_cloud_apis.json | 0 .../classification/db/recipes/alloy.json | 0 .../classification/db/recipes/almerys.json | 0 .../classification/db/recipes/alpaca.json | 0 .../db/recipes/amazon_aws_apis.json | 0 .../classification/db/recipes/ambassador.json | 0 .../db/recipes/amc_theater.json | 0 .../classification/db/recipes/ameli.json | 0 .../classification/db/recipes/amplitude.json | 0 .../db/recipes/apache_airflow.json | 0 .../db/recipes/apache_beam.json | 0 .../db/recipes/apache_hbase.json | 0 .../db/recipes/apache_kafka.json | 0 .../db/recipes/apache_spark.json | 0 .../db/recipes/apollographql.json | 0 .../classification/db/recipes/appbase.json | 0 .../db/recipes/appdynamics.json | 0 .../classification/db/recipes/apple.json | 0 .../classification/db/recipes/apple_pay.json | 0 .../classification/db/recipes/appveyor.json | 0 .../classification/db/recipes/aquasec.json | 0 .../classification/db/recipes/asana.json | 0 .../classification/db/recipes/assurcard.json | 0 .../db/recipes/athos_worldline.json | 0 .../classification/db/recipes/atinternet.json | 0 .../db/recipes/atlassian_cloud.json | 0 .../classification/db/recipes/auth0.json | 0 .../classification/db/recipes/aws_athena.json | 0 .../db/recipes/aws_dynamodb.json | 0 .../aws_key_management_service_kms.json | 0 .../db/recipes/aws_kinesis.json | 0 .../db/recipes/aws_redshift.json | 0 .../classification/db/recipes/aws_s3.json | 0 .../db/recipes/aws_s3_glacier.json | 0 .../classification/db/recipes/aws_sqs.json | 0 .../db/recipes/azure_cognitive_search.json | 0 .../db/recipes/azure_cosmos_db.json | 0 .../db/recipes/azure_key_vault.json | 0 .../db/recipes/azure_service_bus.json | 0 .../db/recipes/azure_storage.json | 0 .../classification/db/recipes/badgerdb.json | 0 .../classification/db/recipes/bamboohr.json | 0 .../classification/db/recipes/bambuser.json | 0 .../db/recipes/bank_of_apis_natwest_rbs.json | 0 .../classification/db/recipes/barclays.json | 0 .../classification/db/recipes/basecamp.json | 0 .../db/recipes/bigcommerce.json | 0 .../db/recipes/bintray_jfrog.json | 0 .../classification/db/recipes/bitbucket.json | 0 .../classification/db/recipes/bitly.json | 0 .../classification/db/recipes/bitrise.json | 0 .../classification/db/recipes/blackfire.json | 0 .../classification/db/recipes/boltdb.json | 0 .../classification/db/recipes/box.json | 0 .../classification/db/recipes/braze.json | 0 .../classification/db/recipes/brightbox.json | 0 .../db/recipes/browserstack.json | 0 .../classification/db/recipes/bugsnag.json | 0 .../classification/db/recipes/buntdb.json | 0 .../classification/db/recipes/calendly.json | 0 .../classification/db/recipes/cashplus.json | 0 .../classification/db/recipes/cassandara.json | 0 .../classification/db/recipes/centrify.json | 0 .../classification/db/recipes/chargebee.json | 0 .../classification/db/recipes/chargify.json | 0 .../db/recipes/checkout_com.json | 0 .../classification/db/recipes/circleci.json | 0 .../classification/db/recipes/cirrus_ci.json | 0 .../classification/db/recipes/clearbit.json | 0 .../classification/db/recipes/clickhouse.json | 0 .../classification/db/recipes/clickup.json | 0 .../classification/db/recipes/clodo.json | 0 .../classification/db/recipes/cloudflare.json | 0 .../classification/db/recipes/cloudinary.json | 0 .../classification/db/recipes/cloudwatch.json | 0 .../db/recipes/cockroachdb.json | 0 .../db/recipes/companies_house_gov_uk.json | 0 .../db/recipes/complyadvantage.json | 0 .../classification/db/recipes/contentful.json | 0 .../db/recipes/cookiebot_com.json | 0 .../classification/db/recipes/copper.json | 0 .../classification/db/recipes/couchbase.json | 0 .../classification/db/recipes/crmgang.json | 0 .../classification/db/recipes/customer.json | 0 .../classification/db/recipes/dalenys.json | 0 .../classification/db/recipes/databricks.json | 0 .../classification/db/recipes/datadog.json | 0 .../classification/db/recipes/datadome.json | 0 .../classification/db/recipes/debounce.json | 0 .../db/recipes/demdex_adobe.json | 0 .../db/recipes/digitalocean.json | 0 .../db/recipes/digitalocean_apis.json | 0 .../classification/db/recipes/discord.json | 0 .../classification/db/recipes/disk.json | 0 .../classification/db/recipes/dmp.json | 0 .../classification/db/recipes/dnsimple.json | 0 .../db/recipes/dnsmadeeasy.json | 0 .../classification/db/recipes/docusign.json | 0 .../db/recipes/dossier_pharmaceutique.json | 0 .../classification/db/recipes/dreamhost.json | 0 .../classification/db/recipes/drift.json | 0 .../classification/db/recipes/dropbox.json | 0 .../db/recipes/dropcontact.json | 0 .../classification/db/recipes/dyn_oracle.json | 0 .../classification/db/recipes/easypost.json | 0 .../classification/db/recipes/edgecast.json | 0 .../classification/db/recipes/elastic.json | 0 .../db/recipes/elasticsearch.json | 0 .../classification/db/recipes/emburse.json | 0 .../classification/db/recipes/enboarder.json | 0 .../classification/db/recipes/envoy.json | 0 .../db/recipes/esante_gouv.json | 0 .../classification/db/recipes/essendex.json | 0 .../classification/db/recipes/etcd.json | 0 .../db/recipes/exoscale_cloud_apis.json | 0 .../classification/db/recipes/expensify.json | 0 .../classification/db/recipes/facebook.json | 0 .../classification/db/recipes/fauna.json | 0 .../classification/db/recipes/firebase.json | 0 .../classification/db/recipes/firebird.json | 0 .../classification/db/recipes/fluentd.json | 0 .../db/recipes/forestadmin.json | 0 .../classification/db/recipes/fountain.json | 0 .../db/recipes/france_billet.json | 0 .../classification/db/recipes/freshworks.json | 0 .../classification/db/recipes/front.json | 0 .../classification/db/recipes/ftp_sftp.json | 0 .../classification/db/recipes/galileo.json | 0 .../classification/db/recipes/gandi.json | 0 .../classification/db/recipes/geckoboard.json | 0 .../classification/db/recipes/gfycat.json | 0 .../classification/db/recipes/gitea.json | 0 .../classification/db/recipes/github.json | 0 .../classification/db/recipes/gitlab.json | 0 .../classification/db/recipes/glesys.json | 0 .../classification/db/recipes/gocardless.json | 0 .../classification/db/recipes/google_ads.json | 0 .../db/recipes/google_analytics.json | 0 .../db/recipes/google_cloud_apis.json | 0 .../db/recipes/google_cloud_bigquery.json | 0 .../db/recipes/google_cloud_bigtable.json | 0 .../db/recipes/google_cloud_dataflow.json | 0 .../db/recipes/google_cloud_datastore.json | 0 .../db/recipes/google_cloud_firestore.json | 0 .../recipes/google_cloud_key_management.json | 0 .../db/recipes/google_cloud_pub_sub.json | 0 .../recipes/google_cloud_secret_manager.json | 0 .../db/recipes/google_cloud_spanner.json | 0 .../db/recipes/google_cloud_storage.json | 0 .../db/recipes/google_maps.json | 0 .../db/recipes/google_recaptcha.json | 0 .../db/recipes/google_service_apis.json | 0 .../db/recipes/google_spreadsheets.json | 0 .../db/recipes/google_tag_manager.json | 0 .../db/recipes/google_workspace_apis.json | 0 .../db/recipes/gouv_fr_data.json | 0 .../classification/db/recipes/gravatar.json | 0 .../db/recipes/gravity_payments.json | 0 .../classification/db/recipes/greenhouse.json | 0 .../db/recipes/hashicorp_vault.json | 0 .../db/recipes/have_i_been_pwned.json | 0 .../classification/db/recipes/heap.json | 0 .../classification/db/recipes/hellosign.json | 0 .../classification/db/recipes/heroku.json | 0 .../classification/db/recipes/hiscox.json | 0 .../db/recipes/hmrc_gov_uk.json | 0 .../db/recipes/honeybadger.json | 0 .../classification/db/recipes/hotjar.json | 0 .../classification/db/recipes/hubspot.json | 0 .../db/recipes/hugging_face.json | 0 .../classification/db/recipes/hunter.json | 0 .../classification/db/recipes/hypersql.json | 0 .../classification/db/recipes/iagility.json | 0 .../classification/db/recipes/iban.json | 0 .../classification/db/recipes/ibm_db2.json | 0 .../db/recipes/iceberg_technology.json | 0 .../classification/db/recipes/influxdb.json | 0 .../classification/db/recipes/instagram.json | 0 .../classification/db/recipes/instana.json | 0 .../classification/db/recipes/intercom.json | 0 .../classification/db/recipes/intuit.json | 0 .../classification/db/recipes/ipdata.json | 0 .../classification/db/recipes/ipify_org.json | 0 .../classification/db/recipes/ipregistry.json | 0 .../classification/db/recipes/iproov.json | 0 .../classification/db/recipes/ipstack.json | 0 .../db/recipes/iris_openbooks_freeagent.json | 0 .../db/recipes/izberg_marketplace.json | 0 .../classification/db/recipes/jfrog.json | 0 .../classification/db/recipes/jsdelivr.json | 0 .../classification/db/recipes/jumio.json | 0 .../classification/db/recipes/klarna.json | 0 .../classification/db/recipes/la_poste.json | 0 .../db/recipes/launchdarkly.json | 0 .../classification/db/recipes/lengow.json | 0 .../db/recipes/lets_enhance.json | 0 .../classification/db/recipes/leveldb.json | 0 .../classification/db/recipes/lever.json | 0 .../classification/db/recipes/lightstep.json | 0 .../classification/db/recipes/linkedin.json | 0 .../db/recipes/liquid_web_cloud_apis.json | 0 .../classification/db/recipes/logrocket.json | 0 .../classification/db/recipes/logz_io.json | 0 .../classification/db/recipes/mabaya.json | 0 .../classification/db/recipes/mailchimp.json | 0 .../classification/db/recipes/mailjet.json | 0 .../classification/db/recipes/mangopay.json | 0 .../classification/db/recipes/mapbox.json | 0 .../classification/db/recipes/mariadb.json | 0 .../classification/db/recipes/marketo.json | 0 .../classification/db/recipes/maxmind.json | 0 .../classification/db/recipes/memcached.json | 0 .../db/recipes/message_bus.json | 0 .../classification/db/recipes/mettle.json | 0 .../classification/db/recipes/microsoft.json | 0 .../db/recipes/microsoft_azure_apis.json | 0 .../db/recipes/microsoft_sql_server.json | 0 .../db/recipes/microsoft_teams.json | 0 .../classification/db/recipes/mirakl.json | 0 .../classification/db/recipes/mixpanel.json | 0 .../classification/db/recipes/monday.json | 0 .../db/recipes/mondial_relay.json | 0 .../classification/db/recipes/mongodb.json | 0 .../classification/db/recipes/mux.json | 0 .../classification/db/recipes/mysql.json | 0 .../classification/db/recipes/name_com.json | 0 .../classification/db/recipes/namesilo.json | 0 .../db/recipes/nativex_mobvista.json | 0 .../classification/db/recipes/neo4j.json | 0 .../db/recipes/nethunt_crm.json | 0 .../classification/db/recipes/netlify.json | 0 .../classification/db/recipes/new_relic.json | 0 .../classification/db/recipes/nightfall.json | 0 .../classification/db/recipes/nimble.json | 0 .../classification/db/recipes/nodemailer.json | 0 .../classification/db/recipes/nuxeo.json | 0 .../classification/db/recipes/nylas.json | 0 .../classification/db/recipes/ocrolus.json | 0 .../classification/db/recipes/okta.json | 0 .../classification/db/recipes/oney.json | 0 .../classification/db/recipes/onfido.json | 0 .../classification/db/recipes/openai.json | 0 .../db/recipes/openstack_object_storage.json | 0 .../classification/db/recipes/opentok.json | 0 .../db/recipes/openweather.json | 0 .../classification/db/recipes/optimizely.json | 0 .../classification/db/recipes/oracle.json | 0 .../db/recipes/ovh_cloud_apis.json | 0 .../recipes/ozone_open_banking_sandbox.json | 0 .../classification/db/recipes/pagerduty.json | 0 .../classification/db/recipes/pandadoc.json | 0 .../classification/db/recipes/payfit.json | 0 .../classification/db/recipes/payline.json | 0 .../classification/db/recipes/paylocity.json | 0 .../classification/db/recipes/payoneer.json | 0 .../classification/db/recipes/paypal.json | 0 .../classification/db/recipes/payu.json | 0 .../classification/db/recipes/phrase.json | 0 .../classification/db/recipes/pipedrive.json | 0 .../classification/db/recipes/pipeliner.json | 0 .../classification/db/recipes/plaid.json | 0 .../classification/db/recipes/porkbun.json | 0 .../classification/db/recipes/postgresql.json | 0 .../classification/db/recipes/posthog.json | 0 .../classification/db/recipes/postmark.json | 0 .../classification/db/recipes/prestashop.json | 0 .../classification/db/recipes/processout.json | 0 .../db/recipes/profitbricks_ionos.json | 0 .../classification/db/recipes/prometheus.json | 0 .../classification/db/recipes/pubnub.json | 0 .../classification/db/recipes/pusher.json | 0 .../classification/db/recipes/quanta.json | 0 .../classification/db/recipes/rabbitmq.json | 0 .../db/recipes/rackspace_cloud.json | 0 .../classification/db/recipes/raygun.json | 0 .../classification/db/recipes/reddit.json | 0 .../classification/db/recipes/redis.json | 0 .../db/recipes/reportportal.json | 0 .../classification/db/recipes/rethinkdb.json | 0 .../classification/db/recipes/revolut.json | 0 .../db/recipes/rocket_chat.json | 0 .../classification/db/recipes/rollbar.json | 0 .../classification/db/recipes/runscope.json | 0 .../classification/db/recipes/rydoo.json | 0 .../classification/db/recipes/sage.json | 0 .../classification/db/recipes/sakura.json | 0 .../classification/db/recipes/salesforce.json | 0 .../classification/db/recipes/sap.json | 0 .../classification/db/recipes/sap_hana.json | 0 .../classification/db/recipes/satismeter.json | 0 .../db/recipes/scaleway_cloud_apis.json | 0 .../classification/db/recipes/scalia_ci.json | 0 .../classification/db/recipes/scout_apm.json | 0 .../db/recipes/seeuletter_mysendingbox.json | 0 .../classification/db/recipes/segment.json | 0 .../classification/db/recipes/selligent.json | 0 .../classification/db/recipes/sendbird.json | 0 .../classification/db/recipes/sendgrid.json | 0 .../classification/db/recipes/sendinblue.json | 0 .../classification/db/recipes/sentry.json | 0 .../classification/db/recipes/shipbob.json | 0 .../classification/db/recipes/shopify.json | 0 .../classification/db/recipes/skyscanner.json | 0 .../classification/db/recipes/slack.json | 0 .../db/recipes/small_improvements.json | 0 .../classification/db/recipes/smb.json | 0 .../classification/db/recipes/snowflake.json | 0 .../db/recipes/societeinfo.json | 0 .../classification/db/recipes/socket_io.json | 0 .../db/recipes/softlayer_ibm_cloud.json | 0 .../db/recipes/solocal_bridge.json | 0 .../classification/db/recipes/splunk.json | 0 .../classification/db/recipes/sqlite.json | 0 .../db/recipes/sqreen_datadog.json | 0 .../classification/db/recipes/square.json | 0 .../classification/db/recipes/stackify.json | 0 .../classification/db/recipes/statuspage.json | 0 .../classification/db/recipes/stripe.json | 0 .../classification/db/recipes/tanker.json | 0 .../classification/db/recipes/telegram.json | 0 .../db/recipes/tencent_cloud_apis.json | 0 .../db/recipes/thunes_limonethik.json | 0 .../classification/db/recipes/tide.json | 0 .../classification/db/recipes/tidelift.json | 0 .../classification/db/recipes/tradier.json | 0 .../db/recipes/trafficvance.json | 0 .../classification/db/recipes/travefy.json | 0 .../classification/db/recipes/travis_ci.json | 0 .../classification/db/recipes/treezor.json | 0 .../classification/db/recipes/trello.json | 0 .../classification/db/recipes/twilio.json | 0 .../classification/db/recipes/twitter.json | 0 .../classification/db/recipes/typeform.json | 0 .../db/recipes/unidentified_data_store.json | 0 .../classification/db/recipes/unsplash.json | 0 .../db/recipes/uploadecare.json | 0 .../classification/db/recipes/uptrends.json | 0 .../db/recipes/userlike_com.json | 0 .../classification/db/recipes/usersnap.json | 0 .../classification/db/recipes/vercel.json | 0 .../classification/db/recipes/vero.json | 0 .../db/recipes/victorops_splunk.json | 0 .../classification/db/recipes/vonage.json | 0 .../classification/db/recipes/wistia.json | 0 .../classification/db/recipes/wordnik.json | 0 .../classification/db/recipes/wordpress.json | 0 .../classification/db/recipes/workos.json | 0 .../classification/db/recipes/wrike.json | 0 .../classification/db/recipes/xero.json | 0 .../classification/db/recipes/xignite.json | 0 .../db/recipes/yandex_cloud_apis.json | 0 .../classification/db/recipes/yodlee.json | 0 .../classification/db/recipes/youtube.json | 0 .../classification/db/recipes/zapier.json | 0 .../classification/db/recipes/zendesk.json | 0 .../classification/db/recipes/zeplin.json | 0 .../classification/db/recipes/zoho.json | 0 .../classification/db/subject_mapping.json | 0 .../dependencies/dependencies.go | 8 +- .../dependencies/dependencies_test.go | 10 +- .../classification/frameworks/frameworks.go | 6 +- .../frameworks/frameworks_test.go | 20 +- .../classification/interfaces/interfaces.go | 10 +- .../interfaces/interfaces_test.go | 12 +- .../schema/.snapshots/TestCSharp | 0 .../schema/.snapshots/TestCSharpKPI | 0 .../classification/schema/.snapshots/TestGo | 0 .../schema/.snapshots/TestGoKPI | 0 .../classification/schema/.snapshots/TestJava | 0 .../schema/.snapshots/TestJavaKPI | 0 .../schema/.snapshots/TestJavascript | 0 .../schema/.snapshots/TestJavascriptKPI | 0 .../classification/schema/.snapshots/TestPHP | 0 .../schema/.snapshots/TestPHPKPI | 0 .../schema/.snapshots/TestPython | 0 .../schema/.snapshots/TestPythonKPI | 0 .../classification/schema/.snapshots/TestRuby | 0 .../schema/.snapshots/TestRubyKPI | 0 .../schema/.snapshots/TestTypescript | 0 .../schema/.snapshots/TestTypescriptKPI | 0 .../schema/fixtures/csharp.json | 0 .../classification/schema/fixtures/go.json | 0 .../classification/schema/fixtures/java.json | 0 .../schema/fixtures/javascript.json | 0 .../classification/schema/fixtures/php.json | 0 .../schema/fixtures/python.json | 0 .../classification/schema/fixtures/ruby.json | 0 .../schema/fixtures/typescript.json | 0 .../schema/internal/testhelper/testhelper.go | 6 +- .../classification/schema/kpi_test.go | 6 +- .../classification/schema/schema.go | 10 +- .../classification/schema/schema_test.go | 10 +- {internal => pkg}/commands/app.go | 5 +- {internal => pkg}/commands/artifact/run.go | 104 ++-- .../commands/artifact/run_test.go | 0 .../commands/artifact/scanid/scanid.go | 6 +- {internal => pkg}/commands/completion.go | 0 .../commands/debugprofile/debugprofile.go | 2 +- {internal => pkg}/commands/ignore.go | 8 +- {internal => pkg}/commands/init.go | 2 +- .../commands/process/filelist/filelist.go | 10 +- .../process/filelist/filelist_test.go | 8 +- .../commands/process/filelist/files/files.go | 2 +- .../process/filelist/ignore/ignore.go | 2 +- .../testdata/happy_path/skip/users/admin.go | 0 .../happy_path/skip/users/minifiedJs.min.js | 0 .../testdata/happy_path/skip/users/users.go | 0 .../testdata/happy_path/standard/user.go | 0 .../process/filelist/timeout/timeout.go | 2 +- .../commands/process/gitrepository/context.go | 4 +- .../process/gitrepository/gitrepository.go | 12 +- .../process/orchestrator/orchestrator.go | 26 +- .../process/orchestrator/pool/pool.go | 12 +- .../process/orchestrator/pool/process.go | 14 +- .../process/orchestrator/work/work.go | 4 +- .../process/orchestrator/worker/worker.go | 18 +- .../process/settings/loader/loader.go | 78 +++ .../process/settings/policies/common.rego | 0 .../process/settings/policies/policies.go | 54 ++ .../process/settings/policies}/policies.yml | 8 +- .../settings/policies/privacy_report.rego | 0 .../settings/policies/risk_policy.rego | 0 .../settings/policies/verifier_policy.rego | 0 .../settings/processors/db_encrypted.rego | 0 .../process/settings/processors/processors.go | 23 + .../settings/processors/rails_encrypted.rego | 0 .../rules/built_in}/sql/lang/create_table.yml | 0 .../third_party/gitleaks/secret_detection.yml | 0 pkg/commands/process/settings/rules/loader.go | 242 +++++++++ pkg/commands/process/settings/rules/rules.go | 290 +++++++++++ .../process/settings/rules/validation.go | 204 ++++++++ .../commands/process/settings/settings.go | 263 ++-------- .../commands/processing_worker.go | 8 +- {internal => pkg}/commands/scan.go | 15 +- {internal => pkg}/commands/version.go | 6 +- .../.snapshots/TestDetectorReportDatabases | 0 {internal => pkg}/detectors/beego/beego.go | 14 +- .../detectors/beego/beego_test.go | 4 +- .../beego/testdata/beego/database.go | 0 .../beego/testdata/beego/database2.go | 0 .../detectors/beego/testdata/beego/go.mod | 0 .../detectors/beego/testdata/beego/main.go | 0 .../beego/testdata/go_not_beego/go.mod | 0 .../beego/testdata/go_not_beego/main.go | 0 .../detectors/beego/testdata/not_go/Gemfile | 0 .../.snapshots/TestDetectorReportDataTypes | 0 .../.snapshots/TestDetectorReportInterfaces | 0 {internal => pkg}/detectors/csharp/csharp.go | 22 +- .../detectors/csharp/csharp_test.go | 10 +- .../detectors/csharp/datatype/datatype.go | 16 +- .../csharp/testdata/datatypes/datatypes.cs | 0 .../csharp/testdata/project/config.cs | 0 .../detectors/csharp/testdata/project/urls.cs | 0 .../detectors/custom/config/config.go | 2 +- {internal => pkg}/detectors/custom/custom.go | 34 +- .../.snapshots/TestDependenciesReport | 0 .../dependencies/buildgradle/buildgradle.go | 6 +- .../buildgradle/buildgradle_test.go | 4 +- .../dependencies/buildgradle/parser/parser.go | 6 +- .../.gradle/7.3.3/checksums/checksums.lock | Bin .../dependencies-accessors.lock | Bin .../dependencies-accessors/gc.properties | 0 .../.gradle/7.3.3/fileChanges/last-build.bin | Bin .../.gradle/7.3.3/fileHashes/fileHashes.lock | Bin .../testdata/.gradle/7.3.3/gc.properties | 0 .../testdata/.gradle/vcs-1/gc.properties | 0 .../buildgradle/testdata/build.gradle | 0 .../.snapshots/TestDependenciesReport | 0 .../dependencies/composerjson/composerjson.go | 8 +- .../composerjson/composerjson_test.go | 4 +- .../composerjson/testdata/composer.json | 0 .../.snapshots/TestDependenciesReport | 0 .../dependencies/composerlock/composerlock.go | 8 +- .../composerlock/composerlock_test.go | 4 +- .../composerlock/testdata/composer.lock | 0 .../detectors/dependencies/dependencies.go | 54 +- .../dependencies/depsbase/depsbase.go | 0 .../gemfile/.snapshots/TestDependenciesReport | 0 .../dependencies/gemfile/gemfile-lock.go | 6 +- .../dependencies/gemfile/gemfile-lock_test.go | 4 +- .../gemfile/testdata/Gemfile.lock | 0 .../gosum/.snapshots/TestDependenciesReport | 0 .../detectors/dependencies/gosum/go.go | 6 +- .../detectors/dependencies/gosum/go_test.go | 4 +- .../dependencies/gosum/testdata/go.sum | 0 .../ivy/.snapshots/TestDependenciesReport | 0 .../detectors/dependencies/ivy/ivy.go | 10 +- .../detectors/dependencies/ivy/ivy_test.go | 4 +- .../dependencies/ivy/testdata/ivy-report.xml | 0 .../.snapshots/TestDependenciesReport | 0 .../dependencies/mvnplugin/mvnplugin.go | 8 +- .../dependencies/mvnplugin/mvnplugin_test.go | 4 +- .../testdata/maven-dependencies.json | 0 .../npm/.snapshots/TestDependenciesReport | 0 .../detectors/dependencies/npm/npm.go | 8 +- .../detectors/dependencies/npm/npm_test.go | 4 +- .../npm/testdata/npm-shrinkwrap.json | 0 .../npm/testdata/package-lock.json | 0 .../nuget/.snapshots/TestDependenciesReport | 0 .../detectors/dependencies/nuget/nuget.go | 8 +- .../dependencies/nuget/nuget_test.go | 4 +- .../nuget/testdata/packages.lock.json | 0 .../.snapshots/TestDependenciesReport | 0 .../package-config/package-config.go | 10 +- .../package-config/package-config_test.go | 4 +- .../package-config/testdata/packages.config | 0 .../.snapshots/TestDependenciesReport | 0 .../dependencies/package-json/package-json.go | 8 +- .../package-json/package-json_test.go | 4 +- .../package-json/testdata/package.json | 0 .../.snapshots/TestDependenciesReport | 0 .../paket-dependencies/paket-dependencies.go | 6 +- .../paket-dependencies_test.go | 4 +- .../testdata/paket.dependencies | 0 .../.snapshots/TestDependenciesReport | 0 .../dependencies/pipdeptree/pipdeptree.go | 8 +- .../pipdeptree/pipdeptree_test.go | 4 +- .../pipdeptree/testdata/pipdeptree.json | 0 .../piplock/.snapshots/TestDependenciesReport | 0 .../detectors/dependencies/piplock/piplock.go | 8 +- .../dependencies/piplock/piplock_test.go | 4 +- .../piplock/testdata/Pipfile.lock | 0 .../poetry/.snapshots/TestDependenciesReport | 0 .../detectors/dependencies/poetry/poetry.go | 8 +- .../dependencies/poetry/poetry_test.go | 4 +- .../dependencies/poetry/testdata/poetry.lock | 0 .../pom-xml/.snapshots/TestDependenciesReport | 0 .../detectors/dependencies/pom-xml/pom-xml.go | 10 +- .../dependencies/pom-xml/pom-xml_test.go | 4 +- .../pom-xml/testdata/large-file/pom.xml | 0 .../dependencies/pom-xml/testdata/v1/pom.xml | 0 .../pom-xml/testdata/v2-iso/pom.xml | 0 .../dependencies/pom-xml/testdata/v2/pom.xml | 0 .../.snapshots/TestDependenciesReport | 0 .../dependencies/project-json/project-json.go | 8 +- .../project-json/project-json_test.go | 4 +- .../project-json/testdata/project.json | 0 .../.snapshots/TestDependenciesReport | 0 .../dependencies/pyproject/pyproject.go | 8 +- .../dependencies/pyproject/pyproject_test.go | 4 +- .../pyproject/testdata/pyproject.toml | 0 .../.snapshots/TestDependenciesReport | 0 .../dependencies/requirements/requirements.go | 6 +- .../requirements/requirements_test.go | 4 +- .../requirements/testdata/requirements.txt | 0 .../.snapshots/TestDependenciesReport | 0 .../dependencies/yarnlock/testdata/yarn.lock | 0 .../dependencies/yarnlock/yarnlock.go | 6 +- .../dependencies/yarnlock/yarnlock_test.go | 4 +- {internal => pkg}/detectors/detectors.go | 74 +-- .../.snapshots/TestDetectorReportDatabases | 0 {internal => pkg}/detectors/django/django.go | 12 +- .../detectors/django/django_test.go | 4 +- .../django/testdata/django/manage.py | 0 .../django/testdata/django/myapp/settings.py | 0 .../django/testdata/not_django/manage.py | 0 .../.snapshots/TestDetectorReportDbContexts | 0 {internal => pkg}/detectors/dotnet/dotnet.go | 12 +- .../detectors/dotnet/dotnet_test.go | 4 +- .../project/db_contexts/multiple/Startup.cs | 0 .../db_contexts/multiple/TodoApi.csproj | 0 .../db_contexts/multiple/nested/Startup.cs | 0 .../testdata/project/multiple/MvcMovie.csproj | 0 .../testdata/project/multiple/TodoApi.csproj | 0 .../testdata/project/single/TodoApi.csproj | 0 .../testdata/project/test/TodoApiTests.csproj | 0 .../.snapshots/TestDetectorReportVariables | 0 .../detectors/envfile/envfile.go | 16 +- .../detectors/envfile/envfile_test.go | 4 +- .../envfile/testdata/variables/.envrc.example | 0 .../gitleaks/.snapshots/TestSecretLeaks | 0 .../detectors/gitleaks/gitlab_config.toml | 0 .../detectors/gitleaks/gitleaks.go | 12 +- .../detectors/gitleaks/gitleaks_test.go | 10 +- .../detectors/gitleaks/testdata/aws.js | 0 .../detectors/gitleaks/testdata/regex/rsa.pem | 0 .../.snapshots/TestDetectorReportDataTypes | 0 .../TestDetectorReportInterfacesPaths | 0 .../TestDetectorReportInterfacesProject | 0 .../detectors/golang/datatype/datatype.go | 16 +- {internal => pkg}/detectors/golang/golang.go | 26 +- .../detectors/golang/golang_test.go | 10 +- .../golang/testdata/datatypes/datatype.go | 0 .../detectors/golang/testdata/paths/paths.go | 0 .../golang/testdata/project/config.go | 0 .../detectors/golang/testdata/project/urls.go | 0 .../graphql/.snapshots/TestBuildReportSchema | 0 .../detectors/graphql/graphql.go | 22 +- .../detectors/graphql/graphql_test.go | 10 +- .../graphql/testdata/schemas/schema.graphql | 0 .../.snapshots/TestDetectorReportInterfaces | 0 {internal => pkg}/detectors/html/html.go | 22 +- {internal => pkg}/detectors/html/html_test.go | 10 +- .../detectors/html/testdata/project/app.vue | 0 .../html/testdata/project/base.html.twig | 0 .../testdata/project/google_analytics.html | 0 .../html/testdata/project/index.cshtml | 0 .../detectors/html/testdata/project/index.ejs | 0 .../html/testdata/project/index.handlebars | 0 .../html/testdata/project/index.html | 0 .../html/testdata/project/index.html.erb | 0 .../html/testdata/project/index.html.twig | 0 .../html/testdata/project/index.jinja | 0 .../html/testdata/project/index.liquid | 0 .../html/testdata/project/index.mustache | 0 .../html/testdata/project/index.phtml | 0 .../internal/testhelper/testhelper.go | 26 +- .../.snapshots/TestDetectorReportInterfaces | 0 {internal => pkg}/detectors/ipynb/ipynb.go | 14 +- .../detectors/ipynb/ipynb_test.go | 10 +- .../ipynb/testdata/notebooks/small.ipynb | 0 .../.snapshots/TestDetectorReportDataTypes | 0 .../java/.snapshots/TestDetectorReportPaths | 0 .../.snapshots/TestDetectorReportVariables | 0 .../detectors/java/datatype/datatype.go | 16 +- {internal => pkg}/detectors/java/java.go | 20 +- {internal => pkg}/detectors/java/java_test.go | 10 +- .../java/testdata/datatype/datatype.java | 0 .../detectors/java/testdata/paths/config.java | 0 .../java/testdata/variables/config.java | 0 .../.snapshots/TestDetectorReportDatatypes | 0 .../.snapshots/TestDetectorReportGeneral | 0 .../detectors/javascript/datatype/datatype.go | 14 +- .../detectors/javascript/datatype/objects.go | 6 +- .../javascript/datatype/properties.go | 10 +- .../detectors/javascript/javascript.go | 20 +- .../detectors/javascript/javascript_test.go | 10 +- .../testdata/datatypes/datatypes.js | 0 .../datatypes_performance/angular1.8.min.js | 0 .../javascript/testdata/general/paths/main.js | 0 .../testdata/general/variables/config.js | 0 .../detectors/javascript/util/util.go | 4 +- .../openapi/.snapshots/TestDetectorV2json | 0 .../openapi/.snapshots/TestDetectorV2yaml | 0 .../openapi/.snapshots/TestDetectorV3json | 0 .../openapi/.snapshots/TestDetectorV3yaml | 0 .../openapi/.snapshots/TestOtherjson | 0 .../detectors/openapi/json/objects.go | 8 +- .../detectors/openapi/json/operationId.go | 8 +- .../detectors/openapi/json/paths.go | 6 +- .../detectors/openapi/openapi.go | 18 +- .../detectors/openapi/openapi_test.go | 10 +- .../detectors/openapi/queries/objects.go | 10 +- .../detectors/openapi/queries/operationId.go | 8 +- .../detectors/openapi/queries/paths.go | 8 +- .../detectors/openapi/queries/queries.go | 2 +- .../detectors/openapi/queries/urls.go | 4 +- .../detectors/openapi/queries/v2parameters.go | 10 +- .../detectors/openapi/queries/v3parameters.go | 10 +- .../openapi/reportadder/reportadder.go | 16 +- .../openapi/testdata/arrayjson/packages.json | 0 .../testdata/v2json/petstore-swagger.json | 0 .../testdata/v2yaml/petstore-swagger.yaml | 0 .../testdata/v3json/petstore-openapi.json | 0 .../testdata/v3yaml/petstore-openapi.yaml | 0 .../detectors/openapi/v2json/v2json.go | 18 +- .../detectors/openapi/v2yaml/v2yml.go | 18 +- .../detectors/openapi/v3json/v3json.go | 18 +- .../detectors/openapi/v3yaml/v3yml.go | 18 +- .../detectors/openapi/yaml/objects.go | 8 +- .../detectors/openapi/yaml/operationId.go | 8 +- .../detectors/openapi/yaml/paths.go | 6 +- .../php/.snapshots/TestDetectorReportContext | 0 .../php/.snapshots/TestDetectorReportDatatype | 0 .../php/.snapshots/TestDetectorReportIgnore | 0 .../.snapshots/TestDetectorReportInterfaces1 | 0 .../.snapshots/TestDetectorReportInterfaces2 | 0 .../php/context/assignment_expression.go | 4 +- .../detectors/php/context/finder.go | 8 +- .../detectors/php/context/property_element.go | 4 +- .../detectors/php/datatype/datatype.go | 20 +- .../detectors/php/datatype/properties.go | 12 +- {internal => pkg}/detectors/php/php.go | 30 +- {internal => pkg}/detectors/php/php_test.go | 10 +- .../php/testdata/context/context.php | 0 .../php/testdata/datatype/datatype.php | 0 .../detectors/php/testdata/ignore/phive | 0 .../detectors/php/testdata/paths/paths.php | 0 .../php/testdata/variables/config.php | 0 .../proto/.snapshots/TestBuildReportSchema | 0 {internal => pkg}/detectors/proto/proto.go | 20 +- .../detectors/proto/proto_test.go | 10 +- .../proto/testdata/protos/schema.proto | 0 .../.snapshots/TestDetectorReportDatatype | 0 .../TestDetectorReportInterfacePaths | 0 .../TestDetectorReportInterfaceProjects | 0 .../detectors/python/datatype/datatype.go | 16 +- .../detectors/python/datatype/properties.go | 10 +- {internal => pkg}/detectors/python/python.go | 20 +- .../detectors/python/python_test.go | 10 +- .../python/testdata/datatype/datatype.py | 0 .../detectors/python/testdata/paths/main.py | 0 .../python/testdata/project/config.py | 0 .../detectors/python/testdata/project/urls.py | 0 .../rails/.snapshots/TestBuildReportCaches | 0 .../.snapshots/TestBuildReportDatabaseSchema | 0 .../TestBuildReportMultipleDatabases | 0 .../.snapshots/TestBuildReportSingleDatabase | 0 .../TestBuildReportStorageProviders | 0 .../detectors/rails/cache/cache.go | 10 +- {internal => pkg}/detectors/rails/rails.go | 22 +- .../detectors/rails/rails_test.go | 10 +- .../detectors/rails/schema_rb/schema_rb.go | 16 +- .../detectors/rails/testdata/cache/bin/rails | 0 .../testdata/cache/config/application.rb | 0 .../cache/config/environments/production.rb | 0 .../testdata/database/multiple/bin/rails | 0 .../database/multiple/config/database.yml | 0 .../rails/testdata/database/single/bin/rails | 0 .../database/single/config/database.yml | 0 .../detectors/rails/testdata/schema/bin/rails | 0 .../rails/testdata/schema/db/schema.rb | 0 .../rails/testdata/storage/bin/rails | 0 .../rails/testdata/storage/config/storage.yml | 0 .../.snapshots/TestDetectorReportDatatype | 0 .../TestDetectorReportInterfacesPaths | 0 .../TestDetectorReportInterfacesVariables | 0 .../ruby/datatype/class_assignment.go | 6 +- .../detectors/ruby/datatype/datatype.go | 10 +- .../detectors/ruby/datatype/properties.go | 12 +- .../detectors/ruby/datatype/structures.go | 6 +- {internal => pkg}/detectors/ruby/ruby.go | 26 +- {internal => pkg}/detectors/ruby/ruby_test.go | 10 +- .../ruby/testdata/datatype/datatype.rb | 0 .../detectors/ruby/testdata/paths/main.rb | 0 .../ruby/testdata/variables/config.rb | 0 .../.snapshots/TestBuildReportInterfaces | 0 {internal => pkg}/detectors/simple/simple.go | 20 +- .../detectors/simple/simple_test.go | 4 +- .../simple/testdata/project/structure.sql | 0 .../simple/testdata/project/unknown.pl | 0 .../.snapshots/TestBuildReportDataStores | 0 {internal => pkg}/detectors/spring/spring.go | 16 +- .../detectors/spring/spring_test.go | 4 +- .../spring/testdata/java_not_spring/pom.xml | 0 .../java_not_spring/src/main/Application.java | 0 .../src/main/resources/application.properties | 0 .../spring/testdata/not_java/Gemfile | 0 .../detectors/spring/testdata/spring/pom.xml | 0 .../testdata/spring/src/main/Application.java | 0 .../src/main/ignore/application.properties | 0 .../spring/src/main/ignore/application.yml | 0 .../src/main/ignore2/application.properties | 0 .../spring/src/main/ignore2/application.yml | 0 .../src/main/resources/application.properties | 0 .../spring/src/main/resources/application.yml | 0 .../main/resources2/application.properties | 0 .../src/main/resources2/application.yml | 0 .../main/resources3/application.properties | 0 .../src/main/resources3/application.yml | 0 .../main/resources4/application.properties | 0 .../src/main/resources4/application.yml | 0 .../sql/custom_detector/compile_pattern.go | 12 +- .../sql/custom_detector/custom_detector.go | 6 +- .../sql/custom_detector/extract_arguments.go | 10 +- {internal => pkg}/detectors/sql/sql.go | 12 +- {internal => pkg}/detectors/sql/util/util.go | 2 +- .../.snapshots/TestBuildReportDataStores | 0 .../detectors/symfony/symfony.go | 16 +- .../detectors/symfony/symfony_test.go | 4 +- .../symfony/testdata/not_php/package.json | 0 .../testdata/php_not_symfony/composer.json | 0 .../testdata/symfony/app/config/config.yml | 0 .../symfony/testdata/symfony/composer.json | 0 .../symfony/config/packages/doctrine.yml | 0 .../symfony/src/AppBundle/AppBundle.php | 0 .../tsx/.snapshots/TestDetectorReportGeneral | 0 .../detectors/tsx/testdata/general/config.tsx | 0 {internal => pkg}/detectors/tsx/tsx.go | 20 +- {internal => pkg}/detectors/tsx/tsx_test.go | 10 +- {internal => pkg}/detectors/types/types.go | 4 +- .../.snapshots/TestDetectorReportDatatype | 0 .../.snapshots/TestDetectorReportGeneral | 0 .../.snapshots/TestDetectorReportKnex | 0 .../detectors/typescript/datatype/datatype.go | 18 +- .../typescript/datatype/knex/functions.go | 10 +- .../typescript/datatype/knex/knex.go | 6 +- .../typescript/datatype/knex/table.go | 8 +- .../typescript/testdata/datatype/schema.ts | 0 .../testdata/datatype_knex/datatype_knex.ts | 0 .../testdata/general/variables/config.ts | 0 .../detectors/typescript/typescript.go | 20 +- .../detectors/typescript/typescript_test.go | 10 +- .../.snapshots/TestDetectorReportInterfaces | 0 .../.snapshots/TestDetectorReportVariables | 0 .../.github/workflows/workflow-github.yml | 0 .../testdata/project/config/parameters.yml.j2 | 0 .../testdata/project/docker-compose.yml.tpl | 0 .../yamlconfig/testdata/project/locale.en.yml | 0 .../testdata/project/locales/client.hu.yml | 0 .../testdata/project/locales/en.yml | 0 .../testdata/project/translations/en.yml | 0 .../detectors/yamlconfig/yamlconfig.go | 22 +- .../detectors/yamlconfig/yamlconfig_test.go | 4 +- pkg/engine/engine.go | 17 + pkg/engine/implementation/implementation.go | 66 +++ {internal => pkg}/flag/general_flags.go | 5 +- {internal => pkg}/flag/ignore_add_flags.go | 2 +- .../flag/ignore_migrate_flags.go | 2 +- {internal => pkg}/flag/ignore_show_flags.go | 2 +- {internal => pkg}/flag/options.go | 6 +- {internal => pkg}/flag/options_test.go | 0 {internal => pkg}/flag/report_flags.go | 8 +- {internal => pkg}/flag/repository_flags.go | 2 +- .../flag/repository_flags_test.go | 0 {internal => pkg}/flag/rule_flags.go | 2 +- {internal => pkg}/flag/scan_flags.go | 2 +- {internal => pkg}/flag/test_helper.go | 2 +- {internal => pkg}/flag/types/types.go | 2 +- {internal => pkg}/flag/worker_flags.go | 2 +- {internal => pkg}/git/branch.go | 0 {internal => pkg}/git/checkout.go | 0 {internal => pkg}/git/commits.go | 0 {internal => pkg}/git/diff.go | 2 +- {internal => pkg}/git/diff_test.go | 2 +- {internal => pkg}/git/fetch.go | 0 {internal => pkg}/git/git.go | 2 +- {internal => pkg}/git/git_suite_test.go | 0 {internal => pkg}/git/git_test.go | 4 +- {internal => pkg}/git/remote.go | 0 {internal => pkg}/git/tree.go | 0 .../golang/.snapshots/TestImport--main.yml | 0 .../golang/.snapshots/TestScope--scope.yml | 0 .../flow/TestFlow--different-line.yml | 0 .../.snapshots/flow/TestFlow--same-line.yml | 0 .../languages/golang/analyzer/analyzer.go | 6 +- .../.snapshots/TestGoObjects-object_class | 0 .../.snapshots/TestGoObjects-object_no_class | 0 .../detectors/.snapshots/TestGoString-string | 0 .../golang/detectors/detectors_test.go | 4 +- .../golang/detectors/object/object.go | 12 +- .../golang/detectors/object/projection.go | 6 +- .../golang/detectors/string/string.go | 12 +- .../golang/detectors/testdata/class.go | 0 .../golang/detectors/testdata/no_class.go | 0 .../golang/detectors/testdata/string.go | 0 {internal => pkg}/languages/golang/golang.go | 36 +- .../languages/golang/golang_test.go | 2 +- .../languages/golang/pattern/pattern.go | 6 +- .../languages/golang/testdata/import/main.go | 0 .../languages/golang/testdata/import_rule.yml | 0 .../languages/golang/testdata/logger.yml | 0 .../languages/golang/testdata/scope/scope.go | 0 .../languages/golang/testdata/scope_rule.yml | 0 .../testdata/testcases/flow/different-line.go | 0 .../testdata/testcases/flow/same-line.go | 0 ...estPattern-catch_types_is_a_container_type | 0 ...tPattern-method_params_is_a_container_type | 0 .../java/.snapshots/TestScope--scope.yml | 0 .../flow/TestFlow--different-line.yml | 0 .../.snapshots/flow/TestFlow--same-line.yml | 0 .../languages/java/analyzer/analyzer.go | 4 +- .../.snapshots/TestJavaObjects-object_class | 0 .../TestJavaObjects-object_no_class | 0 .../.snapshots/TestJavaString-string | 0 .../java/detectors/detectors_test.go | 4 +- .../languages/java/detectors/object/object.go | 10 +- .../java/detectors/object/projection.go | 6 +- .../languages/java/detectors/string/string.go | 12 +- .../java/detectors/testdata/class.java | 0 .../java/detectors/testdata/no_class.java | 0 .../java/detectors/testdata/string.java | 0 {internal => pkg}/languages/java/java.go | 32 +- {internal => pkg}/languages/java/java_test.go | 6 +- .../languages/java/pattern/pattern.go | 6 +- .../languages/java/testdata/logger.yml | 0 .../languages/java/testdata/scope/scope.java | 0 .../languages/java/testdata/scope_rule.yml | 0 .../testcases/flow/different-line.java | 0 .../testdata/testcases/flow/same-line.java | 0 .../.snapshots/TestPatternVariables--main.yml | 0 .../.snapshots/TestScope--scope.yml | 0 .../flow/TestFlow--assigment-expression.yml | 0 .../flow/TestFlow--variable-declarator.yml | 0 .../.snapshots/import/TestImport--import.yml | 0 ...stObjectDeconstructing--deconstructing.yml | 0 ...ObjectDeconstructing--multiple_objects.yml | 0 .../string/TestString--concatanation.yml | 0 .../.snapshots/string/TestString--simple.yml | 0 .../string/TestString--single-quotes.yml | 0 ...ring--template-variable-reconciliation.yml | 0 .../string/TestString--template.yml | 0 .../languages/javascript/analyzer/analyzer.go | 4 +- .../TestJavascriptFileTypes-file_type_jsx | 0 .../TestJavascriptFileTypes-file_type_tsx | 0 .../TestJavascriptObjectDetector-object_class | 0 ...TestJavascriptObjectDetector-object_object | 0 ...JavascriptObjectDetector-object_projection | 0 ...TestJavascriptObjectDetector-object_spread | 0 ...tJavascriptStringDetector-string_assign_eq | 0 ...estJavascriptStringDetector-string_literal | 0 ...avascriptStringDetector-string_non_literal | 0 .../TestJavascriptTypes-typed_object_const | 0 .../TestJavascriptTypes-typed_object_let | 0 .../TestJavascriptTypes-typed_object_var | 0 .../javascript/detectors/detectors_test.go | 4 +- .../javascript/detectors/object/object.go | 16 +- .../javascript/detectors/object/projection.go | 12 +- .../javascript/detectors/string/string.go | 12 +- .../detectors/testdata/file_type.jsx | 0 .../detectors/testdata/file_type.tsx | 0 .../detectors/testdata/object_class.js | 0 .../detectors/testdata/object_object.js | 0 .../detectors/testdata/object_projection.js | 0 .../detectors/testdata/object_spread.js | 0 .../detectors/testdata/string_assign_eq.js | 0 .../detectors/testdata/string_literal.js | 0 .../detectors/testdata/string_non_literal.js | 0 .../detectors/testdata/typed_object_const.ts | 0 .../detectors/testdata/typed_object_let.ts | 0 .../detectors/testdata/typed_object_var.ts | 0 .../languages/javascript/javascript.go | 32 +- .../languages/javascript/javascript_test.go | 2 +- .../languages/javascript/pattern/pattern.go | 6 +- .../javascript/testdata/datatype.yml | 0 .../javascript/testdata/deconstructing.yml | 0 .../javascript/testdata/import/import.js | 0 .../javascript/testdata/import_rule.yml | 0 .../javascript/testdata/insecureURL.yml | 0 .../testdata/pattern_variables/main.js | 0 .../testdata/pattern_variables_rule.yml | 0 .../javascript/testdata/scope/scope.js | 0 .../javascript/testdata/scope_rule.yml | 0 .../testcases/flow/assigment-expression.js | 0 .../testcases/flow/variable-declarator.js | 0 .../object-deconstructing/deconstructing.js | 0 .../object-deconstructing/multiple_objects.js | 0 .../testcases/string/concatanation.js | 0 .../testdata/testcases/string/simple.js | 0 .../testcases/string/single-quotes.js | 0 .../template-variable-reconciliation.js | 0 .../testdata/testcases/string/template.js | 0 pkg/languages/languages.go | 22 + .../php/.snapshots/TestAnalyzer-foreach | 0 .../php/.snapshots/TestConst--main.yml | 0 ...s_function_names_and_bodies_are_unanchored | 0 ...ern-catch_clauses_and_types_are_unanchored | 0 ...lass_name_in_object_creation_is_unanchored | 0 ...n-function_names_and_bodies_are_unanchored | 0 ...TestPattern-named_arguments_are_unanchored | 0 ...TestPattern-parameter_names_are_unanchored | 0 .../TestPattern-property_names_are_unanchored | 0 .../php/.snapshots/TestScope--scope.yml | 0 .../flow/TestFlow--different-line.yml | 0 .../.snapshots/flow/TestFlow--same-line.yml | 0 .../languages/php/analyzer/analyzer.go | 4 +- .../.snapshots/TestPHPObjects-object_class | 0 .../.snapshots/TestPHPObjects-object_no_class | 0 .../detectors/.snapshots/TestPHPString-string | 0 .../languages/php/detectors/detectors_test.go | 4 +- .../languages/php/detectors/object/object.go | 12 +- .../php/detectors/object/projection.go | 8 +- .../languages/php/detectors/string/string.go | 10 +- .../php/detectors/testdata/class.php | 0 .../php/detectors/testdata/no_class.php | 0 .../php/detectors/testdata/string.php | 0 .../languages/php/pattern/pattern.go | 6 +- {internal => pkg}/languages/php/php.go | 34 +- {internal => pkg}/languages/php/php_test.go | 14 +- .../languages/php/testdata/logger.yml | 0 .../languages/php/testdata/md.yml | 0 .../languages/php/testdata/md/main.php | 0 .../languages/php/testdata/scope/scope.php | 0 .../languages/php/testdata/scope_rule.yml | 0 .../testcases/flow/different-line.php | 0 .../php/testdata/testcases/flow/same-line.php | 0 .../TestDatatypes--different-line.yml | 0 .../.snapshots/TestDatatypes--same-line.yml | 0 .../python/.snapshots/TestFlow--flow.yml | 0 .../python/.snapshots/TestImport--import.yml | 0 .../python/.snapshots/TestPair--pair.yml | 0 .../python/.snapshots/TestScope--scope.yml | 0 .../.snapshots/TestSubscript--subscript.yml | 0 .../languages/python/analyzer/analyzer.go | 4 +- .../.snapshots/TestPythonObjects-object_class | 0 .../TestPythonObjects-object_no_class | 0 .../.snapshots/TestPythonString-string | 0 .../TestPythonString-string_literal | 0 .../python/detectors/detectors_test.go | 4 +- .../python/detectors/object/object.go | 12 +- .../python/detectors/object/projection.go | 6 +- .../python/detectors/string/string.go | 12 +- .../python/detectors/testdata/class.py | 0 .../python/detectors/testdata/no_class.py | 0 .../python/detectors/testdata/string.py | 0 .../detectors/testdata/string_literal.py | 0 .../languages/python/pattern/pattern.go | 6 +- {internal => pkg}/languages/python/python.go | 32 +- .../languages/python/python_test.go | 2 +- .../testdata/datatypes/different-line.py | 0 .../python/testdata/datatypes/same-line.py | 0 .../python/testdata/datatypes_rule.yml | 0 .../languages/python/testdata/flow/flow.py | 0 .../languages/python/testdata/flow_rule.yml | 0 .../python/testdata/import/import.py | 0 .../languages/python/testdata/import_rule.yml | 0 .../languages/python/testdata/pair/pair.py | 0 .../languages/python/testdata/pair_rule.yml | 0 .../languages/python/testdata/scope/scope.py | 0 .../languages/python/testdata/scope_rule.yml | 0 .../python/testdata/subscript/subscript.py | 0 .../python/testdata/subscript_rule.yml | 0 .../.snapshots/TestPatternVariables--main.yml | 0 .../ruby/.snapshots/TestRuby--call.yml | 0 .../.snapshots/TestRuby--insecure-url.yml | 0 ...stRuby--object-variable-reconciliation.yml | 0 .../ruby/.snapshots/TestRuby--object.yml | 0 .../ruby/.snapshots/TestScope--scope.yml | 0 .../languages/ruby/analyzer/analyzer.go | 4 +- .../TestRubyObjectDetector-object_class | 0 .../TestRubyObjectDetector-object_hash | 0 .../TestRubyObjectDetector-object_projection | 0 .../TestRubyStringDetector-string_assign_eq | 0 .../TestRubyStringDetector-string_literal | 0 .../TestRubyStringDetector-string_non_literal | 0 .../languages/ruby/detectors/common/common.go | 2 +- .../ruby/detectors/detectors_test.go | 4 +- .../languages/ruby/detectors/object/object.go | 16 +- .../ruby/detectors/object/projection.go | 8 +- .../languages/ruby/detectors/string/string.go | 10 +- .../ruby/detectors/testdata/object_class.rb | 0 .../ruby/detectors/testdata/object_hash.rb | 0 .../detectors/testdata/object_projection.rb | 0 .../detectors/testdata/string_assign_eq.rb | 0 .../ruby/detectors/testdata/string_literal.rb | 0 .../detectors/testdata/string_non_literal.rb | 0 .../languages/ruby/pattern/pattern.go | 6 +- {internal => pkg}/languages/ruby/ruby.go | 32 +- {internal => pkg}/languages/ruby/ruby_test.go | 2 +- .../ruby/testdata/pattern_variables/main.rb | 0 .../ruby/testdata/pattern_variables_rule.yml | 0 .../languages/ruby/testdata/rule.yml | 0 .../languages/ruby/testdata/scope/scope.rb | 0 .../languages/ruby/testdata/scope_rule.yml | 0 .../languages/ruby/testdata/testcases/call.rb | 0 .../ruby/testdata/testcases/insecure-url.rb | 0 .../object-variable-reconciliation.rb | 0 .../ruby/testdata/testcases/object.rb | 0 .../languages/testhelper/testhelper.go | 36 +- {internal => pkg}/parser/context/finder.go | 4 +- {internal => pkg}/parser/context/resolver.go | 4 +- {internal => pkg}/parser/custom/custom.go | 10 +- {internal => pkg}/parser/datatype/datatype.go | 4 +- {internal => pkg}/parser/datatype/merge.go | 2 +- .../parser/datatype/parented_by.go | 2 +- .../parser/datatype/property_finder.go | 4 +- {internal => pkg}/parser/datatype/scope.go | 6 +- .../datatype/variable_reconciliation.go | 4 +- .../parser/golang_util/golang_util.go | 2 +- .../parser/interfacedetector/interfaces.go | 14 +- .../parser/interfaces/interfaces.go | 8 +- .../parser/interfaces/paths/paths.go | 6 +- .../parser/interfaces/urls/urls.go | 8 +- .../parser/interfaces/urls/urls_test.go | 6 +- {internal => pkg}/parser/nodeid/nodeid.go | 2 +- {internal => pkg}/parser/parser.go | 8 +- {internal => pkg}/parser/schema/fieldId.go | 4 +- {internal => pkg}/parser/schema/schema.go | 6 +- .../parser/sitter/config_variables/README.md | 0 .../parser/sitter/config_variables/binding.go | 0 .../sitter/config_variables/binding_test.go | 2 +- .../parser/sitter/config_variables/grammar.js | 0 .../sitter/config_variables/package.json | 0 .../parser/sitter/config_variables/parser.c | 0 .../config_variables/test/corpus/examples.txt | 0 .../config_variables/tree_sitter/parser.h | 0 .../parser/sitter/graphql/README.md | 0 .../parser/sitter/graphql/binding.go | 0 .../parser/sitter/graphql/parser.c | 0 .../sitter/graphql/tree_sitter/parser.h | 0 .../parser/sitter/html2/binding.go | 0 .../parser/sitter/html2/parser.c | 0 .../parser/sitter/html2/readme.md | 0 .../parser/sitter/html2/scanner.c | 0 {internal => pkg}/parser/sitter/html2/tag.h | 0 .../parser/sitter/html2/tree_sitter/parser.h | 0 .../parser/sitter/php2/README.md | 0 .../parser/sitter/php2/binding.go | 0 {internal => pkg}/parser/sitter/php2/parser.c | 0 .../parser/sitter/php2/scanner.c | 0 .../parser/sitter/php2/tree_sitter/parser.h | 0 {internal => pkg}/parser/sitter/sql/README.md | 0 .../parser/sitter/sql/binding.go | 0 {internal => pkg}/parser/sitter/sql/parser.c | 0 .../parser/sitter/sql/scanner.cc | 0 .../parser/sitter/sql/tree_sitter/parser.h | 0 .../parser/sitter/xml/binding.go | 0 {internal => pkg}/parser/sitter/xml/parser.c | 0 {internal => pkg}/parser/sitter/xml/readme.md | 0 .../parser/sitter/xml/tree_sitter/parser.h | 0 .../basebranchfindings/basebranchfindings.go | 4 +- {internal => pkg}/report/config/config.go | 0 .../report/customdetectors/customdetectors.go | 0 .../report/dependencies/dependencies.go | 2 +- .../report/detections/detections.go | 6 +- .../report/detectors/detectors.go | 0 {internal => pkg}/report/detectors/openapi.go | 0 {internal => pkg}/report/domain/domain.go | 0 .../report/frameworks/beego/beego.go | 2 +- .../report/frameworks/django/django.go | 2 +- .../report/frameworks/dotnet/dotnet.go | 2 +- .../report/frameworks/frameworks.go | 0 .../report/frameworks/knex/knex.go | 2 +- .../report/frameworks/rails/rails.go | 2 +- .../report/frameworks/spring/spring.go | 2 +- .../report/frameworks/symfony/symfony.go | 2 +- .../report/interfaces/interfaces.go | 2 +- .../report/operations/operations.go | 0 .../operationshelper/operationshelper.go | 4 +- .../output/dataflow/components/components.go | 12 +- .../dataflow/components/components_test.go | 12 +- .../report/output/dataflow/dataflow.go | 24 +- .../output/dataflow/datatypes/datatypes.go | 20 +- .../dataflow/datatypes/datatypes_test.go | 12 +- .../output/dataflow/datatypes/get_extras.go | 29 +- .../dependency_classification.go | 2 +- .../framework_classification.go | 2 +- .../interface_classification.go | 2 +- .../detectiondecoder/schema_classification.go | 6 +- .../dataflow/file_errors/file_errors.go | 4 +- .../report/output/dataflow/formatter.go | 8 +- .../report/output/dataflow/risks/risks.go | 20 +- .../output/dataflow/risks/risks_test.go | 14 +- .../output/dataflow/types/components.go | 0 .../report/output/dataflow/types/datatypes.go | 2 +- .../output/dataflow/types/file_errors.go | 0 .../report/output/dataflow/types/risks.go | 2 +- .../report/output/detectors/detectors.go | 10 +- .../report/output/detectors/formatter.go | 8 +- .../gitlab/.snapshots/TestJuiceShopSarif | 0 .../report/output/gitlab/gitlab.go | 4 +- .../report/output/gitlab/gitlab_test.go | 4 +- .../testdata/juice-shop-security-report.json | 0 .../report/output/gitlab/types/types.go | 0 .../TestBearPublishingPrivacyHtml.html | 0 .../.snapshots/TestJuiceShopSecurityHtml.html | 0 {internal => pkg}/report/output/html/html.go | 8 +- .../report/output/html/html_test.go | 4 +- .../report/output/html/privacy.tmpl | 0 .../report/output/html/security.tmpl | 0 .../report/output/html/styles.css | 0 .../bear-publishing-privacy-report.json | 0 .../testdata/juice-shop-security-report.json | 0 .../report/output/html/types/types.go | 2 +- .../report/output/html/wrapper.tmpl | 0 {internal => pkg}/report/output/output.go | 28 +- .../privacy/.snapshots/TestAddReportData | 0 .../privacy/.snapshots/TestBuildCsvString | 0 .../report/output/privacy/formatter.go | 10 +- .../report/output/privacy/privacy.go | 22 +- .../report/output/privacy/privacy_test.go | 31 +- .../report/output/privacy/types/types.go | 0 .../.snapshots/TestRailsGoatReviewdog | 0 .../report/output/reviewdog/reviewdog.go | 4 +- .../report/output/reviewdog/reviewdog_test.go | 6 +- .../testdata/rails-goat-security-report.json | 0 .../report/output/reviewdog/types/types.go | 0 .../TestBearerPublishingGitlabMetaSaas | 0 .../saas/.snapshots/TestBearerPublishingSaas | 0 .../report/output/saas/formatter.go | 8 +- {internal => pkg}/report/output/saas/saas.go | 14 +- .../report/output/saas/sass_test.go | 12 +- .../output/saas/testdata/report_fixture.json | 0 .../report/output/saas/types/types.go | 6 +- .../sarif/.snapshots/TestJuiceShopSarif | 0 .../report/output/sarif/sarif.go | 6 +- .../report/output/sarif/sarif_test.go | 8 +- .../testdata/juice-shop-security-report.json | 0 .../report/output/sarif/types/types.go | 0 .../security/.snapshots/TestAddReportData | 0 .../.snapshots/TestAddReportDataWithSeverity | 0 .../security/.snapshots/TestBuildReportString | 0 .../.snapshots/TestNoRulesBuildReportString | 0 .../report/output/security/formatter.go | 30 +- .../report/output/security/security.go | 80 ++- .../report/output/security/security_test.go | 59 ++- .../report/output/security/types/types.go | 4 +- .../report/output/stats/formatter.go | 8 +- .../report/output/stats/gocloc_detector.go | 4 +- .../report/output/stats/stats.go | 10 +- .../report/output/stats/types/types.go | 0 pkg/report/output/testhelper/testhelper.go | 31 ++ .../report/output/types/types.go | 10 +- {internal => pkg}/report/report.go | 18 +- .../report/schema/datatype/datatype.go | 18 +- {internal => pkg}/report/schema/schema.go | 8 +- .../schema/schemahelper/schemahelper.go | 11 + {internal => pkg}/report/secret/secret.go | 0 {internal => pkg}/report/source/source.go | 2 +- {internal => pkg}/report/values/values.go | 2 +- .../report/variables/variables.go | 0 {internal => pkg}/report/writer/detectors.go | 28 +- .../scanner/ast/.snapshots/TestDisabledRules | 0 .../ast/.snapshots/TestExpectedRulesJava | 0 .../ast/.snapshots/TestExpectedRulesRuby | 0 {internal => pkg}/scanner/ast/ast.go | 10 +- {internal => pkg}/scanner/ast/ast_test.go | 12 +- {internal => pkg}/scanner/ast/query/query.go | 2 +- .../scanner/ast/traversalstrategy/builtin.go | 4 +- .../traversalstrategy/traversalstrategy.go | 4 +- .../scanner/ast/tree/.snapshots/TestTree | 0 {internal => pkg}/scanner/ast/tree/builder.go | 76 ++- {internal => pkg}/scanner/ast/tree/tree.go | 9 +- .../scanner/ast/tree/tree_test.go | 4 +- {internal => pkg}/scanner/cache/cache.go | 8 +- .../.snapshots/TestDatatypeDetector-datatype | 0 ...tDatatypeDetectorInvalidDetection-datatype | 0 .../TestInsecureUrlDetector-insecure_url | 0 .../scanner/detectors/common/object.go | 8 +- .../scanner/detectors/common/string.go | 8 +- .../detectors/customrule/customrule.go | 20 +- .../scanner/detectors/customrule/filter.go | 10 +- .../detectors/customrule/filters/filters.go | 16 +- .../customrule/filters/filters_suite_test.go | 0 .../customrule/filters/filters_test.go | 20 +- .../patternquery/builder/builder.go | 12 +- .../builder/bytereplacer/bytereplacer.go | 0 .../bytereplacer/bytereplacer_suite_test.go | 0 .../builder/bytereplacer/bytereplacer_test.go | 2 +- .../customrule/patternquery/builder/input.go | 4 +- .../customrule/patternquery/patternquery.go | 10 +- .../detectors/customrule/types/types.go | 4 +- .../scanner/detectors/datatype/datatype.go | 18 +- .../scanner/detectors/detectors_test.go | 4 +- .../detectors/insecureurl/insecureurl.go | 12 +- .../detectors/stringliteral/stringliteral.go | 12 +- .../scanner/detectors/testdata/datatype.rb | 0 .../scanner/detectors/testdata/insecureurl.rb | 0 .../detectors/testdata/invalid_datatype.java | 0 .../detectors/testhelper/testhelper.go | 24 +- .../scanner/detectors/types/types.go | 6 +- .../scanner/detectorset/detectorset.go | 18 +- .../scanner/language/language.go | 9 +- {internal => pkg}/scanner/language/pattern.go | 2 +- .../scanner/language/patternbase.go | 2 +- {internal => pkg}/scanner/language/scope.go | 0 .../languagescanner/languagescanner.go | 32 +- .../scanner/rulescanner/rulescanner.go | 14 +- {internal => pkg}/scanner/ruleset/builtin.go | 0 {internal => pkg}/scanner/ruleset/ruleset.go | 6 +- {internal => pkg}/scanner/scanner.go | 44 +- {internal => pkg}/scanner/stats/stats.go | 0 .../scanner/variableshape/variableshape.go | 10 +- {internal => pkg}/types/artifact.go | 0 {internal => pkg}/types/report.go | 0 {internal => pkg}/types/severity.go | 0 {internal => pkg}/types/target.go | 0 {internal => pkg}/types/trigger.go | 0 {internal => pkg}/util/cache/utils.go | 0 {internal => pkg}/util/classify/classify.go | 2 +- .../util/classify/classify_schema.go | 2 +- .../util/classify/classify_schema_test.go | 4 +- .../util/classify/classify_test.go | 4 +- .../util/components/components.go | 4 +- .../util/entropy/.snapshots/TestShannon | 0 {internal => pkg}/util/entropy/entropy.go | 0 .../util/entropy/entropy_test.go | 2 +- {internal => pkg}/util/file/file.go | 4 +- {internal => pkg}/util/ignore/ignore.go | 4 +- {internal => pkg}/util/ignore/ignore_test.go | 4 +- {internal => pkg}/util/ignore/types/types.go | 0 {internal => pkg}/util/jsonlines/jsonlines.go | 2 +- .../util/jsonlines/jsonlines_test.go | 2 +- .../util/linescanner/linescanner.go | 0 {internal => pkg}/util/maputil/maputil.go | 0 .../util/normalize_key/normalize_key.go | 0 .../util/normalize_key/normalize_key_test.go | 2 +- {internal => pkg}/util/output/output.go | 2 +- {internal => pkg}/util/pluralize/pluralize.go | 0 {internal => pkg}/util/pointers/pointers.go | 0 .../util/progressbar/progressbar.go | 6 +- {internal => pkg}/util/regex/regex.go | 23 + {internal => pkg}/util/rego/rego.go | 0 {internal => pkg}/util/set/set.go | 0 {internal => pkg}/util/slices/slices.go | 0 .../util/slices/slices_suite_test.go | 0 {internal => pkg}/util/slices/slices_test.go | 2 +- .../util/stringutil/stringutil.go | 0 {internal => pkg}/util/tmpfile/tmpfile.go | 2 +- {internal => pkg}/util/url/domain_resolver.go | 0 .../util/url/domain_resolver_test.go | 2 +- {internal => pkg}/util/url/url.go | 4 +- {internal => pkg}/util/url/url_test.go | 10 +- .../version_check/bearer_version.go | 2 +- .../version_check/github_version.go | 0 .../version_check/version_check.go | 6 +- scripts/gen-doc-yaml.go | 10 +- 1736 files changed, 3221 insertions(+), 2912 deletions(-) create mode 100644 external/run/run.go delete mode 100644 internal/commands/process/settings/regexp.go delete mode 100644 internal/commands/process/settings/ruleLoader.go delete mode 100644 internal/commands/process/settings/ruleValidator.go delete mode 100644 internal/commands/process/settings/rules.go delete mode 100644 internal/commands/process/settings/rules/javascript/lang/jwt/.snapshots/TestJavascriptJWT--jwt_insecure.yml delete mode 100644 internal/commands/process/settings/rules/javascript/lang/jwt/testdata/jwt_insecure.js delete mode 100644 internal/commands/process/settings/rules/ruby/lang/weak_encryption/.snapshots/TestRubyLangWeakEncryption--sha1.yml delete mode 100644 internal/commands/process/settings/rules/ruby/lang/weak_encryption/testdata/sha1.rb delete mode 100644 internal/report/output/testhelper/testhelper.go delete mode 100644 internal/report/schema/schemahelper/schemahelper.go rename {internal => pkg}/classification/classification.go (79%) rename {internal => pkg}/classification/db/category_grouping.json (100%) rename {internal => pkg}/classification/db/data_categories/authenticating.json (100%) rename {internal => pkg}/classification/db/data_categories/behavioral_information.json (100%) rename {internal => pkg}/classification/db/data_categories/communication.json (100%) rename {internal => pkg}/classification/db/data_categories/computer_device.json (100%) rename {internal => pkg}/classification/db/data_categories/contact.json (100%) rename {internal => pkg}/classification/db/data_categories/credit_history.json (100%) rename {internal => pkg}/classification/db/data_categories/criminal_records.json (100%) rename {internal => pkg}/classification/db/data_categories/demographic.json (100%) rename {internal => pkg}/classification/db/data_categories/ethnicity.json (100%) rename {internal => pkg}/classification/db/data_categories/family.json (100%) rename {internal => pkg}/classification/db/data_categories/financial_accounts.json (100%) rename {internal => pkg}/classification/db/data_categories/identification.json (100%) rename {internal => pkg}/classification/db/data_categories/knowledge_and_belief.json (100%) rename {internal => pkg}/classification/db/data_categories/location.json (100%) rename {internal => pkg}/classification/db/data_categories/medical_and_health.json (100%) rename {internal => pkg}/classification/db/data_categories/personal_ownership.json (100%) rename {internal => pkg}/classification/db/data_categories/physical_characteristic.json (100%) rename {internal => pkg}/classification/db/data_categories/preference.json (100%) rename {internal => pkg}/classification/db/data_categories/professional_information.json (100%) rename {internal => pkg}/classification/db/data_categories/public_life.json (100%) rename {internal => pkg}/classification/db/data_categories/sexual.json (100%) rename {internal => pkg}/classification/db/data_categories/social_network.json (100%) rename {internal => pkg}/classification/db/data_categories/transactional.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/100_telephone_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/101_geographic.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/102_transactions.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/103_browser_fingerprint.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/104_emails.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/105_links_clicked.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/106_race.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/107_conversation.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/108_vaccine.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/109_question.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/10_charges.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/110_answer.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/111_click.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/112_tracking.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/113_cart.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/114_payment.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/115_order.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/116_purchase.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/117_token.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/118_invoice.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/119_access_token.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/11_pardons.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/120_billing.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/121_bank_transfer.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/122_creditcard.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/123_paystub.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/124_subscription.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/125_exam.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/126_appointment.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/127_consultation.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/128_document.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/129_file.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/12_driving_license.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/130_content.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/131_device.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/132_identification.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/133_earning.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/134_credentials.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/135_message.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/136_rating.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/137_review.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/138_voice.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/139_amount.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/13_device_identifier.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/140_comment.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/142_fullname.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/143_unique_identifier.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/144_disease.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/145_genetic.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/146_lab_test_results.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/147_health_insurance_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/148_insurance.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/149_test.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/14_ethnic_origin.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/150_medical_conditions.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/151_treatment.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/152_scan.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/153_medication.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/154_phi_dates.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/155_diagnosis.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/156_procedures.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/157_risk_assessments.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/158_allergies.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/159_health_insurance_claim_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/15_national_origin.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/160_health_provider.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/161_vital_signs.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/162_blood_pressure.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/163_bmi.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/165_tomography.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/166_physical_activity.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/167_x-ray.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/168_concerns.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/169_hospital_admission_date.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/16_biometric_data.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/170_hospital_discharge_date.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/171_cancer.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/172_colonoscopy.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/173_cholesterol_measurement.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/174_blood_glucose.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/175_high_low_density_lipoproteins.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/176_asthma.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/177_hiv.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/178_flu.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/179_giardiasis.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/17_bank_account.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/180_diphtheria.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/181_pneumonia.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/182_tuberculosis.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/183_hypertension.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/184_illness.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/185_therapy.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/186_procedure.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/187_feedback.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/188_agenda.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/189_contraception.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/18_mothers_maiden_name.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/190_physiotherapy.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/191_pregnancy.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/192_message.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/193_symptom.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/194_signature.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/195_replies.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/196_post.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/197_purchases.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/198_comment.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/19_passport_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/1_email_address.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/20_cars.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/21_national_identity_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/22_telephone_recordings.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/23_voice_mail.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/24_personal_health_history.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/25_family_health_history.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/26_health_records.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/27_disabilities.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/28_drugs_test_results.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/29_blood_type.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/2_email_address.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/30_dna_code.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/31_prescriptions.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/32_place_of_birth.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/33_divorces.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/34_marriages.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/35_friends.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/36_martial_status.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/37_social_status.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/38_student_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/39_taxpayer_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/3_age_range.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/40_social_security_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/41_sexual_preferences.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/42_sexual_history.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/43_disciplinary_actions.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/44_interviews.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/45_job_titles.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/46_work_history.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/47_employment_history.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/48_salary.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/49_certifications.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/4_physical_address.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/50_group_membership.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/51_acquaintances.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/52_opinion.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/53_favorite_foods.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/54_religious_beliefs.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/55_philosophical_beliefs.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/56_vehicle_registration_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/57_browsing_behavior.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/58_call_logs.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/59_links_clicked.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/5_country.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/60_date_of_birth.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/61_date_of_birth.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/62_spoken_languages.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/63_spoken_languages.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/64_accents.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/65_race.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/66_credit.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/67_loan_records.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/68_gender_identity.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/69_gender.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/6_credit_card_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/70_political_affiliation.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/71_religion.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/72_interactions.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/73_general_reputation.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/74_intentions.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/75_interests.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/76_likes.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/77_dislikes.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/78_attitude.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/79_physical_address.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/7_credit_records.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/80_id_number.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/82_ip_address.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/83_mac_address.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/84_mac_address.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/85_firstname.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/86_firstname.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/87_lastname.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/88_lastname.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/8_credit_capacity.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/90_fullname.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/91_username.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/92_physical_and_mental_health.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/93_physical_and_mental_health.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/94_family_structure.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/95_siblings.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/96_image.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/97_income_brackets.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/98_purchases_and_spending_habits.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/99_passwords.json (100%) rename {internal => pkg}/classification/db/data_type_classification_patterns/9_convictions.json (100%) rename {internal => pkg}/classification/db/data_types/accents.json (100%) rename {internal => pkg}/classification/db/data_types/acquaintances.json (100%) rename {internal => pkg}/classification/db/data_types/age.json (100%) rename {internal => pkg}/classification/db/data_types/age_range.json (100%) rename {internal => pkg}/classification/db/data_types/apartments.json (100%) rename {internal => pkg}/classification/db/data_types/associations.json (100%) rename {internal => pkg}/classification/db/data_types/attitude.json (100%) rename {internal => pkg}/classification/db/data_types/bank_account.json (100%) rename {internal => pkg}/classification/db/data_types/biometric_data.json (100%) rename {internal => pkg}/classification/db/data_types/blood_type.json (100%) rename {internal => pkg}/classification/db/data_types/browser_fingerprint.json (100%) rename {internal => pkg}/classification/db/data_types/browsing_behavior.json (100%) rename {internal => pkg}/classification/db/data_types/call_logs.json (100%) rename {internal => pkg}/classification/db/data_types/cars.json (100%) rename {internal => pkg}/classification/db/data_types/certifications.json (100%) rename {internal => pkg}/classification/db/data_types/character.json (100%) rename {internal => pkg}/classification/db/data_types/charges.json (100%) rename {internal => pkg}/classification/db/data_types/colors.json (100%) rename {internal => pkg}/classification/db/data_types/connections.json (100%) rename {internal => pkg}/classification/db/data_types/convictions.json (100%) rename {internal => pkg}/classification/db/data_types/country.json (100%) rename {internal => pkg}/classification/db/data_types/credit.json (100%) rename {internal => pkg}/classification/db/data_types/credit_capacity.json (100%) rename {internal => pkg}/classification/db/data_types/credit_card_number.json (100%) rename {internal => pkg}/classification/db/data_types/credit_records.json (100%) rename {internal => pkg}/classification/db/data_types/credit_standing.json (100%) rename {internal => pkg}/classification/db/data_types/credit_worthiness.json (100%) rename {internal => pkg}/classification/db/data_types/date_of_birth.json (100%) rename {internal => pkg}/classification/db/data_types/demeanor.json (100%) rename {internal => pkg}/classification/db/data_types/device_identifier.json (100%) rename {internal => pkg}/classification/db/data_types/disabilities.json (100%) rename {internal => pkg}/classification/db/data_types/disciplinary_actions.json (100%) rename {internal => pkg}/classification/db/data_types/dislikes.json (100%) rename {internal => pkg}/classification/db/data_types/divorces.json (100%) rename {internal => pkg}/classification/db/data_types/dna_code.json (100%) rename {internal => pkg}/classification/db/data_types/drugs_test_results.json (100%) rename {internal => pkg}/classification/db/data_types/email_address.json (100%) rename {internal => pkg}/classification/db/data_types/emails.json (100%) rename {internal => pkg}/classification/db/data_types/employee_files.json (100%) rename {internal => pkg}/classification/db/data_types/employment_history.json (100%) rename {internal => pkg}/classification/db/data_types/ethnic_origin.json (100%) rename {internal => pkg}/classification/db/data_types/evaluations.json (100%) rename {internal => pkg}/classification/db/data_types/family_health_history.json (100%) rename {internal => pkg}/classification/db/data_types/family_structure.json (100%) rename {internal => pkg}/classification/db/data_types/favorite_foods.json (100%) rename {internal => pkg}/classification/db/data_types/firstname.json (100%) rename {internal => pkg}/classification/db/data_types/friends.json (100%) rename {internal => pkg}/classification/db/data_types/fullname.json (100%) rename {internal => pkg}/classification/db/data_types/gender.json (100%) rename {internal => pkg}/classification/db/data_types/gender_identity.json (100%) rename {internal => pkg}/classification/db/data_types/general_reputation.json (100%) rename {internal => pkg}/classification/db/data_types/geographic.json (100%) rename {internal => pkg}/classification/db/data_types/gps_coordinate.json (100%) rename {internal => pkg}/classification/db/data_types/group_membership.json (100%) rename {internal => pkg}/classification/db/data_types/hair_color.json (100%) rename {internal => pkg}/classification/db/data_types/health_records.json (100%) rename {internal => pkg}/classification/db/data_types/height.json (100%) rename {internal => pkg}/classification/db/data_types/houses.json (100%) rename {internal => pkg}/classification/db/data_types/id_number.json (100%) rename {internal => pkg}/classification/db/data_types/image.json (100%) rename {internal => pkg}/classification/db/data_types/income.json (100%) rename {internal => pkg}/classification/db/data_types/income_brackets.json (100%) rename {internal => pkg}/classification/db/data_types/intentions.json (100%) rename {internal => pkg}/classification/db/data_types/interactions.json (100%) rename {internal => pkg}/classification/db/data_types/interests.json (100%) rename {internal => pkg}/classification/db/data_types/interviews.json (100%) rename {internal => pkg}/classification/db/data_types/ip_address.json (100%) rename {internal => pkg}/classification/db/data_types/job_titles.json (100%) rename {internal => pkg}/classification/db/data_types/knowledge.json (100%) rename {internal => pkg}/classification/db/data_types/lastname.json (100%) rename {internal => pkg}/classification/db/data_types/likes.json (100%) rename {internal => pkg}/classification/db/data_types/links_clicked.json (100%) rename {internal => pkg}/classification/db/data_types/loan_records.json (100%) rename {internal => pkg}/classification/db/data_types/mac_address.json (100%) rename {internal => pkg}/classification/db/data_types/marriages.json (100%) rename {internal => pkg}/classification/db/data_types/martial_status.json (100%) rename {internal => pkg}/classification/db/data_types/mother_maiden_name.json (100%) rename {internal => pkg}/classification/db/data_types/music.json (100%) rename {internal => pkg}/classification/db/data_types/national_origin.json (100%) rename {internal => pkg}/classification/db/data_types/offspring.json (100%) rename {internal => pkg}/classification/db/data_types/opinions.json (100%) rename {internal => pkg}/classification/db/data_types/pardons.json (100%) rename {internal => pkg}/classification/db/data_types/passport_number.json (100%) rename {internal => pkg}/classification/db/data_types/passwords.json (100%) rename {internal => pkg}/classification/db/data_types/personal_health_history.json (100%) rename {internal => pkg}/classification/db/data_types/personal_possessions.json (100%) rename {internal => pkg}/classification/db/data_types/philosophical_beliefs.json (100%) rename {internal => pkg}/classification/db/data_types/physical_address.json (100%) rename {internal => pkg}/classification/db/data_types/physical_and_mental_health.json (100%) rename {internal => pkg}/classification/db/data_types/physical_traits.json (100%) rename {internal => pkg}/classification/db/data_types/piercings.json (100%) rename {internal => pkg}/classification/db/data_types/pin.json (100%) rename {internal => pkg}/classification/db/data_types/political_affiliation.json (100%) rename {internal => pkg}/classification/db/data_types/prescriptions.json (100%) rename {internal => pkg}/classification/db/data_types/purchases.json (100%) rename {internal => pkg}/classification/db/data_types/purchases_and_spending_habits.json (100%) rename {internal => pkg}/classification/db/data_types/race.json (100%) rename {internal => pkg}/classification/db/data_types/references.json (100%) rename {internal => pkg}/classification/db/data_types/relationships.json (100%) rename {internal => pkg}/classification/db/data_types/religion.json (100%) rename {internal => pkg}/classification/db/data_types/religious_beliefs.json (100%) rename {internal => pkg}/classification/db/data_types/room_number.json (100%) rename {internal => pkg}/classification/db/data_types/salary.json (100%) rename {internal => pkg}/classification/db/data_types/sales.json (100%) rename {internal => pkg}/classification/db/data_types/school_attended.json (100%) rename {internal => pkg}/classification/db/data_types/sexual_history.json (100%) rename {internal => pkg}/classification/db/data_types/sexual_preferences.json (100%) rename {internal => pkg}/classification/db/data_types/siblings.json (100%) rename {internal => pkg}/classification/db/data_types/skin_tone.json (100%) rename {internal => pkg}/classification/db/data_types/social_status.json (100%) rename {internal => pkg}/classification/db/data_types/spoken_languages.json (100%) rename {internal => pkg}/classification/db/data_types/tattoos.json (100%) rename {internal => pkg}/classification/db/data_types/taxes.json (100%) rename {internal => pkg}/classification/db/data_types/telephone_number.json (100%) rename {internal => pkg}/classification/db/data_types/telephone_recordings.json (100%) rename {internal => pkg}/classification/db/data_types/thoughts.json (100%) rename {internal => pkg}/classification/db/data_types/transactions.json (100%) rename {internal => pkg}/classification/db/data_types/unique_identifier.json (100%) rename {internal => pkg}/classification/db/data_types/username.json (100%) rename {internal => pkg}/classification/db/data_types/voice_mail.json (100%) rename {internal => pkg}/classification/db/data_types/weight.json (100%) rename {internal => pkg}/classification/db/data_types/work_history.json (100%) rename {internal => pkg}/classification/db/db.go (99%) rename {internal => pkg}/classification/db/known_person_object_patterns/account.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/advisor.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/applicant.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/artist.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/attendee.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/author.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/bank_account.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/beneficiar.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/buyer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/caller.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/candidate.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/cardholder.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/client.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/coach.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/collaborator.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/commenter.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/committer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/competitor.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/consumer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/contact.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/contractor.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/contributor.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/credentials.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/customer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/developer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/doctor.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/driver.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/employee.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/employer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/follower.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/guardian.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/identity.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/insuree.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/invitee.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/issuer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/landlord.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/lead.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/learner.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/login.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/member.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/mentor.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/moderator.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/organizer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/owner.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/panelist.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/participant.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/partner.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/passenger.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/patient.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/payee.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/payer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/payor.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/people.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/person.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/player.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/profile.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/reader.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/receiver.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/recipient.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/recruit.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/referee.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/referer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/registrant.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/seller.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/sender.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/shareholder.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/shopper.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/signer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/student.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/subscriber.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/supplier.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/teacher.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/trainer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/user.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/veteran.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/volunteer.json (100%) rename {internal => pkg}/classification/db/known_person_object_patterns/winner.json (100%) rename {internal => pkg}/classification/db/recipes/abbyy_cloud_ocr_sdk.json (100%) rename {internal => pkg}/classification/db/recipes/abtasty.json (100%) rename {internal => pkg}/classification/db/recipes/active_directory.json (100%) rename {internal => pkg}/classification/db/recipes/activecampaign.json (100%) rename {internal => pkg}/classification/db/recipes/adictiz.json (100%) rename {internal => pkg}/classification/db/recipes/adjust.json (100%) rename {internal => pkg}/classification/db/recipes/adobe_campaign_neolane.json (100%) rename {internal => pkg}/classification/db/recipes/adobe_scene7.json (100%) rename {internal => pkg}/classification/db/recipes/adotmob.json (100%) rename {internal => pkg}/classification/db/recipes/adroll.json (100%) rename {internal => pkg}/classification/db/recipes/adyen.json (100%) rename {internal => pkg}/classification/db/recipes/aerospike.json (100%) rename {internal => pkg}/classification/db/recipes/airbrake.json (100%) rename {internal => pkg}/classification/db/recipes/airtable.json (100%) rename {internal => pkg}/classification/db/recipes/alexa_com.json (100%) rename {internal => pkg}/classification/db/recipes/algolia.json (100%) rename {internal => pkg}/classification/db/recipes/alibaba_cloud_apis.json (100%) rename {internal => pkg}/classification/db/recipes/alloy.json (100%) rename {internal => pkg}/classification/db/recipes/almerys.json (100%) rename {internal => pkg}/classification/db/recipes/alpaca.json (100%) rename {internal => pkg}/classification/db/recipes/amazon_aws_apis.json (100%) rename {internal => pkg}/classification/db/recipes/ambassador.json (100%) rename {internal => pkg}/classification/db/recipes/amc_theater.json (100%) rename {internal => pkg}/classification/db/recipes/ameli.json (100%) rename {internal => pkg}/classification/db/recipes/amplitude.json (100%) rename {internal => pkg}/classification/db/recipes/apache_airflow.json (100%) rename {internal => pkg}/classification/db/recipes/apache_beam.json (100%) rename {internal => pkg}/classification/db/recipes/apache_hbase.json (100%) rename {internal => pkg}/classification/db/recipes/apache_kafka.json (100%) rename {internal => pkg}/classification/db/recipes/apache_spark.json (100%) rename {internal => pkg}/classification/db/recipes/apollographql.json (100%) rename {internal => pkg}/classification/db/recipes/appbase.json (100%) rename {internal => pkg}/classification/db/recipes/appdynamics.json (100%) rename {internal => pkg}/classification/db/recipes/apple.json (100%) rename {internal => pkg}/classification/db/recipes/apple_pay.json (100%) rename {internal => pkg}/classification/db/recipes/appveyor.json (100%) rename {internal => pkg}/classification/db/recipes/aquasec.json (100%) rename {internal => pkg}/classification/db/recipes/asana.json (100%) rename {internal => pkg}/classification/db/recipes/assurcard.json (100%) rename {internal => pkg}/classification/db/recipes/athos_worldline.json (100%) rename {internal => pkg}/classification/db/recipes/atinternet.json (100%) rename {internal => pkg}/classification/db/recipes/atlassian_cloud.json (100%) rename {internal => pkg}/classification/db/recipes/auth0.json (100%) rename {internal => pkg}/classification/db/recipes/aws_athena.json (100%) rename {internal => pkg}/classification/db/recipes/aws_dynamodb.json (100%) rename {internal => pkg}/classification/db/recipes/aws_key_management_service_kms.json (100%) rename {internal => pkg}/classification/db/recipes/aws_kinesis.json (100%) rename {internal => pkg}/classification/db/recipes/aws_redshift.json (100%) rename {internal => pkg}/classification/db/recipes/aws_s3.json (100%) rename {internal => pkg}/classification/db/recipes/aws_s3_glacier.json (100%) rename {internal => pkg}/classification/db/recipes/aws_sqs.json (100%) rename {internal => pkg}/classification/db/recipes/azure_cognitive_search.json (100%) rename {internal => pkg}/classification/db/recipes/azure_cosmos_db.json (100%) rename {internal => pkg}/classification/db/recipes/azure_key_vault.json (100%) rename {internal => pkg}/classification/db/recipes/azure_service_bus.json (100%) rename {internal => pkg}/classification/db/recipes/azure_storage.json (100%) rename {internal => pkg}/classification/db/recipes/badgerdb.json (100%) rename {internal => pkg}/classification/db/recipes/bamboohr.json (100%) rename {internal => pkg}/classification/db/recipes/bambuser.json (100%) rename {internal => pkg}/classification/db/recipes/bank_of_apis_natwest_rbs.json (100%) rename {internal => pkg}/classification/db/recipes/barclays.json (100%) rename {internal => pkg}/classification/db/recipes/basecamp.json (100%) rename {internal => pkg}/classification/db/recipes/bigcommerce.json (100%) rename {internal => pkg}/classification/db/recipes/bintray_jfrog.json (100%) rename {internal => pkg}/classification/db/recipes/bitbucket.json (100%) rename {internal => pkg}/classification/db/recipes/bitly.json (100%) rename {internal => pkg}/classification/db/recipes/bitrise.json (100%) rename {internal => pkg}/classification/db/recipes/blackfire.json (100%) rename {internal => pkg}/classification/db/recipes/boltdb.json (100%) rename {internal => pkg}/classification/db/recipes/box.json (100%) rename {internal => pkg}/classification/db/recipes/braze.json (100%) rename {internal => pkg}/classification/db/recipes/brightbox.json (100%) rename {internal => pkg}/classification/db/recipes/browserstack.json (100%) rename {internal => pkg}/classification/db/recipes/bugsnag.json (100%) rename {internal => pkg}/classification/db/recipes/buntdb.json (100%) rename {internal => pkg}/classification/db/recipes/calendly.json (100%) rename {internal => pkg}/classification/db/recipes/cashplus.json (100%) rename {internal => pkg}/classification/db/recipes/cassandara.json (100%) rename {internal => pkg}/classification/db/recipes/centrify.json (100%) rename {internal => pkg}/classification/db/recipes/chargebee.json (100%) rename {internal => pkg}/classification/db/recipes/chargify.json (100%) rename {internal => pkg}/classification/db/recipes/checkout_com.json (100%) rename {internal => pkg}/classification/db/recipes/circleci.json (100%) rename {internal => pkg}/classification/db/recipes/cirrus_ci.json (100%) rename {internal => pkg}/classification/db/recipes/clearbit.json (100%) rename {internal => pkg}/classification/db/recipes/clickhouse.json (100%) rename {internal => pkg}/classification/db/recipes/clickup.json (100%) rename {internal => pkg}/classification/db/recipes/clodo.json (100%) rename {internal => pkg}/classification/db/recipes/cloudflare.json (100%) rename {internal => pkg}/classification/db/recipes/cloudinary.json (100%) rename {internal => pkg}/classification/db/recipes/cloudwatch.json (100%) rename {internal => pkg}/classification/db/recipes/cockroachdb.json (100%) rename {internal => pkg}/classification/db/recipes/companies_house_gov_uk.json (100%) rename {internal => pkg}/classification/db/recipes/complyadvantage.json (100%) rename {internal => pkg}/classification/db/recipes/contentful.json (100%) rename {internal => pkg}/classification/db/recipes/cookiebot_com.json (100%) rename {internal => pkg}/classification/db/recipes/copper.json (100%) rename {internal => pkg}/classification/db/recipes/couchbase.json (100%) rename {internal => pkg}/classification/db/recipes/crmgang.json (100%) rename {internal => pkg}/classification/db/recipes/customer.json (100%) rename {internal => pkg}/classification/db/recipes/dalenys.json (100%) rename {internal => pkg}/classification/db/recipes/databricks.json (100%) rename {internal => pkg}/classification/db/recipes/datadog.json (100%) rename {internal => pkg}/classification/db/recipes/datadome.json (100%) rename {internal => pkg}/classification/db/recipes/debounce.json (100%) rename {internal => pkg}/classification/db/recipes/demdex_adobe.json (100%) rename {internal => pkg}/classification/db/recipes/digitalocean.json (100%) rename {internal => pkg}/classification/db/recipes/digitalocean_apis.json (100%) rename {internal => pkg}/classification/db/recipes/discord.json (100%) rename {internal => pkg}/classification/db/recipes/disk.json (100%) rename {internal => pkg}/classification/db/recipes/dmp.json (100%) rename {internal => pkg}/classification/db/recipes/dnsimple.json (100%) rename {internal => pkg}/classification/db/recipes/dnsmadeeasy.json (100%) rename {internal => pkg}/classification/db/recipes/docusign.json (100%) rename {internal => pkg}/classification/db/recipes/dossier_pharmaceutique.json (100%) rename {internal => pkg}/classification/db/recipes/dreamhost.json (100%) rename {internal => pkg}/classification/db/recipes/drift.json (100%) rename {internal => pkg}/classification/db/recipes/dropbox.json (100%) rename {internal => pkg}/classification/db/recipes/dropcontact.json (100%) rename {internal => pkg}/classification/db/recipes/dyn_oracle.json (100%) rename {internal => pkg}/classification/db/recipes/easypost.json (100%) rename {internal => pkg}/classification/db/recipes/edgecast.json (100%) rename {internal => pkg}/classification/db/recipes/elastic.json (100%) rename {internal => pkg}/classification/db/recipes/elasticsearch.json (100%) rename {internal => pkg}/classification/db/recipes/emburse.json (100%) rename {internal => pkg}/classification/db/recipes/enboarder.json (100%) rename {internal => pkg}/classification/db/recipes/envoy.json (100%) rename {internal => pkg}/classification/db/recipes/esante_gouv.json (100%) rename {internal => pkg}/classification/db/recipes/essendex.json (100%) rename {internal => pkg}/classification/db/recipes/etcd.json (100%) rename {internal => pkg}/classification/db/recipes/exoscale_cloud_apis.json (100%) rename {internal => pkg}/classification/db/recipes/expensify.json (100%) rename {internal => pkg}/classification/db/recipes/facebook.json (100%) rename {internal => pkg}/classification/db/recipes/fauna.json (100%) rename {internal => pkg}/classification/db/recipes/firebase.json (100%) rename {internal => pkg}/classification/db/recipes/firebird.json (100%) rename {internal => pkg}/classification/db/recipes/fluentd.json (100%) rename {internal => pkg}/classification/db/recipes/forestadmin.json (100%) rename {internal => pkg}/classification/db/recipes/fountain.json (100%) rename {internal => pkg}/classification/db/recipes/france_billet.json (100%) rename {internal => pkg}/classification/db/recipes/freshworks.json (100%) rename {internal => pkg}/classification/db/recipes/front.json (100%) rename {internal => pkg}/classification/db/recipes/ftp_sftp.json (100%) rename {internal => pkg}/classification/db/recipes/galileo.json (100%) rename {internal => pkg}/classification/db/recipes/gandi.json (100%) rename {internal => pkg}/classification/db/recipes/geckoboard.json (100%) rename {internal => pkg}/classification/db/recipes/gfycat.json (100%) rename {internal => pkg}/classification/db/recipes/gitea.json (100%) rename {internal => pkg}/classification/db/recipes/github.json (100%) rename {internal => pkg}/classification/db/recipes/gitlab.json (100%) rename {internal => pkg}/classification/db/recipes/glesys.json (100%) rename {internal => pkg}/classification/db/recipes/gocardless.json (100%) rename {internal => pkg}/classification/db/recipes/google_ads.json (100%) rename {internal => pkg}/classification/db/recipes/google_analytics.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_apis.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_bigquery.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_bigtable.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_dataflow.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_datastore.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_firestore.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_key_management.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_pub_sub.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_secret_manager.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_spanner.json (100%) rename {internal => pkg}/classification/db/recipes/google_cloud_storage.json (100%) rename {internal => pkg}/classification/db/recipes/google_maps.json (100%) rename {internal => pkg}/classification/db/recipes/google_recaptcha.json (100%) rename {internal => pkg}/classification/db/recipes/google_service_apis.json (100%) rename {internal => pkg}/classification/db/recipes/google_spreadsheets.json (100%) rename {internal => pkg}/classification/db/recipes/google_tag_manager.json (100%) rename {internal => pkg}/classification/db/recipes/google_workspace_apis.json (100%) rename {internal => pkg}/classification/db/recipes/gouv_fr_data.json (100%) rename {internal => pkg}/classification/db/recipes/gravatar.json (100%) rename {internal => pkg}/classification/db/recipes/gravity_payments.json (100%) rename {internal => pkg}/classification/db/recipes/greenhouse.json (100%) rename {internal => pkg}/classification/db/recipes/hashicorp_vault.json (100%) rename {internal => pkg}/classification/db/recipes/have_i_been_pwned.json (100%) rename {internal => pkg}/classification/db/recipes/heap.json (100%) rename {internal => pkg}/classification/db/recipes/hellosign.json (100%) rename {internal => pkg}/classification/db/recipes/heroku.json (100%) rename {internal => pkg}/classification/db/recipes/hiscox.json (100%) rename {internal => pkg}/classification/db/recipes/hmrc_gov_uk.json (100%) rename {internal => pkg}/classification/db/recipes/honeybadger.json (100%) rename {internal => pkg}/classification/db/recipes/hotjar.json (100%) rename {internal => pkg}/classification/db/recipes/hubspot.json (100%) rename {internal => pkg}/classification/db/recipes/hugging_face.json (100%) rename {internal => pkg}/classification/db/recipes/hunter.json (100%) rename {internal => pkg}/classification/db/recipes/hypersql.json (100%) rename {internal => pkg}/classification/db/recipes/iagility.json (100%) rename {internal => pkg}/classification/db/recipes/iban.json (100%) rename {internal => pkg}/classification/db/recipes/ibm_db2.json (100%) rename {internal => pkg}/classification/db/recipes/iceberg_technology.json (100%) rename {internal => pkg}/classification/db/recipes/influxdb.json (100%) rename {internal => pkg}/classification/db/recipes/instagram.json (100%) rename {internal => pkg}/classification/db/recipes/instana.json (100%) rename {internal => pkg}/classification/db/recipes/intercom.json (100%) rename {internal => pkg}/classification/db/recipes/intuit.json (100%) rename {internal => pkg}/classification/db/recipes/ipdata.json (100%) rename {internal => pkg}/classification/db/recipes/ipify_org.json (100%) rename {internal => pkg}/classification/db/recipes/ipregistry.json (100%) rename {internal => pkg}/classification/db/recipes/iproov.json (100%) rename {internal => pkg}/classification/db/recipes/ipstack.json (100%) rename {internal => pkg}/classification/db/recipes/iris_openbooks_freeagent.json (100%) rename {internal => pkg}/classification/db/recipes/izberg_marketplace.json (100%) rename {internal => pkg}/classification/db/recipes/jfrog.json (100%) rename {internal => pkg}/classification/db/recipes/jsdelivr.json (100%) rename {internal => pkg}/classification/db/recipes/jumio.json (100%) rename {internal => pkg}/classification/db/recipes/klarna.json (100%) rename {internal => pkg}/classification/db/recipes/la_poste.json (100%) rename {internal => pkg}/classification/db/recipes/launchdarkly.json (100%) rename {internal => pkg}/classification/db/recipes/lengow.json (100%) rename {internal => pkg}/classification/db/recipes/lets_enhance.json (100%) rename {internal => pkg}/classification/db/recipes/leveldb.json (100%) rename {internal => pkg}/classification/db/recipes/lever.json (100%) rename {internal => pkg}/classification/db/recipes/lightstep.json (100%) rename {internal => pkg}/classification/db/recipes/linkedin.json (100%) rename {internal => pkg}/classification/db/recipes/liquid_web_cloud_apis.json (100%) rename {internal => pkg}/classification/db/recipes/logrocket.json (100%) rename {internal => pkg}/classification/db/recipes/logz_io.json (100%) rename {internal => pkg}/classification/db/recipes/mabaya.json (100%) rename {internal => pkg}/classification/db/recipes/mailchimp.json (100%) rename {internal => pkg}/classification/db/recipes/mailjet.json (100%) rename {internal => pkg}/classification/db/recipes/mangopay.json (100%) rename {internal => pkg}/classification/db/recipes/mapbox.json (100%) rename {internal => pkg}/classification/db/recipes/mariadb.json (100%) rename {internal => pkg}/classification/db/recipes/marketo.json (100%) rename {internal => pkg}/classification/db/recipes/maxmind.json (100%) rename {internal => pkg}/classification/db/recipes/memcached.json (100%) rename {internal => pkg}/classification/db/recipes/message_bus.json (100%) rename {internal => pkg}/classification/db/recipes/mettle.json (100%) rename {internal => pkg}/classification/db/recipes/microsoft.json (100%) rename {internal => pkg}/classification/db/recipes/microsoft_azure_apis.json (100%) rename {internal => pkg}/classification/db/recipes/microsoft_sql_server.json (100%) rename {internal => pkg}/classification/db/recipes/microsoft_teams.json (100%) rename {internal => pkg}/classification/db/recipes/mirakl.json (100%) rename {internal => pkg}/classification/db/recipes/mixpanel.json (100%) rename {internal => pkg}/classification/db/recipes/monday.json (100%) rename {internal => pkg}/classification/db/recipes/mondial_relay.json (100%) rename {internal => pkg}/classification/db/recipes/mongodb.json (100%) rename {internal => pkg}/classification/db/recipes/mux.json (100%) rename {internal => pkg}/classification/db/recipes/mysql.json (100%) rename {internal => pkg}/classification/db/recipes/name_com.json (100%) rename {internal => pkg}/classification/db/recipes/namesilo.json (100%) rename {internal => pkg}/classification/db/recipes/nativex_mobvista.json (100%) rename {internal => pkg}/classification/db/recipes/neo4j.json (100%) rename {internal => pkg}/classification/db/recipes/nethunt_crm.json (100%) rename {internal => pkg}/classification/db/recipes/netlify.json (100%) rename {internal => pkg}/classification/db/recipes/new_relic.json (100%) rename {internal => pkg}/classification/db/recipes/nightfall.json (100%) rename {internal => pkg}/classification/db/recipes/nimble.json (100%) rename {internal => pkg}/classification/db/recipes/nodemailer.json (100%) rename {internal => pkg}/classification/db/recipes/nuxeo.json (100%) rename {internal => pkg}/classification/db/recipes/nylas.json (100%) rename {internal => pkg}/classification/db/recipes/ocrolus.json (100%) rename {internal => pkg}/classification/db/recipes/okta.json (100%) rename {internal => pkg}/classification/db/recipes/oney.json (100%) rename {internal => pkg}/classification/db/recipes/onfido.json (100%) rename {internal => pkg}/classification/db/recipes/openai.json (100%) rename {internal => pkg}/classification/db/recipes/openstack_object_storage.json (100%) rename {internal => pkg}/classification/db/recipes/opentok.json (100%) rename {internal => pkg}/classification/db/recipes/openweather.json (100%) rename {internal => pkg}/classification/db/recipes/optimizely.json (100%) rename {internal => pkg}/classification/db/recipes/oracle.json (100%) rename {internal => pkg}/classification/db/recipes/ovh_cloud_apis.json (100%) rename {internal => pkg}/classification/db/recipes/ozone_open_banking_sandbox.json (100%) rename {internal => pkg}/classification/db/recipes/pagerduty.json (100%) rename {internal => pkg}/classification/db/recipes/pandadoc.json (100%) rename {internal => pkg}/classification/db/recipes/payfit.json (100%) rename {internal => pkg}/classification/db/recipes/payline.json (100%) rename {internal => pkg}/classification/db/recipes/paylocity.json (100%) rename {internal => pkg}/classification/db/recipes/payoneer.json (100%) rename {internal => pkg}/classification/db/recipes/paypal.json (100%) rename {internal => pkg}/classification/db/recipes/payu.json (100%) rename {internal => pkg}/classification/db/recipes/phrase.json (100%) rename {internal => pkg}/classification/db/recipes/pipedrive.json (100%) rename {internal => pkg}/classification/db/recipes/pipeliner.json (100%) rename {internal => pkg}/classification/db/recipes/plaid.json (100%) rename {internal => pkg}/classification/db/recipes/porkbun.json (100%) rename {internal => pkg}/classification/db/recipes/postgresql.json (100%) rename {internal => pkg}/classification/db/recipes/posthog.json (100%) rename {internal => pkg}/classification/db/recipes/postmark.json (100%) rename {internal => pkg}/classification/db/recipes/prestashop.json (100%) rename {internal => pkg}/classification/db/recipes/processout.json (100%) rename {internal => pkg}/classification/db/recipes/profitbricks_ionos.json (100%) rename {internal => pkg}/classification/db/recipes/prometheus.json (100%) rename {internal => pkg}/classification/db/recipes/pubnub.json (100%) rename {internal => pkg}/classification/db/recipes/pusher.json (100%) rename {internal => pkg}/classification/db/recipes/quanta.json (100%) rename {internal => pkg}/classification/db/recipes/rabbitmq.json (100%) rename {internal => pkg}/classification/db/recipes/rackspace_cloud.json (100%) rename {internal => pkg}/classification/db/recipes/raygun.json (100%) rename {internal => pkg}/classification/db/recipes/reddit.json (100%) rename {internal => pkg}/classification/db/recipes/redis.json (100%) rename {internal => pkg}/classification/db/recipes/reportportal.json (100%) rename {internal => pkg}/classification/db/recipes/rethinkdb.json (100%) rename {internal => pkg}/classification/db/recipes/revolut.json (100%) rename {internal => pkg}/classification/db/recipes/rocket_chat.json (100%) rename {internal => pkg}/classification/db/recipes/rollbar.json (100%) rename {internal => pkg}/classification/db/recipes/runscope.json (100%) rename {internal => pkg}/classification/db/recipes/rydoo.json (100%) rename {internal => pkg}/classification/db/recipes/sage.json (100%) rename {internal => pkg}/classification/db/recipes/sakura.json (100%) rename {internal => pkg}/classification/db/recipes/salesforce.json (100%) rename {internal => pkg}/classification/db/recipes/sap.json (100%) rename {internal => pkg}/classification/db/recipes/sap_hana.json (100%) rename {internal => pkg}/classification/db/recipes/satismeter.json (100%) rename {internal => pkg}/classification/db/recipes/scaleway_cloud_apis.json (100%) rename {internal => pkg}/classification/db/recipes/scalia_ci.json (100%) rename {internal => pkg}/classification/db/recipes/scout_apm.json (100%) rename {internal => pkg}/classification/db/recipes/seeuletter_mysendingbox.json (100%) rename {internal => pkg}/classification/db/recipes/segment.json (100%) rename {internal => pkg}/classification/db/recipes/selligent.json (100%) rename {internal => pkg}/classification/db/recipes/sendbird.json (100%) rename {internal => pkg}/classification/db/recipes/sendgrid.json (100%) rename {internal => pkg}/classification/db/recipes/sendinblue.json (100%) rename {internal => pkg}/classification/db/recipes/sentry.json (100%) rename {internal => pkg}/classification/db/recipes/shipbob.json (100%) rename {internal => pkg}/classification/db/recipes/shopify.json (100%) rename {internal => pkg}/classification/db/recipes/skyscanner.json (100%) rename {internal => pkg}/classification/db/recipes/slack.json (100%) rename {internal => pkg}/classification/db/recipes/small_improvements.json (100%) rename {internal => pkg}/classification/db/recipes/smb.json (100%) rename {internal => pkg}/classification/db/recipes/snowflake.json (100%) rename {internal => pkg}/classification/db/recipes/societeinfo.json (100%) rename {internal => pkg}/classification/db/recipes/socket_io.json (100%) rename {internal => pkg}/classification/db/recipes/softlayer_ibm_cloud.json (100%) rename {internal => pkg}/classification/db/recipes/solocal_bridge.json (100%) rename {internal => pkg}/classification/db/recipes/splunk.json (100%) rename {internal => pkg}/classification/db/recipes/sqlite.json (100%) rename {internal => pkg}/classification/db/recipes/sqreen_datadog.json (100%) rename {internal => pkg}/classification/db/recipes/square.json (100%) rename {internal => pkg}/classification/db/recipes/stackify.json (100%) rename {internal => pkg}/classification/db/recipes/statuspage.json (100%) rename {internal => pkg}/classification/db/recipes/stripe.json (100%) rename {internal => pkg}/classification/db/recipes/tanker.json (100%) rename {internal => pkg}/classification/db/recipes/telegram.json (100%) rename {internal => pkg}/classification/db/recipes/tencent_cloud_apis.json (100%) rename {internal => pkg}/classification/db/recipes/thunes_limonethik.json (100%) rename {internal => pkg}/classification/db/recipes/tide.json (100%) rename {internal => pkg}/classification/db/recipes/tidelift.json (100%) rename {internal => pkg}/classification/db/recipes/tradier.json (100%) rename {internal => pkg}/classification/db/recipes/trafficvance.json (100%) rename {internal => pkg}/classification/db/recipes/travefy.json (100%) rename {internal => pkg}/classification/db/recipes/travis_ci.json (100%) rename {internal => pkg}/classification/db/recipes/treezor.json (100%) rename {internal => pkg}/classification/db/recipes/trello.json (100%) rename {internal => pkg}/classification/db/recipes/twilio.json (100%) rename {internal => pkg}/classification/db/recipes/twitter.json (100%) rename {internal => pkg}/classification/db/recipes/typeform.json (100%) rename {internal => pkg}/classification/db/recipes/unidentified_data_store.json (100%) rename {internal => pkg}/classification/db/recipes/unsplash.json (100%) rename {internal => pkg}/classification/db/recipes/uploadecare.json (100%) rename {internal => pkg}/classification/db/recipes/uptrends.json (100%) rename {internal => pkg}/classification/db/recipes/userlike_com.json (100%) rename {internal => pkg}/classification/db/recipes/usersnap.json (100%) rename {internal => pkg}/classification/db/recipes/vercel.json (100%) rename {internal => pkg}/classification/db/recipes/vero.json (100%) rename {internal => pkg}/classification/db/recipes/victorops_splunk.json (100%) rename {internal => pkg}/classification/db/recipes/vonage.json (100%) rename {internal => pkg}/classification/db/recipes/wistia.json (100%) rename {internal => pkg}/classification/db/recipes/wordnik.json (100%) rename {internal => pkg}/classification/db/recipes/wordpress.json (100%) rename {internal => pkg}/classification/db/recipes/workos.json (100%) rename {internal => pkg}/classification/db/recipes/wrike.json (100%) rename {internal => pkg}/classification/db/recipes/xero.json (100%) rename {internal => pkg}/classification/db/recipes/xignite.json (100%) rename {internal => pkg}/classification/db/recipes/yandex_cloud_apis.json (100%) rename {internal => pkg}/classification/db/recipes/yodlee.json (100%) rename {internal => pkg}/classification/db/recipes/youtube.json (100%) rename {internal => pkg}/classification/db/recipes/zapier.json (100%) rename {internal => pkg}/classification/db/recipes/zendesk.json (100%) rename {internal => pkg}/classification/db/recipes/zeplin.json (100%) rename {internal => pkg}/classification/db/recipes/zoho.json (100%) rename {internal => pkg}/classification/db/subject_mapping.json (100%) rename {internal => pkg}/classification/dependencies/dependencies.go (92%) rename {internal => pkg}/classification/dependencies/dependencies_test.go (90%) rename {internal => pkg}/classification/frameworks/frameworks.go (93%) rename {internal => pkg}/classification/frameworks/frameworks_test.go (93%) rename {internal => pkg}/classification/interfaces/interfaces.go (96%) rename {internal => pkg}/classification/interfaces/interfaces_test.go (95%) rename {internal => pkg}/classification/schema/.snapshots/TestCSharp (100%) rename {internal => pkg}/classification/schema/.snapshots/TestCSharpKPI (100%) rename {internal => pkg}/classification/schema/.snapshots/TestGo (100%) rename {internal => pkg}/classification/schema/.snapshots/TestGoKPI (100%) rename {internal => pkg}/classification/schema/.snapshots/TestJava (100%) rename {internal => pkg}/classification/schema/.snapshots/TestJavaKPI (100%) rename {internal => pkg}/classification/schema/.snapshots/TestJavascript (100%) rename {internal => pkg}/classification/schema/.snapshots/TestJavascriptKPI (100%) rename {internal => pkg}/classification/schema/.snapshots/TestPHP (100%) rename {internal => pkg}/classification/schema/.snapshots/TestPHPKPI (100%) rename {internal => pkg}/classification/schema/.snapshots/TestPython (100%) rename {internal => pkg}/classification/schema/.snapshots/TestPythonKPI (100%) rename {internal => pkg}/classification/schema/.snapshots/TestRuby (100%) rename {internal => pkg}/classification/schema/.snapshots/TestRubyKPI (100%) rename {internal => pkg}/classification/schema/.snapshots/TestTypescript (100%) rename {internal => pkg}/classification/schema/.snapshots/TestTypescriptKPI (100%) rename {internal => pkg}/classification/schema/fixtures/csharp.json (100%) rename {internal => pkg}/classification/schema/fixtures/go.json (100%) rename {internal => pkg}/classification/schema/fixtures/java.json (100%) rename {internal => pkg}/classification/schema/fixtures/javascript.json (100%) rename {internal => pkg}/classification/schema/fixtures/php.json (100%) rename {internal => pkg}/classification/schema/fixtures/python.json (100%) rename {internal => pkg}/classification/schema/fixtures/ruby.json (100%) rename {internal => pkg}/classification/schema/fixtures/typescript.json (100%) rename {internal => pkg}/classification/schema/internal/testhelper/testhelper.go (97%) rename {internal => pkg}/classification/schema/kpi_test.go (97%) rename {internal => pkg}/classification/schema/schema.go (98%) rename {internal => pkg}/classification/schema/schema_test.go (98%) rename {internal => pkg}/commands/app.go (94%) rename {internal => pkg}/commands/artifact/run.go (82%) rename {internal => pkg}/commands/artifact/run_test.go (100%) rename {internal => pkg}/commands/artifact/scanid/scanid.go (93%) rename {internal => pkg}/commands/completion.go (100%) rename {internal => pkg}/commands/debugprofile/debugprofile.go (96%) rename {internal => pkg}/commands/ignore.go (98%) rename {internal => pkg}/commands/init.go (89%) rename {internal => pkg}/commands/process/filelist/filelist.go (82%) rename {internal => pkg}/commands/process/filelist/filelist_test.go (93%) rename {internal => pkg}/commands/process/filelist/files/files.go (86%) rename {internal => pkg}/commands/process/filelist/ignore/ignore.go (97%) rename {internal => pkg}/commands/process/filelist/testdata/happy_path/skip/users/admin.go (100%) rename {internal => pkg}/commands/process/filelist/testdata/happy_path/skip/users/minifiedJs.min.js (100%) rename {internal => pkg}/commands/process/filelist/testdata/happy_path/skip/users/users.go (100%) rename {internal => pkg}/commands/process/filelist/testdata/happy_path/standard/user.go (100%) rename {internal => pkg}/commands/process/filelist/timeout/timeout.go (89%) rename {internal => pkg}/commands/process/gitrepository/context.go (98%) rename {internal => pkg}/commands/process/gitrepository/gitrepository.go (93%) rename {internal => pkg}/commands/process/orchestrator/orchestrator.go (87%) rename {internal => pkg}/commands/process/orchestrator/pool/pool.go (89%) rename {internal => pkg}/commands/process/orchestrator/pool/process.go (95%) rename {internal => pkg}/commands/process/orchestrator/work/work.go (79%) rename {internal => pkg}/commands/process/orchestrator/worker/worker.go (90%) create mode 100644 pkg/commands/process/settings/loader/loader.go rename {internal => pkg}/commands/process/settings/policies/common.rego (100%) create mode 100644 pkg/commands/process/settings/policies/policies.go rename {internal/commands/process/settings => pkg/commands/process/settings/policies}/policies.yml (71%) rename {internal => pkg}/commands/process/settings/policies/privacy_report.rego (100%) rename {internal => pkg}/commands/process/settings/policies/risk_policy.rego (100%) rename {internal => pkg}/commands/process/settings/policies/verifier_policy.rego (100%) rename {internal => pkg}/commands/process/settings/processors/db_encrypted.rego (100%) create mode 100644 pkg/commands/process/settings/processors/processors.go rename {internal => pkg}/commands/process/settings/processors/rails_encrypted.rego (100%) rename {internal/commands/process/settings/built_in_rules => pkg/commands/process/settings/rules/built_in}/sql/lang/create_table.yml (100%) rename {internal/commands/process/settings/built_in_rules => pkg/commands/process/settings/rules/built_in}/third_party/gitleaks/secret_detection.yml (100%) create mode 100644 pkg/commands/process/settings/rules/loader.go create mode 100644 pkg/commands/process/settings/rules/rules.go create mode 100644 pkg/commands/process/settings/rules/validation.go rename {internal => pkg}/commands/process/settings/settings.go (73%) rename {internal => pkg}/commands/processing_worker.go (86%) rename {internal => pkg}/commands/scan.go (88%) rename {internal => pkg}/commands/version.go (90%) rename {internal => pkg}/detectors/beego/.snapshots/TestDetectorReportDatabases (100%) rename {internal => pkg}/detectors/beego/beego.go (91%) rename {internal => pkg}/detectors/beego/beego_test.go (74%) rename {internal => pkg}/detectors/beego/testdata/beego/database.go (100%) rename {internal => pkg}/detectors/beego/testdata/beego/database2.go (100%) rename {internal => pkg}/detectors/beego/testdata/beego/go.mod (100%) rename {internal => pkg}/detectors/beego/testdata/beego/main.go (100%) rename {internal => pkg}/detectors/beego/testdata/go_not_beego/go.mod (100%) rename {internal => pkg}/detectors/beego/testdata/go_not_beego/main.go (100%) rename {internal => pkg}/detectors/beego/testdata/not_go/Gemfile (100%) rename {internal => pkg}/detectors/csharp/.snapshots/TestDetectorReportDataTypes (100%) rename {internal => pkg}/detectors/csharp/.snapshots/TestDetectorReportInterfaces (100%) rename {internal => pkg}/detectors/csharp/csharp.go (87%) rename {internal => pkg}/detectors/csharp/csharp_test.go (74%) rename {internal => pkg}/detectors/csharp/datatype/datatype.go (93%) rename {internal => pkg}/detectors/csharp/testdata/datatypes/datatypes.cs (100%) rename {internal => pkg}/detectors/csharp/testdata/project/config.cs (100%) rename {internal => pkg}/detectors/csharp/testdata/project/urls.cs (100%) rename {internal => pkg}/detectors/custom/config/config.go (95%) rename {internal => pkg}/detectors/custom/custom.go (91%) rename {internal => pkg}/detectors/dependencies/buildgradle/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/buildgradle/buildgradle.go (52%) rename {internal => pkg}/detectors/dependencies/buildgradle/buildgradle_test.go (76%) rename {internal => pkg}/detectors/dependencies/buildgradle/parser/parser.go (93%) rename {internal => pkg}/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/checksums/checksums.lock (100%) rename {internal => pkg}/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock (100%) rename {internal => pkg}/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/dependencies-accessors/gc.properties (100%) rename {internal => pkg}/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/fileChanges/last-build.bin (100%) rename {internal => pkg}/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/fileHashes/fileHashes.lock (100%) rename {internal => pkg}/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/gc.properties (100%) rename {internal => pkg}/detectors/dependencies/buildgradle/testdata/.gradle/vcs-1/gc.properties (100%) rename {internal => pkg}/detectors/dependencies/buildgradle/testdata/build.gradle (100%) rename {internal => pkg}/detectors/dependencies/composerjson/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/composerjson/composerjson.go (88%) rename {internal => pkg}/detectors/dependencies/composerjson/composerjson_test.go (76%) rename {internal => pkg}/detectors/dependencies/composerjson/testdata/composer.json (100%) rename {internal => pkg}/detectors/dependencies/composerlock/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/composerlock/composerlock.go (89%) rename {internal => pkg}/detectors/dependencies/composerlock/composerlock_test.go (76%) rename {internal => pkg}/detectors/dependencies/composerlock/testdata/composer.lock (100%) rename {internal => pkg}/detectors/dependencies/dependencies.go (62%) rename {internal => pkg}/detectors/dependencies/depsbase/depsbase.go (100%) rename {internal => pkg}/detectors/dependencies/gemfile/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/gemfile/gemfile-lock.go (95%) rename {internal => pkg}/detectors/dependencies/gemfile/gemfile-lock_test.go (76%) rename {internal => pkg}/detectors/dependencies/gemfile/testdata/Gemfile.lock (100%) rename {internal => pkg}/detectors/dependencies/gosum/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/gosum/go.go (86%) rename {internal => pkg}/detectors/dependencies/gosum/go_test.go (76%) rename {internal => pkg}/detectors/dependencies/gosum/testdata/go.sum (100%) rename {internal => pkg}/detectors/dependencies/ivy/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/ivy/ivy.go (92%) rename {internal => pkg}/detectors/dependencies/ivy/ivy_test.go (76%) rename {internal => pkg}/detectors/dependencies/ivy/testdata/ivy-report.xml (100%) rename {internal => pkg}/detectors/dependencies/mvnplugin/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/mvnplugin/mvnplugin.go (89%) rename {internal => pkg}/detectors/dependencies/mvnplugin/mvnplugin_test.go (76%) rename {internal => pkg}/detectors/dependencies/mvnplugin/testdata/maven-dependencies.json (100%) rename {internal => pkg}/detectors/dependencies/npm/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/npm/npm.go (93%) rename {internal => pkg}/detectors/dependencies/npm/npm_test.go (76%) rename {internal => pkg}/detectors/dependencies/npm/testdata/npm-shrinkwrap.json (100%) rename {internal => pkg}/detectors/dependencies/npm/testdata/package-lock.json (100%) rename {internal => pkg}/detectors/dependencies/nuget/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/nuget/nuget.go (93%) rename {internal => pkg}/detectors/dependencies/nuget/nuget_test.go (76%) rename {internal => pkg}/detectors/dependencies/nuget/testdata/packages.lock.json (100%) rename {internal => pkg}/detectors/dependencies/package-config/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/package-config/package-config.go (86%) rename {internal => pkg}/detectors/dependencies/package-config/package-config_test.go (76%) rename {internal => pkg}/detectors/dependencies/package-config/testdata/packages.config (100%) rename {internal => pkg}/detectors/dependencies/package-json/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/package-json/package-json.go (87%) rename {internal => pkg}/detectors/dependencies/package-json/package-json_test.go (76%) rename {internal => pkg}/detectors/dependencies/package-json/testdata/package.json (100%) rename {internal => pkg}/detectors/dependencies/paket-dependencies/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/paket-dependencies/paket-dependencies.go (93%) rename {internal => pkg}/detectors/dependencies/paket-dependencies/paket-dependencies_test.go (76%) rename {internal => pkg}/detectors/dependencies/paket-dependencies/testdata/paket.dependencies (100%) rename {internal => pkg}/detectors/dependencies/pipdeptree/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/pipdeptree/pipdeptree.go (87%) rename {internal => pkg}/detectors/dependencies/pipdeptree/pipdeptree_test.go (76%) rename {internal => pkg}/detectors/dependencies/pipdeptree/testdata/pipdeptree.json (100%) rename {internal => pkg}/detectors/dependencies/piplock/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/piplock/piplock.go (86%) rename {internal => pkg}/detectors/dependencies/piplock/piplock_test.go (76%) rename {internal => pkg}/detectors/dependencies/piplock/testdata/Pipfile.lock (100%) rename {internal => pkg}/detectors/dependencies/poetry/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/poetry/poetry.go (87%) rename {internal => pkg}/detectors/dependencies/poetry/poetry_test.go (76%) rename {internal => pkg}/detectors/dependencies/poetry/testdata/poetry.lock (100%) rename {internal => pkg}/detectors/dependencies/pom-xml/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/pom-xml/pom-xml.go (87%) rename {internal => pkg}/detectors/dependencies/pom-xml/pom-xml_test.go (76%) rename {internal => pkg}/detectors/dependencies/pom-xml/testdata/large-file/pom.xml (100%) rename {internal => pkg}/detectors/dependencies/pom-xml/testdata/v1/pom.xml (100%) rename {internal => pkg}/detectors/dependencies/pom-xml/testdata/v2-iso/pom.xml (100%) rename {internal => pkg}/detectors/dependencies/pom-xml/testdata/v2/pom.xml (100%) rename {internal => pkg}/detectors/dependencies/project-json/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/project-json/project-json.go (87%) rename {internal => pkg}/detectors/dependencies/project-json/project-json_test.go (76%) rename {internal => pkg}/detectors/dependencies/project-json/testdata/project.json (100%) rename {internal => pkg}/detectors/dependencies/pyproject/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/pyproject/pyproject.go (86%) rename {internal => pkg}/detectors/dependencies/pyproject/pyproject_test.go (76%) rename {internal => pkg}/detectors/dependencies/pyproject/testdata/pyproject.toml (100%) rename {internal => pkg}/detectors/dependencies/requirements/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/requirements/requirements.go (85%) rename {internal => pkg}/detectors/dependencies/requirements/requirements_test.go (76%) rename {internal => pkg}/detectors/dependencies/requirements/testdata/requirements.txt (100%) rename {internal => pkg}/detectors/dependencies/yarnlock/.snapshots/TestDependenciesReport (100%) rename {internal => pkg}/detectors/dependencies/yarnlock/testdata/yarn.lock (100%) rename {internal => pkg}/detectors/dependencies/yarnlock/yarnlock.go (92%) rename {internal => pkg}/detectors/dependencies/yarnlock/yarnlock_test.go (76%) rename {internal => pkg}/detectors/detectors.go (75%) rename {internal => pkg}/detectors/django/.snapshots/TestDetectorReportDatabases (100%) rename {internal => pkg}/detectors/django/django.go (88%) rename {internal => pkg}/detectors/django/django_test.go (74%) rename {internal => pkg}/detectors/django/testdata/django/manage.py (100%) rename {internal => pkg}/detectors/django/testdata/django/myapp/settings.py (100%) rename {internal => pkg}/detectors/django/testdata/not_django/manage.py (100%) rename {internal => pkg}/detectors/dotnet/.snapshots/TestDetectorReportDbContexts (100%) rename {internal => pkg}/detectors/dotnet/dotnet.go (89%) rename {internal => pkg}/detectors/dotnet/dotnet_test.go (76%) rename {internal => pkg}/detectors/dotnet/testdata/project/db_contexts/multiple/Startup.cs (100%) rename {internal => pkg}/detectors/dotnet/testdata/project/db_contexts/multiple/TodoApi.csproj (100%) rename {internal => pkg}/detectors/dotnet/testdata/project/db_contexts/multiple/nested/Startup.cs (100%) rename {internal => pkg}/detectors/dotnet/testdata/project/multiple/MvcMovie.csproj (100%) rename {internal => pkg}/detectors/dotnet/testdata/project/multiple/TodoApi.csproj (100%) rename {internal => pkg}/detectors/dotnet/testdata/project/single/TodoApi.csproj (100%) rename {internal => pkg}/detectors/dotnet/testdata/project/test/TodoApiTests.csproj (100%) rename {internal => pkg}/detectors/envfile/.snapshots/TestDetectorReportVariables (100%) rename {internal => pkg}/detectors/envfile/envfile.go (77%) rename {internal => pkg}/detectors/envfile/envfile_test.go (77%) rename {internal => pkg}/detectors/envfile/testdata/variables/.envrc.example (100%) rename {internal => pkg}/detectors/gitleaks/.snapshots/TestSecretLeaks (100%) rename {internal => pkg}/detectors/gitleaks/gitlab_config.toml (100%) rename {internal => pkg}/detectors/gitleaks/gitleaks.go (83%) rename {internal => pkg}/detectors/gitleaks/gitleaks_test.go (62%) rename {internal => pkg}/detectors/gitleaks/testdata/aws.js (100%) rename {internal => pkg}/detectors/gitleaks/testdata/regex/rsa.pem (100%) rename {internal => pkg}/detectors/golang/.snapshots/TestDetectorReportDataTypes (100%) rename {internal => pkg}/detectors/golang/.snapshots/TestDetectorReportInterfacesPaths (100%) rename {internal => pkg}/detectors/golang/.snapshots/TestDetectorReportInterfacesProject (100%) rename {internal => pkg}/detectors/golang/datatype/datatype.go (94%) rename {internal => pkg}/detectors/golang/golang.go (88%) rename {internal => pkg}/detectors/golang/golang_test.go (80%) rename {internal => pkg}/detectors/golang/testdata/datatypes/datatype.go (100%) rename {internal => pkg}/detectors/golang/testdata/paths/paths.go (100%) rename {internal => pkg}/detectors/golang/testdata/project/config.go (100%) rename {internal => pkg}/detectors/golang/testdata/project/urls.go (100%) rename {internal => pkg}/detectors/graphql/.snapshots/TestBuildReportSchema (100%) rename {internal => pkg}/detectors/graphql/graphql.go (85%) rename {internal => pkg}/detectors/graphql/graphql_test.go (62%) rename {internal => pkg}/detectors/graphql/testdata/schemas/schema.graphql (100%) rename {internal => pkg}/detectors/html/.snapshots/TestDetectorReportInterfaces (100%) rename {internal => pkg}/detectors/html/html.go (84%) rename {internal => pkg}/detectors/html/html_test.go (64%) rename {internal => pkg}/detectors/html/testdata/project/app.vue (100%) rename {internal => pkg}/detectors/html/testdata/project/base.html.twig (100%) rename {internal => pkg}/detectors/html/testdata/project/google_analytics.html (100%) rename {internal => pkg}/detectors/html/testdata/project/index.cshtml (100%) rename {internal => pkg}/detectors/html/testdata/project/index.ejs (100%) rename {internal => pkg}/detectors/html/testdata/project/index.handlebars (100%) rename {internal => pkg}/detectors/html/testdata/project/index.html (100%) rename {internal => pkg}/detectors/html/testdata/project/index.html.erb (100%) rename {internal => pkg}/detectors/html/testdata/project/index.html.twig (100%) rename {internal => pkg}/detectors/html/testdata/project/index.jinja (100%) rename {internal => pkg}/detectors/html/testdata/project/index.liquid (100%) rename {internal => pkg}/detectors/html/testdata/project/index.mustache (100%) rename {internal => pkg}/detectors/html/testdata/project/index.phtml (100%) rename {internal => pkg}/detectors/internal/testhelper/testhelper.go (89%) rename {internal => pkg}/detectors/ipynb/.snapshots/TestDetectorReportInterfaces (100%) rename {internal => pkg}/detectors/ipynb/ipynb.go (87%) rename {internal => pkg}/detectors/ipynb/ipynb_test.go (64%) rename {internal => pkg}/detectors/ipynb/testdata/notebooks/small.ipynb (100%) rename {internal => pkg}/detectors/java/.snapshots/TestDetectorReportDataTypes (100%) rename {internal => pkg}/detectors/java/.snapshots/TestDetectorReportPaths (100%) rename {internal => pkg}/detectors/java/.snapshots/TestDetectorReportVariables (100%) rename {internal => pkg}/detectors/java/datatype/datatype.go (89%) rename {internal => pkg}/detectors/java/java.go (85%) rename {internal => pkg}/detectors/java/java_test.go (80%) rename {internal => pkg}/detectors/java/testdata/datatype/datatype.java (100%) rename {internal => pkg}/detectors/java/testdata/paths/config.java (100%) rename {internal => pkg}/detectors/java/testdata/variables/config.java (100%) rename {internal => pkg}/detectors/javascript/.snapshots/TestDetectorReportDatatypes (100%) rename {internal => pkg}/detectors/javascript/.snapshots/TestDetectorReportGeneral (100%) rename {internal => pkg}/detectors/javascript/datatype/datatype.go (63%) rename {internal => pkg}/detectors/javascript/datatype/objects.go (97%) rename {internal => pkg}/detectors/javascript/datatype/properties.go (92%) rename {internal => pkg}/detectors/javascript/javascript.go (89%) rename {internal => pkg}/detectors/javascript/javascript_test.go (80%) rename {internal => pkg}/detectors/javascript/testdata/datatypes/datatypes.js (100%) rename {internal => pkg}/detectors/javascript/testdata/datatypes_performance/angular1.8.min.js (100%) rename {internal => pkg}/detectors/javascript/testdata/general/paths/main.js (100%) rename {internal => pkg}/detectors/javascript/testdata/general/variables/config.js (100%) rename {internal => pkg}/detectors/javascript/util/util.go (96%) rename {internal => pkg}/detectors/openapi/.snapshots/TestDetectorV2json (100%) rename {internal => pkg}/detectors/openapi/.snapshots/TestDetectorV2yaml (100%) rename {internal => pkg}/detectors/openapi/.snapshots/TestDetectorV3json (100%) rename {internal => pkg}/detectors/openapi/.snapshots/TestDetectorV3yaml (100%) rename {internal => pkg}/detectors/openapi/.snapshots/TestOtherjson (100%) rename {internal => pkg}/detectors/openapi/json/objects.go (81%) rename {internal => pkg}/detectors/openapi/json/operationId.go (82%) rename {internal => pkg}/detectors/openapi/json/paths.go (82%) rename {internal => pkg}/detectors/openapi/openapi.go (83%) rename {internal => pkg}/detectors/openapi/openapi_test.go (80%) rename {internal => pkg}/detectors/openapi/queries/objects.go (88%) rename {internal => pkg}/detectors/openapi/queries/operationId.go (87%) rename {internal => pkg}/detectors/openapi/queries/paths.go (78%) rename {internal => pkg}/detectors/openapi/queries/queries.go (67%) rename {internal => pkg}/detectors/openapi/queries/urls.go (93%) rename {internal => pkg}/detectors/openapi/queries/v2parameters.go (76%) rename {internal => pkg}/detectors/openapi/queries/v3parameters.go (83%) rename {internal => pkg}/detectors/openapi/reportadder/reportadder.go (83%) rename {internal => pkg}/detectors/openapi/testdata/arrayjson/packages.json (100%) rename {internal => pkg}/detectors/openapi/testdata/v2json/petstore-swagger.json (100%) rename {internal => pkg}/detectors/openapi/testdata/v2yaml/petstore-swagger.yaml (100%) rename {internal => pkg}/detectors/openapi/testdata/v3json/petstore-openapi.json (100%) rename {internal => pkg}/detectors/openapi/testdata/v3yaml/petstore-openapi.yaml (100%) rename {internal => pkg}/detectors/openapi/v2json/v2json.go (73%) rename {internal => pkg}/detectors/openapi/v2yaml/v2yml.go (73%) rename {internal => pkg}/detectors/openapi/v3json/v3json.go (73%) rename {internal => pkg}/detectors/openapi/v3yaml/v3yml.go (73%) rename {internal => pkg}/detectors/openapi/yaml/objects.go (84%) rename {internal => pkg}/detectors/openapi/yaml/operationId.go (84%) rename {internal => pkg}/detectors/openapi/yaml/paths.go (85%) rename {internal => pkg}/detectors/php/.snapshots/TestDetectorReportContext (100%) rename {internal => pkg}/detectors/php/.snapshots/TestDetectorReportDatatype (100%) rename {internal => pkg}/detectors/php/.snapshots/TestDetectorReportIgnore (100%) rename {internal => pkg}/detectors/php/.snapshots/TestDetectorReportInterfaces1 (100%) rename {internal => pkg}/detectors/php/.snapshots/TestDetectorReportInterfaces2 (100%) rename {internal => pkg}/detectors/php/context/assignment_expression.go (80%) rename {internal => pkg}/detectors/php/context/finder.go (89%) rename {internal => pkg}/detectors/php/context/property_element.go (87%) rename {internal => pkg}/detectors/php/datatype/datatype.go (86%) rename {internal => pkg}/detectors/php/datatype/properties.go (90%) rename {internal => pkg}/detectors/php/php.go (87%) rename {internal => pkg}/detectors/php/php_test.go (87%) rename {internal => pkg}/detectors/php/testdata/context/context.php (100%) rename {internal => pkg}/detectors/php/testdata/datatype/datatype.php (100%) rename {internal => pkg}/detectors/php/testdata/ignore/phive (100%) rename {internal => pkg}/detectors/php/testdata/paths/paths.php (100%) rename {internal => pkg}/detectors/php/testdata/variables/config.php (100%) rename {internal => pkg}/detectors/proto/.snapshots/TestBuildReportSchema (100%) rename {internal => pkg}/detectors/proto/proto.go (87%) rename {internal => pkg}/detectors/proto/proto_test.go (62%) rename {internal => pkg}/detectors/proto/testdata/protos/schema.proto (100%) rename {internal => pkg}/detectors/python/.snapshots/TestDetectorReportDatatype (100%) rename {internal => pkg}/detectors/python/.snapshots/TestDetectorReportInterfacePaths (100%) rename {internal => pkg}/detectors/python/.snapshots/TestDetectorReportInterfaceProjects (100%) rename {internal => pkg}/detectors/python/datatype/datatype.go (89%) rename {internal => pkg}/detectors/python/datatype/properties.go (93%) rename {internal => pkg}/detectors/python/python.go (91%) rename {internal => pkg}/detectors/python/python_test.go (81%) rename {internal => pkg}/detectors/python/testdata/datatype/datatype.py (100%) rename {internal => pkg}/detectors/python/testdata/paths/main.py (100%) rename {internal => pkg}/detectors/python/testdata/project/config.py (100%) rename {internal => pkg}/detectors/python/testdata/project/urls.py (100%) rename {internal => pkg}/detectors/rails/.snapshots/TestBuildReportCaches (100%) rename {internal => pkg}/detectors/rails/.snapshots/TestBuildReportDatabaseSchema (100%) rename {internal => pkg}/detectors/rails/.snapshots/TestBuildReportMultipleDatabases (100%) rename {internal => pkg}/detectors/rails/.snapshots/TestBuildReportSingleDatabase (100%) rename {internal => pkg}/detectors/rails/.snapshots/TestBuildReportStorageProviders (100%) rename {internal => pkg}/detectors/rails/cache/cache.go (75%) rename {internal => pkg}/detectors/rails/rails.go (89%) rename {internal => pkg}/detectors/rails/rails_test.go (81%) rename {internal => pkg}/detectors/rails/schema_rb/schema_rb.go (88%) rename {internal => pkg}/detectors/rails/testdata/cache/bin/rails (100%) rename {internal => pkg}/detectors/rails/testdata/cache/config/application.rb (100%) rename {internal => pkg}/detectors/rails/testdata/cache/config/environments/production.rb (100%) rename {internal => pkg}/detectors/rails/testdata/database/multiple/bin/rails (100%) rename {internal => pkg}/detectors/rails/testdata/database/multiple/config/database.yml (100%) rename {internal => pkg}/detectors/rails/testdata/database/single/bin/rails (100%) rename {internal => pkg}/detectors/rails/testdata/database/single/config/database.yml (100%) rename {internal => pkg}/detectors/rails/testdata/schema/bin/rails (100%) rename {internal => pkg}/detectors/rails/testdata/schema/db/schema.rb (100%) rename {internal => pkg}/detectors/rails/testdata/storage/bin/rails (100%) rename {internal => pkg}/detectors/rails/testdata/storage/config/storage.yml (100%) rename {internal => pkg}/detectors/ruby/.snapshots/TestDetectorReportDatatype (100%) rename {internal => pkg}/detectors/ruby/.snapshots/TestDetectorReportInterfacesPaths (100%) rename {internal => pkg}/detectors/ruby/.snapshots/TestDetectorReportInterfacesVariables (100%) rename {internal => pkg}/detectors/ruby/datatype/class_assignment.go (94%) rename {internal => pkg}/detectors/ruby/datatype/datatype.go (91%) rename {internal => pkg}/detectors/ruby/datatype/properties.go (96%) rename {internal => pkg}/detectors/ruby/datatype/structures.go (92%) rename {internal => pkg}/detectors/ruby/ruby.go (86%) rename {internal => pkg}/detectors/ruby/ruby_test.go (81%) rename {internal => pkg}/detectors/ruby/testdata/datatype/datatype.rb (100%) rename {internal => pkg}/detectors/ruby/testdata/paths/main.rb (100%) rename {internal => pkg}/detectors/ruby/testdata/variables/config.rb (100%) rename {internal => pkg}/detectors/simple/.snapshots/TestBuildReportInterfaces (100%) rename {internal => pkg}/detectors/simple/simple.go (81%) rename {internal => pkg}/detectors/simple/simple_test.go (77%) rename {internal => pkg}/detectors/simple/testdata/project/structure.sql (100%) rename {internal => pkg}/detectors/simple/testdata/project/unknown.pl (100%) rename {internal => pkg}/detectors/spring/.snapshots/TestBuildReportDataStores (100%) rename {internal => pkg}/detectors/spring/spring.go (91%) rename {internal => pkg}/detectors/spring/spring_test.go (87%) rename {internal => pkg}/detectors/spring/testdata/java_not_spring/pom.xml (100%) rename {internal => pkg}/detectors/spring/testdata/java_not_spring/src/main/Application.java (100%) rename {internal => pkg}/detectors/spring/testdata/java_not_spring/src/main/resources/application.properties (100%) rename {internal => pkg}/detectors/spring/testdata/not_java/Gemfile (100%) rename {internal => pkg}/detectors/spring/testdata/spring/pom.xml (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/Application.java (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/ignore/application.properties (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/ignore/application.yml (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/ignore2/application.properties (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/ignore2/application.yml (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/resources/application.properties (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/resources/application.yml (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/resources2/application.properties (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/resources2/application.yml (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/resources3/application.properties (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/resources3/application.yml (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/resources4/application.properties (100%) rename {internal => pkg}/detectors/spring/testdata/spring/src/main/resources4/application.yml (100%) rename {internal => pkg}/detectors/sql/custom_detector/compile_pattern.go (83%) rename {internal => pkg}/detectors/sql/custom_detector/custom_detector.go (87%) rename {internal => pkg}/detectors/sql/custom_detector/extract_arguments.go (86%) rename {internal => pkg}/detectors/sql/sql.go (70%) rename {internal => pkg}/detectors/sql/util/util.go (96%) rename {internal => pkg}/detectors/symfony/.snapshots/TestBuildReportDataStores (100%) rename {internal => pkg}/detectors/symfony/symfony.go (87%) rename {internal => pkg}/detectors/symfony/symfony_test.go (87%) rename {internal => pkg}/detectors/symfony/testdata/not_php/package.json (100%) rename {internal => pkg}/detectors/symfony/testdata/php_not_symfony/composer.json (100%) rename {internal => pkg}/detectors/symfony/testdata/symfony/app/config/config.yml (100%) rename {internal => pkg}/detectors/symfony/testdata/symfony/composer.json (100%) rename {internal => pkg}/detectors/symfony/testdata/symfony/config/packages/doctrine.yml (100%) rename {internal => pkg}/detectors/symfony/testdata/symfony/src/AppBundle/AppBundle.php (100%) rename {internal => pkg}/detectors/tsx/.snapshots/TestDetectorReportGeneral (100%) rename {internal => pkg}/detectors/tsx/testdata/general/config.tsx (100%) rename {internal => pkg}/detectors/tsx/tsx.go (87%) rename {internal => pkg}/detectors/tsx/tsx_test.go (64%) rename {internal => pkg}/detectors/types/types.go (71%) rename {internal => pkg}/detectors/typescript/.snapshots/TestDetectorReportDatatype (100%) rename {internal => pkg}/detectors/typescript/.snapshots/TestDetectorReportGeneral (100%) rename {internal => pkg}/detectors/typescript/.snapshots/TestDetectorReportKnex (100%) rename {internal => pkg}/detectors/typescript/datatype/datatype.go (93%) rename {internal => pkg}/detectors/typescript/datatype/knex/functions.go (91%) rename {internal => pkg}/detectors/typescript/datatype/knex/knex.go (71%) rename {internal => pkg}/detectors/typescript/datatype/knex/table.go (89%) rename {internal => pkg}/detectors/typescript/testdata/datatype/schema.ts (100%) rename {internal => pkg}/detectors/typescript/testdata/datatype_knex/datatype_knex.ts (100%) rename {internal => pkg}/detectors/typescript/testdata/general/variables/config.ts (100%) rename {internal => pkg}/detectors/typescript/typescript.go (87%) rename {internal => pkg}/detectors/typescript/typescript_test.go (80%) rename {internal => pkg}/detectors/yamlconfig/.snapshots/TestDetectorReportInterfaces (100%) rename {internal => pkg}/detectors/yamlconfig/.snapshots/TestDetectorReportVariables (100%) rename {internal => pkg}/detectors/yamlconfig/testdata/project/.github/workflows/workflow-github.yml (100%) rename {internal => pkg}/detectors/yamlconfig/testdata/project/config/parameters.yml.j2 (100%) rename {internal => pkg}/detectors/yamlconfig/testdata/project/docker-compose.yml.tpl (100%) rename {internal => pkg}/detectors/yamlconfig/testdata/project/locale.en.yml (100%) rename {internal => pkg}/detectors/yamlconfig/testdata/project/locales/client.hu.yml (100%) rename {internal => pkg}/detectors/yamlconfig/testdata/project/locales/en.yml (100%) rename {internal => pkg}/detectors/yamlconfig/testdata/project/translations/en.yml (100%) rename {internal => pkg}/detectors/yamlconfig/yamlconfig.go (87%) rename {internal => pkg}/detectors/yamlconfig/yamlconfig_test.go (83%) create mode 100644 pkg/engine/engine.go create mode 100644 pkg/engine/implementation/implementation.go rename {internal => pkg}/flag/general_flags.go (98%) rename {internal => pkg}/flag/ignore_add_flags.go (96%) rename {internal => pkg}/flag/ignore_migrate_flags.go (92%) rename {internal => pkg}/flag/ignore_show_flags.go (90%) rename {internal => pkg}/flag/options.go (97%) rename {internal => pkg}/flag/options_test.go (100%) rename {internal => pkg}/flag/report_flags.go (96%) rename {internal => pkg}/flag/repository_flags.go (98%) rename {internal => pkg}/flag/repository_flags_test.go (100%) rename {internal => pkg}/flag/rule_flags.go (95%) rename {internal => pkg}/flag/scan_flags.go (99%) rename {internal => pkg}/flag/test_helper.go (93%) rename {internal => pkg}/flag/types/types.go (99%) rename {internal => pkg}/flag/worker_flags.go (95%) rename {internal => pkg}/git/branch.go (100%) rename {internal => pkg}/git/checkout.go (100%) rename {internal => pkg}/git/commits.go (100%) rename {internal => pkg}/git/diff.go (98%) rename {internal => pkg}/git/diff_test.go (99%) rename {internal => pkg}/git/fetch.go (100%) rename {internal => pkg}/git/git.go (98%) rename {internal => pkg}/git/git_suite_test.go (100%) rename {internal => pkg}/git/git_test.go (93%) rename {internal => pkg}/git/remote.go (100%) rename {internal => pkg}/git/tree.go (100%) rename {internal => pkg}/languages/golang/.snapshots/TestImport--main.yml (100%) rename {internal => pkg}/languages/golang/.snapshots/TestScope--scope.yml (100%) rename {internal => pkg}/languages/golang/.snapshots/flow/TestFlow--different-line.yml (100%) rename {internal => pkg}/languages/golang/.snapshots/flow/TestFlow--same-line.yml (100%) rename {internal => pkg}/languages/golang/analyzer/analyzer.go (98%) rename {internal => pkg}/languages/golang/detectors/.snapshots/TestGoObjects-object_class (100%) rename {internal => pkg}/languages/golang/detectors/.snapshots/TestGoObjects-object_no_class (100%) rename {internal => pkg}/languages/golang/detectors/.snapshots/TestGoString-string (100%) rename {internal => pkg}/languages/golang/detectors/detectors_test.go (78%) rename {internal => pkg}/languages/golang/detectors/object/object.go (91%) rename {internal => pkg}/languages/golang/detectors/object/projection.go (90%) rename {internal => pkg}/languages/golang/detectors/string/string.go (87%) rename {internal => pkg}/languages/golang/detectors/testdata/class.go (100%) rename {internal => pkg}/languages/golang/detectors/testdata/no_class.go (100%) rename {internal => pkg}/languages/golang/detectors/testdata/string.go (100%) rename {internal => pkg}/languages/golang/golang.go (52%) rename {internal => pkg}/languages/golang/golang_test.go (91%) rename {internal => pkg}/languages/golang/pattern/pattern.go (96%) rename {internal => pkg}/languages/golang/testdata/import/main.go (100%) rename {internal => pkg}/languages/golang/testdata/import_rule.yml (100%) rename {internal => pkg}/languages/golang/testdata/logger.yml (100%) rename {internal => pkg}/languages/golang/testdata/scope/scope.go (100%) rename {internal => pkg}/languages/golang/testdata/scope_rule.yml (100%) rename {internal => pkg}/languages/golang/testdata/testcases/flow/different-line.go (100%) rename {internal => pkg}/languages/golang/testdata/testcases/flow/same-line.go (100%) rename {internal => pkg}/languages/java/.snapshots/TestPattern-catch_types_is_a_container_type (100%) rename {internal => pkg}/languages/java/.snapshots/TestPattern-method_params_is_a_container_type (100%) rename {internal => pkg}/languages/java/.snapshots/TestScope--scope.yml (100%) rename {internal => pkg}/languages/java/.snapshots/flow/TestFlow--different-line.yml (100%) rename {internal => pkg}/languages/java/.snapshots/flow/TestFlow--same-line.yml (100%) rename {internal => pkg}/languages/java/analyzer/analyzer.go (98%) rename {internal => pkg}/languages/java/detectors/.snapshots/TestJavaObjects-object_class (100%) rename {internal => pkg}/languages/java/detectors/.snapshots/TestJavaObjects-object_no_class (100%) rename {internal => pkg}/languages/java/detectors/.snapshots/TestJavaString-string (100%) rename {internal => pkg}/languages/java/detectors/detectors_test.go (79%) rename {internal => pkg}/languages/java/detectors/object/object.go (91%) rename {internal => pkg}/languages/java/detectors/object/projection.go (84%) rename {internal => pkg}/languages/java/detectors/string/string.go (71%) rename {internal => pkg}/languages/java/detectors/testdata/class.java (100%) rename {internal => pkg}/languages/java/detectors/testdata/no_class.java (100%) rename {internal => pkg}/languages/java/detectors/testdata/string.java (100%) rename {internal => pkg}/languages/java/java.go (54%) rename {internal => pkg}/languages/java/java_test.go (82%) rename {internal => pkg}/languages/java/pattern/pattern.go (95%) rename {internal => pkg}/languages/java/testdata/logger.yml (100%) rename {internal => pkg}/languages/java/testdata/scope/scope.java (100%) rename {internal => pkg}/languages/java/testdata/scope_rule.yml (100%) rename {internal => pkg}/languages/java/testdata/testcases/flow/different-line.java (100%) rename {internal => pkg}/languages/java/testdata/testcases/flow/same-line.java (100%) rename {internal => pkg}/languages/javascript/.snapshots/TestPatternVariables--main.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/TestScope--scope.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/flow/TestFlow--assigment-expression.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/flow/TestFlow--variable-declarator.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/import/TestImport--import.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/object-deconstructing/TestObjectDeconstructing--deconstructing.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/object-deconstructing/TestObjectDeconstructing--multiple_objects.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/string/TestString--concatanation.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/string/TestString--simple.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/string/TestString--single-quotes.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/string/TestString--template-variable-reconciliation.yml (100%) rename {internal => pkg}/languages/javascript/.snapshots/string/TestString--template.yml (100%) rename {internal => pkg}/languages/javascript/analyzer/analyzer.go (98%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptFileTypes-file_type_jsx (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptFileTypes-file_type_tsx (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_class (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_object (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_projection (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_spread (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_assign_eq (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_literal (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_non_literal (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_const (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_let (100%) rename {internal => pkg}/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_var (100%) rename {internal => pkg}/languages/javascript/detectors/detectors_test.go (90%) rename {internal => pkg}/languages/javascript/detectors/object/object.go (93%) rename {internal => pkg}/languages/javascript/detectors/object/projection.go (92%) rename {internal => pkg}/languages/javascript/detectors/string/string.go (87%) rename {internal => pkg}/languages/javascript/detectors/testdata/file_type.jsx (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/file_type.tsx (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/object_class.js (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/object_object.js (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/object_projection.js (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/object_spread.js (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/string_assign_eq.js (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/string_literal.js (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/string_non_literal.js (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/typed_object_const.ts (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/typed_object_let.ts (100%) rename {internal => pkg}/languages/javascript/detectors/testdata/typed_object_var.ts (100%) rename {internal => pkg}/languages/javascript/javascript.go (55%) rename {internal => pkg}/languages/javascript/javascript_test.go (95%) rename {internal => pkg}/languages/javascript/pattern/pattern.go (95%) rename {internal => pkg}/languages/javascript/testdata/datatype.yml (100%) rename {internal => pkg}/languages/javascript/testdata/deconstructing.yml (100%) rename {internal => pkg}/languages/javascript/testdata/import/import.js (100%) rename {internal => pkg}/languages/javascript/testdata/import_rule.yml (100%) rename {internal => pkg}/languages/javascript/testdata/insecureURL.yml (100%) rename {internal => pkg}/languages/javascript/testdata/pattern_variables/main.js (100%) rename {internal => pkg}/languages/javascript/testdata/pattern_variables_rule.yml (100%) rename {internal => pkg}/languages/javascript/testdata/scope/scope.js (100%) rename {internal => pkg}/languages/javascript/testdata/scope_rule.yml (100%) rename {internal => pkg}/languages/javascript/testdata/testcases/flow/assigment-expression.js (100%) rename {internal => pkg}/languages/javascript/testdata/testcases/flow/variable-declarator.js (100%) rename {internal => pkg}/languages/javascript/testdata/testcases/object-deconstructing/deconstructing.js (100%) rename {internal => pkg}/languages/javascript/testdata/testcases/object-deconstructing/multiple_objects.js (100%) rename {internal => pkg}/languages/javascript/testdata/testcases/string/concatanation.js (100%) rename {internal => pkg}/languages/javascript/testdata/testcases/string/simple.js (100%) rename {internal => pkg}/languages/javascript/testdata/testcases/string/single-quotes.js (100%) rename {internal => pkg}/languages/javascript/testdata/testcases/string/template-variable-reconciliation.js (100%) rename {internal => pkg}/languages/javascript/testdata/testcases/string/template.js (100%) create mode 100644 pkg/languages/languages.go rename {internal => pkg}/languages/php/.snapshots/TestAnalyzer-foreach (100%) rename {internal => pkg}/languages/php/.snapshots/TestConst--main.yml (100%) rename {internal => pkg}/languages/php/.snapshots/TestPattern-anonymous_function_names_and_bodies_are_unanchored (100%) rename {internal => pkg}/languages/php/.snapshots/TestPattern-catch_clauses_and_types_are_unanchored (100%) rename {internal => pkg}/languages/php/.snapshots/TestPattern-class_name_in_object_creation_is_unanchored (100%) rename {internal => pkg}/languages/php/.snapshots/TestPattern-function_names_and_bodies_are_unanchored (100%) rename {internal => pkg}/languages/php/.snapshots/TestPattern-named_arguments_are_unanchored (100%) rename {internal => pkg}/languages/php/.snapshots/TestPattern-parameter_names_are_unanchored (100%) rename {internal => pkg}/languages/php/.snapshots/TestPattern-property_names_are_unanchored (100%) rename {internal => pkg}/languages/php/.snapshots/TestScope--scope.yml (100%) rename {internal => pkg}/languages/php/.snapshots/flow/TestFlow--different-line.yml (100%) rename {internal => pkg}/languages/php/.snapshots/flow/TestFlow--same-line.yml (100%) rename {internal => pkg}/languages/php/analyzer/analyzer.go (98%) rename {internal => pkg}/languages/php/detectors/.snapshots/TestPHPObjects-object_class (100%) rename {internal => pkg}/languages/php/detectors/.snapshots/TestPHPObjects-object_no_class (100%) rename {internal => pkg}/languages/php/detectors/.snapshots/TestPHPString-string (100%) rename {internal => pkg}/languages/php/detectors/detectors_test.go (78%) rename {internal => pkg}/languages/php/detectors/object/object.go (92%) rename {internal => pkg}/languages/php/detectors/object/projection.go (87%) rename {internal => pkg}/languages/php/detectors/string/string.go (76%) rename {internal => pkg}/languages/php/detectors/testdata/class.php (100%) rename {internal => pkg}/languages/php/detectors/testdata/no_class.php (100%) rename {internal => pkg}/languages/php/detectors/testdata/string.php (100%) rename {internal => pkg}/languages/php/pattern/pattern.go (97%) rename {internal => pkg}/languages/php/php.go (51%) rename {internal => pkg}/languages/php/php_test.go (85%) rename {internal => pkg}/languages/php/testdata/logger.yml (100%) rename {internal => pkg}/languages/php/testdata/md.yml (100%) rename {internal => pkg}/languages/php/testdata/md/main.php (100%) rename {internal => pkg}/languages/php/testdata/scope/scope.php (100%) rename {internal => pkg}/languages/php/testdata/scope_rule.yml (100%) rename {internal => pkg}/languages/php/testdata/testcases/flow/different-line.php (100%) rename {internal => pkg}/languages/php/testdata/testcases/flow/same-line.php (100%) rename {internal => pkg}/languages/python/.snapshots/TestDatatypes--different-line.yml (100%) rename {internal => pkg}/languages/python/.snapshots/TestDatatypes--same-line.yml (100%) rename {internal => pkg}/languages/python/.snapshots/TestFlow--flow.yml (100%) rename {internal => pkg}/languages/python/.snapshots/TestImport--import.yml (100%) rename {internal => pkg}/languages/python/.snapshots/TestPair--pair.yml (100%) rename {internal => pkg}/languages/python/.snapshots/TestScope--scope.yml (100%) rename {internal => pkg}/languages/python/.snapshots/TestSubscript--subscript.yml (100%) rename {internal => pkg}/languages/python/analyzer/analyzer.go (98%) rename {internal => pkg}/languages/python/detectors/.snapshots/TestPythonObjects-object_class (100%) rename {internal => pkg}/languages/python/detectors/.snapshots/TestPythonObjects-object_no_class (100%) rename {internal => pkg}/languages/python/detectors/.snapshots/TestPythonString-string (100%) rename {internal => pkg}/languages/python/detectors/.snapshots/TestPythonString-string_literal (100%) rename {internal => pkg}/languages/python/detectors/detectors_test.go (81%) rename {internal => pkg}/languages/python/detectors/object/object.go (92%) rename {internal => pkg}/languages/python/detectors/object/projection.go (86%) rename {internal => pkg}/languages/python/detectors/string/string.go (88%) rename {internal => pkg}/languages/python/detectors/testdata/class.py (100%) rename {internal => pkg}/languages/python/detectors/testdata/no_class.py (100%) rename {internal => pkg}/languages/python/detectors/testdata/string.py (100%) rename {internal => pkg}/languages/python/detectors/testdata/string_literal.py (100%) rename {internal => pkg}/languages/python/pattern/pattern.go (96%) rename {internal => pkg}/languages/python/python.go (54%) rename {internal => pkg}/languages/python/python_test.go (95%) rename {internal => pkg}/languages/python/testdata/datatypes/different-line.py (100%) rename {internal => pkg}/languages/python/testdata/datatypes/same-line.py (100%) rename {internal => pkg}/languages/python/testdata/datatypes_rule.yml (100%) rename {internal => pkg}/languages/python/testdata/flow/flow.py (100%) rename {internal => pkg}/languages/python/testdata/flow_rule.yml (100%) rename {internal => pkg}/languages/python/testdata/import/import.py (100%) rename {internal => pkg}/languages/python/testdata/import_rule.yml (100%) rename {internal => pkg}/languages/python/testdata/pair/pair.py (100%) rename {internal => pkg}/languages/python/testdata/pair_rule.yml (100%) rename {internal => pkg}/languages/python/testdata/scope/scope.py (100%) rename {internal => pkg}/languages/python/testdata/scope_rule.yml (100%) rename {internal => pkg}/languages/python/testdata/subscript/subscript.py (100%) rename {internal => pkg}/languages/python/testdata/subscript_rule.yml (100%) rename {internal => pkg}/languages/ruby/.snapshots/TestPatternVariables--main.yml (100%) rename {internal => pkg}/languages/ruby/.snapshots/TestRuby--call.yml (100%) rename {internal => pkg}/languages/ruby/.snapshots/TestRuby--insecure-url.yml (100%) rename {internal => pkg}/languages/ruby/.snapshots/TestRuby--object-variable-reconciliation.yml (100%) rename {internal => pkg}/languages/ruby/.snapshots/TestRuby--object.yml (100%) rename {internal => pkg}/languages/ruby/.snapshots/TestScope--scope.yml (100%) rename {internal => pkg}/languages/ruby/analyzer/analyzer.go (98%) rename {internal => pkg}/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_class (100%) rename {internal => pkg}/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_hash (100%) rename {internal => pkg}/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_projection (100%) rename {internal => pkg}/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_assign_eq (100%) rename {internal => pkg}/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_literal (100%) rename {internal => pkg}/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_non_literal (100%) rename {internal => pkg}/languages/ruby/detectors/common/common.go (85%) rename {internal => pkg}/languages/ruby/detectors/detectors_test.go (85%) rename {internal => pkg}/languages/ruby/detectors/object/object.go (93%) rename {internal => pkg}/languages/ruby/detectors/object/projection.go (88%) rename {internal => pkg}/languages/ruby/detectors/string/string.go (81%) rename {internal => pkg}/languages/ruby/detectors/testdata/object_class.rb (100%) rename {internal => pkg}/languages/ruby/detectors/testdata/object_hash.rb (100%) rename {internal => pkg}/languages/ruby/detectors/testdata/object_projection.rb (100%) rename {internal => pkg}/languages/ruby/detectors/testdata/string_assign_eq.rb (100%) rename {internal => pkg}/languages/ruby/detectors/testdata/string_literal.rb (100%) rename {internal => pkg}/languages/ruby/detectors/testdata/string_non_literal.rb (100%) rename {internal => pkg}/languages/ruby/pattern/pattern.go (96%) rename {internal => pkg}/languages/ruby/ruby.go (54%) rename {internal => pkg}/languages/ruby/ruby_test.go (91%) rename {internal => pkg}/languages/ruby/testdata/pattern_variables/main.rb (100%) rename {internal => pkg}/languages/ruby/testdata/pattern_variables_rule.yml (100%) rename {internal => pkg}/languages/ruby/testdata/rule.yml (100%) rename {internal => pkg}/languages/ruby/testdata/scope/scope.rb (100%) rename {internal => pkg}/languages/ruby/testdata/scope_rule.yml (100%) rename {internal => pkg}/languages/ruby/testdata/testcases/call.rb (100%) rename {internal => pkg}/languages/ruby/testdata/testcases/insecure-url.rb (100%) rename {internal => pkg}/languages/ruby/testdata/testcases/object-variable-reconciliation.rb (100%) rename {internal => pkg}/languages/ruby/testdata/testcases/object.rb (100%) rename {internal => pkg}/languages/testhelper/testhelper.go (78%) rename {internal => pkg}/parser/context/finder.go (95%) rename {internal => pkg}/parser/context/resolver.go (93%) rename {internal => pkg}/parser/custom/custom.go (82%) rename {internal => pkg}/parser/datatype/datatype.go (94%) rename {internal => pkg}/parser/datatype/merge.go (97%) rename {internal => pkg}/parser/datatype/parented_by.go (85%) rename {internal => pkg}/parser/datatype/property_finder.go (90%) rename {internal => pkg}/parser/datatype/scope.go (96%) rename {internal => pkg}/parser/datatype/variable_reconciliation.go (93%) rename {internal => pkg}/parser/golang_util/golang_util.go (96%) rename {internal => pkg}/parser/interfacedetector/interfaces.go (79%) rename {internal => pkg}/parser/interfaces/interfaces.go (71%) rename {internal => pkg}/parser/interfaces/paths/paths.go (88%) rename {internal => pkg}/parser/interfaces/urls/urls.go (92%) rename {internal => pkg}/parser/interfaces/urls/urls_test.go (91%) rename {internal => pkg}/parser/nodeid/nodeid.go (95%) rename {internal => pkg}/parser/parser.go (98%) rename {internal => pkg}/parser/schema/fieldId.go (81%) rename {internal => pkg}/parser/schema/schema.go (90%) rename {internal => pkg}/parser/sitter/config_variables/README.md (100%) rename {internal => pkg}/parser/sitter/config_variables/binding.go (100%) rename {internal => pkg}/parser/sitter/config_variables/binding_test.go (94%) rename {internal => pkg}/parser/sitter/config_variables/grammar.js (100%) rename {internal => pkg}/parser/sitter/config_variables/package.json (100%) rename {internal => pkg}/parser/sitter/config_variables/parser.c (100%) rename {internal => pkg}/parser/sitter/config_variables/test/corpus/examples.txt (100%) rename {internal => pkg}/parser/sitter/config_variables/tree_sitter/parser.h (100%) rename {internal => pkg}/parser/sitter/graphql/README.md (100%) rename {internal => pkg}/parser/sitter/graphql/binding.go (100%) rename {internal => pkg}/parser/sitter/graphql/parser.c (100%) rename {internal => pkg}/parser/sitter/graphql/tree_sitter/parser.h (100%) rename {internal => pkg}/parser/sitter/html2/binding.go (100%) rename {internal => pkg}/parser/sitter/html2/parser.c (100%) rename {internal => pkg}/parser/sitter/html2/readme.md (100%) rename {internal => pkg}/parser/sitter/html2/scanner.c (100%) rename {internal => pkg}/parser/sitter/html2/tag.h (100%) rename {internal => pkg}/parser/sitter/html2/tree_sitter/parser.h (100%) rename {internal => pkg}/parser/sitter/php2/README.md (100%) rename {internal => pkg}/parser/sitter/php2/binding.go (100%) rename {internal => pkg}/parser/sitter/php2/parser.c (100%) rename {internal => pkg}/parser/sitter/php2/scanner.c (100%) rename {internal => pkg}/parser/sitter/php2/tree_sitter/parser.h (100%) rename {internal => pkg}/parser/sitter/sql/README.md (100%) rename {internal => pkg}/parser/sitter/sql/binding.go (100%) rename {internal => pkg}/parser/sitter/sql/parser.c (100%) rename {internal => pkg}/parser/sitter/sql/scanner.cc (100%) rename {internal => pkg}/parser/sitter/sql/tree_sitter/parser.h (100%) rename {internal => pkg}/parser/sitter/xml/binding.go (100%) rename {internal => pkg}/parser/sitter/xml/parser.c (100%) rename {internal => pkg}/parser/sitter/xml/readme.md (100%) rename {internal => pkg}/parser/sitter/xml/tree_sitter/parser.h (100%) rename {internal => pkg}/report/basebranchfindings/basebranchfindings.go (92%) rename {internal => pkg}/report/config/config.go (100%) rename {internal => pkg}/report/customdetectors/customdetectors.go (100%) rename {internal => pkg}/report/dependencies/dependencies.go (88%) rename {internal => pkg}/report/detections/detections.go (94%) rename {internal => pkg}/report/detectors/detectors.go (100%) rename {internal => pkg}/report/detectors/openapi.go (100%) rename {internal => pkg}/report/domain/domain.go (100%) rename {internal => pkg}/report/frameworks/beego/beego.go (96%) rename {internal => pkg}/report/frameworks/django/django.go (92%) rename {internal => pkg}/report/frameworks/dotnet/dotnet.go (92%) rename {internal => pkg}/report/frameworks/frameworks.go (100%) rename {internal => pkg}/report/frameworks/knex/knex.go (84%) rename {internal => pkg}/report/frameworks/rails/rails.go (97%) rename {internal => pkg}/report/frameworks/spring/spring.go (94%) rename {internal => pkg}/report/frameworks/symfony/symfony.go (93%) rename {internal => pkg}/report/interfaces/interfaces.go (86%) rename {internal => pkg}/report/operations/operations.go (100%) rename {internal => pkg}/report/operations/operationshelper/operationshelper.go (52%) rename {internal => pkg}/report/output/dataflow/components/components.go (94%) rename {internal => pkg}/report/output/dataflow/components/components_test.go (94%) rename {internal => pkg}/report/output/dataflow/dataflow.go (89%) rename {internal => pkg}/report/output/dataflow/datatypes/datatypes.go (92%) rename {internal => pkg}/report/output/dataflow/datatypes/datatypes_test.go (95%) rename {internal => pkg}/report/output/dataflow/datatypes/get_extras.go (91%) rename {internal => pkg}/report/output/dataflow/detectiondecoder/dependency_classification.go (88%) rename {internal => pkg}/report/output/dataflow/detectiondecoder/framework_classification.go (88%) rename {internal => pkg}/report/output/dataflow/detectiondecoder/interface_classification.go (88%) rename {internal => pkg}/report/output/dataflow/detectiondecoder/schema_classification.go (86%) rename {internal => pkg}/report/output/dataflow/file_errors/file_errors.go (84%) rename {internal => pkg}/report/output/dataflow/formatter.go (70%) rename {internal => pkg}/report/output/dataflow/risks/risks.go (94%) rename {internal => pkg}/report/output/dataflow/risks/risks_test.go (95%) rename {internal => pkg}/report/output/dataflow/types/components.go (100%) rename {internal => pkg}/report/output/dataflow/types/datatypes.go (97%) rename {internal => pkg}/report/output/dataflow/types/file_errors.go (100%) rename {internal => pkg}/report/output/dataflow/types/risks.go (96%) rename {internal => pkg}/report/output/detectors/detectors.go (69%) rename {internal => pkg}/report/output/detectors/formatter.go (70%) rename {internal => pkg}/report/output/gitlab/.snapshots/TestJuiceShopSarif (100%) rename {internal => pkg}/report/output/gitlab/gitlab.go (95%) rename {internal => pkg}/report/output/gitlab/gitlab_test.go (89%) rename {internal => pkg}/report/output/gitlab/testdata/juice-shop-security-report.json (100%) rename {internal => pkg}/report/output/gitlab/types/types.go (100%) rename {internal => pkg}/report/output/html/.snapshots/TestBearPublishingPrivacyHtml.html (100%) rename {internal => pkg}/report/output/html/.snapshots/TestJuiceShopSecurityHtml.html (100%) rename {internal => pkg}/report/output/html/html.go (93%) rename {internal => pkg}/report/output/html/html_test.go (89%) rename {internal => pkg}/report/output/html/privacy.tmpl (100%) rename {internal => pkg}/report/output/html/security.tmpl (100%) rename {internal => pkg}/report/output/html/styles.css (100%) rename {internal => pkg}/report/output/html/testdata/bear-publishing-privacy-report.json (100%) rename {internal => pkg}/report/output/html/testdata/juice-shop-security-report.json (100%) rename {internal => pkg}/report/output/html/types/types.go (85%) rename {internal => pkg}/report/output/html/wrapper.tmpl (100%) rename {internal => pkg}/report/output/output.go (79%) rename {internal => pkg}/report/output/privacy/.snapshots/TestAddReportData (100%) rename {internal => pkg}/report/output/privacy/.snapshots/TestBuildCsvString (100%) rename {internal => pkg}/report/output/privacy/formatter.go (78%) rename {internal => pkg}/report/output/privacy/privacy.go (95%) rename {internal => pkg}/report/output/privacy/privacy_test.go (77%) rename {internal => pkg}/report/output/privacy/types/types.go (100%) rename {internal => pkg}/report/output/reviewdog/.snapshots/TestRailsGoatReviewdog (100%) rename {internal => pkg}/report/output/reviewdog/reviewdog.go (90%) rename {internal => pkg}/report/output/reviewdog/reviewdog_test.go (83%) rename {internal => pkg}/report/output/reviewdog/testdata/rails-goat-security-report.json (100%) rename {internal => pkg}/report/output/reviewdog/types/types.go (100%) rename {internal => pkg}/report/output/saas/.snapshots/TestBearerPublishingGitlabMetaSaas (100%) rename {internal => pkg}/report/output/saas/.snapshots/TestBearerPublishingSaas (100%) rename {internal => pkg}/report/output/saas/formatter.go (70%) rename {internal => pkg}/report/output/saas/saas.go (90%) rename {internal => pkg}/report/output/saas/sass_test.go (89%) rename {internal => pkg}/report/output/saas/testdata/report_fixture.json (100%) rename {internal => pkg}/report/output/saas/types/types.go (91%) rename {internal => pkg}/report/output/sarif/.snapshots/TestJuiceShopSarif (100%) rename {internal => pkg}/report/output/sarif/sarif.go (90%) rename {internal => pkg}/report/output/sarif/sarif_test.go (88%) rename {internal => pkg}/report/output/sarif/testdata/juice-shop-security-report.json (100%) rename {internal => pkg}/report/output/sarif/types/types.go (100%) rename {internal => pkg}/report/output/security/.snapshots/TestAddReportData (100%) rename {internal => pkg}/report/output/security/.snapshots/TestAddReportDataWithSeverity (100%) rename {internal => pkg}/report/output/security/.snapshots/TestBuildReportString (100%) rename {internal => pkg}/report/output/security/.snapshots/TestNoRulesBuildReportString (100%) rename {internal => pkg}/report/output/security/formatter.go (75%) rename {internal => pkg}/report/output/security/security.go (93%) rename {internal => pkg}/report/output/security/security_test.go (83%) rename {internal => pkg}/report/output/security/types/types.go (98%) rename {internal => pkg}/report/output/stats/formatter.go (70%) rename {internal => pkg}/report/output/stats/gocloc_detector.go (91%) rename {internal => pkg}/report/output/stats/stats.go (93%) rename {internal => pkg}/report/output/stats/types/types.go (100%) create mode 100644 pkg/report/output/testhelper/testhelper.go rename {internal => pkg}/report/output/types/types.go (79%) rename {internal => pkg}/report/report.go (53%) rename {internal => pkg}/report/schema/datatype/datatype.go (94%) rename {internal => pkg}/report/schema/schema.go (91%) create mode 100644 pkg/report/schema/schemahelper/schemahelper.go rename {internal => pkg}/report/secret/secret.go (100%) rename {internal => pkg}/report/source/source.go (97%) rename {internal => pkg}/report/values/values.go (98%) rename {internal => pkg}/report/variables/variables.go (100%) rename {internal => pkg}/report/writer/detectors.go (89%) rename {internal => pkg}/scanner/ast/.snapshots/TestDisabledRules (100%) rename {internal => pkg}/scanner/ast/.snapshots/TestExpectedRulesJava (100%) rename {internal => pkg}/scanner/ast/.snapshots/TestExpectedRulesRuby (100%) rename {internal => pkg}/scanner/ast/ast.go (92%) rename {internal => pkg}/scanner/ast/ast_test.go (92%) rename {internal => pkg}/scanner/ast/query/query.go (98%) rename {internal => pkg}/scanner/ast/traversalstrategy/builtin.go (95%) rename {internal => pkg}/scanner/ast/traversalstrategy/traversalstrategy.go (95%) rename {internal => pkg}/scanner/ast/tree/.snapshots/TestTree (100%) rename {internal => pkg}/scanner/ast/tree/builder.go (80%) rename {internal => pkg}/scanner/ast/tree/tree.go (97%) rename {internal => pkg}/scanner/ast/tree/tree_test.go (82%) rename {internal => pkg}/scanner/cache/cache.go (91%) rename {internal => pkg}/scanner/detectors/.snapshots/TestDatatypeDetector-datatype (100%) rename {internal => pkg}/scanner/detectors/.snapshots/TestDatatypeDetectorInvalidDetection-datatype (100%) rename {internal => pkg}/scanner/detectors/.snapshots/TestInsecureUrlDetector-insecure_url (100%) rename {internal => pkg}/scanner/detectors/common/object.go (89%) rename {internal => pkg}/scanner/detectors/common/string.go (91%) rename {internal => pkg}/scanner/detectors/customrule/customrule.go (79%) rename {internal => pkg}/scanner/detectors/customrule/filter.go (95%) rename {internal => pkg}/scanner/detectors/customrule/filters/filters.go (96%) rename {internal => pkg}/scanner/detectors/customrule/filters/filters_suite_test.go (100%) rename {internal => pkg}/scanner/detectors/customrule/filters/filters_test.go (97%) rename {internal => pkg}/scanner/detectors/customrule/patternquery/builder/builder.go (96%) rename {internal => pkg}/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer.go (100%) rename {internal => pkg}/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_suite_test.go (100%) rename {internal => pkg}/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_test.go (97%) rename {internal => pkg}/scanner/detectors/customrule/patternquery/builder/input.go (95%) rename {internal => pkg}/scanner/detectors/customrule/patternquery/patternquery.go (94%) rename {internal => pkg}/scanner/detectors/customrule/types/types.go (50%) rename {internal => pkg}/scanner/detectors/datatype/datatype.go (89%) rename {internal => pkg}/scanner/detectors/detectors_test.go (82%) rename {internal => pkg}/scanner/detectors/insecureurl/insecureurl.go (73%) rename {internal => pkg}/scanner/detectors/stringliteral/stringliteral.go (68%) rename {internal => pkg}/scanner/detectors/testdata/datatype.rb (100%) rename {internal => pkg}/scanner/detectors/testdata/insecureurl.rb (100%) rename {internal => pkg}/scanner/detectors/testdata/invalid_datatype.java (100%) rename {internal => pkg}/scanner/detectors/testhelper/testhelper.go (79%) rename {internal => pkg}/scanner/detectors/types/types.go (77%) rename {internal => pkg}/scanner/detectorset/detectorset.go (85%) rename {internal => pkg}/scanner/language/language.go (64%) rename {internal => pkg}/scanner/language/pattern.go (98%) rename {internal => pkg}/scanner/language/patternbase.go (92%) rename {internal => pkg}/scanner/language/scope.go (100%) rename {internal => pkg}/scanner/languagescanner/languagescanner.go (80%) rename {internal => pkg}/scanner/rulescanner/rulescanner.go (88%) rename {internal => pkg}/scanner/ruleset/builtin.go (100%) rename {internal => pkg}/scanner/ruleset/ruleset.go (95%) rename {internal => pkg}/scanner/scanner.go (78%) rename {internal => pkg}/scanner/stats/stats.go (100%) rename {internal => pkg}/scanner/variableshape/variableshape.go (91%) rename {internal => pkg}/types/artifact.go (100%) rename {internal => pkg}/types/report.go (100%) rename {internal => pkg}/types/severity.go (100%) rename {internal => pkg}/types/target.go (100%) rename {internal => pkg}/types/trigger.go (100%) rename {internal => pkg}/util/cache/utils.go (100%) rename {internal => pkg}/util/classify/classify.go (94%) rename {internal => pkg}/util/classify/classify_schema.go (95%) rename {internal => pkg}/util/classify/classify_schema_test.go (95%) rename {internal => pkg}/util/classify/classify_test.go (92%) rename {internal => pkg}/util/components/components.go (73%) rename {internal => pkg}/util/entropy/.snapshots/TestShannon (100%) rename {internal => pkg}/util/entropy/entropy.go (100%) rename {internal => pkg}/util/entropy/entropy_test.go (88%) rename {internal => pkg}/util/file/file.go (98%) rename {internal => pkg}/util/ignore/ignore.go (97%) rename {internal => pkg}/util/ignore/ignore_test.go (96%) rename {internal => pkg}/util/ignore/types/types.go (100%) rename {internal => pkg}/util/jsonlines/jsonlines.go (97%) rename {internal => pkg}/util/jsonlines/jsonlines_test.go (95%) rename {internal => pkg}/util/linescanner/linescanner.go (100%) rename {internal => pkg}/util/maputil/maputil.go (100%) rename {internal => pkg}/util/normalize_key/normalize_key.go (100%) rename {internal => pkg}/util/normalize_key/normalize_key_test.go (90%) rename {internal => pkg}/util/output/output.go (98%) rename {internal => pkg}/util/pluralize/pluralize.go (100%) rename {internal => pkg}/util/pointers/pointers.go (100%) rename {internal => pkg}/util/progressbar/progressbar.go (79%) rename {internal => pkg}/util/regex/regex.go (72%) rename {internal => pkg}/util/rego/rego.go (100%) rename {internal => pkg}/util/set/set.go (100%) rename {internal => pkg}/util/slices/slices.go (100%) rename {internal => pkg}/util/slices/slices_suite_test.go (100%) rename {internal => pkg}/util/slices/slices_test.go (92%) rename {internal => pkg}/util/stringutil/stringutil.go (100%) rename {internal => pkg}/util/tmpfile/tmpfile.go (87%) rename {internal => pkg}/util/url/domain_resolver.go (100%) rename {internal => pkg}/util/url/domain_resolver_test.go (98%) rename {internal => pkg}/util/url/url.go (99%) rename {internal => pkg}/util/url/url_test.go (98%) rename {internal => pkg}/version_check/bearer_version.go (91%) rename {internal => pkg}/version_check/github_version.go (100%) rename {internal => pkg}/version_check/version_check.go (93%) diff --git a/.envrc.example b/.envrc.example index 4ff592814..8f72545b7 100644 --- a/.envrc.example +++ b/.envrc.example @@ -5,7 +5,7 @@ export GOOGLE_APP='' export REDIS_INIT="true" export GOOGLE_MAX_ATTEMPT="5" export BEARER_EXECUTABLE_PATH="./bearer" -export GITHUB_WORKSPACE="/path/to/bearer/project" +export GITHUB_WORKSPACE="$PWD" export SCAN_DIR=/Users/username/OWASP export BEARER_DISABLE_VERSION_CHECK=true export BEARER_DISABLE_DEFAULT_RULES=true diff --git a/cmd/bearer/bearer.go b/cmd/bearer/bearer.go index 76767d431..5286ac2cf 100644 --- a/cmd/bearer/bearer.go +++ b/cmd/bearer/bearer.go @@ -1,16 +1,10 @@ package main import ( - "os" - "github.com/bearer/bearer/cmd/bearer/build" - "github.com/bearer/bearer/internal/commands" + "github.com/bearer/bearer/external/run" ) func main() { - app := commands.NewApp(build.Version, build.CommitSHA) - if err := app.Execute(); err != nil { - // error messages are printed by the framework - os.Exit(1) - } + run.Run(build.Version, build.CommitSHA, run.NewEngine(run.DefaultLanguages())) } diff --git a/e2e/flags/report_flags_test.go b/e2e/flags/report_flags_test.go index 8e431629e..3ab372c12 100644 --- a/e2e/flags/report_flags_test.go +++ b/e2e/flags/report_flags_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/bearer/bearer/e2e/internal/testhelper" - "github.com/bearer/bearer/internal/util/tmpfile" + "github.com/bearer/bearer/pkg/util/tmpfile" "github.com/bradleyjkemp/cupaloy" ) diff --git a/external/run/run.go b/external/run/run.go new file mode 100644 index 000000000..6e31ed486 --- /dev/null +++ b/external/run/run.go @@ -0,0 +1,97 @@ +package run + +import ( + "os" + "regexp" + + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/commands" + "github.com/bearer/bearer/pkg/engine" + "github.com/bearer/bearer/pkg/engine/implementation" + "github.com/bearer/bearer/pkg/languages" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/util/regex" + "github.com/bearer/bearer/pkg/util/stringutil" +) + +type Object = common.Object +type Property = common.Property +type String = common.String + +type Engine = engine.Engine + +type Analyzer = language.Analyzer +type Language = language.Language +type Pattern = language.Pattern +type PatternBase = language.PatternBase +type PatternVariable = language.PatternVariable +type Scope = language.Scope + +type Query = query.Query +type Set = query.Set + +type Rule = ruleset.Rule + +type Classifier = schema.Classifier + +type Builder = tree.Builder +type Node = tree.Node + +type Context = types.Context +type Detection = types.Detection +type Detector = types.Detector +type DetectorBase = types.DetectorBase + +var BuiltinObjectRule = ruleset.BuiltinObjectRule +var BuiltinStringRule = ruleset.BuiltinStringRule + +func GetNonVirtualObjects(detectorContext types.Context, node *tree.Node) ([]*types.Detection, error) { + return common.GetNonVirtualObjects(detectorContext, node) +} + +func StripQuotes(input string) string { + return stringutil.StripQuotes(input) +} + +func ConcatenateChildStrings(node *tree.Node, detectorContext types.Context) ([]interface{}, error) { + return common.ConcatenateChildStrings(node, detectorContext) +} + +func ConcatenateAssignEquals(node *tree.Node, detectorContext types.Context) ([]interface{}, error) { + return common.ConcatenateAssignEquals(node, detectorContext) +} + +func ProjectObject(node *tree.Node, detectorContext types.Context, objectNode *tree.Node, objectName string, propertyName string, isPropertyAccess bool) ([]interface{}, error) { + return common.ProjectObject(node, detectorContext, objectNode, objectName, propertyName, isPropertyAccess) +} + +func ReplaceAllWithSubmatches(pattern *regexp.Regexp, input string, replace func(submatches []string) (string, error)) (string, error) { + return regex.ReplaceAllWithSubmatches(pattern, input, replace) +} + +func NewScope(parent *language.Scope) *language.Scope { + return language.NewScope(parent) +} + +func NewEngine(languages []Language) Engine { + return implementation.New(languages) +} + +func DefaultLanguages() []Language { + return languages.Default() +} + +func Run(version, commitSHA string, engine Engine) { + err := commands.NewApp(version, commitSHA, engine).Execute() + engine.Close() + + if err != nil { + // error messages are printed by the framework + os.Exit(1) + } +} diff --git a/internal/commands/process/settings/regexp.go b/internal/commands/process/settings/regexp.go deleted file mode 100644 index 9be3d1135..000000000 --- a/internal/commands/process/settings/regexp.go +++ /dev/null @@ -1,26 +0,0 @@ -package settings - -import "regexp" - -type Regexp struct { - *regexp.Regexp -} - -func (r *Regexp) UnmarshalText(b []byte) error { - pattern, err := regexp.Compile(string(b)) - if err != nil { - return err - } - - r.Regexp = pattern - - return nil -} - -func (r *Regexp) MarshalText() ([]byte, error) { - if r.Regexp != nil { - return []byte(r.Regexp.String()), nil - } - - return nil, nil -} diff --git a/internal/commands/process/settings/ruleLoader.go b/internal/commands/process/settings/ruleLoader.go deleted file mode 100644 index 48deb68c9..000000000 --- a/internal/commands/process/settings/ruleLoader.go +++ /dev/null @@ -1,142 +0,0 @@ -package settings - -import ( - "archive/tar" - "compress/gzip" - "crypto/md5" - "errors" - "fmt" - "io" - "net/http" - "os" - "path/filepath" - "strings" - "time" - - "github.com/rs/zerolog/log" - "gopkg.in/yaml.v3" -) - -const BASE_RULE_FOLDER = "/" - -func LoadRuleDefinitionsFromUrls(ruleDefinitions map[string]RuleDefinition, languageDownloads []string) (err error) { - - bearerRulesDir := bearerRulesDir() - if _, err := os.Stat(bearerRulesDir); errors.Is(err, os.ErrNotExist) { - err := os.Mkdir(bearerRulesDir, os.ModePerm) - if err != nil { - return fmt.Errorf("could not create bearer-rules directory: %s", err) - } - } - - for _, languagePackageUrl := range languageDownloads { - // Prepare filepath - urlHash := md5.Sum([]byte(languagePackageUrl)) - filepath, err := filepath.Abs(filepath.Join(bearerRulesDir, fmt.Sprintf("%x.tar.gz", urlHash))) - - if err != nil { - return err - } - - if _, err := os.Stat(filepath); err == nil { - log.Trace().Msgf("Using local cache for rule package: %s", languagePackageUrl) - file, err := os.Open(filepath) - if err != nil { - return err - } - defer file.Close() - - if err = ReadRuleDefinitions(ruleDefinitions, file); err != nil { - return err - } - } else { - log.Trace().Msgf("Downloading rule package: %s", languagePackageUrl) - httpClient := &http.Client{Timeout: 60 * time.Second} - resp, err := httpClient.Get(languagePackageUrl) - if err != nil { - return err - } - defer resp.Body.Close() - - // Create file in rules dir - file, err := os.Create(filepath) - if err != nil { - return err - } - defer file.Close() - - // Copy the contents of the downloaded archive to the file - if _, err := io.Copy(file, resp.Body); err != nil { - return err - } - // reset file pointer to start of file - _, err = file.Seek(0, 0) - if err != nil { - return err - } - - if err = ReadRuleDefinitions(ruleDefinitions, file); err != nil { - return err - } - } - } - - return nil -} - -func ReadRuleDefinitions(ruleDefinitions map[string]RuleDefinition, file *os.File) error { - gzr, err := gzip.NewReader(file) - if err != nil { - return err - } - defer gzr.Close() - - tr := tar.NewReader(gzr) - for { - header, err := tr.Next() - if err == io.EOF { - break - } else if err != nil { - return err - } - - if !isRuleFile(header.Name) { - continue - } - - data := make([]byte, header.Size) - _, err = io.ReadFull(tr, data) - if err != nil { - return fmt.Errorf("failed to read file %s: %w", header.Name, err) - } - - var ruleDefinition RuleDefinition - err = yaml.Unmarshal(data, &ruleDefinition) - if err != nil { - return fmt.Errorf("failed to unmarshal rule %s: %w", header.Name, err) - } - - id := ruleDefinition.Metadata.ID - _, ruleExists := ruleDefinitions[id] - if ruleExists { - return fmt.Errorf("duplicate built-in rule ID %s", id) - } - - ruleDefinitions[id] = ruleDefinition - } - - return nil -} - -func isRuleFile(headerName string) bool { - if strings.Contains(headerName, ".snapshots") { - return false - } - - ext := filepath.Ext(headerName) - if ext != ".yaml" && ext != ".yml" { - return false - } - - return strings.Contains(headerName, BASE_RULE_FOLDER) -} diff --git a/internal/commands/process/settings/ruleValidator.go b/internal/commands/process/settings/ruleValidator.go deleted file mode 100644 index a0077425c..000000000 --- a/internal/commands/process/settings/ruleValidator.go +++ /dev/null @@ -1,68 +0,0 @@ -package settings - -import ( - "bytes" - "fmt" - "net/http" - "strings" - - "github.com/xeipuuv/gojsonschema" - "sigs.k8s.io/yaml" -) - -const SCHEMA_URL = "https://raw.githubusercontent.com/Bearer/bearer-rules/main/scripts/rule_schema.json" - -func ValidateRule(entry []byte, filename string) string { - validationStr := &strings.Builder{} - validationStr.WriteString(fmt.Sprintf("Failed to load %s\nValidating against %s\n\n", filename, SCHEMA_URL)) - schema, err := loadSchema(SCHEMA_URL) - if err != nil { - validationStr.WriteString("Could not load schema to validate") - return validationStr.String() - } - - jsonData, err := yaml.YAMLToJSON(entry) - if err != nil { - validationStr.WriteString("File format is invalid") - return validationStr.String() - } - - result, err := validateData(jsonData, schema) - if err != nil { - validationStr.WriteString("Could not apply validation") - return validationStr.String() - } - - if result.Valid() { - validationStr.WriteString("Format of appears valid but could not be loaded") - } else { - validationStr.WriteString(fmt.Sprintf("%s validation issues found:\n", filename)) - for _, desc := range result.Errors() { - validationStr.WriteString(fmt.Sprintf("- %s\n", desc)) - } - fmt.Print("\n") - } - return validationStr.String() -} - -func loadSchema(url string) (*gojsonschema.Schema, error) { - response, err := http.Get(url) - if err != nil { - return nil, err - } - defer response.Body.Close() - - var buf bytes.Buffer - _, err = buf.ReadFrom(response.Body) - if err != nil { - return nil, err - } - - loader := gojsonschema.NewStringLoader(buf.String()) - return gojsonschema.NewSchema(loader) -} - -func validateData(data []byte, schema *gojsonschema.Schema) (*gojsonschema.Result, error) { - loader := gojsonschema.NewStringLoader(string(data)) - return schema.Validate(loader) -} diff --git a/internal/commands/process/settings/rules.go b/internal/commands/process/settings/rules.go deleted file mode 100644 index fdbd27974..000000000 --- a/internal/commands/process/settings/rules.go +++ /dev/null @@ -1,485 +0,0 @@ -package settings - -import ( - "fmt" - "io/fs" - "os" - "path/filepath" - "sort" - "strings" - - "github.com/rs/zerolog/log" - "gopkg.in/yaml.v3" - - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/report/customdetectors" - "github.com/bearer/bearer/internal/util/output" - "github.com/bearer/bearer/internal/util/set" - "github.com/bearer/bearer/internal/version_check" -) - -const ( - defaultRuleType = customdetectors.TypeRisk - defaultAuxiliaryRuleType = customdetectors.TypeVerifier -) - -var ( - builtinRuleIDs = []string{ - "datatype", - "insecure_url", - "string_literal", - } -) - -func GetSupportedRuleLanguages() map[string]bool { - return map[string]bool{ - "python": true, - "php": true, - "go": true, - "java": true, - "sql": true, // partly supported but not exposed - "ruby": true, - "javascript": true, - "typescript": true, - } -} - -func loadRules( - externalRuleDirs []string, - options flagtypes.RuleOptions, - versionMeta *version_check.VersionMeta, - force bool, -) ( - result LoadRulesResult, - err error, -) { - definitions := make(map[string]RuleDefinition) - builtInDefinitions := make(map[string]RuleDefinition) - - if versionMeta.Rules.Version != nil { - result.BearerRulesVersion = *versionMeta.Rules.Version - } - - log.Debug().Msg("Loading rules") - - loadRuleDefinitionsFromRemote(definitions, options, versionMeta) - - if err := loadRuleDefinitionsFromDir(builtInDefinitions, buildInRulesFs); err != nil { - return result, fmt.Errorf("error loading built-in rules: %w", err) - } - - for _, dir := range externalRuleDirs { - if strings.HasPrefix(dir, "~/") { - dirname, _ := os.UserHomeDir() - dir = filepath.Join(dirname, dir[2:]) - } - log.Debug().Msgf("loading external rules from: %s", dir) - if err := loadRuleDefinitionsFromDir(definitions, os.DirFS(dir)); err != nil { - return result, fmt.Errorf("external rules %w", err) - } - } - - if err := validateRuleOptionIDs(options, definitions, builtInDefinitions); err != nil { - return result, err - } - - enabledRules := getEnabledRules(options, definitions, nil) - builtInRules := getEnabledRules(options, builtInDefinitions, enabledRules) - - result.Rules = BuildRules(definitions, enabledRules) - result.BuiltInRules = BuildRules(builtInDefinitions, builtInRules) - - return result, nil -} - -func loadRuleDefinitionsFromRemote( - definitions map[string]RuleDefinition, - options flagtypes.RuleOptions, - versionMeta *version_check.VersionMeta, -) (err error) { - if options.DisableDefaultRules { - return - } - - if versionMeta.Rules.Version == nil { - log.Debug().Msg("No rule packages found") - return - } - - urls := make([]string, 0, len(versionMeta.Rules.Packages)) - for _, value := range versionMeta.Rules.Packages { - log.Debug().Msgf("Added rule package URL %s", value) - urls = append(urls, value) - } - - err = LoadRuleDefinitionsFromUrls(definitions, urls) - if err != nil { - err = fmt.Errorf("loading rules failed: %s", err) - } - - return -} - -func loadRuleDefinitionsFromDir(definitions map[string]RuleDefinition, dir fs.FS) error { - loadedDefinitions := make(map[string]RuleDefinition) - if err := fs.WalkDir(dir, ".", func(path string, dirEntry fs.DirEntry, err error) error { - if err != nil { - return err - } - - if dirEntry.IsDir() { - return nil - } - - filename := dirEntry.Name() - ext := filepath.Ext(filename) - - if ext != ".yaml" && ext != ".yml" { - return nil - } - - entry, err := fs.ReadFile(dir, path) - if err != nil { - return fmt.Errorf("failed to read file %s: %w", path, err) - } - - var ruleDefinition RuleDefinition - err = yaml.Unmarshal(entry, &ruleDefinition) - if err != nil { - output.StdErrLog(ValidateRule(entry, filename)) - return fmt.Errorf("rule file was invalid") - } - - if ruleDefinition.Metadata == nil { - log.Debug().Msgf("rule file has invalid metadata %s", path) - return nil - } - - id := ruleDefinition.Metadata.ID - if id == "" { - log.Debug().Msgf("rule file missing metadata.id %s", path) - return nil - } - - for _, language := range ruleDefinition.Languages { - if exists := GetSupportedRuleLanguages()[language]; !exists { - log.Debug().Msgf("rule file includes unsupported language[%s] %s", language, path) - return nil - } - } - - if _, exists := loadedDefinitions[id]; exists { - return fmt.Errorf("duplicate rule ID %s", id) - } - - loadedDefinitions[id] = ruleDefinition - - return nil - }); err != nil { - return err - } - - for id, definition := range loadedDefinitions { - if validateRuleDefinition(loadedDefinitions, &definition) { - definitions[id] = definition - } - } - - return nil -} - -func validateRuleDefinition(allDefinitions map[string]RuleDefinition, definition *RuleDefinition) bool { - metadata := definition.Metadata - - valid := true - fail := func(message string) { - valid = false - log.Debug().Msgf("%s: %s", metadata.ID, message) - } - - visibleRuleIDs := set.New[string]() - visibleRuleIDs.Add(metadata.ID) - visibleRuleIDs.AddAll(builtinRuleIDs) - - for _, importedID := range definition.Imports { - visibleRuleIDs.Add(importedID) - - importedDefinition, exists := allDefinitions[importedID] - - if !exists { - fail(fmt.Sprintf("import of unknown rule '%s'", importedID)) - continue - } - - if importedDefinition.Type != customdetectors.TypeShared { - fail(fmt.Sprintf("imported rule '%s' is not of type 'shared'", importedID)) - } - } - - for _, auxiliaryDefinition := range definition.Auxiliary { - visibleRuleIDs.Add(auxiliaryDefinition.Id) - } - - for _, filterRuleID := range getFilterRuleReferences(definition).Items() { - if !visibleRuleIDs.Has(filterRuleID) { - fail(fmt.Sprintf("filter references invalid or non-imported rule '%s'", filterRuleID)) - } - } - - for _, sanitizerRuleID := range getSanitizers(definition).Items() { - if !visibleRuleIDs.Has(sanitizerRuleID) { - fail(fmt.Sprintf("sanitizer references invalid or non-imported rule '%s'", sanitizerRuleID)) - } - } - - if metadata.ID == "" { - fail("metadata.id must be specified") - } - - if definition.Type == customdetectors.TypeShared { - metadata := definition.Metadata - if metadata != nil { - if metadata.CWEIDs != nil { - fail("cwe ids cannot be specified for a shared rule") - } - - if metadata.RemediationMessage != "" { - fail("remediation message cannot be specified for a shared rule") - } - } - - if definition.Severity != "" { - fail("severity cannot be specified for a shared rule") - } - } - - if !valid { - log.Debug().Msgf("%s ignored due to validation errors", metadata.ID) - } - - return valid -} - -func getFilterRuleReferences(definition *RuleDefinition) set.Set[string] { - result := set.New[string]() - - var addFilter func(filter PatternFilter) - - addPatterns := func(patterns []RulePattern) { - for _, pattern := range patterns { - for _, filter := range pattern.Filters { - addFilter(filter) - } - } - } - - addFilter = func(filter PatternFilter) { - if filter.Detection != "" { - result.Add(filter.Detection) - } - - if filter.Not != nil { - addFilter(*filter.Not) - } - - for _, subFilter := range filter.Either { - addFilter(subFilter) - } - } - - addPatterns(definition.Patterns) - for _, auxiliaryDefinition := range definition.Auxiliary { - addPatterns(auxiliaryDefinition.Patterns) - } - - return result -} - -func getSanitizers(definition *RuleDefinition) set.Set[string] { - result := set.New[string]() - - if definition.SanitizerRuleID != "" { - result.Add(definition.SanitizerRuleID) - } - - for _, auxiliaryDefinition := range definition.Auxiliary { - if auxiliaryDefinition.SanitizerRuleID != "" { - result.Add(auxiliaryDefinition.SanitizerRuleID) - } - } - - return result -} - -func validateRuleOptionIDs( - options flagtypes.RuleOptions, - definitions map[string]RuleDefinition, - builtInDefinitions map[string]RuleDefinition, -) error { - var invalidRuleIDs []string - - for id := range options.OnlyRule { - _, existsInDefinition := definitions[id] - _, existsInBuiltInDefinition := builtInDefinitions[id] - - if !existsInBuiltInDefinition && !existsInDefinition { - invalidRuleIDs = append(invalidRuleIDs, id) - } - } - var invalidSkipRuleIDs []string - for id := range options.SkipRule { - _, existsInDefinition := definitions[id] - _, existsInBuiltInDefinition := builtInDefinitions[id] - - if !existsInBuiltInDefinition && !existsInDefinition { - invalidSkipRuleIDs = append(invalidSkipRuleIDs, id) - } - } - - if len(invalidSkipRuleIDs) > 0 { - sort.Strings(invalidSkipRuleIDs) - output.StdErrLog(fmt.Sprintf("Warning: rule IDs %s given to be skipped but were not found", strings.Join(invalidSkipRuleIDs, ","))) - } - if len(invalidRuleIDs) > 0 { - return fmt.Errorf("invalid rule IDs in only option: %s", strings.Join(invalidRuleIDs, ",")) - } - - return nil -} - -func getEnabledRules(options flagtypes.RuleOptions, definitions map[string]RuleDefinition, rules map[string]struct{}) map[string]struct{} { - enabledRules := make(map[string]struct{}) - - for ruleId := range rules { - enabledRules[ruleId] = struct{}{} - } - - var enableRule func(definition RuleDefinition) - enableRule = func(definition RuleDefinition) { - if definition.Disabled { - return - } - - id := definition.Metadata.ID - - if _, alreadyEnabled := enabledRules[id]; alreadyEnabled { - return - } - - enabledRules[id] = struct{}{} - - for _, dependencyID := range definition.Detectors { - enabledRules[dependencyID] = struct{}{} - } - - for _, importedRuleID := range definition.Imports { - if importedDefinition, exists := definitions[importedRuleID]; exists { - enableRule(importedDefinition) - } - } - } - - for _, definition := range definitions { - id := definition.Metadata.ID - - if len(options.OnlyRule) > 0 && !options.OnlyRule[id] { - continue - } - - if options.SkipRule[id] { - continue - } - - enableRule(definition) - } - - return enabledRules -} - -func BuildRules(definitions map[string]RuleDefinition, enabledRules map[string]struct{}) map[string]*Rule { - rules := make(map[string]*Rule) - - for _, definition := range definitions { - id := definition.Metadata.ID - - if _, enabled := enabledRules[id]; !enabled { - continue - } - - ruleType := definition.Type - if len(ruleType) == 0 { - ruleType = defaultRuleType - } - - // build rule trigger - ruleTrigger := RuleTrigger{ - MatchOn: PRESENCE, - DataTypesRequired: false, - } - - if definition.Trigger != nil { - if definition.Trigger.MatchOn != nil { - ruleTrigger.MatchOn = *definition.Trigger.MatchOn - } - if definition.Trigger.DataTypesRequired != nil { - ruleTrigger.DataTypesRequired = *definition.Trigger.DataTypesRequired - } - if definition.Trigger.RequiredDetection != nil { - ruleTrigger.RequiredDetection = definition.Trigger.RequiredDetection - } - } - - isLocal := false - for _, rulePattern := range definition.Patterns { - if strings.Contains(rulePattern.Pattern, "$") { - isLocal = true - break - } - } - - rules[id] = &Rule{ - Id: id, - Type: ruleType, - AssociatedRecipe: definition.Metadata.AssociatedRecipe, - Trigger: ruleTrigger, - IsLocal: isLocal, - SkipDataTypes: definition.SkipDataTypes, - OnlyDataTypes: definition.OnlyDataTypes, - Severity: definition.Severity, - Description: definition.Metadata.Description, - RemediationMessage: definition.Metadata.RemediationMessage, - Stored: definition.Stored, - Detectors: definition.Detectors, - Processors: definition.Processors, - AutoEncrytPrefix: definition.AutoEncrytPrefix, - CWEIDs: definition.Metadata.CWEIDs, - Languages: definition.Languages, - ParamParenting: definition.ParamParenting, - Patterns: definition.Patterns, - SanitizerRuleID: definition.SanitizerRuleID, - DocumentationUrl: definition.Metadata.DocumentationUrl, - HasDetailedContext: definition.HasDetailedContext, - DependencyCheck: definition.DependencyCheck, - Dependency: definition.Dependency, - } - - for _, auxiliaryDefinition := range definition.Auxiliary { - rules[auxiliaryDefinition.Id] = &Rule{ - Id: auxiliaryDefinition.Id, - Type: defaultAuxiliaryRuleType, - Languages: definition.Languages, - ParamParenting: auxiliaryDefinition.ParamParenting, - Patterns: auxiliaryDefinition.Patterns, - SanitizerRuleID: auxiliaryDefinition.SanitizerRuleID, - Stored: auxiliaryDefinition.Stored, - IsAuxilary: true, - } - } - } - - return rules -} - -func bearerRulesDir() string { - return filepath.Join(os.TempDir(), "bearer-rules") -} diff --git a/internal/commands/process/settings/rules/javascript/lang/jwt/.snapshots/TestJavascriptJWT--jwt_insecure.yml b/internal/commands/process/settings/rules/javascript/lang/jwt/.snapshots/TestJavascriptJWT--jwt_insecure.yml deleted file mode 100644 index 311847daa..000000000 --- a/internal/commands/process/settings/rules/javascript/lang/jwt/.snapshots/TestJavascriptJWT--jwt_insecure.yml +++ /dev/null @@ -1,2 +0,0 @@ -{} - diff --git a/internal/commands/process/settings/rules/javascript/lang/jwt/testdata/jwt_insecure.js b/internal/commands/process/settings/rules/javascript/lang/jwt/testdata/jwt_insecure.js deleted file mode 100644 index 95716c53d..000000000 --- a/internal/commands/process/settings/rules/javascript/lang/jwt/testdata/jwt_insecure.js +++ /dev/null @@ -1,11 +0,0 @@ -import myJWT from "jsonwebtoken"; - -import {jwt as myJWT} from "jsonwebtoken"; - -const myJWT = require("jsonwebtoken").jwt; - -const privateKey = "foo"; -myJWT.sign(user, privateKey, { - expiresInMinutes: 60 * 5, - algorithm: "RS256", -}); diff --git a/internal/commands/process/settings/rules/ruby/lang/weak_encryption/.snapshots/TestRubyLangWeakEncryption--sha1.yml b/internal/commands/process/settings/rules/ruby/lang/weak_encryption/.snapshots/TestRubyLangWeakEncryption--sha1.yml deleted file mode 100644 index 0ecc2002a..000000000 --- a/internal/commands/process/settings/rules/ruby/lang/weak_encryption/.snapshots/TestRubyLangWeakEncryption--sha1.yml +++ /dev/null @@ -1,44 +0,0 @@ -high: - - rule: - cwe_ids: - - "331" - - "326" - id: ruby_lang_weak_encryption - title: Weak encryption library usage detected. - description: | - ## Description - - A weak encryption or hashing library can lead to data breaches and greater security risk. This rule checks for the use of weak encryption and hashing libraries or algorithms. - - ## Remediations - According to [OWASP](https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/09-Testing_for_Weak_Cryptography/04-Testing_for_Weak_Encryption): MD5, RC4, DES, Blowfish, SHA1. 1024-bit RSA or DSA, 160-bit ECDSA (elliptic curves), 80/112-bit 2TDEA (two key triple DES) are considered as weak hash/encryption algorithms and therefor shouldn't be used. - - ❌ Avoid libraries and algorithms with known weaknesses: - - ```ruby - Digest::SHA1.hexdigest 'weak password encryption' - Crypt::Blowfish.new("weak password encryption") - RC4.new("weak password encryption") - OpenSSL::PKey::RSA.new 1024 - OpenSSL::PKey::DSA.new 1024 - Digest::MD5.hexdigest 'unsecure string' - ``` - - ✅ Instead, we recommend using bcrypt: - - ```ruby - BCrypt::Password.create('iLOVEdogs123') - ``` - - ## Resources - - [BCrypt Explained](https://dev.to/sylviapap/bcrypt-explained-4k5c) - documentation_url: https://docs.bearer.com/reference/rules/ruby_lang_weak_encryption - line_number: 1 - filename: sha1.rb - category_groups: - - PII - - Personal Data - parent_line_number: 1 - snippet: Digest::SHA1.hexidigest(user.name) - fingerprint: c7e6bc4967b8598e0d32e8f35f0d5691_0 - diff --git a/internal/commands/process/settings/rules/ruby/lang/weak_encryption/testdata/sha1.rb b/internal/commands/process/settings/rules/ruby/lang/weak_encryption/testdata/sha1.rb deleted file mode 100644 index a01c74013..000000000 --- a/internal/commands/process/settings/rules/ruby/lang/weak_encryption/testdata/sha1.rb +++ /dev/null @@ -1 +0,0 @@ -Digest::SHA1.hexdigest(aaaa.bbbb) \ No newline at end of file diff --git a/internal/report/output/testhelper/testhelper.go b/internal/report/output/testhelper/testhelper.go deleted file mode 100644 index e6a17174c..000000000 --- a/internal/report/output/testhelper/testhelper.go +++ /dev/null @@ -1,28 +0,0 @@ -package testhelper - -import "github.com/bearer/bearer/internal/commands/process/settings" - -// new rules are added -func CustomRule() *settings.Rule { - return &settings.Rule{ - Id: "custom_test_rule", - Description: "Its a test!", - CWEIDs: []string{}, - Type: "risk", - Languages: []string{"ruby"}, - Severity: "low", - IsLocal: false, - } -} - -func RubyLangSSLVerificationRule() *settings.Rule { - return &settings.Rule{Id: "ruby_lang_ssl_verification", AssociatedRecipe: "", Type: "risk", Trigger: settings.RuleTrigger{MatchOn: "presence", DataTypesRequired: false, RequiredDetection: (*string)(nil)}, IsLocal: false, Detectors: []string(nil), Processors: []string(nil), Stored: false, AutoEncrytPrefix: "", HasDetailedContext: false, SkipDataTypes: []string(nil), OnlyDataTypes: []string(nil), Severity: "medium", Description: "Missing SSL certificate verification detected.", RemediationMessage: "## Description\n\nApplications processing sensitive data should use valid SSL certificates. This rule checks if SSL verification is enabled.\n\n## Remediations\n\n❌ By default Ruby check for SSL certificate verification but this can be bypassed when setting Open SSL verification mode to `VERIFY_NONE`:\n\n```clojure\nrequire \"net/https\"\nrequire \"uri\"\n\nuri = URI.parse(\"https://ssl-site.com/\")\nhttp = Net::HTTP.new(uri.host, uri.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n```\n\n✅ To ensure that SSL verification always happens, make sure to use the following mode:\n\n```bash\nhttp.verify_mode = OpenSSL::SSL::VERIFY_PEER\n```\n\n## Resources\n- [Ruby OpenSSL module](https://ruby.github.io/openssl/OpenSSL.html)\n", CWEIDs: []string{"295"}, Languages: []string{"ruby"}, Patterns: []settings.RulePattern{settings.RulePattern{Pattern: "Net::HTTP.start(verify_mode: OpenSSL::SSL::VERIFY_NONE)$<...>\n", Focus: "", Filters: []settings.PatternFilter(nil)}, settings.RulePattern{Pattern: "Net::HTTP.start($<...>{ verify_mode: OpenSSL::SSL::VERIFY_NONE })$<...>\n", Focus: "", Filters: []settings.PatternFilter(nil)}, settings.RulePattern{Pattern: "$<_>.verify_mode = OpenSSL::SSL::VERIFY_NONE\n", Focus: "", Filters: []settings.PatternFilter(nil)}}, SanitizerRuleID: "", DocumentationUrl: "https://docs.bearer.com/reference/rules/ruby_lang_ssl_verification", IsAuxilary: false, DependencyCheck: false, Dependency: (*settings.Dependency)(nil), Metavars: map[string]settings.MetaVar(nil), ParamParenting: false, DetectPresence: false, OmitParent: false} -} - -func RubyRailsLoggerRule() *settings.Rule { - return &settings.Rule{Id: "ruby_rails_logger", AssociatedRecipe: "", Type: "risk", Trigger: settings.RuleTrigger{MatchOn: "presence", DataTypesRequired: false, RequiredDetection: (*string)(nil)}, IsLocal: true, Detectors: []string(nil), Processors: []string(nil), Stored: false, AutoEncrytPrefix: "", HasDetailedContext: false, SkipDataTypes: []string{"Unique Identifier"}, OnlyDataTypes: []string(nil), Severity: "critical", Description: "Sensitive data sent to Rails loggers detected.", RemediationMessage: "## Description\nLeaking sensitive data to loggers is a common cause of data leaks and can lead to data breaches. This rule looks for instances of sensitive data sent to rails loggers.\n\n## Remediations\n❌ Avoid using sensitive data in logger messages:\n\n```ruby\nRails.logger.info('User is: #{user.email}')\n```\n\n✅ If you need to identify a user, ensure to use their unique identifier instead of their personal identifiable information:\n\n```ruby\nRails.logger.info('User is: #{user.uuid}')\n```\n\n## Resources\n- [OWASP logging cheat sheet](https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html)\n", CWEIDs: []string{"209", "532"}, Languages: []string{"ruby"}, Patterns: []settings.RulePattern{settings.RulePattern{Pattern: "Rails.logger.$($)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}, settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "METHOD", Detection: "", Scope: "", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string{"info", "warn", "error", "fatal", "unknown"}, LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}}, SanitizerRuleID: "", DocumentationUrl: "https://docs.bearer.com/reference/rules/ruby_rails_logger", IsAuxilary: false, DependencyCheck: false, Dependency: (*settings.Dependency)(nil), Metavars: map[string]settings.MetaVar(nil), ParamParenting: false, DetectPresence: false, OmitParent: false} -} - -func RubyThirdPartiesSentryRule() *settings.Rule { - return &settings.Rule{Id: "ruby_third_parties_sentry", AssociatedRecipe: "Sentry", Type: "risk", Trigger: settings.RuleTrigger{MatchOn: "presence", DataTypesRequired: false, RequiredDetection: (*string)(nil)}, IsLocal: true, Detectors: []string(nil), Processors: []string(nil), Stored: false, AutoEncrytPrefix: "", HasDetailedContext: false, SkipDataTypes: []string{"Unique Identifier"}, OnlyDataTypes: []string(nil), Severity: "Critical", Description: "Sensitive data sent to Sentry detected.", RemediationMessage: "## Description\nLeaking sensitive data to third-party loggers is a common cause of data leaks and can lead to data breaches. This rule looks for instances of sensitive data sent to Sentry.\n\n## Remediations\n\nWhen logging errors or events, ensure all sensitive data is removed.\n\n## Resources\n- [Sentry Docs](https://docs.sentry.io/)\n", CWEIDs: []string{"201"}, Languages: []string{"ruby"}, Patterns: []settings.RulePattern{settings.RulePattern{Pattern: "Sentry::Breadcrumb.new($<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.capture_message($<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.init do |$|\n $.before_breadcrumb = lambda do |$, $<_:identifier>|\n $$.message = $\n end\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.set_context($<_>, $<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_context($<_>, $<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_context($<_>, $<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_extra($<_>, $)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_extra($<_>, $)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.set_extras($<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_extras($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_extras($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_tag($<_>, $)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_tag($<_>, $)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.set_tags($<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_tags($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_tags($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.set_user($<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_user($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_user($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*settings.Regexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*settings.Regexp)(nil), FilenameRegex: (*settings.Regexp)(nil)}}}}, SanitizerRuleID: "", DocumentationUrl: "https://docs.bearer.com/reference/rules/ruby_third_parties_sentry", IsAuxilary: false, DependencyCheck: false, Dependency: (*settings.Dependency)(nil), Metavars: map[string]settings.MetaVar(nil), ParamParenting: false, DetectPresence: false, OmitParent: false} -} diff --git a/internal/report/schema/schemahelper/schemahelper.go b/internal/report/schema/schemahelper/schemahelper.go deleted file mode 100644 index 6872868b0..000000000 --- a/internal/report/schema/schemahelper/schemahelper.go +++ /dev/null @@ -1,11 +0,0 @@ -package schemahelper - -import ( - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/report/source" -) - -type Schema struct { - Source source.Source - Value schema.Schema -} diff --git a/internal/classification/classification.go b/pkg/classification/classification.go similarity index 79% rename from internal/classification/classification.go rename to pkg/classification/classification.go index 901477036..2d80e0df9 100644 --- a/internal/classification/classification.go +++ b/pkg/classification/classification.go @@ -1,13 +1,13 @@ package classification import ( - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/classification/dependencies" - "github.com/bearer/bearer/internal/classification/frameworks" - "github.com/bearer/bearer/internal/classification/interfaces" - "github.com/bearer/bearer/internal/classification/schema" - config "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/util/url" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/classification/dependencies" + "github.com/bearer/bearer/pkg/classification/frameworks" + "github.com/bearer/bearer/pkg/classification/interfaces" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/util/url" ) type Classifier struct { @@ -20,7 +20,7 @@ type Classifier struct { } type Config struct { - Config config.Config + Config settings.Config } func NewClassifier(config *Config) (*Classifier, error) { diff --git a/internal/classification/db/category_grouping.json b/pkg/classification/db/category_grouping.json similarity index 100% rename from internal/classification/db/category_grouping.json rename to pkg/classification/db/category_grouping.json diff --git a/internal/classification/db/data_categories/authenticating.json b/pkg/classification/db/data_categories/authenticating.json similarity index 100% rename from internal/classification/db/data_categories/authenticating.json rename to pkg/classification/db/data_categories/authenticating.json diff --git a/internal/classification/db/data_categories/behavioral_information.json b/pkg/classification/db/data_categories/behavioral_information.json similarity index 100% rename from internal/classification/db/data_categories/behavioral_information.json rename to pkg/classification/db/data_categories/behavioral_information.json diff --git a/internal/classification/db/data_categories/communication.json b/pkg/classification/db/data_categories/communication.json similarity index 100% rename from internal/classification/db/data_categories/communication.json rename to pkg/classification/db/data_categories/communication.json diff --git a/internal/classification/db/data_categories/computer_device.json b/pkg/classification/db/data_categories/computer_device.json similarity index 100% rename from internal/classification/db/data_categories/computer_device.json rename to pkg/classification/db/data_categories/computer_device.json diff --git a/internal/classification/db/data_categories/contact.json b/pkg/classification/db/data_categories/contact.json similarity index 100% rename from internal/classification/db/data_categories/contact.json rename to pkg/classification/db/data_categories/contact.json diff --git a/internal/classification/db/data_categories/credit_history.json b/pkg/classification/db/data_categories/credit_history.json similarity index 100% rename from internal/classification/db/data_categories/credit_history.json rename to pkg/classification/db/data_categories/credit_history.json diff --git a/internal/classification/db/data_categories/criminal_records.json b/pkg/classification/db/data_categories/criminal_records.json similarity index 100% rename from internal/classification/db/data_categories/criminal_records.json rename to pkg/classification/db/data_categories/criminal_records.json diff --git a/internal/classification/db/data_categories/demographic.json b/pkg/classification/db/data_categories/demographic.json similarity index 100% rename from internal/classification/db/data_categories/demographic.json rename to pkg/classification/db/data_categories/demographic.json diff --git a/internal/classification/db/data_categories/ethnicity.json b/pkg/classification/db/data_categories/ethnicity.json similarity index 100% rename from internal/classification/db/data_categories/ethnicity.json rename to pkg/classification/db/data_categories/ethnicity.json diff --git a/internal/classification/db/data_categories/family.json b/pkg/classification/db/data_categories/family.json similarity index 100% rename from internal/classification/db/data_categories/family.json rename to pkg/classification/db/data_categories/family.json diff --git a/internal/classification/db/data_categories/financial_accounts.json b/pkg/classification/db/data_categories/financial_accounts.json similarity index 100% rename from internal/classification/db/data_categories/financial_accounts.json rename to pkg/classification/db/data_categories/financial_accounts.json diff --git a/internal/classification/db/data_categories/identification.json b/pkg/classification/db/data_categories/identification.json similarity index 100% rename from internal/classification/db/data_categories/identification.json rename to pkg/classification/db/data_categories/identification.json diff --git a/internal/classification/db/data_categories/knowledge_and_belief.json b/pkg/classification/db/data_categories/knowledge_and_belief.json similarity index 100% rename from internal/classification/db/data_categories/knowledge_and_belief.json rename to pkg/classification/db/data_categories/knowledge_and_belief.json diff --git a/internal/classification/db/data_categories/location.json b/pkg/classification/db/data_categories/location.json similarity index 100% rename from internal/classification/db/data_categories/location.json rename to pkg/classification/db/data_categories/location.json diff --git a/internal/classification/db/data_categories/medical_and_health.json b/pkg/classification/db/data_categories/medical_and_health.json similarity index 100% rename from internal/classification/db/data_categories/medical_and_health.json rename to pkg/classification/db/data_categories/medical_and_health.json diff --git a/internal/classification/db/data_categories/personal_ownership.json b/pkg/classification/db/data_categories/personal_ownership.json similarity index 100% rename from internal/classification/db/data_categories/personal_ownership.json rename to pkg/classification/db/data_categories/personal_ownership.json diff --git a/internal/classification/db/data_categories/physical_characteristic.json b/pkg/classification/db/data_categories/physical_characteristic.json similarity index 100% rename from internal/classification/db/data_categories/physical_characteristic.json rename to pkg/classification/db/data_categories/physical_characteristic.json diff --git a/internal/classification/db/data_categories/preference.json b/pkg/classification/db/data_categories/preference.json similarity index 100% rename from internal/classification/db/data_categories/preference.json rename to pkg/classification/db/data_categories/preference.json diff --git a/internal/classification/db/data_categories/professional_information.json b/pkg/classification/db/data_categories/professional_information.json similarity index 100% rename from internal/classification/db/data_categories/professional_information.json rename to pkg/classification/db/data_categories/professional_information.json diff --git a/internal/classification/db/data_categories/public_life.json b/pkg/classification/db/data_categories/public_life.json similarity index 100% rename from internal/classification/db/data_categories/public_life.json rename to pkg/classification/db/data_categories/public_life.json diff --git a/internal/classification/db/data_categories/sexual.json b/pkg/classification/db/data_categories/sexual.json similarity index 100% rename from internal/classification/db/data_categories/sexual.json rename to pkg/classification/db/data_categories/sexual.json diff --git a/internal/classification/db/data_categories/social_network.json b/pkg/classification/db/data_categories/social_network.json similarity index 100% rename from internal/classification/db/data_categories/social_network.json rename to pkg/classification/db/data_categories/social_network.json diff --git a/internal/classification/db/data_categories/transactional.json b/pkg/classification/db/data_categories/transactional.json similarity index 100% rename from internal/classification/db/data_categories/transactional.json rename to pkg/classification/db/data_categories/transactional.json diff --git a/internal/classification/db/data_type_classification_patterns/100_telephone_number.json b/pkg/classification/db/data_type_classification_patterns/100_telephone_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/100_telephone_number.json rename to pkg/classification/db/data_type_classification_patterns/100_telephone_number.json diff --git a/internal/classification/db/data_type_classification_patterns/101_geographic.json b/pkg/classification/db/data_type_classification_patterns/101_geographic.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/101_geographic.json rename to pkg/classification/db/data_type_classification_patterns/101_geographic.json diff --git a/internal/classification/db/data_type_classification_patterns/102_transactions.json b/pkg/classification/db/data_type_classification_patterns/102_transactions.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/102_transactions.json rename to pkg/classification/db/data_type_classification_patterns/102_transactions.json diff --git a/internal/classification/db/data_type_classification_patterns/103_browser_fingerprint.json b/pkg/classification/db/data_type_classification_patterns/103_browser_fingerprint.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/103_browser_fingerprint.json rename to pkg/classification/db/data_type_classification_patterns/103_browser_fingerprint.json diff --git a/internal/classification/db/data_type_classification_patterns/104_emails.json b/pkg/classification/db/data_type_classification_patterns/104_emails.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/104_emails.json rename to pkg/classification/db/data_type_classification_patterns/104_emails.json diff --git a/internal/classification/db/data_type_classification_patterns/105_links_clicked.json b/pkg/classification/db/data_type_classification_patterns/105_links_clicked.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/105_links_clicked.json rename to pkg/classification/db/data_type_classification_patterns/105_links_clicked.json diff --git a/internal/classification/db/data_type_classification_patterns/106_race.json b/pkg/classification/db/data_type_classification_patterns/106_race.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/106_race.json rename to pkg/classification/db/data_type_classification_patterns/106_race.json diff --git a/internal/classification/db/data_type_classification_patterns/107_conversation.json b/pkg/classification/db/data_type_classification_patterns/107_conversation.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/107_conversation.json rename to pkg/classification/db/data_type_classification_patterns/107_conversation.json diff --git a/internal/classification/db/data_type_classification_patterns/108_vaccine.json b/pkg/classification/db/data_type_classification_patterns/108_vaccine.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/108_vaccine.json rename to pkg/classification/db/data_type_classification_patterns/108_vaccine.json diff --git a/internal/classification/db/data_type_classification_patterns/109_question.json b/pkg/classification/db/data_type_classification_patterns/109_question.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/109_question.json rename to pkg/classification/db/data_type_classification_patterns/109_question.json diff --git a/internal/classification/db/data_type_classification_patterns/10_charges.json b/pkg/classification/db/data_type_classification_patterns/10_charges.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/10_charges.json rename to pkg/classification/db/data_type_classification_patterns/10_charges.json diff --git a/internal/classification/db/data_type_classification_patterns/110_answer.json b/pkg/classification/db/data_type_classification_patterns/110_answer.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/110_answer.json rename to pkg/classification/db/data_type_classification_patterns/110_answer.json diff --git a/internal/classification/db/data_type_classification_patterns/111_click.json b/pkg/classification/db/data_type_classification_patterns/111_click.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/111_click.json rename to pkg/classification/db/data_type_classification_patterns/111_click.json diff --git a/internal/classification/db/data_type_classification_patterns/112_tracking.json b/pkg/classification/db/data_type_classification_patterns/112_tracking.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/112_tracking.json rename to pkg/classification/db/data_type_classification_patterns/112_tracking.json diff --git a/internal/classification/db/data_type_classification_patterns/113_cart.json b/pkg/classification/db/data_type_classification_patterns/113_cart.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/113_cart.json rename to pkg/classification/db/data_type_classification_patterns/113_cart.json diff --git a/internal/classification/db/data_type_classification_patterns/114_payment.json b/pkg/classification/db/data_type_classification_patterns/114_payment.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/114_payment.json rename to pkg/classification/db/data_type_classification_patterns/114_payment.json diff --git a/internal/classification/db/data_type_classification_patterns/115_order.json b/pkg/classification/db/data_type_classification_patterns/115_order.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/115_order.json rename to pkg/classification/db/data_type_classification_patterns/115_order.json diff --git a/internal/classification/db/data_type_classification_patterns/116_purchase.json b/pkg/classification/db/data_type_classification_patterns/116_purchase.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/116_purchase.json rename to pkg/classification/db/data_type_classification_patterns/116_purchase.json diff --git a/internal/classification/db/data_type_classification_patterns/117_token.json b/pkg/classification/db/data_type_classification_patterns/117_token.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/117_token.json rename to pkg/classification/db/data_type_classification_patterns/117_token.json diff --git a/internal/classification/db/data_type_classification_patterns/118_invoice.json b/pkg/classification/db/data_type_classification_patterns/118_invoice.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/118_invoice.json rename to pkg/classification/db/data_type_classification_patterns/118_invoice.json diff --git a/internal/classification/db/data_type_classification_patterns/119_access_token.json b/pkg/classification/db/data_type_classification_patterns/119_access_token.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/119_access_token.json rename to pkg/classification/db/data_type_classification_patterns/119_access_token.json diff --git a/internal/classification/db/data_type_classification_patterns/11_pardons.json b/pkg/classification/db/data_type_classification_patterns/11_pardons.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/11_pardons.json rename to pkg/classification/db/data_type_classification_patterns/11_pardons.json diff --git a/internal/classification/db/data_type_classification_patterns/120_billing.json b/pkg/classification/db/data_type_classification_patterns/120_billing.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/120_billing.json rename to pkg/classification/db/data_type_classification_patterns/120_billing.json diff --git a/internal/classification/db/data_type_classification_patterns/121_bank_transfer.json b/pkg/classification/db/data_type_classification_patterns/121_bank_transfer.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/121_bank_transfer.json rename to pkg/classification/db/data_type_classification_patterns/121_bank_transfer.json diff --git a/internal/classification/db/data_type_classification_patterns/122_creditcard.json b/pkg/classification/db/data_type_classification_patterns/122_creditcard.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/122_creditcard.json rename to pkg/classification/db/data_type_classification_patterns/122_creditcard.json diff --git a/internal/classification/db/data_type_classification_patterns/123_paystub.json b/pkg/classification/db/data_type_classification_patterns/123_paystub.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/123_paystub.json rename to pkg/classification/db/data_type_classification_patterns/123_paystub.json diff --git a/internal/classification/db/data_type_classification_patterns/124_subscription.json b/pkg/classification/db/data_type_classification_patterns/124_subscription.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/124_subscription.json rename to pkg/classification/db/data_type_classification_patterns/124_subscription.json diff --git a/internal/classification/db/data_type_classification_patterns/125_exam.json b/pkg/classification/db/data_type_classification_patterns/125_exam.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/125_exam.json rename to pkg/classification/db/data_type_classification_patterns/125_exam.json diff --git a/internal/classification/db/data_type_classification_patterns/126_appointment.json b/pkg/classification/db/data_type_classification_patterns/126_appointment.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/126_appointment.json rename to pkg/classification/db/data_type_classification_patterns/126_appointment.json diff --git a/internal/classification/db/data_type_classification_patterns/127_consultation.json b/pkg/classification/db/data_type_classification_patterns/127_consultation.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/127_consultation.json rename to pkg/classification/db/data_type_classification_patterns/127_consultation.json diff --git a/internal/classification/db/data_type_classification_patterns/128_document.json b/pkg/classification/db/data_type_classification_patterns/128_document.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/128_document.json rename to pkg/classification/db/data_type_classification_patterns/128_document.json diff --git a/internal/classification/db/data_type_classification_patterns/129_file.json b/pkg/classification/db/data_type_classification_patterns/129_file.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/129_file.json rename to pkg/classification/db/data_type_classification_patterns/129_file.json diff --git a/internal/classification/db/data_type_classification_patterns/12_driving_license.json b/pkg/classification/db/data_type_classification_patterns/12_driving_license.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/12_driving_license.json rename to pkg/classification/db/data_type_classification_patterns/12_driving_license.json diff --git a/internal/classification/db/data_type_classification_patterns/130_content.json b/pkg/classification/db/data_type_classification_patterns/130_content.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/130_content.json rename to pkg/classification/db/data_type_classification_patterns/130_content.json diff --git a/internal/classification/db/data_type_classification_patterns/131_device.json b/pkg/classification/db/data_type_classification_patterns/131_device.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/131_device.json rename to pkg/classification/db/data_type_classification_patterns/131_device.json diff --git a/internal/classification/db/data_type_classification_patterns/132_identification.json b/pkg/classification/db/data_type_classification_patterns/132_identification.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/132_identification.json rename to pkg/classification/db/data_type_classification_patterns/132_identification.json diff --git a/internal/classification/db/data_type_classification_patterns/133_earning.json b/pkg/classification/db/data_type_classification_patterns/133_earning.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/133_earning.json rename to pkg/classification/db/data_type_classification_patterns/133_earning.json diff --git a/internal/classification/db/data_type_classification_patterns/134_credentials.json b/pkg/classification/db/data_type_classification_patterns/134_credentials.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/134_credentials.json rename to pkg/classification/db/data_type_classification_patterns/134_credentials.json diff --git a/internal/classification/db/data_type_classification_patterns/135_message.json b/pkg/classification/db/data_type_classification_patterns/135_message.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/135_message.json rename to pkg/classification/db/data_type_classification_patterns/135_message.json diff --git a/internal/classification/db/data_type_classification_patterns/136_rating.json b/pkg/classification/db/data_type_classification_patterns/136_rating.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/136_rating.json rename to pkg/classification/db/data_type_classification_patterns/136_rating.json diff --git a/internal/classification/db/data_type_classification_patterns/137_review.json b/pkg/classification/db/data_type_classification_patterns/137_review.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/137_review.json rename to pkg/classification/db/data_type_classification_patterns/137_review.json diff --git a/internal/classification/db/data_type_classification_patterns/138_voice.json b/pkg/classification/db/data_type_classification_patterns/138_voice.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/138_voice.json rename to pkg/classification/db/data_type_classification_patterns/138_voice.json diff --git a/internal/classification/db/data_type_classification_patterns/139_amount.json b/pkg/classification/db/data_type_classification_patterns/139_amount.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/139_amount.json rename to pkg/classification/db/data_type_classification_patterns/139_amount.json diff --git a/internal/classification/db/data_type_classification_patterns/13_device_identifier.json b/pkg/classification/db/data_type_classification_patterns/13_device_identifier.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/13_device_identifier.json rename to pkg/classification/db/data_type_classification_patterns/13_device_identifier.json diff --git a/internal/classification/db/data_type_classification_patterns/140_comment.json b/pkg/classification/db/data_type_classification_patterns/140_comment.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/140_comment.json rename to pkg/classification/db/data_type_classification_patterns/140_comment.json diff --git a/internal/classification/db/data_type_classification_patterns/142_fullname.json b/pkg/classification/db/data_type_classification_patterns/142_fullname.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/142_fullname.json rename to pkg/classification/db/data_type_classification_patterns/142_fullname.json diff --git a/internal/classification/db/data_type_classification_patterns/143_unique_identifier.json b/pkg/classification/db/data_type_classification_patterns/143_unique_identifier.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/143_unique_identifier.json rename to pkg/classification/db/data_type_classification_patterns/143_unique_identifier.json diff --git a/internal/classification/db/data_type_classification_patterns/144_disease.json b/pkg/classification/db/data_type_classification_patterns/144_disease.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/144_disease.json rename to pkg/classification/db/data_type_classification_patterns/144_disease.json diff --git a/internal/classification/db/data_type_classification_patterns/145_genetic.json b/pkg/classification/db/data_type_classification_patterns/145_genetic.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/145_genetic.json rename to pkg/classification/db/data_type_classification_patterns/145_genetic.json diff --git a/internal/classification/db/data_type_classification_patterns/146_lab_test_results.json b/pkg/classification/db/data_type_classification_patterns/146_lab_test_results.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/146_lab_test_results.json rename to pkg/classification/db/data_type_classification_patterns/146_lab_test_results.json diff --git a/internal/classification/db/data_type_classification_patterns/147_health_insurance_number.json b/pkg/classification/db/data_type_classification_patterns/147_health_insurance_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/147_health_insurance_number.json rename to pkg/classification/db/data_type_classification_patterns/147_health_insurance_number.json diff --git a/internal/classification/db/data_type_classification_patterns/148_insurance.json b/pkg/classification/db/data_type_classification_patterns/148_insurance.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/148_insurance.json rename to pkg/classification/db/data_type_classification_patterns/148_insurance.json diff --git a/internal/classification/db/data_type_classification_patterns/149_test.json b/pkg/classification/db/data_type_classification_patterns/149_test.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/149_test.json rename to pkg/classification/db/data_type_classification_patterns/149_test.json diff --git a/internal/classification/db/data_type_classification_patterns/14_ethnic_origin.json b/pkg/classification/db/data_type_classification_patterns/14_ethnic_origin.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/14_ethnic_origin.json rename to pkg/classification/db/data_type_classification_patterns/14_ethnic_origin.json diff --git a/internal/classification/db/data_type_classification_patterns/150_medical_conditions.json b/pkg/classification/db/data_type_classification_patterns/150_medical_conditions.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/150_medical_conditions.json rename to pkg/classification/db/data_type_classification_patterns/150_medical_conditions.json diff --git a/internal/classification/db/data_type_classification_patterns/151_treatment.json b/pkg/classification/db/data_type_classification_patterns/151_treatment.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/151_treatment.json rename to pkg/classification/db/data_type_classification_patterns/151_treatment.json diff --git a/internal/classification/db/data_type_classification_patterns/152_scan.json b/pkg/classification/db/data_type_classification_patterns/152_scan.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/152_scan.json rename to pkg/classification/db/data_type_classification_patterns/152_scan.json diff --git a/internal/classification/db/data_type_classification_patterns/153_medication.json b/pkg/classification/db/data_type_classification_patterns/153_medication.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/153_medication.json rename to pkg/classification/db/data_type_classification_patterns/153_medication.json diff --git a/internal/classification/db/data_type_classification_patterns/154_phi_dates.json b/pkg/classification/db/data_type_classification_patterns/154_phi_dates.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/154_phi_dates.json rename to pkg/classification/db/data_type_classification_patterns/154_phi_dates.json diff --git a/internal/classification/db/data_type_classification_patterns/155_diagnosis.json b/pkg/classification/db/data_type_classification_patterns/155_diagnosis.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/155_diagnosis.json rename to pkg/classification/db/data_type_classification_patterns/155_diagnosis.json diff --git a/internal/classification/db/data_type_classification_patterns/156_procedures.json b/pkg/classification/db/data_type_classification_patterns/156_procedures.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/156_procedures.json rename to pkg/classification/db/data_type_classification_patterns/156_procedures.json diff --git a/internal/classification/db/data_type_classification_patterns/157_risk_assessments.json b/pkg/classification/db/data_type_classification_patterns/157_risk_assessments.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/157_risk_assessments.json rename to pkg/classification/db/data_type_classification_patterns/157_risk_assessments.json diff --git a/internal/classification/db/data_type_classification_patterns/158_allergies.json b/pkg/classification/db/data_type_classification_patterns/158_allergies.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/158_allergies.json rename to pkg/classification/db/data_type_classification_patterns/158_allergies.json diff --git a/internal/classification/db/data_type_classification_patterns/159_health_insurance_claim_number.json b/pkg/classification/db/data_type_classification_patterns/159_health_insurance_claim_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/159_health_insurance_claim_number.json rename to pkg/classification/db/data_type_classification_patterns/159_health_insurance_claim_number.json diff --git a/internal/classification/db/data_type_classification_patterns/15_national_origin.json b/pkg/classification/db/data_type_classification_patterns/15_national_origin.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/15_national_origin.json rename to pkg/classification/db/data_type_classification_patterns/15_national_origin.json diff --git a/internal/classification/db/data_type_classification_patterns/160_health_provider.json b/pkg/classification/db/data_type_classification_patterns/160_health_provider.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/160_health_provider.json rename to pkg/classification/db/data_type_classification_patterns/160_health_provider.json diff --git a/internal/classification/db/data_type_classification_patterns/161_vital_signs.json b/pkg/classification/db/data_type_classification_patterns/161_vital_signs.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/161_vital_signs.json rename to pkg/classification/db/data_type_classification_patterns/161_vital_signs.json diff --git a/internal/classification/db/data_type_classification_patterns/162_blood_pressure.json b/pkg/classification/db/data_type_classification_patterns/162_blood_pressure.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/162_blood_pressure.json rename to pkg/classification/db/data_type_classification_patterns/162_blood_pressure.json diff --git a/internal/classification/db/data_type_classification_patterns/163_bmi.json b/pkg/classification/db/data_type_classification_patterns/163_bmi.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/163_bmi.json rename to pkg/classification/db/data_type_classification_patterns/163_bmi.json diff --git a/internal/classification/db/data_type_classification_patterns/165_tomography.json b/pkg/classification/db/data_type_classification_patterns/165_tomography.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/165_tomography.json rename to pkg/classification/db/data_type_classification_patterns/165_tomography.json diff --git a/internal/classification/db/data_type_classification_patterns/166_physical_activity.json b/pkg/classification/db/data_type_classification_patterns/166_physical_activity.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/166_physical_activity.json rename to pkg/classification/db/data_type_classification_patterns/166_physical_activity.json diff --git a/internal/classification/db/data_type_classification_patterns/167_x-ray.json b/pkg/classification/db/data_type_classification_patterns/167_x-ray.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/167_x-ray.json rename to pkg/classification/db/data_type_classification_patterns/167_x-ray.json diff --git a/internal/classification/db/data_type_classification_patterns/168_concerns.json b/pkg/classification/db/data_type_classification_patterns/168_concerns.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/168_concerns.json rename to pkg/classification/db/data_type_classification_patterns/168_concerns.json diff --git a/internal/classification/db/data_type_classification_patterns/169_hospital_admission_date.json b/pkg/classification/db/data_type_classification_patterns/169_hospital_admission_date.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/169_hospital_admission_date.json rename to pkg/classification/db/data_type_classification_patterns/169_hospital_admission_date.json diff --git a/internal/classification/db/data_type_classification_patterns/16_biometric_data.json b/pkg/classification/db/data_type_classification_patterns/16_biometric_data.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/16_biometric_data.json rename to pkg/classification/db/data_type_classification_patterns/16_biometric_data.json diff --git a/internal/classification/db/data_type_classification_patterns/170_hospital_discharge_date.json b/pkg/classification/db/data_type_classification_patterns/170_hospital_discharge_date.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/170_hospital_discharge_date.json rename to pkg/classification/db/data_type_classification_patterns/170_hospital_discharge_date.json diff --git a/internal/classification/db/data_type_classification_patterns/171_cancer.json b/pkg/classification/db/data_type_classification_patterns/171_cancer.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/171_cancer.json rename to pkg/classification/db/data_type_classification_patterns/171_cancer.json diff --git a/internal/classification/db/data_type_classification_patterns/172_colonoscopy.json b/pkg/classification/db/data_type_classification_patterns/172_colonoscopy.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/172_colonoscopy.json rename to pkg/classification/db/data_type_classification_patterns/172_colonoscopy.json diff --git a/internal/classification/db/data_type_classification_patterns/173_cholesterol_measurement.json b/pkg/classification/db/data_type_classification_patterns/173_cholesterol_measurement.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/173_cholesterol_measurement.json rename to pkg/classification/db/data_type_classification_patterns/173_cholesterol_measurement.json diff --git a/internal/classification/db/data_type_classification_patterns/174_blood_glucose.json b/pkg/classification/db/data_type_classification_patterns/174_blood_glucose.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/174_blood_glucose.json rename to pkg/classification/db/data_type_classification_patterns/174_blood_glucose.json diff --git a/internal/classification/db/data_type_classification_patterns/175_high_low_density_lipoproteins.json b/pkg/classification/db/data_type_classification_patterns/175_high_low_density_lipoproteins.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/175_high_low_density_lipoproteins.json rename to pkg/classification/db/data_type_classification_patterns/175_high_low_density_lipoproteins.json diff --git a/internal/classification/db/data_type_classification_patterns/176_asthma.json b/pkg/classification/db/data_type_classification_patterns/176_asthma.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/176_asthma.json rename to pkg/classification/db/data_type_classification_patterns/176_asthma.json diff --git a/internal/classification/db/data_type_classification_patterns/177_hiv.json b/pkg/classification/db/data_type_classification_patterns/177_hiv.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/177_hiv.json rename to pkg/classification/db/data_type_classification_patterns/177_hiv.json diff --git a/internal/classification/db/data_type_classification_patterns/178_flu.json b/pkg/classification/db/data_type_classification_patterns/178_flu.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/178_flu.json rename to pkg/classification/db/data_type_classification_patterns/178_flu.json diff --git a/internal/classification/db/data_type_classification_patterns/179_giardiasis.json b/pkg/classification/db/data_type_classification_patterns/179_giardiasis.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/179_giardiasis.json rename to pkg/classification/db/data_type_classification_patterns/179_giardiasis.json diff --git a/internal/classification/db/data_type_classification_patterns/17_bank_account.json b/pkg/classification/db/data_type_classification_patterns/17_bank_account.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/17_bank_account.json rename to pkg/classification/db/data_type_classification_patterns/17_bank_account.json diff --git a/internal/classification/db/data_type_classification_patterns/180_diphtheria.json b/pkg/classification/db/data_type_classification_patterns/180_diphtheria.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/180_diphtheria.json rename to pkg/classification/db/data_type_classification_patterns/180_diphtheria.json diff --git a/internal/classification/db/data_type_classification_patterns/181_pneumonia.json b/pkg/classification/db/data_type_classification_patterns/181_pneumonia.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/181_pneumonia.json rename to pkg/classification/db/data_type_classification_patterns/181_pneumonia.json diff --git a/internal/classification/db/data_type_classification_patterns/182_tuberculosis.json b/pkg/classification/db/data_type_classification_patterns/182_tuberculosis.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/182_tuberculosis.json rename to pkg/classification/db/data_type_classification_patterns/182_tuberculosis.json diff --git a/internal/classification/db/data_type_classification_patterns/183_hypertension.json b/pkg/classification/db/data_type_classification_patterns/183_hypertension.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/183_hypertension.json rename to pkg/classification/db/data_type_classification_patterns/183_hypertension.json diff --git a/internal/classification/db/data_type_classification_patterns/184_illness.json b/pkg/classification/db/data_type_classification_patterns/184_illness.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/184_illness.json rename to pkg/classification/db/data_type_classification_patterns/184_illness.json diff --git a/internal/classification/db/data_type_classification_patterns/185_therapy.json b/pkg/classification/db/data_type_classification_patterns/185_therapy.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/185_therapy.json rename to pkg/classification/db/data_type_classification_patterns/185_therapy.json diff --git a/internal/classification/db/data_type_classification_patterns/186_procedure.json b/pkg/classification/db/data_type_classification_patterns/186_procedure.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/186_procedure.json rename to pkg/classification/db/data_type_classification_patterns/186_procedure.json diff --git a/internal/classification/db/data_type_classification_patterns/187_feedback.json b/pkg/classification/db/data_type_classification_patterns/187_feedback.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/187_feedback.json rename to pkg/classification/db/data_type_classification_patterns/187_feedback.json diff --git a/internal/classification/db/data_type_classification_patterns/188_agenda.json b/pkg/classification/db/data_type_classification_patterns/188_agenda.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/188_agenda.json rename to pkg/classification/db/data_type_classification_patterns/188_agenda.json diff --git a/internal/classification/db/data_type_classification_patterns/189_contraception.json b/pkg/classification/db/data_type_classification_patterns/189_contraception.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/189_contraception.json rename to pkg/classification/db/data_type_classification_patterns/189_contraception.json diff --git a/internal/classification/db/data_type_classification_patterns/18_mothers_maiden_name.json b/pkg/classification/db/data_type_classification_patterns/18_mothers_maiden_name.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/18_mothers_maiden_name.json rename to pkg/classification/db/data_type_classification_patterns/18_mothers_maiden_name.json diff --git a/internal/classification/db/data_type_classification_patterns/190_physiotherapy.json b/pkg/classification/db/data_type_classification_patterns/190_physiotherapy.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/190_physiotherapy.json rename to pkg/classification/db/data_type_classification_patterns/190_physiotherapy.json diff --git a/internal/classification/db/data_type_classification_patterns/191_pregnancy.json b/pkg/classification/db/data_type_classification_patterns/191_pregnancy.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/191_pregnancy.json rename to pkg/classification/db/data_type_classification_patterns/191_pregnancy.json diff --git a/internal/classification/db/data_type_classification_patterns/192_message.json b/pkg/classification/db/data_type_classification_patterns/192_message.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/192_message.json rename to pkg/classification/db/data_type_classification_patterns/192_message.json diff --git a/internal/classification/db/data_type_classification_patterns/193_symptom.json b/pkg/classification/db/data_type_classification_patterns/193_symptom.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/193_symptom.json rename to pkg/classification/db/data_type_classification_patterns/193_symptom.json diff --git a/internal/classification/db/data_type_classification_patterns/194_signature.json b/pkg/classification/db/data_type_classification_patterns/194_signature.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/194_signature.json rename to pkg/classification/db/data_type_classification_patterns/194_signature.json diff --git a/internal/classification/db/data_type_classification_patterns/195_replies.json b/pkg/classification/db/data_type_classification_patterns/195_replies.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/195_replies.json rename to pkg/classification/db/data_type_classification_patterns/195_replies.json diff --git a/internal/classification/db/data_type_classification_patterns/196_post.json b/pkg/classification/db/data_type_classification_patterns/196_post.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/196_post.json rename to pkg/classification/db/data_type_classification_patterns/196_post.json diff --git a/internal/classification/db/data_type_classification_patterns/197_purchases.json b/pkg/classification/db/data_type_classification_patterns/197_purchases.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/197_purchases.json rename to pkg/classification/db/data_type_classification_patterns/197_purchases.json diff --git a/internal/classification/db/data_type_classification_patterns/198_comment.json b/pkg/classification/db/data_type_classification_patterns/198_comment.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/198_comment.json rename to pkg/classification/db/data_type_classification_patterns/198_comment.json diff --git a/internal/classification/db/data_type_classification_patterns/19_passport_number.json b/pkg/classification/db/data_type_classification_patterns/19_passport_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/19_passport_number.json rename to pkg/classification/db/data_type_classification_patterns/19_passport_number.json diff --git a/internal/classification/db/data_type_classification_patterns/1_email_address.json b/pkg/classification/db/data_type_classification_patterns/1_email_address.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/1_email_address.json rename to pkg/classification/db/data_type_classification_patterns/1_email_address.json diff --git a/internal/classification/db/data_type_classification_patterns/20_cars.json b/pkg/classification/db/data_type_classification_patterns/20_cars.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/20_cars.json rename to pkg/classification/db/data_type_classification_patterns/20_cars.json diff --git a/internal/classification/db/data_type_classification_patterns/21_national_identity_number.json b/pkg/classification/db/data_type_classification_patterns/21_national_identity_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/21_national_identity_number.json rename to pkg/classification/db/data_type_classification_patterns/21_national_identity_number.json diff --git a/internal/classification/db/data_type_classification_patterns/22_telephone_recordings.json b/pkg/classification/db/data_type_classification_patterns/22_telephone_recordings.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/22_telephone_recordings.json rename to pkg/classification/db/data_type_classification_patterns/22_telephone_recordings.json diff --git a/internal/classification/db/data_type_classification_patterns/23_voice_mail.json b/pkg/classification/db/data_type_classification_patterns/23_voice_mail.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/23_voice_mail.json rename to pkg/classification/db/data_type_classification_patterns/23_voice_mail.json diff --git a/internal/classification/db/data_type_classification_patterns/24_personal_health_history.json b/pkg/classification/db/data_type_classification_patterns/24_personal_health_history.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/24_personal_health_history.json rename to pkg/classification/db/data_type_classification_patterns/24_personal_health_history.json diff --git a/internal/classification/db/data_type_classification_patterns/25_family_health_history.json b/pkg/classification/db/data_type_classification_patterns/25_family_health_history.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/25_family_health_history.json rename to pkg/classification/db/data_type_classification_patterns/25_family_health_history.json diff --git a/internal/classification/db/data_type_classification_patterns/26_health_records.json b/pkg/classification/db/data_type_classification_patterns/26_health_records.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/26_health_records.json rename to pkg/classification/db/data_type_classification_patterns/26_health_records.json diff --git a/internal/classification/db/data_type_classification_patterns/27_disabilities.json b/pkg/classification/db/data_type_classification_patterns/27_disabilities.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/27_disabilities.json rename to pkg/classification/db/data_type_classification_patterns/27_disabilities.json diff --git a/internal/classification/db/data_type_classification_patterns/28_drugs_test_results.json b/pkg/classification/db/data_type_classification_patterns/28_drugs_test_results.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/28_drugs_test_results.json rename to pkg/classification/db/data_type_classification_patterns/28_drugs_test_results.json diff --git a/internal/classification/db/data_type_classification_patterns/29_blood_type.json b/pkg/classification/db/data_type_classification_patterns/29_blood_type.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/29_blood_type.json rename to pkg/classification/db/data_type_classification_patterns/29_blood_type.json diff --git a/internal/classification/db/data_type_classification_patterns/2_email_address.json b/pkg/classification/db/data_type_classification_patterns/2_email_address.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/2_email_address.json rename to pkg/classification/db/data_type_classification_patterns/2_email_address.json diff --git a/internal/classification/db/data_type_classification_patterns/30_dna_code.json b/pkg/classification/db/data_type_classification_patterns/30_dna_code.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/30_dna_code.json rename to pkg/classification/db/data_type_classification_patterns/30_dna_code.json diff --git a/internal/classification/db/data_type_classification_patterns/31_prescriptions.json b/pkg/classification/db/data_type_classification_patterns/31_prescriptions.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/31_prescriptions.json rename to pkg/classification/db/data_type_classification_patterns/31_prescriptions.json diff --git a/internal/classification/db/data_type_classification_patterns/32_place_of_birth.json b/pkg/classification/db/data_type_classification_patterns/32_place_of_birth.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/32_place_of_birth.json rename to pkg/classification/db/data_type_classification_patterns/32_place_of_birth.json diff --git a/internal/classification/db/data_type_classification_patterns/33_divorces.json b/pkg/classification/db/data_type_classification_patterns/33_divorces.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/33_divorces.json rename to pkg/classification/db/data_type_classification_patterns/33_divorces.json diff --git a/internal/classification/db/data_type_classification_patterns/34_marriages.json b/pkg/classification/db/data_type_classification_patterns/34_marriages.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/34_marriages.json rename to pkg/classification/db/data_type_classification_patterns/34_marriages.json diff --git a/internal/classification/db/data_type_classification_patterns/35_friends.json b/pkg/classification/db/data_type_classification_patterns/35_friends.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/35_friends.json rename to pkg/classification/db/data_type_classification_patterns/35_friends.json diff --git a/internal/classification/db/data_type_classification_patterns/36_martial_status.json b/pkg/classification/db/data_type_classification_patterns/36_martial_status.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/36_martial_status.json rename to pkg/classification/db/data_type_classification_patterns/36_martial_status.json diff --git a/internal/classification/db/data_type_classification_patterns/37_social_status.json b/pkg/classification/db/data_type_classification_patterns/37_social_status.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/37_social_status.json rename to pkg/classification/db/data_type_classification_patterns/37_social_status.json diff --git a/internal/classification/db/data_type_classification_patterns/38_student_number.json b/pkg/classification/db/data_type_classification_patterns/38_student_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/38_student_number.json rename to pkg/classification/db/data_type_classification_patterns/38_student_number.json diff --git a/internal/classification/db/data_type_classification_patterns/39_taxpayer_number.json b/pkg/classification/db/data_type_classification_patterns/39_taxpayer_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/39_taxpayer_number.json rename to pkg/classification/db/data_type_classification_patterns/39_taxpayer_number.json diff --git a/internal/classification/db/data_type_classification_patterns/3_age_range.json b/pkg/classification/db/data_type_classification_patterns/3_age_range.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/3_age_range.json rename to pkg/classification/db/data_type_classification_patterns/3_age_range.json diff --git a/internal/classification/db/data_type_classification_patterns/40_social_security_number.json b/pkg/classification/db/data_type_classification_patterns/40_social_security_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/40_social_security_number.json rename to pkg/classification/db/data_type_classification_patterns/40_social_security_number.json diff --git a/internal/classification/db/data_type_classification_patterns/41_sexual_preferences.json b/pkg/classification/db/data_type_classification_patterns/41_sexual_preferences.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/41_sexual_preferences.json rename to pkg/classification/db/data_type_classification_patterns/41_sexual_preferences.json diff --git a/internal/classification/db/data_type_classification_patterns/42_sexual_history.json b/pkg/classification/db/data_type_classification_patterns/42_sexual_history.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/42_sexual_history.json rename to pkg/classification/db/data_type_classification_patterns/42_sexual_history.json diff --git a/internal/classification/db/data_type_classification_patterns/43_disciplinary_actions.json b/pkg/classification/db/data_type_classification_patterns/43_disciplinary_actions.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/43_disciplinary_actions.json rename to pkg/classification/db/data_type_classification_patterns/43_disciplinary_actions.json diff --git a/internal/classification/db/data_type_classification_patterns/44_interviews.json b/pkg/classification/db/data_type_classification_patterns/44_interviews.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/44_interviews.json rename to pkg/classification/db/data_type_classification_patterns/44_interviews.json diff --git a/internal/classification/db/data_type_classification_patterns/45_job_titles.json b/pkg/classification/db/data_type_classification_patterns/45_job_titles.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/45_job_titles.json rename to pkg/classification/db/data_type_classification_patterns/45_job_titles.json diff --git a/internal/classification/db/data_type_classification_patterns/46_work_history.json b/pkg/classification/db/data_type_classification_patterns/46_work_history.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/46_work_history.json rename to pkg/classification/db/data_type_classification_patterns/46_work_history.json diff --git a/internal/classification/db/data_type_classification_patterns/47_employment_history.json b/pkg/classification/db/data_type_classification_patterns/47_employment_history.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/47_employment_history.json rename to pkg/classification/db/data_type_classification_patterns/47_employment_history.json diff --git a/internal/classification/db/data_type_classification_patterns/48_salary.json b/pkg/classification/db/data_type_classification_patterns/48_salary.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/48_salary.json rename to pkg/classification/db/data_type_classification_patterns/48_salary.json diff --git a/internal/classification/db/data_type_classification_patterns/49_certifications.json b/pkg/classification/db/data_type_classification_patterns/49_certifications.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/49_certifications.json rename to pkg/classification/db/data_type_classification_patterns/49_certifications.json diff --git a/internal/classification/db/data_type_classification_patterns/4_physical_address.json b/pkg/classification/db/data_type_classification_patterns/4_physical_address.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/4_physical_address.json rename to pkg/classification/db/data_type_classification_patterns/4_physical_address.json diff --git a/internal/classification/db/data_type_classification_patterns/50_group_membership.json b/pkg/classification/db/data_type_classification_patterns/50_group_membership.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/50_group_membership.json rename to pkg/classification/db/data_type_classification_patterns/50_group_membership.json diff --git a/internal/classification/db/data_type_classification_patterns/51_acquaintances.json b/pkg/classification/db/data_type_classification_patterns/51_acquaintances.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/51_acquaintances.json rename to pkg/classification/db/data_type_classification_patterns/51_acquaintances.json diff --git a/internal/classification/db/data_type_classification_patterns/52_opinion.json b/pkg/classification/db/data_type_classification_patterns/52_opinion.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/52_opinion.json rename to pkg/classification/db/data_type_classification_patterns/52_opinion.json diff --git a/internal/classification/db/data_type_classification_patterns/53_favorite_foods.json b/pkg/classification/db/data_type_classification_patterns/53_favorite_foods.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/53_favorite_foods.json rename to pkg/classification/db/data_type_classification_patterns/53_favorite_foods.json diff --git a/internal/classification/db/data_type_classification_patterns/54_religious_beliefs.json b/pkg/classification/db/data_type_classification_patterns/54_religious_beliefs.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/54_religious_beliefs.json rename to pkg/classification/db/data_type_classification_patterns/54_religious_beliefs.json diff --git a/internal/classification/db/data_type_classification_patterns/55_philosophical_beliefs.json b/pkg/classification/db/data_type_classification_patterns/55_philosophical_beliefs.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/55_philosophical_beliefs.json rename to pkg/classification/db/data_type_classification_patterns/55_philosophical_beliefs.json diff --git a/internal/classification/db/data_type_classification_patterns/56_vehicle_registration_number.json b/pkg/classification/db/data_type_classification_patterns/56_vehicle_registration_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/56_vehicle_registration_number.json rename to pkg/classification/db/data_type_classification_patterns/56_vehicle_registration_number.json diff --git a/internal/classification/db/data_type_classification_patterns/57_browsing_behavior.json b/pkg/classification/db/data_type_classification_patterns/57_browsing_behavior.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/57_browsing_behavior.json rename to pkg/classification/db/data_type_classification_patterns/57_browsing_behavior.json diff --git a/internal/classification/db/data_type_classification_patterns/58_call_logs.json b/pkg/classification/db/data_type_classification_patterns/58_call_logs.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/58_call_logs.json rename to pkg/classification/db/data_type_classification_patterns/58_call_logs.json diff --git a/internal/classification/db/data_type_classification_patterns/59_links_clicked.json b/pkg/classification/db/data_type_classification_patterns/59_links_clicked.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/59_links_clicked.json rename to pkg/classification/db/data_type_classification_patterns/59_links_clicked.json diff --git a/internal/classification/db/data_type_classification_patterns/5_country.json b/pkg/classification/db/data_type_classification_patterns/5_country.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/5_country.json rename to pkg/classification/db/data_type_classification_patterns/5_country.json diff --git a/internal/classification/db/data_type_classification_patterns/60_date_of_birth.json b/pkg/classification/db/data_type_classification_patterns/60_date_of_birth.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/60_date_of_birth.json rename to pkg/classification/db/data_type_classification_patterns/60_date_of_birth.json diff --git a/internal/classification/db/data_type_classification_patterns/61_date_of_birth.json b/pkg/classification/db/data_type_classification_patterns/61_date_of_birth.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/61_date_of_birth.json rename to pkg/classification/db/data_type_classification_patterns/61_date_of_birth.json diff --git a/internal/classification/db/data_type_classification_patterns/62_spoken_languages.json b/pkg/classification/db/data_type_classification_patterns/62_spoken_languages.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/62_spoken_languages.json rename to pkg/classification/db/data_type_classification_patterns/62_spoken_languages.json diff --git a/internal/classification/db/data_type_classification_patterns/63_spoken_languages.json b/pkg/classification/db/data_type_classification_patterns/63_spoken_languages.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/63_spoken_languages.json rename to pkg/classification/db/data_type_classification_patterns/63_spoken_languages.json diff --git a/internal/classification/db/data_type_classification_patterns/64_accents.json b/pkg/classification/db/data_type_classification_patterns/64_accents.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/64_accents.json rename to pkg/classification/db/data_type_classification_patterns/64_accents.json diff --git a/internal/classification/db/data_type_classification_patterns/65_race.json b/pkg/classification/db/data_type_classification_patterns/65_race.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/65_race.json rename to pkg/classification/db/data_type_classification_patterns/65_race.json diff --git a/internal/classification/db/data_type_classification_patterns/66_credit.json b/pkg/classification/db/data_type_classification_patterns/66_credit.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/66_credit.json rename to pkg/classification/db/data_type_classification_patterns/66_credit.json diff --git a/internal/classification/db/data_type_classification_patterns/67_loan_records.json b/pkg/classification/db/data_type_classification_patterns/67_loan_records.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/67_loan_records.json rename to pkg/classification/db/data_type_classification_patterns/67_loan_records.json diff --git a/internal/classification/db/data_type_classification_patterns/68_gender_identity.json b/pkg/classification/db/data_type_classification_patterns/68_gender_identity.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/68_gender_identity.json rename to pkg/classification/db/data_type_classification_patterns/68_gender_identity.json diff --git a/internal/classification/db/data_type_classification_patterns/69_gender.json b/pkg/classification/db/data_type_classification_patterns/69_gender.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/69_gender.json rename to pkg/classification/db/data_type_classification_patterns/69_gender.json diff --git a/internal/classification/db/data_type_classification_patterns/6_credit_card_number.json b/pkg/classification/db/data_type_classification_patterns/6_credit_card_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/6_credit_card_number.json rename to pkg/classification/db/data_type_classification_patterns/6_credit_card_number.json diff --git a/internal/classification/db/data_type_classification_patterns/70_political_affiliation.json b/pkg/classification/db/data_type_classification_patterns/70_political_affiliation.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/70_political_affiliation.json rename to pkg/classification/db/data_type_classification_patterns/70_political_affiliation.json diff --git a/internal/classification/db/data_type_classification_patterns/71_religion.json b/pkg/classification/db/data_type_classification_patterns/71_religion.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/71_religion.json rename to pkg/classification/db/data_type_classification_patterns/71_religion.json diff --git a/internal/classification/db/data_type_classification_patterns/72_interactions.json b/pkg/classification/db/data_type_classification_patterns/72_interactions.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/72_interactions.json rename to pkg/classification/db/data_type_classification_patterns/72_interactions.json diff --git a/internal/classification/db/data_type_classification_patterns/73_general_reputation.json b/pkg/classification/db/data_type_classification_patterns/73_general_reputation.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/73_general_reputation.json rename to pkg/classification/db/data_type_classification_patterns/73_general_reputation.json diff --git a/internal/classification/db/data_type_classification_patterns/74_intentions.json b/pkg/classification/db/data_type_classification_patterns/74_intentions.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/74_intentions.json rename to pkg/classification/db/data_type_classification_patterns/74_intentions.json diff --git a/internal/classification/db/data_type_classification_patterns/75_interests.json b/pkg/classification/db/data_type_classification_patterns/75_interests.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/75_interests.json rename to pkg/classification/db/data_type_classification_patterns/75_interests.json diff --git a/internal/classification/db/data_type_classification_patterns/76_likes.json b/pkg/classification/db/data_type_classification_patterns/76_likes.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/76_likes.json rename to pkg/classification/db/data_type_classification_patterns/76_likes.json diff --git a/internal/classification/db/data_type_classification_patterns/77_dislikes.json b/pkg/classification/db/data_type_classification_patterns/77_dislikes.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/77_dislikes.json rename to pkg/classification/db/data_type_classification_patterns/77_dislikes.json diff --git a/internal/classification/db/data_type_classification_patterns/78_attitude.json b/pkg/classification/db/data_type_classification_patterns/78_attitude.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/78_attitude.json rename to pkg/classification/db/data_type_classification_patterns/78_attitude.json diff --git a/internal/classification/db/data_type_classification_patterns/79_physical_address.json b/pkg/classification/db/data_type_classification_patterns/79_physical_address.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/79_physical_address.json rename to pkg/classification/db/data_type_classification_patterns/79_physical_address.json diff --git a/internal/classification/db/data_type_classification_patterns/7_credit_records.json b/pkg/classification/db/data_type_classification_patterns/7_credit_records.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/7_credit_records.json rename to pkg/classification/db/data_type_classification_patterns/7_credit_records.json diff --git a/internal/classification/db/data_type_classification_patterns/80_id_number.json b/pkg/classification/db/data_type_classification_patterns/80_id_number.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/80_id_number.json rename to pkg/classification/db/data_type_classification_patterns/80_id_number.json diff --git a/internal/classification/db/data_type_classification_patterns/82_ip_address.json b/pkg/classification/db/data_type_classification_patterns/82_ip_address.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/82_ip_address.json rename to pkg/classification/db/data_type_classification_patterns/82_ip_address.json diff --git a/internal/classification/db/data_type_classification_patterns/83_mac_address.json b/pkg/classification/db/data_type_classification_patterns/83_mac_address.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/83_mac_address.json rename to pkg/classification/db/data_type_classification_patterns/83_mac_address.json diff --git a/internal/classification/db/data_type_classification_patterns/84_mac_address.json b/pkg/classification/db/data_type_classification_patterns/84_mac_address.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/84_mac_address.json rename to pkg/classification/db/data_type_classification_patterns/84_mac_address.json diff --git a/internal/classification/db/data_type_classification_patterns/85_firstname.json b/pkg/classification/db/data_type_classification_patterns/85_firstname.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/85_firstname.json rename to pkg/classification/db/data_type_classification_patterns/85_firstname.json diff --git a/internal/classification/db/data_type_classification_patterns/86_firstname.json b/pkg/classification/db/data_type_classification_patterns/86_firstname.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/86_firstname.json rename to pkg/classification/db/data_type_classification_patterns/86_firstname.json diff --git a/internal/classification/db/data_type_classification_patterns/87_lastname.json b/pkg/classification/db/data_type_classification_patterns/87_lastname.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/87_lastname.json rename to pkg/classification/db/data_type_classification_patterns/87_lastname.json diff --git a/internal/classification/db/data_type_classification_patterns/88_lastname.json b/pkg/classification/db/data_type_classification_patterns/88_lastname.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/88_lastname.json rename to pkg/classification/db/data_type_classification_patterns/88_lastname.json diff --git a/internal/classification/db/data_type_classification_patterns/8_credit_capacity.json b/pkg/classification/db/data_type_classification_patterns/8_credit_capacity.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/8_credit_capacity.json rename to pkg/classification/db/data_type_classification_patterns/8_credit_capacity.json diff --git a/internal/classification/db/data_type_classification_patterns/90_fullname.json b/pkg/classification/db/data_type_classification_patterns/90_fullname.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/90_fullname.json rename to pkg/classification/db/data_type_classification_patterns/90_fullname.json diff --git a/internal/classification/db/data_type_classification_patterns/91_username.json b/pkg/classification/db/data_type_classification_patterns/91_username.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/91_username.json rename to pkg/classification/db/data_type_classification_patterns/91_username.json diff --git a/internal/classification/db/data_type_classification_patterns/92_physical_and_mental_health.json b/pkg/classification/db/data_type_classification_patterns/92_physical_and_mental_health.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/92_physical_and_mental_health.json rename to pkg/classification/db/data_type_classification_patterns/92_physical_and_mental_health.json diff --git a/internal/classification/db/data_type_classification_patterns/93_physical_and_mental_health.json b/pkg/classification/db/data_type_classification_patterns/93_physical_and_mental_health.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/93_physical_and_mental_health.json rename to pkg/classification/db/data_type_classification_patterns/93_physical_and_mental_health.json diff --git a/internal/classification/db/data_type_classification_patterns/94_family_structure.json b/pkg/classification/db/data_type_classification_patterns/94_family_structure.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/94_family_structure.json rename to pkg/classification/db/data_type_classification_patterns/94_family_structure.json diff --git a/internal/classification/db/data_type_classification_patterns/95_siblings.json b/pkg/classification/db/data_type_classification_patterns/95_siblings.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/95_siblings.json rename to pkg/classification/db/data_type_classification_patterns/95_siblings.json diff --git a/internal/classification/db/data_type_classification_patterns/96_image.json b/pkg/classification/db/data_type_classification_patterns/96_image.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/96_image.json rename to pkg/classification/db/data_type_classification_patterns/96_image.json diff --git a/internal/classification/db/data_type_classification_patterns/97_income_brackets.json b/pkg/classification/db/data_type_classification_patterns/97_income_brackets.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/97_income_brackets.json rename to pkg/classification/db/data_type_classification_patterns/97_income_brackets.json diff --git a/internal/classification/db/data_type_classification_patterns/98_purchases_and_spending_habits.json b/pkg/classification/db/data_type_classification_patterns/98_purchases_and_spending_habits.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/98_purchases_and_spending_habits.json rename to pkg/classification/db/data_type_classification_patterns/98_purchases_and_spending_habits.json diff --git a/internal/classification/db/data_type_classification_patterns/99_passwords.json b/pkg/classification/db/data_type_classification_patterns/99_passwords.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/99_passwords.json rename to pkg/classification/db/data_type_classification_patterns/99_passwords.json diff --git a/internal/classification/db/data_type_classification_patterns/9_convictions.json b/pkg/classification/db/data_type_classification_patterns/9_convictions.json similarity index 100% rename from internal/classification/db/data_type_classification_patterns/9_convictions.json rename to pkg/classification/db/data_type_classification_patterns/9_convictions.json diff --git a/internal/classification/db/data_types/accents.json b/pkg/classification/db/data_types/accents.json similarity index 100% rename from internal/classification/db/data_types/accents.json rename to pkg/classification/db/data_types/accents.json diff --git a/internal/classification/db/data_types/acquaintances.json b/pkg/classification/db/data_types/acquaintances.json similarity index 100% rename from internal/classification/db/data_types/acquaintances.json rename to pkg/classification/db/data_types/acquaintances.json diff --git a/internal/classification/db/data_types/age.json b/pkg/classification/db/data_types/age.json similarity index 100% rename from internal/classification/db/data_types/age.json rename to pkg/classification/db/data_types/age.json diff --git a/internal/classification/db/data_types/age_range.json b/pkg/classification/db/data_types/age_range.json similarity index 100% rename from internal/classification/db/data_types/age_range.json rename to pkg/classification/db/data_types/age_range.json diff --git a/internal/classification/db/data_types/apartments.json b/pkg/classification/db/data_types/apartments.json similarity index 100% rename from internal/classification/db/data_types/apartments.json rename to pkg/classification/db/data_types/apartments.json diff --git a/internal/classification/db/data_types/associations.json b/pkg/classification/db/data_types/associations.json similarity index 100% rename from internal/classification/db/data_types/associations.json rename to pkg/classification/db/data_types/associations.json diff --git a/internal/classification/db/data_types/attitude.json b/pkg/classification/db/data_types/attitude.json similarity index 100% rename from internal/classification/db/data_types/attitude.json rename to pkg/classification/db/data_types/attitude.json diff --git a/internal/classification/db/data_types/bank_account.json b/pkg/classification/db/data_types/bank_account.json similarity index 100% rename from internal/classification/db/data_types/bank_account.json rename to pkg/classification/db/data_types/bank_account.json diff --git a/internal/classification/db/data_types/biometric_data.json b/pkg/classification/db/data_types/biometric_data.json similarity index 100% rename from internal/classification/db/data_types/biometric_data.json rename to pkg/classification/db/data_types/biometric_data.json diff --git a/internal/classification/db/data_types/blood_type.json b/pkg/classification/db/data_types/blood_type.json similarity index 100% rename from internal/classification/db/data_types/blood_type.json rename to pkg/classification/db/data_types/blood_type.json diff --git a/internal/classification/db/data_types/browser_fingerprint.json b/pkg/classification/db/data_types/browser_fingerprint.json similarity index 100% rename from internal/classification/db/data_types/browser_fingerprint.json rename to pkg/classification/db/data_types/browser_fingerprint.json diff --git a/internal/classification/db/data_types/browsing_behavior.json b/pkg/classification/db/data_types/browsing_behavior.json similarity index 100% rename from internal/classification/db/data_types/browsing_behavior.json rename to pkg/classification/db/data_types/browsing_behavior.json diff --git a/internal/classification/db/data_types/call_logs.json b/pkg/classification/db/data_types/call_logs.json similarity index 100% rename from internal/classification/db/data_types/call_logs.json rename to pkg/classification/db/data_types/call_logs.json diff --git a/internal/classification/db/data_types/cars.json b/pkg/classification/db/data_types/cars.json similarity index 100% rename from internal/classification/db/data_types/cars.json rename to pkg/classification/db/data_types/cars.json diff --git a/internal/classification/db/data_types/certifications.json b/pkg/classification/db/data_types/certifications.json similarity index 100% rename from internal/classification/db/data_types/certifications.json rename to pkg/classification/db/data_types/certifications.json diff --git a/internal/classification/db/data_types/character.json b/pkg/classification/db/data_types/character.json similarity index 100% rename from internal/classification/db/data_types/character.json rename to pkg/classification/db/data_types/character.json diff --git a/internal/classification/db/data_types/charges.json b/pkg/classification/db/data_types/charges.json similarity index 100% rename from internal/classification/db/data_types/charges.json rename to pkg/classification/db/data_types/charges.json diff --git a/internal/classification/db/data_types/colors.json b/pkg/classification/db/data_types/colors.json similarity index 100% rename from internal/classification/db/data_types/colors.json rename to pkg/classification/db/data_types/colors.json diff --git a/internal/classification/db/data_types/connections.json b/pkg/classification/db/data_types/connections.json similarity index 100% rename from internal/classification/db/data_types/connections.json rename to pkg/classification/db/data_types/connections.json diff --git a/internal/classification/db/data_types/convictions.json b/pkg/classification/db/data_types/convictions.json similarity index 100% rename from internal/classification/db/data_types/convictions.json rename to pkg/classification/db/data_types/convictions.json diff --git a/internal/classification/db/data_types/country.json b/pkg/classification/db/data_types/country.json similarity index 100% rename from internal/classification/db/data_types/country.json rename to pkg/classification/db/data_types/country.json diff --git a/internal/classification/db/data_types/credit.json b/pkg/classification/db/data_types/credit.json similarity index 100% rename from internal/classification/db/data_types/credit.json rename to pkg/classification/db/data_types/credit.json diff --git a/internal/classification/db/data_types/credit_capacity.json b/pkg/classification/db/data_types/credit_capacity.json similarity index 100% rename from internal/classification/db/data_types/credit_capacity.json rename to pkg/classification/db/data_types/credit_capacity.json diff --git a/internal/classification/db/data_types/credit_card_number.json b/pkg/classification/db/data_types/credit_card_number.json similarity index 100% rename from internal/classification/db/data_types/credit_card_number.json rename to pkg/classification/db/data_types/credit_card_number.json diff --git a/internal/classification/db/data_types/credit_records.json b/pkg/classification/db/data_types/credit_records.json similarity index 100% rename from internal/classification/db/data_types/credit_records.json rename to pkg/classification/db/data_types/credit_records.json diff --git a/internal/classification/db/data_types/credit_standing.json b/pkg/classification/db/data_types/credit_standing.json similarity index 100% rename from internal/classification/db/data_types/credit_standing.json rename to pkg/classification/db/data_types/credit_standing.json diff --git a/internal/classification/db/data_types/credit_worthiness.json b/pkg/classification/db/data_types/credit_worthiness.json similarity index 100% rename from internal/classification/db/data_types/credit_worthiness.json rename to pkg/classification/db/data_types/credit_worthiness.json diff --git a/internal/classification/db/data_types/date_of_birth.json b/pkg/classification/db/data_types/date_of_birth.json similarity index 100% rename from internal/classification/db/data_types/date_of_birth.json rename to pkg/classification/db/data_types/date_of_birth.json diff --git a/internal/classification/db/data_types/demeanor.json b/pkg/classification/db/data_types/demeanor.json similarity index 100% rename from internal/classification/db/data_types/demeanor.json rename to pkg/classification/db/data_types/demeanor.json diff --git a/internal/classification/db/data_types/device_identifier.json b/pkg/classification/db/data_types/device_identifier.json similarity index 100% rename from internal/classification/db/data_types/device_identifier.json rename to pkg/classification/db/data_types/device_identifier.json diff --git a/internal/classification/db/data_types/disabilities.json b/pkg/classification/db/data_types/disabilities.json similarity index 100% rename from internal/classification/db/data_types/disabilities.json rename to pkg/classification/db/data_types/disabilities.json diff --git a/internal/classification/db/data_types/disciplinary_actions.json b/pkg/classification/db/data_types/disciplinary_actions.json similarity index 100% rename from internal/classification/db/data_types/disciplinary_actions.json rename to pkg/classification/db/data_types/disciplinary_actions.json diff --git a/internal/classification/db/data_types/dislikes.json b/pkg/classification/db/data_types/dislikes.json similarity index 100% rename from internal/classification/db/data_types/dislikes.json rename to pkg/classification/db/data_types/dislikes.json diff --git a/internal/classification/db/data_types/divorces.json b/pkg/classification/db/data_types/divorces.json similarity index 100% rename from internal/classification/db/data_types/divorces.json rename to pkg/classification/db/data_types/divorces.json diff --git a/internal/classification/db/data_types/dna_code.json b/pkg/classification/db/data_types/dna_code.json similarity index 100% rename from internal/classification/db/data_types/dna_code.json rename to pkg/classification/db/data_types/dna_code.json diff --git a/internal/classification/db/data_types/drugs_test_results.json b/pkg/classification/db/data_types/drugs_test_results.json similarity index 100% rename from internal/classification/db/data_types/drugs_test_results.json rename to pkg/classification/db/data_types/drugs_test_results.json diff --git a/internal/classification/db/data_types/email_address.json b/pkg/classification/db/data_types/email_address.json similarity index 100% rename from internal/classification/db/data_types/email_address.json rename to pkg/classification/db/data_types/email_address.json diff --git a/internal/classification/db/data_types/emails.json b/pkg/classification/db/data_types/emails.json similarity index 100% rename from internal/classification/db/data_types/emails.json rename to pkg/classification/db/data_types/emails.json diff --git a/internal/classification/db/data_types/employee_files.json b/pkg/classification/db/data_types/employee_files.json similarity index 100% rename from internal/classification/db/data_types/employee_files.json rename to pkg/classification/db/data_types/employee_files.json diff --git a/internal/classification/db/data_types/employment_history.json b/pkg/classification/db/data_types/employment_history.json similarity index 100% rename from internal/classification/db/data_types/employment_history.json rename to pkg/classification/db/data_types/employment_history.json diff --git a/internal/classification/db/data_types/ethnic_origin.json b/pkg/classification/db/data_types/ethnic_origin.json similarity index 100% rename from internal/classification/db/data_types/ethnic_origin.json rename to pkg/classification/db/data_types/ethnic_origin.json diff --git a/internal/classification/db/data_types/evaluations.json b/pkg/classification/db/data_types/evaluations.json similarity index 100% rename from internal/classification/db/data_types/evaluations.json rename to pkg/classification/db/data_types/evaluations.json diff --git a/internal/classification/db/data_types/family_health_history.json b/pkg/classification/db/data_types/family_health_history.json similarity index 100% rename from internal/classification/db/data_types/family_health_history.json rename to pkg/classification/db/data_types/family_health_history.json diff --git a/internal/classification/db/data_types/family_structure.json b/pkg/classification/db/data_types/family_structure.json similarity index 100% rename from internal/classification/db/data_types/family_structure.json rename to pkg/classification/db/data_types/family_structure.json diff --git a/internal/classification/db/data_types/favorite_foods.json b/pkg/classification/db/data_types/favorite_foods.json similarity index 100% rename from internal/classification/db/data_types/favorite_foods.json rename to pkg/classification/db/data_types/favorite_foods.json diff --git a/internal/classification/db/data_types/firstname.json b/pkg/classification/db/data_types/firstname.json similarity index 100% rename from internal/classification/db/data_types/firstname.json rename to pkg/classification/db/data_types/firstname.json diff --git a/internal/classification/db/data_types/friends.json b/pkg/classification/db/data_types/friends.json similarity index 100% rename from internal/classification/db/data_types/friends.json rename to pkg/classification/db/data_types/friends.json diff --git a/internal/classification/db/data_types/fullname.json b/pkg/classification/db/data_types/fullname.json similarity index 100% rename from internal/classification/db/data_types/fullname.json rename to pkg/classification/db/data_types/fullname.json diff --git a/internal/classification/db/data_types/gender.json b/pkg/classification/db/data_types/gender.json similarity index 100% rename from internal/classification/db/data_types/gender.json rename to pkg/classification/db/data_types/gender.json diff --git a/internal/classification/db/data_types/gender_identity.json b/pkg/classification/db/data_types/gender_identity.json similarity index 100% rename from internal/classification/db/data_types/gender_identity.json rename to pkg/classification/db/data_types/gender_identity.json diff --git a/internal/classification/db/data_types/general_reputation.json b/pkg/classification/db/data_types/general_reputation.json similarity index 100% rename from internal/classification/db/data_types/general_reputation.json rename to pkg/classification/db/data_types/general_reputation.json diff --git a/internal/classification/db/data_types/geographic.json b/pkg/classification/db/data_types/geographic.json similarity index 100% rename from internal/classification/db/data_types/geographic.json rename to pkg/classification/db/data_types/geographic.json diff --git a/internal/classification/db/data_types/gps_coordinate.json b/pkg/classification/db/data_types/gps_coordinate.json similarity index 100% rename from internal/classification/db/data_types/gps_coordinate.json rename to pkg/classification/db/data_types/gps_coordinate.json diff --git a/internal/classification/db/data_types/group_membership.json b/pkg/classification/db/data_types/group_membership.json similarity index 100% rename from internal/classification/db/data_types/group_membership.json rename to pkg/classification/db/data_types/group_membership.json diff --git a/internal/classification/db/data_types/hair_color.json b/pkg/classification/db/data_types/hair_color.json similarity index 100% rename from internal/classification/db/data_types/hair_color.json rename to pkg/classification/db/data_types/hair_color.json diff --git a/internal/classification/db/data_types/health_records.json b/pkg/classification/db/data_types/health_records.json similarity index 100% rename from internal/classification/db/data_types/health_records.json rename to pkg/classification/db/data_types/health_records.json diff --git a/internal/classification/db/data_types/height.json b/pkg/classification/db/data_types/height.json similarity index 100% rename from internal/classification/db/data_types/height.json rename to pkg/classification/db/data_types/height.json diff --git a/internal/classification/db/data_types/houses.json b/pkg/classification/db/data_types/houses.json similarity index 100% rename from internal/classification/db/data_types/houses.json rename to pkg/classification/db/data_types/houses.json diff --git a/internal/classification/db/data_types/id_number.json b/pkg/classification/db/data_types/id_number.json similarity index 100% rename from internal/classification/db/data_types/id_number.json rename to pkg/classification/db/data_types/id_number.json diff --git a/internal/classification/db/data_types/image.json b/pkg/classification/db/data_types/image.json similarity index 100% rename from internal/classification/db/data_types/image.json rename to pkg/classification/db/data_types/image.json diff --git a/internal/classification/db/data_types/income.json b/pkg/classification/db/data_types/income.json similarity index 100% rename from internal/classification/db/data_types/income.json rename to pkg/classification/db/data_types/income.json diff --git a/internal/classification/db/data_types/income_brackets.json b/pkg/classification/db/data_types/income_brackets.json similarity index 100% rename from internal/classification/db/data_types/income_brackets.json rename to pkg/classification/db/data_types/income_brackets.json diff --git a/internal/classification/db/data_types/intentions.json b/pkg/classification/db/data_types/intentions.json similarity index 100% rename from internal/classification/db/data_types/intentions.json rename to pkg/classification/db/data_types/intentions.json diff --git a/internal/classification/db/data_types/interactions.json b/pkg/classification/db/data_types/interactions.json similarity index 100% rename from internal/classification/db/data_types/interactions.json rename to pkg/classification/db/data_types/interactions.json diff --git a/internal/classification/db/data_types/interests.json b/pkg/classification/db/data_types/interests.json similarity index 100% rename from internal/classification/db/data_types/interests.json rename to pkg/classification/db/data_types/interests.json diff --git a/internal/classification/db/data_types/interviews.json b/pkg/classification/db/data_types/interviews.json similarity index 100% rename from internal/classification/db/data_types/interviews.json rename to pkg/classification/db/data_types/interviews.json diff --git a/internal/classification/db/data_types/ip_address.json b/pkg/classification/db/data_types/ip_address.json similarity index 100% rename from internal/classification/db/data_types/ip_address.json rename to pkg/classification/db/data_types/ip_address.json diff --git a/internal/classification/db/data_types/job_titles.json b/pkg/classification/db/data_types/job_titles.json similarity index 100% rename from internal/classification/db/data_types/job_titles.json rename to pkg/classification/db/data_types/job_titles.json diff --git a/internal/classification/db/data_types/knowledge.json b/pkg/classification/db/data_types/knowledge.json similarity index 100% rename from internal/classification/db/data_types/knowledge.json rename to pkg/classification/db/data_types/knowledge.json diff --git a/internal/classification/db/data_types/lastname.json b/pkg/classification/db/data_types/lastname.json similarity index 100% rename from internal/classification/db/data_types/lastname.json rename to pkg/classification/db/data_types/lastname.json diff --git a/internal/classification/db/data_types/likes.json b/pkg/classification/db/data_types/likes.json similarity index 100% rename from internal/classification/db/data_types/likes.json rename to pkg/classification/db/data_types/likes.json diff --git a/internal/classification/db/data_types/links_clicked.json b/pkg/classification/db/data_types/links_clicked.json similarity index 100% rename from internal/classification/db/data_types/links_clicked.json rename to pkg/classification/db/data_types/links_clicked.json diff --git a/internal/classification/db/data_types/loan_records.json b/pkg/classification/db/data_types/loan_records.json similarity index 100% rename from internal/classification/db/data_types/loan_records.json rename to pkg/classification/db/data_types/loan_records.json diff --git a/internal/classification/db/data_types/mac_address.json b/pkg/classification/db/data_types/mac_address.json similarity index 100% rename from internal/classification/db/data_types/mac_address.json rename to pkg/classification/db/data_types/mac_address.json diff --git a/internal/classification/db/data_types/marriages.json b/pkg/classification/db/data_types/marriages.json similarity index 100% rename from internal/classification/db/data_types/marriages.json rename to pkg/classification/db/data_types/marriages.json diff --git a/internal/classification/db/data_types/martial_status.json b/pkg/classification/db/data_types/martial_status.json similarity index 100% rename from internal/classification/db/data_types/martial_status.json rename to pkg/classification/db/data_types/martial_status.json diff --git a/internal/classification/db/data_types/mother_maiden_name.json b/pkg/classification/db/data_types/mother_maiden_name.json similarity index 100% rename from internal/classification/db/data_types/mother_maiden_name.json rename to pkg/classification/db/data_types/mother_maiden_name.json diff --git a/internal/classification/db/data_types/music.json b/pkg/classification/db/data_types/music.json similarity index 100% rename from internal/classification/db/data_types/music.json rename to pkg/classification/db/data_types/music.json diff --git a/internal/classification/db/data_types/national_origin.json b/pkg/classification/db/data_types/national_origin.json similarity index 100% rename from internal/classification/db/data_types/national_origin.json rename to pkg/classification/db/data_types/national_origin.json diff --git a/internal/classification/db/data_types/offspring.json b/pkg/classification/db/data_types/offspring.json similarity index 100% rename from internal/classification/db/data_types/offspring.json rename to pkg/classification/db/data_types/offspring.json diff --git a/internal/classification/db/data_types/opinions.json b/pkg/classification/db/data_types/opinions.json similarity index 100% rename from internal/classification/db/data_types/opinions.json rename to pkg/classification/db/data_types/opinions.json diff --git a/internal/classification/db/data_types/pardons.json b/pkg/classification/db/data_types/pardons.json similarity index 100% rename from internal/classification/db/data_types/pardons.json rename to pkg/classification/db/data_types/pardons.json diff --git a/internal/classification/db/data_types/passport_number.json b/pkg/classification/db/data_types/passport_number.json similarity index 100% rename from internal/classification/db/data_types/passport_number.json rename to pkg/classification/db/data_types/passport_number.json diff --git a/internal/classification/db/data_types/passwords.json b/pkg/classification/db/data_types/passwords.json similarity index 100% rename from internal/classification/db/data_types/passwords.json rename to pkg/classification/db/data_types/passwords.json diff --git a/internal/classification/db/data_types/personal_health_history.json b/pkg/classification/db/data_types/personal_health_history.json similarity index 100% rename from internal/classification/db/data_types/personal_health_history.json rename to pkg/classification/db/data_types/personal_health_history.json diff --git a/internal/classification/db/data_types/personal_possessions.json b/pkg/classification/db/data_types/personal_possessions.json similarity index 100% rename from internal/classification/db/data_types/personal_possessions.json rename to pkg/classification/db/data_types/personal_possessions.json diff --git a/internal/classification/db/data_types/philosophical_beliefs.json b/pkg/classification/db/data_types/philosophical_beliefs.json similarity index 100% rename from internal/classification/db/data_types/philosophical_beliefs.json rename to pkg/classification/db/data_types/philosophical_beliefs.json diff --git a/internal/classification/db/data_types/physical_address.json b/pkg/classification/db/data_types/physical_address.json similarity index 100% rename from internal/classification/db/data_types/physical_address.json rename to pkg/classification/db/data_types/physical_address.json diff --git a/internal/classification/db/data_types/physical_and_mental_health.json b/pkg/classification/db/data_types/physical_and_mental_health.json similarity index 100% rename from internal/classification/db/data_types/physical_and_mental_health.json rename to pkg/classification/db/data_types/physical_and_mental_health.json diff --git a/internal/classification/db/data_types/physical_traits.json b/pkg/classification/db/data_types/physical_traits.json similarity index 100% rename from internal/classification/db/data_types/physical_traits.json rename to pkg/classification/db/data_types/physical_traits.json diff --git a/internal/classification/db/data_types/piercings.json b/pkg/classification/db/data_types/piercings.json similarity index 100% rename from internal/classification/db/data_types/piercings.json rename to pkg/classification/db/data_types/piercings.json diff --git a/internal/classification/db/data_types/pin.json b/pkg/classification/db/data_types/pin.json similarity index 100% rename from internal/classification/db/data_types/pin.json rename to pkg/classification/db/data_types/pin.json diff --git a/internal/classification/db/data_types/political_affiliation.json b/pkg/classification/db/data_types/political_affiliation.json similarity index 100% rename from internal/classification/db/data_types/political_affiliation.json rename to pkg/classification/db/data_types/political_affiliation.json diff --git a/internal/classification/db/data_types/prescriptions.json b/pkg/classification/db/data_types/prescriptions.json similarity index 100% rename from internal/classification/db/data_types/prescriptions.json rename to pkg/classification/db/data_types/prescriptions.json diff --git a/internal/classification/db/data_types/purchases.json b/pkg/classification/db/data_types/purchases.json similarity index 100% rename from internal/classification/db/data_types/purchases.json rename to pkg/classification/db/data_types/purchases.json diff --git a/internal/classification/db/data_types/purchases_and_spending_habits.json b/pkg/classification/db/data_types/purchases_and_spending_habits.json similarity index 100% rename from internal/classification/db/data_types/purchases_and_spending_habits.json rename to pkg/classification/db/data_types/purchases_and_spending_habits.json diff --git a/internal/classification/db/data_types/race.json b/pkg/classification/db/data_types/race.json similarity index 100% rename from internal/classification/db/data_types/race.json rename to pkg/classification/db/data_types/race.json diff --git a/internal/classification/db/data_types/references.json b/pkg/classification/db/data_types/references.json similarity index 100% rename from internal/classification/db/data_types/references.json rename to pkg/classification/db/data_types/references.json diff --git a/internal/classification/db/data_types/relationships.json b/pkg/classification/db/data_types/relationships.json similarity index 100% rename from internal/classification/db/data_types/relationships.json rename to pkg/classification/db/data_types/relationships.json diff --git a/internal/classification/db/data_types/religion.json b/pkg/classification/db/data_types/religion.json similarity index 100% rename from internal/classification/db/data_types/religion.json rename to pkg/classification/db/data_types/religion.json diff --git a/internal/classification/db/data_types/religious_beliefs.json b/pkg/classification/db/data_types/religious_beliefs.json similarity index 100% rename from internal/classification/db/data_types/religious_beliefs.json rename to pkg/classification/db/data_types/religious_beliefs.json diff --git a/internal/classification/db/data_types/room_number.json b/pkg/classification/db/data_types/room_number.json similarity index 100% rename from internal/classification/db/data_types/room_number.json rename to pkg/classification/db/data_types/room_number.json diff --git a/internal/classification/db/data_types/salary.json b/pkg/classification/db/data_types/salary.json similarity index 100% rename from internal/classification/db/data_types/salary.json rename to pkg/classification/db/data_types/salary.json diff --git a/internal/classification/db/data_types/sales.json b/pkg/classification/db/data_types/sales.json similarity index 100% rename from internal/classification/db/data_types/sales.json rename to pkg/classification/db/data_types/sales.json diff --git a/internal/classification/db/data_types/school_attended.json b/pkg/classification/db/data_types/school_attended.json similarity index 100% rename from internal/classification/db/data_types/school_attended.json rename to pkg/classification/db/data_types/school_attended.json diff --git a/internal/classification/db/data_types/sexual_history.json b/pkg/classification/db/data_types/sexual_history.json similarity index 100% rename from internal/classification/db/data_types/sexual_history.json rename to pkg/classification/db/data_types/sexual_history.json diff --git a/internal/classification/db/data_types/sexual_preferences.json b/pkg/classification/db/data_types/sexual_preferences.json similarity index 100% rename from internal/classification/db/data_types/sexual_preferences.json rename to pkg/classification/db/data_types/sexual_preferences.json diff --git a/internal/classification/db/data_types/siblings.json b/pkg/classification/db/data_types/siblings.json similarity index 100% rename from internal/classification/db/data_types/siblings.json rename to pkg/classification/db/data_types/siblings.json diff --git a/internal/classification/db/data_types/skin_tone.json b/pkg/classification/db/data_types/skin_tone.json similarity index 100% rename from internal/classification/db/data_types/skin_tone.json rename to pkg/classification/db/data_types/skin_tone.json diff --git a/internal/classification/db/data_types/social_status.json b/pkg/classification/db/data_types/social_status.json similarity index 100% rename from internal/classification/db/data_types/social_status.json rename to pkg/classification/db/data_types/social_status.json diff --git a/internal/classification/db/data_types/spoken_languages.json b/pkg/classification/db/data_types/spoken_languages.json similarity index 100% rename from internal/classification/db/data_types/spoken_languages.json rename to pkg/classification/db/data_types/spoken_languages.json diff --git a/internal/classification/db/data_types/tattoos.json b/pkg/classification/db/data_types/tattoos.json similarity index 100% rename from internal/classification/db/data_types/tattoos.json rename to pkg/classification/db/data_types/tattoos.json diff --git a/internal/classification/db/data_types/taxes.json b/pkg/classification/db/data_types/taxes.json similarity index 100% rename from internal/classification/db/data_types/taxes.json rename to pkg/classification/db/data_types/taxes.json diff --git a/internal/classification/db/data_types/telephone_number.json b/pkg/classification/db/data_types/telephone_number.json similarity index 100% rename from internal/classification/db/data_types/telephone_number.json rename to pkg/classification/db/data_types/telephone_number.json diff --git a/internal/classification/db/data_types/telephone_recordings.json b/pkg/classification/db/data_types/telephone_recordings.json similarity index 100% rename from internal/classification/db/data_types/telephone_recordings.json rename to pkg/classification/db/data_types/telephone_recordings.json diff --git a/internal/classification/db/data_types/thoughts.json b/pkg/classification/db/data_types/thoughts.json similarity index 100% rename from internal/classification/db/data_types/thoughts.json rename to pkg/classification/db/data_types/thoughts.json diff --git a/internal/classification/db/data_types/transactions.json b/pkg/classification/db/data_types/transactions.json similarity index 100% rename from internal/classification/db/data_types/transactions.json rename to pkg/classification/db/data_types/transactions.json diff --git a/internal/classification/db/data_types/unique_identifier.json b/pkg/classification/db/data_types/unique_identifier.json similarity index 100% rename from internal/classification/db/data_types/unique_identifier.json rename to pkg/classification/db/data_types/unique_identifier.json diff --git a/internal/classification/db/data_types/username.json b/pkg/classification/db/data_types/username.json similarity index 100% rename from internal/classification/db/data_types/username.json rename to pkg/classification/db/data_types/username.json diff --git a/internal/classification/db/data_types/voice_mail.json b/pkg/classification/db/data_types/voice_mail.json similarity index 100% rename from internal/classification/db/data_types/voice_mail.json rename to pkg/classification/db/data_types/voice_mail.json diff --git a/internal/classification/db/data_types/weight.json b/pkg/classification/db/data_types/weight.json similarity index 100% rename from internal/classification/db/data_types/weight.json rename to pkg/classification/db/data_types/weight.json diff --git a/internal/classification/db/data_types/work_history.json b/pkg/classification/db/data_types/work_history.json similarity index 100% rename from internal/classification/db/data_types/work_history.json rename to pkg/classification/db/data_types/work_history.json diff --git a/internal/classification/db/db.go b/pkg/classification/db/db.go similarity index 99% rename from internal/classification/db/db.go rename to pkg/classification/db/db.go index 9e1815304..07ff483a0 100644 --- a/internal/classification/db/db.go +++ b/pkg/classification/db/db.go @@ -8,8 +8,8 @@ import ( "regexp" "strings" - "github.com/bearer/bearer/internal/flag" - flagtypes "github.com/bearer/bearer/internal/flag/types" + "github.com/bearer/bearer/pkg/flag" + flagtypes "github.com/bearer/bearer/pkg/flag/types" "github.com/tangzero/inflector" ) diff --git a/internal/classification/db/known_person_object_patterns/account.json b/pkg/classification/db/known_person_object_patterns/account.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/account.json rename to pkg/classification/db/known_person_object_patterns/account.json diff --git a/internal/classification/db/known_person_object_patterns/advisor.json b/pkg/classification/db/known_person_object_patterns/advisor.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/advisor.json rename to pkg/classification/db/known_person_object_patterns/advisor.json diff --git a/internal/classification/db/known_person_object_patterns/applicant.json b/pkg/classification/db/known_person_object_patterns/applicant.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/applicant.json rename to pkg/classification/db/known_person_object_patterns/applicant.json diff --git a/internal/classification/db/known_person_object_patterns/artist.json b/pkg/classification/db/known_person_object_patterns/artist.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/artist.json rename to pkg/classification/db/known_person_object_patterns/artist.json diff --git a/internal/classification/db/known_person_object_patterns/attendee.json b/pkg/classification/db/known_person_object_patterns/attendee.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/attendee.json rename to pkg/classification/db/known_person_object_patterns/attendee.json diff --git a/internal/classification/db/known_person_object_patterns/author.json b/pkg/classification/db/known_person_object_patterns/author.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/author.json rename to pkg/classification/db/known_person_object_patterns/author.json diff --git a/internal/classification/db/known_person_object_patterns/bank_account.json b/pkg/classification/db/known_person_object_patterns/bank_account.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/bank_account.json rename to pkg/classification/db/known_person_object_patterns/bank_account.json diff --git a/internal/classification/db/known_person_object_patterns/beneficiar.json b/pkg/classification/db/known_person_object_patterns/beneficiar.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/beneficiar.json rename to pkg/classification/db/known_person_object_patterns/beneficiar.json diff --git a/internal/classification/db/known_person_object_patterns/buyer.json b/pkg/classification/db/known_person_object_patterns/buyer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/buyer.json rename to pkg/classification/db/known_person_object_patterns/buyer.json diff --git a/internal/classification/db/known_person_object_patterns/caller.json b/pkg/classification/db/known_person_object_patterns/caller.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/caller.json rename to pkg/classification/db/known_person_object_patterns/caller.json diff --git a/internal/classification/db/known_person_object_patterns/candidate.json b/pkg/classification/db/known_person_object_patterns/candidate.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/candidate.json rename to pkg/classification/db/known_person_object_patterns/candidate.json diff --git a/internal/classification/db/known_person_object_patterns/cardholder.json b/pkg/classification/db/known_person_object_patterns/cardholder.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/cardholder.json rename to pkg/classification/db/known_person_object_patterns/cardholder.json diff --git a/internal/classification/db/known_person_object_patterns/client.json b/pkg/classification/db/known_person_object_patterns/client.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/client.json rename to pkg/classification/db/known_person_object_patterns/client.json diff --git a/internal/classification/db/known_person_object_patterns/coach.json b/pkg/classification/db/known_person_object_patterns/coach.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/coach.json rename to pkg/classification/db/known_person_object_patterns/coach.json diff --git a/internal/classification/db/known_person_object_patterns/collaborator.json b/pkg/classification/db/known_person_object_patterns/collaborator.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/collaborator.json rename to pkg/classification/db/known_person_object_patterns/collaborator.json diff --git a/internal/classification/db/known_person_object_patterns/commenter.json b/pkg/classification/db/known_person_object_patterns/commenter.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/commenter.json rename to pkg/classification/db/known_person_object_patterns/commenter.json diff --git a/internal/classification/db/known_person_object_patterns/committer.json b/pkg/classification/db/known_person_object_patterns/committer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/committer.json rename to pkg/classification/db/known_person_object_patterns/committer.json diff --git a/internal/classification/db/known_person_object_patterns/competitor.json b/pkg/classification/db/known_person_object_patterns/competitor.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/competitor.json rename to pkg/classification/db/known_person_object_patterns/competitor.json diff --git a/internal/classification/db/known_person_object_patterns/consumer.json b/pkg/classification/db/known_person_object_patterns/consumer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/consumer.json rename to pkg/classification/db/known_person_object_patterns/consumer.json diff --git a/internal/classification/db/known_person_object_patterns/contact.json b/pkg/classification/db/known_person_object_patterns/contact.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/contact.json rename to pkg/classification/db/known_person_object_patterns/contact.json diff --git a/internal/classification/db/known_person_object_patterns/contractor.json b/pkg/classification/db/known_person_object_patterns/contractor.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/contractor.json rename to pkg/classification/db/known_person_object_patterns/contractor.json diff --git a/internal/classification/db/known_person_object_patterns/contributor.json b/pkg/classification/db/known_person_object_patterns/contributor.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/contributor.json rename to pkg/classification/db/known_person_object_patterns/contributor.json diff --git a/internal/classification/db/known_person_object_patterns/credentials.json b/pkg/classification/db/known_person_object_patterns/credentials.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/credentials.json rename to pkg/classification/db/known_person_object_patterns/credentials.json diff --git a/internal/classification/db/known_person_object_patterns/customer.json b/pkg/classification/db/known_person_object_patterns/customer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/customer.json rename to pkg/classification/db/known_person_object_patterns/customer.json diff --git a/internal/classification/db/known_person_object_patterns/developer.json b/pkg/classification/db/known_person_object_patterns/developer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/developer.json rename to pkg/classification/db/known_person_object_patterns/developer.json diff --git a/internal/classification/db/known_person_object_patterns/doctor.json b/pkg/classification/db/known_person_object_patterns/doctor.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/doctor.json rename to pkg/classification/db/known_person_object_patterns/doctor.json diff --git a/internal/classification/db/known_person_object_patterns/driver.json b/pkg/classification/db/known_person_object_patterns/driver.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/driver.json rename to pkg/classification/db/known_person_object_patterns/driver.json diff --git a/internal/classification/db/known_person_object_patterns/employee.json b/pkg/classification/db/known_person_object_patterns/employee.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/employee.json rename to pkg/classification/db/known_person_object_patterns/employee.json diff --git a/internal/classification/db/known_person_object_patterns/employer.json b/pkg/classification/db/known_person_object_patterns/employer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/employer.json rename to pkg/classification/db/known_person_object_patterns/employer.json diff --git a/internal/classification/db/known_person_object_patterns/follower.json b/pkg/classification/db/known_person_object_patterns/follower.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/follower.json rename to pkg/classification/db/known_person_object_patterns/follower.json diff --git a/internal/classification/db/known_person_object_patterns/guardian.json b/pkg/classification/db/known_person_object_patterns/guardian.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/guardian.json rename to pkg/classification/db/known_person_object_patterns/guardian.json diff --git a/internal/classification/db/known_person_object_patterns/identity.json b/pkg/classification/db/known_person_object_patterns/identity.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/identity.json rename to pkg/classification/db/known_person_object_patterns/identity.json diff --git a/internal/classification/db/known_person_object_patterns/insuree.json b/pkg/classification/db/known_person_object_patterns/insuree.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/insuree.json rename to pkg/classification/db/known_person_object_patterns/insuree.json diff --git a/internal/classification/db/known_person_object_patterns/invitee.json b/pkg/classification/db/known_person_object_patterns/invitee.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/invitee.json rename to pkg/classification/db/known_person_object_patterns/invitee.json diff --git a/internal/classification/db/known_person_object_patterns/issuer.json b/pkg/classification/db/known_person_object_patterns/issuer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/issuer.json rename to pkg/classification/db/known_person_object_patterns/issuer.json diff --git a/internal/classification/db/known_person_object_patterns/landlord.json b/pkg/classification/db/known_person_object_patterns/landlord.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/landlord.json rename to pkg/classification/db/known_person_object_patterns/landlord.json diff --git a/internal/classification/db/known_person_object_patterns/lead.json b/pkg/classification/db/known_person_object_patterns/lead.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/lead.json rename to pkg/classification/db/known_person_object_patterns/lead.json diff --git a/internal/classification/db/known_person_object_patterns/learner.json b/pkg/classification/db/known_person_object_patterns/learner.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/learner.json rename to pkg/classification/db/known_person_object_patterns/learner.json diff --git a/internal/classification/db/known_person_object_patterns/login.json b/pkg/classification/db/known_person_object_patterns/login.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/login.json rename to pkg/classification/db/known_person_object_patterns/login.json diff --git a/internal/classification/db/known_person_object_patterns/member.json b/pkg/classification/db/known_person_object_patterns/member.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/member.json rename to pkg/classification/db/known_person_object_patterns/member.json diff --git a/internal/classification/db/known_person_object_patterns/mentor.json b/pkg/classification/db/known_person_object_patterns/mentor.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/mentor.json rename to pkg/classification/db/known_person_object_patterns/mentor.json diff --git a/internal/classification/db/known_person_object_patterns/moderator.json b/pkg/classification/db/known_person_object_patterns/moderator.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/moderator.json rename to pkg/classification/db/known_person_object_patterns/moderator.json diff --git a/internal/classification/db/known_person_object_patterns/organizer.json b/pkg/classification/db/known_person_object_patterns/organizer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/organizer.json rename to pkg/classification/db/known_person_object_patterns/organizer.json diff --git a/internal/classification/db/known_person_object_patterns/owner.json b/pkg/classification/db/known_person_object_patterns/owner.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/owner.json rename to pkg/classification/db/known_person_object_patterns/owner.json diff --git a/internal/classification/db/known_person_object_patterns/panelist.json b/pkg/classification/db/known_person_object_patterns/panelist.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/panelist.json rename to pkg/classification/db/known_person_object_patterns/panelist.json diff --git a/internal/classification/db/known_person_object_patterns/participant.json b/pkg/classification/db/known_person_object_patterns/participant.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/participant.json rename to pkg/classification/db/known_person_object_patterns/participant.json diff --git a/internal/classification/db/known_person_object_patterns/partner.json b/pkg/classification/db/known_person_object_patterns/partner.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/partner.json rename to pkg/classification/db/known_person_object_patterns/partner.json diff --git a/internal/classification/db/known_person_object_patterns/passenger.json b/pkg/classification/db/known_person_object_patterns/passenger.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/passenger.json rename to pkg/classification/db/known_person_object_patterns/passenger.json diff --git a/internal/classification/db/known_person_object_patterns/patient.json b/pkg/classification/db/known_person_object_patterns/patient.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/patient.json rename to pkg/classification/db/known_person_object_patterns/patient.json diff --git a/internal/classification/db/known_person_object_patterns/payee.json b/pkg/classification/db/known_person_object_patterns/payee.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/payee.json rename to pkg/classification/db/known_person_object_patterns/payee.json diff --git a/internal/classification/db/known_person_object_patterns/payer.json b/pkg/classification/db/known_person_object_patterns/payer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/payer.json rename to pkg/classification/db/known_person_object_patterns/payer.json diff --git a/internal/classification/db/known_person_object_patterns/payor.json b/pkg/classification/db/known_person_object_patterns/payor.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/payor.json rename to pkg/classification/db/known_person_object_patterns/payor.json diff --git a/internal/classification/db/known_person_object_patterns/people.json b/pkg/classification/db/known_person_object_patterns/people.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/people.json rename to pkg/classification/db/known_person_object_patterns/people.json diff --git a/internal/classification/db/known_person_object_patterns/person.json b/pkg/classification/db/known_person_object_patterns/person.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/person.json rename to pkg/classification/db/known_person_object_patterns/person.json diff --git a/internal/classification/db/known_person_object_patterns/player.json b/pkg/classification/db/known_person_object_patterns/player.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/player.json rename to pkg/classification/db/known_person_object_patterns/player.json diff --git a/internal/classification/db/known_person_object_patterns/profile.json b/pkg/classification/db/known_person_object_patterns/profile.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/profile.json rename to pkg/classification/db/known_person_object_patterns/profile.json diff --git a/internal/classification/db/known_person_object_patterns/reader.json b/pkg/classification/db/known_person_object_patterns/reader.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/reader.json rename to pkg/classification/db/known_person_object_patterns/reader.json diff --git a/internal/classification/db/known_person_object_patterns/receiver.json b/pkg/classification/db/known_person_object_patterns/receiver.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/receiver.json rename to pkg/classification/db/known_person_object_patterns/receiver.json diff --git a/internal/classification/db/known_person_object_patterns/recipient.json b/pkg/classification/db/known_person_object_patterns/recipient.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/recipient.json rename to pkg/classification/db/known_person_object_patterns/recipient.json diff --git a/internal/classification/db/known_person_object_patterns/recruit.json b/pkg/classification/db/known_person_object_patterns/recruit.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/recruit.json rename to pkg/classification/db/known_person_object_patterns/recruit.json diff --git a/internal/classification/db/known_person_object_patterns/referee.json b/pkg/classification/db/known_person_object_patterns/referee.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/referee.json rename to pkg/classification/db/known_person_object_patterns/referee.json diff --git a/internal/classification/db/known_person_object_patterns/referer.json b/pkg/classification/db/known_person_object_patterns/referer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/referer.json rename to pkg/classification/db/known_person_object_patterns/referer.json diff --git a/internal/classification/db/known_person_object_patterns/registrant.json b/pkg/classification/db/known_person_object_patterns/registrant.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/registrant.json rename to pkg/classification/db/known_person_object_patterns/registrant.json diff --git a/internal/classification/db/known_person_object_patterns/seller.json b/pkg/classification/db/known_person_object_patterns/seller.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/seller.json rename to pkg/classification/db/known_person_object_patterns/seller.json diff --git a/internal/classification/db/known_person_object_patterns/sender.json b/pkg/classification/db/known_person_object_patterns/sender.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/sender.json rename to pkg/classification/db/known_person_object_patterns/sender.json diff --git a/internal/classification/db/known_person_object_patterns/shareholder.json b/pkg/classification/db/known_person_object_patterns/shareholder.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/shareholder.json rename to pkg/classification/db/known_person_object_patterns/shareholder.json diff --git a/internal/classification/db/known_person_object_patterns/shopper.json b/pkg/classification/db/known_person_object_patterns/shopper.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/shopper.json rename to pkg/classification/db/known_person_object_patterns/shopper.json diff --git a/internal/classification/db/known_person_object_patterns/signer.json b/pkg/classification/db/known_person_object_patterns/signer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/signer.json rename to pkg/classification/db/known_person_object_patterns/signer.json diff --git a/internal/classification/db/known_person_object_patterns/student.json b/pkg/classification/db/known_person_object_patterns/student.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/student.json rename to pkg/classification/db/known_person_object_patterns/student.json diff --git a/internal/classification/db/known_person_object_patterns/subscriber.json b/pkg/classification/db/known_person_object_patterns/subscriber.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/subscriber.json rename to pkg/classification/db/known_person_object_patterns/subscriber.json diff --git a/internal/classification/db/known_person_object_patterns/supplier.json b/pkg/classification/db/known_person_object_patterns/supplier.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/supplier.json rename to pkg/classification/db/known_person_object_patterns/supplier.json diff --git a/internal/classification/db/known_person_object_patterns/teacher.json b/pkg/classification/db/known_person_object_patterns/teacher.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/teacher.json rename to pkg/classification/db/known_person_object_patterns/teacher.json diff --git a/internal/classification/db/known_person_object_patterns/trainer.json b/pkg/classification/db/known_person_object_patterns/trainer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/trainer.json rename to pkg/classification/db/known_person_object_patterns/trainer.json diff --git a/internal/classification/db/known_person_object_patterns/user.json b/pkg/classification/db/known_person_object_patterns/user.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/user.json rename to pkg/classification/db/known_person_object_patterns/user.json diff --git a/internal/classification/db/known_person_object_patterns/veteran.json b/pkg/classification/db/known_person_object_patterns/veteran.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/veteran.json rename to pkg/classification/db/known_person_object_patterns/veteran.json diff --git a/internal/classification/db/known_person_object_patterns/volunteer.json b/pkg/classification/db/known_person_object_patterns/volunteer.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/volunteer.json rename to pkg/classification/db/known_person_object_patterns/volunteer.json diff --git a/internal/classification/db/known_person_object_patterns/winner.json b/pkg/classification/db/known_person_object_patterns/winner.json similarity index 100% rename from internal/classification/db/known_person_object_patterns/winner.json rename to pkg/classification/db/known_person_object_patterns/winner.json diff --git a/internal/classification/db/recipes/abbyy_cloud_ocr_sdk.json b/pkg/classification/db/recipes/abbyy_cloud_ocr_sdk.json similarity index 100% rename from internal/classification/db/recipes/abbyy_cloud_ocr_sdk.json rename to pkg/classification/db/recipes/abbyy_cloud_ocr_sdk.json diff --git a/internal/classification/db/recipes/abtasty.json b/pkg/classification/db/recipes/abtasty.json similarity index 100% rename from internal/classification/db/recipes/abtasty.json rename to pkg/classification/db/recipes/abtasty.json diff --git a/internal/classification/db/recipes/active_directory.json b/pkg/classification/db/recipes/active_directory.json similarity index 100% rename from internal/classification/db/recipes/active_directory.json rename to pkg/classification/db/recipes/active_directory.json diff --git a/internal/classification/db/recipes/activecampaign.json b/pkg/classification/db/recipes/activecampaign.json similarity index 100% rename from internal/classification/db/recipes/activecampaign.json rename to pkg/classification/db/recipes/activecampaign.json diff --git a/internal/classification/db/recipes/adictiz.json b/pkg/classification/db/recipes/adictiz.json similarity index 100% rename from internal/classification/db/recipes/adictiz.json rename to pkg/classification/db/recipes/adictiz.json diff --git a/internal/classification/db/recipes/adjust.json b/pkg/classification/db/recipes/adjust.json similarity index 100% rename from internal/classification/db/recipes/adjust.json rename to pkg/classification/db/recipes/adjust.json diff --git a/internal/classification/db/recipes/adobe_campaign_neolane.json b/pkg/classification/db/recipes/adobe_campaign_neolane.json similarity index 100% rename from internal/classification/db/recipes/adobe_campaign_neolane.json rename to pkg/classification/db/recipes/adobe_campaign_neolane.json diff --git a/internal/classification/db/recipes/adobe_scene7.json b/pkg/classification/db/recipes/adobe_scene7.json similarity index 100% rename from internal/classification/db/recipes/adobe_scene7.json rename to pkg/classification/db/recipes/adobe_scene7.json diff --git a/internal/classification/db/recipes/adotmob.json b/pkg/classification/db/recipes/adotmob.json similarity index 100% rename from internal/classification/db/recipes/adotmob.json rename to pkg/classification/db/recipes/adotmob.json diff --git a/internal/classification/db/recipes/adroll.json b/pkg/classification/db/recipes/adroll.json similarity index 100% rename from internal/classification/db/recipes/adroll.json rename to pkg/classification/db/recipes/adroll.json diff --git a/internal/classification/db/recipes/adyen.json b/pkg/classification/db/recipes/adyen.json similarity index 100% rename from internal/classification/db/recipes/adyen.json rename to pkg/classification/db/recipes/adyen.json diff --git a/internal/classification/db/recipes/aerospike.json b/pkg/classification/db/recipes/aerospike.json similarity index 100% rename from internal/classification/db/recipes/aerospike.json rename to pkg/classification/db/recipes/aerospike.json diff --git a/internal/classification/db/recipes/airbrake.json b/pkg/classification/db/recipes/airbrake.json similarity index 100% rename from internal/classification/db/recipes/airbrake.json rename to pkg/classification/db/recipes/airbrake.json diff --git a/internal/classification/db/recipes/airtable.json b/pkg/classification/db/recipes/airtable.json similarity index 100% rename from internal/classification/db/recipes/airtable.json rename to pkg/classification/db/recipes/airtable.json diff --git a/internal/classification/db/recipes/alexa_com.json b/pkg/classification/db/recipes/alexa_com.json similarity index 100% rename from internal/classification/db/recipes/alexa_com.json rename to pkg/classification/db/recipes/alexa_com.json diff --git a/internal/classification/db/recipes/algolia.json b/pkg/classification/db/recipes/algolia.json similarity index 100% rename from internal/classification/db/recipes/algolia.json rename to pkg/classification/db/recipes/algolia.json diff --git a/internal/classification/db/recipes/alibaba_cloud_apis.json b/pkg/classification/db/recipes/alibaba_cloud_apis.json similarity index 100% rename from internal/classification/db/recipes/alibaba_cloud_apis.json rename to pkg/classification/db/recipes/alibaba_cloud_apis.json diff --git a/internal/classification/db/recipes/alloy.json b/pkg/classification/db/recipes/alloy.json similarity index 100% rename from internal/classification/db/recipes/alloy.json rename to pkg/classification/db/recipes/alloy.json diff --git a/internal/classification/db/recipes/almerys.json b/pkg/classification/db/recipes/almerys.json similarity index 100% rename from internal/classification/db/recipes/almerys.json rename to pkg/classification/db/recipes/almerys.json diff --git a/internal/classification/db/recipes/alpaca.json b/pkg/classification/db/recipes/alpaca.json similarity index 100% rename from internal/classification/db/recipes/alpaca.json rename to pkg/classification/db/recipes/alpaca.json diff --git a/internal/classification/db/recipes/amazon_aws_apis.json b/pkg/classification/db/recipes/amazon_aws_apis.json similarity index 100% rename from internal/classification/db/recipes/amazon_aws_apis.json rename to pkg/classification/db/recipes/amazon_aws_apis.json diff --git a/internal/classification/db/recipes/ambassador.json b/pkg/classification/db/recipes/ambassador.json similarity index 100% rename from internal/classification/db/recipes/ambassador.json rename to pkg/classification/db/recipes/ambassador.json diff --git a/internal/classification/db/recipes/amc_theater.json b/pkg/classification/db/recipes/amc_theater.json similarity index 100% rename from internal/classification/db/recipes/amc_theater.json rename to pkg/classification/db/recipes/amc_theater.json diff --git a/internal/classification/db/recipes/ameli.json b/pkg/classification/db/recipes/ameli.json similarity index 100% rename from internal/classification/db/recipes/ameli.json rename to pkg/classification/db/recipes/ameli.json diff --git a/internal/classification/db/recipes/amplitude.json b/pkg/classification/db/recipes/amplitude.json similarity index 100% rename from internal/classification/db/recipes/amplitude.json rename to pkg/classification/db/recipes/amplitude.json diff --git a/internal/classification/db/recipes/apache_airflow.json b/pkg/classification/db/recipes/apache_airflow.json similarity index 100% rename from internal/classification/db/recipes/apache_airflow.json rename to pkg/classification/db/recipes/apache_airflow.json diff --git a/internal/classification/db/recipes/apache_beam.json b/pkg/classification/db/recipes/apache_beam.json similarity index 100% rename from internal/classification/db/recipes/apache_beam.json rename to pkg/classification/db/recipes/apache_beam.json diff --git a/internal/classification/db/recipes/apache_hbase.json b/pkg/classification/db/recipes/apache_hbase.json similarity index 100% rename from internal/classification/db/recipes/apache_hbase.json rename to pkg/classification/db/recipes/apache_hbase.json diff --git a/internal/classification/db/recipes/apache_kafka.json b/pkg/classification/db/recipes/apache_kafka.json similarity index 100% rename from internal/classification/db/recipes/apache_kafka.json rename to pkg/classification/db/recipes/apache_kafka.json diff --git a/internal/classification/db/recipes/apache_spark.json b/pkg/classification/db/recipes/apache_spark.json similarity index 100% rename from internal/classification/db/recipes/apache_spark.json rename to pkg/classification/db/recipes/apache_spark.json diff --git a/internal/classification/db/recipes/apollographql.json b/pkg/classification/db/recipes/apollographql.json similarity index 100% rename from internal/classification/db/recipes/apollographql.json rename to pkg/classification/db/recipes/apollographql.json diff --git a/internal/classification/db/recipes/appbase.json b/pkg/classification/db/recipes/appbase.json similarity index 100% rename from internal/classification/db/recipes/appbase.json rename to pkg/classification/db/recipes/appbase.json diff --git a/internal/classification/db/recipes/appdynamics.json b/pkg/classification/db/recipes/appdynamics.json similarity index 100% rename from internal/classification/db/recipes/appdynamics.json rename to pkg/classification/db/recipes/appdynamics.json diff --git a/internal/classification/db/recipes/apple.json b/pkg/classification/db/recipes/apple.json similarity index 100% rename from internal/classification/db/recipes/apple.json rename to pkg/classification/db/recipes/apple.json diff --git a/internal/classification/db/recipes/apple_pay.json b/pkg/classification/db/recipes/apple_pay.json similarity index 100% rename from internal/classification/db/recipes/apple_pay.json rename to pkg/classification/db/recipes/apple_pay.json diff --git a/internal/classification/db/recipes/appveyor.json b/pkg/classification/db/recipes/appveyor.json similarity index 100% rename from internal/classification/db/recipes/appveyor.json rename to pkg/classification/db/recipes/appveyor.json diff --git a/internal/classification/db/recipes/aquasec.json b/pkg/classification/db/recipes/aquasec.json similarity index 100% rename from internal/classification/db/recipes/aquasec.json rename to pkg/classification/db/recipes/aquasec.json diff --git a/internal/classification/db/recipes/asana.json b/pkg/classification/db/recipes/asana.json similarity index 100% rename from internal/classification/db/recipes/asana.json rename to pkg/classification/db/recipes/asana.json diff --git a/internal/classification/db/recipes/assurcard.json b/pkg/classification/db/recipes/assurcard.json similarity index 100% rename from internal/classification/db/recipes/assurcard.json rename to pkg/classification/db/recipes/assurcard.json diff --git a/internal/classification/db/recipes/athos_worldline.json b/pkg/classification/db/recipes/athos_worldline.json similarity index 100% rename from internal/classification/db/recipes/athos_worldline.json rename to pkg/classification/db/recipes/athos_worldline.json diff --git a/internal/classification/db/recipes/atinternet.json b/pkg/classification/db/recipes/atinternet.json similarity index 100% rename from internal/classification/db/recipes/atinternet.json rename to pkg/classification/db/recipes/atinternet.json diff --git a/internal/classification/db/recipes/atlassian_cloud.json b/pkg/classification/db/recipes/atlassian_cloud.json similarity index 100% rename from internal/classification/db/recipes/atlassian_cloud.json rename to pkg/classification/db/recipes/atlassian_cloud.json diff --git a/internal/classification/db/recipes/auth0.json b/pkg/classification/db/recipes/auth0.json similarity index 100% rename from internal/classification/db/recipes/auth0.json rename to pkg/classification/db/recipes/auth0.json diff --git a/internal/classification/db/recipes/aws_athena.json b/pkg/classification/db/recipes/aws_athena.json similarity index 100% rename from internal/classification/db/recipes/aws_athena.json rename to pkg/classification/db/recipes/aws_athena.json diff --git a/internal/classification/db/recipes/aws_dynamodb.json b/pkg/classification/db/recipes/aws_dynamodb.json similarity index 100% rename from internal/classification/db/recipes/aws_dynamodb.json rename to pkg/classification/db/recipes/aws_dynamodb.json diff --git a/internal/classification/db/recipes/aws_key_management_service_kms.json b/pkg/classification/db/recipes/aws_key_management_service_kms.json similarity index 100% rename from internal/classification/db/recipes/aws_key_management_service_kms.json rename to pkg/classification/db/recipes/aws_key_management_service_kms.json diff --git a/internal/classification/db/recipes/aws_kinesis.json b/pkg/classification/db/recipes/aws_kinesis.json similarity index 100% rename from internal/classification/db/recipes/aws_kinesis.json rename to pkg/classification/db/recipes/aws_kinesis.json diff --git a/internal/classification/db/recipes/aws_redshift.json b/pkg/classification/db/recipes/aws_redshift.json similarity index 100% rename from internal/classification/db/recipes/aws_redshift.json rename to pkg/classification/db/recipes/aws_redshift.json diff --git a/internal/classification/db/recipes/aws_s3.json b/pkg/classification/db/recipes/aws_s3.json similarity index 100% rename from internal/classification/db/recipes/aws_s3.json rename to pkg/classification/db/recipes/aws_s3.json diff --git a/internal/classification/db/recipes/aws_s3_glacier.json b/pkg/classification/db/recipes/aws_s3_glacier.json similarity index 100% rename from internal/classification/db/recipes/aws_s3_glacier.json rename to pkg/classification/db/recipes/aws_s3_glacier.json diff --git a/internal/classification/db/recipes/aws_sqs.json b/pkg/classification/db/recipes/aws_sqs.json similarity index 100% rename from internal/classification/db/recipes/aws_sqs.json rename to pkg/classification/db/recipes/aws_sqs.json diff --git a/internal/classification/db/recipes/azure_cognitive_search.json b/pkg/classification/db/recipes/azure_cognitive_search.json similarity index 100% rename from internal/classification/db/recipes/azure_cognitive_search.json rename to pkg/classification/db/recipes/azure_cognitive_search.json diff --git a/internal/classification/db/recipes/azure_cosmos_db.json b/pkg/classification/db/recipes/azure_cosmos_db.json similarity index 100% rename from internal/classification/db/recipes/azure_cosmos_db.json rename to pkg/classification/db/recipes/azure_cosmos_db.json diff --git a/internal/classification/db/recipes/azure_key_vault.json b/pkg/classification/db/recipes/azure_key_vault.json similarity index 100% rename from internal/classification/db/recipes/azure_key_vault.json rename to pkg/classification/db/recipes/azure_key_vault.json diff --git a/internal/classification/db/recipes/azure_service_bus.json b/pkg/classification/db/recipes/azure_service_bus.json similarity index 100% rename from internal/classification/db/recipes/azure_service_bus.json rename to pkg/classification/db/recipes/azure_service_bus.json diff --git a/internal/classification/db/recipes/azure_storage.json b/pkg/classification/db/recipes/azure_storage.json similarity index 100% rename from internal/classification/db/recipes/azure_storage.json rename to pkg/classification/db/recipes/azure_storage.json diff --git a/internal/classification/db/recipes/badgerdb.json b/pkg/classification/db/recipes/badgerdb.json similarity index 100% rename from internal/classification/db/recipes/badgerdb.json rename to pkg/classification/db/recipes/badgerdb.json diff --git a/internal/classification/db/recipes/bamboohr.json b/pkg/classification/db/recipes/bamboohr.json similarity index 100% rename from internal/classification/db/recipes/bamboohr.json rename to pkg/classification/db/recipes/bamboohr.json diff --git a/internal/classification/db/recipes/bambuser.json b/pkg/classification/db/recipes/bambuser.json similarity index 100% rename from internal/classification/db/recipes/bambuser.json rename to pkg/classification/db/recipes/bambuser.json diff --git a/internal/classification/db/recipes/bank_of_apis_natwest_rbs.json b/pkg/classification/db/recipes/bank_of_apis_natwest_rbs.json similarity index 100% rename from internal/classification/db/recipes/bank_of_apis_natwest_rbs.json rename to pkg/classification/db/recipes/bank_of_apis_natwest_rbs.json diff --git a/internal/classification/db/recipes/barclays.json b/pkg/classification/db/recipes/barclays.json similarity index 100% rename from internal/classification/db/recipes/barclays.json rename to pkg/classification/db/recipes/barclays.json diff --git a/internal/classification/db/recipes/basecamp.json b/pkg/classification/db/recipes/basecamp.json similarity index 100% rename from internal/classification/db/recipes/basecamp.json rename to pkg/classification/db/recipes/basecamp.json diff --git a/internal/classification/db/recipes/bigcommerce.json b/pkg/classification/db/recipes/bigcommerce.json similarity index 100% rename from internal/classification/db/recipes/bigcommerce.json rename to pkg/classification/db/recipes/bigcommerce.json diff --git a/internal/classification/db/recipes/bintray_jfrog.json b/pkg/classification/db/recipes/bintray_jfrog.json similarity index 100% rename from internal/classification/db/recipes/bintray_jfrog.json rename to pkg/classification/db/recipes/bintray_jfrog.json diff --git a/internal/classification/db/recipes/bitbucket.json b/pkg/classification/db/recipes/bitbucket.json similarity index 100% rename from internal/classification/db/recipes/bitbucket.json rename to pkg/classification/db/recipes/bitbucket.json diff --git a/internal/classification/db/recipes/bitly.json b/pkg/classification/db/recipes/bitly.json similarity index 100% rename from internal/classification/db/recipes/bitly.json rename to pkg/classification/db/recipes/bitly.json diff --git a/internal/classification/db/recipes/bitrise.json b/pkg/classification/db/recipes/bitrise.json similarity index 100% rename from internal/classification/db/recipes/bitrise.json rename to pkg/classification/db/recipes/bitrise.json diff --git a/internal/classification/db/recipes/blackfire.json b/pkg/classification/db/recipes/blackfire.json similarity index 100% rename from internal/classification/db/recipes/blackfire.json rename to pkg/classification/db/recipes/blackfire.json diff --git a/internal/classification/db/recipes/boltdb.json b/pkg/classification/db/recipes/boltdb.json similarity index 100% rename from internal/classification/db/recipes/boltdb.json rename to pkg/classification/db/recipes/boltdb.json diff --git a/internal/classification/db/recipes/box.json b/pkg/classification/db/recipes/box.json similarity index 100% rename from internal/classification/db/recipes/box.json rename to pkg/classification/db/recipes/box.json diff --git a/internal/classification/db/recipes/braze.json b/pkg/classification/db/recipes/braze.json similarity index 100% rename from internal/classification/db/recipes/braze.json rename to pkg/classification/db/recipes/braze.json diff --git a/internal/classification/db/recipes/brightbox.json b/pkg/classification/db/recipes/brightbox.json similarity index 100% rename from internal/classification/db/recipes/brightbox.json rename to pkg/classification/db/recipes/brightbox.json diff --git a/internal/classification/db/recipes/browserstack.json b/pkg/classification/db/recipes/browserstack.json similarity index 100% rename from internal/classification/db/recipes/browserstack.json rename to pkg/classification/db/recipes/browserstack.json diff --git a/internal/classification/db/recipes/bugsnag.json b/pkg/classification/db/recipes/bugsnag.json similarity index 100% rename from internal/classification/db/recipes/bugsnag.json rename to pkg/classification/db/recipes/bugsnag.json diff --git a/internal/classification/db/recipes/buntdb.json b/pkg/classification/db/recipes/buntdb.json similarity index 100% rename from internal/classification/db/recipes/buntdb.json rename to pkg/classification/db/recipes/buntdb.json diff --git a/internal/classification/db/recipes/calendly.json b/pkg/classification/db/recipes/calendly.json similarity index 100% rename from internal/classification/db/recipes/calendly.json rename to pkg/classification/db/recipes/calendly.json diff --git a/internal/classification/db/recipes/cashplus.json b/pkg/classification/db/recipes/cashplus.json similarity index 100% rename from internal/classification/db/recipes/cashplus.json rename to pkg/classification/db/recipes/cashplus.json diff --git a/internal/classification/db/recipes/cassandara.json b/pkg/classification/db/recipes/cassandara.json similarity index 100% rename from internal/classification/db/recipes/cassandara.json rename to pkg/classification/db/recipes/cassandara.json diff --git a/internal/classification/db/recipes/centrify.json b/pkg/classification/db/recipes/centrify.json similarity index 100% rename from internal/classification/db/recipes/centrify.json rename to pkg/classification/db/recipes/centrify.json diff --git a/internal/classification/db/recipes/chargebee.json b/pkg/classification/db/recipes/chargebee.json similarity index 100% rename from internal/classification/db/recipes/chargebee.json rename to pkg/classification/db/recipes/chargebee.json diff --git a/internal/classification/db/recipes/chargify.json b/pkg/classification/db/recipes/chargify.json similarity index 100% rename from internal/classification/db/recipes/chargify.json rename to pkg/classification/db/recipes/chargify.json diff --git a/internal/classification/db/recipes/checkout_com.json b/pkg/classification/db/recipes/checkout_com.json similarity index 100% rename from internal/classification/db/recipes/checkout_com.json rename to pkg/classification/db/recipes/checkout_com.json diff --git a/internal/classification/db/recipes/circleci.json b/pkg/classification/db/recipes/circleci.json similarity index 100% rename from internal/classification/db/recipes/circleci.json rename to pkg/classification/db/recipes/circleci.json diff --git a/internal/classification/db/recipes/cirrus_ci.json b/pkg/classification/db/recipes/cirrus_ci.json similarity index 100% rename from internal/classification/db/recipes/cirrus_ci.json rename to pkg/classification/db/recipes/cirrus_ci.json diff --git a/internal/classification/db/recipes/clearbit.json b/pkg/classification/db/recipes/clearbit.json similarity index 100% rename from internal/classification/db/recipes/clearbit.json rename to pkg/classification/db/recipes/clearbit.json diff --git a/internal/classification/db/recipes/clickhouse.json b/pkg/classification/db/recipes/clickhouse.json similarity index 100% rename from internal/classification/db/recipes/clickhouse.json rename to pkg/classification/db/recipes/clickhouse.json diff --git a/internal/classification/db/recipes/clickup.json b/pkg/classification/db/recipes/clickup.json similarity index 100% rename from internal/classification/db/recipes/clickup.json rename to pkg/classification/db/recipes/clickup.json diff --git a/internal/classification/db/recipes/clodo.json b/pkg/classification/db/recipes/clodo.json similarity index 100% rename from internal/classification/db/recipes/clodo.json rename to pkg/classification/db/recipes/clodo.json diff --git a/internal/classification/db/recipes/cloudflare.json b/pkg/classification/db/recipes/cloudflare.json similarity index 100% rename from internal/classification/db/recipes/cloudflare.json rename to pkg/classification/db/recipes/cloudflare.json diff --git a/internal/classification/db/recipes/cloudinary.json b/pkg/classification/db/recipes/cloudinary.json similarity index 100% rename from internal/classification/db/recipes/cloudinary.json rename to pkg/classification/db/recipes/cloudinary.json diff --git a/internal/classification/db/recipes/cloudwatch.json b/pkg/classification/db/recipes/cloudwatch.json similarity index 100% rename from internal/classification/db/recipes/cloudwatch.json rename to pkg/classification/db/recipes/cloudwatch.json diff --git a/internal/classification/db/recipes/cockroachdb.json b/pkg/classification/db/recipes/cockroachdb.json similarity index 100% rename from internal/classification/db/recipes/cockroachdb.json rename to pkg/classification/db/recipes/cockroachdb.json diff --git a/internal/classification/db/recipes/companies_house_gov_uk.json b/pkg/classification/db/recipes/companies_house_gov_uk.json similarity index 100% rename from internal/classification/db/recipes/companies_house_gov_uk.json rename to pkg/classification/db/recipes/companies_house_gov_uk.json diff --git a/internal/classification/db/recipes/complyadvantage.json b/pkg/classification/db/recipes/complyadvantage.json similarity index 100% rename from internal/classification/db/recipes/complyadvantage.json rename to pkg/classification/db/recipes/complyadvantage.json diff --git a/internal/classification/db/recipes/contentful.json b/pkg/classification/db/recipes/contentful.json similarity index 100% rename from internal/classification/db/recipes/contentful.json rename to pkg/classification/db/recipes/contentful.json diff --git a/internal/classification/db/recipes/cookiebot_com.json b/pkg/classification/db/recipes/cookiebot_com.json similarity index 100% rename from internal/classification/db/recipes/cookiebot_com.json rename to pkg/classification/db/recipes/cookiebot_com.json diff --git a/internal/classification/db/recipes/copper.json b/pkg/classification/db/recipes/copper.json similarity index 100% rename from internal/classification/db/recipes/copper.json rename to pkg/classification/db/recipes/copper.json diff --git a/internal/classification/db/recipes/couchbase.json b/pkg/classification/db/recipes/couchbase.json similarity index 100% rename from internal/classification/db/recipes/couchbase.json rename to pkg/classification/db/recipes/couchbase.json diff --git a/internal/classification/db/recipes/crmgang.json b/pkg/classification/db/recipes/crmgang.json similarity index 100% rename from internal/classification/db/recipes/crmgang.json rename to pkg/classification/db/recipes/crmgang.json diff --git a/internal/classification/db/recipes/customer.json b/pkg/classification/db/recipes/customer.json similarity index 100% rename from internal/classification/db/recipes/customer.json rename to pkg/classification/db/recipes/customer.json diff --git a/internal/classification/db/recipes/dalenys.json b/pkg/classification/db/recipes/dalenys.json similarity index 100% rename from internal/classification/db/recipes/dalenys.json rename to pkg/classification/db/recipes/dalenys.json diff --git a/internal/classification/db/recipes/databricks.json b/pkg/classification/db/recipes/databricks.json similarity index 100% rename from internal/classification/db/recipes/databricks.json rename to pkg/classification/db/recipes/databricks.json diff --git a/internal/classification/db/recipes/datadog.json b/pkg/classification/db/recipes/datadog.json similarity index 100% rename from internal/classification/db/recipes/datadog.json rename to pkg/classification/db/recipes/datadog.json diff --git a/internal/classification/db/recipes/datadome.json b/pkg/classification/db/recipes/datadome.json similarity index 100% rename from internal/classification/db/recipes/datadome.json rename to pkg/classification/db/recipes/datadome.json diff --git a/internal/classification/db/recipes/debounce.json b/pkg/classification/db/recipes/debounce.json similarity index 100% rename from internal/classification/db/recipes/debounce.json rename to pkg/classification/db/recipes/debounce.json diff --git a/internal/classification/db/recipes/demdex_adobe.json b/pkg/classification/db/recipes/demdex_adobe.json similarity index 100% rename from internal/classification/db/recipes/demdex_adobe.json rename to pkg/classification/db/recipes/demdex_adobe.json diff --git a/internal/classification/db/recipes/digitalocean.json b/pkg/classification/db/recipes/digitalocean.json similarity index 100% rename from internal/classification/db/recipes/digitalocean.json rename to pkg/classification/db/recipes/digitalocean.json diff --git a/internal/classification/db/recipes/digitalocean_apis.json b/pkg/classification/db/recipes/digitalocean_apis.json similarity index 100% rename from internal/classification/db/recipes/digitalocean_apis.json rename to pkg/classification/db/recipes/digitalocean_apis.json diff --git a/internal/classification/db/recipes/discord.json b/pkg/classification/db/recipes/discord.json similarity index 100% rename from internal/classification/db/recipes/discord.json rename to pkg/classification/db/recipes/discord.json diff --git a/internal/classification/db/recipes/disk.json b/pkg/classification/db/recipes/disk.json similarity index 100% rename from internal/classification/db/recipes/disk.json rename to pkg/classification/db/recipes/disk.json diff --git a/internal/classification/db/recipes/dmp.json b/pkg/classification/db/recipes/dmp.json similarity index 100% rename from internal/classification/db/recipes/dmp.json rename to pkg/classification/db/recipes/dmp.json diff --git a/internal/classification/db/recipes/dnsimple.json b/pkg/classification/db/recipes/dnsimple.json similarity index 100% rename from internal/classification/db/recipes/dnsimple.json rename to pkg/classification/db/recipes/dnsimple.json diff --git a/internal/classification/db/recipes/dnsmadeeasy.json b/pkg/classification/db/recipes/dnsmadeeasy.json similarity index 100% rename from internal/classification/db/recipes/dnsmadeeasy.json rename to pkg/classification/db/recipes/dnsmadeeasy.json diff --git a/internal/classification/db/recipes/docusign.json b/pkg/classification/db/recipes/docusign.json similarity index 100% rename from internal/classification/db/recipes/docusign.json rename to pkg/classification/db/recipes/docusign.json diff --git a/internal/classification/db/recipes/dossier_pharmaceutique.json b/pkg/classification/db/recipes/dossier_pharmaceutique.json similarity index 100% rename from internal/classification/db/recipes/dossier_pharmaceutique.json rename to pkg/classification/db/recipes/dossier_pharmaceutique.json diff --git a/internal/classification/db/recipes/dreamhost.json b/pkg/classification/db/recipes/dreamhost.json similarity index 100% rename from internal/classification/db/recipes/dreamhost.json rename to pkg/classification/db/recipes/dreamhost.json diff --git a/internal/classification/db/recipes/drift.json b/pkg/classification/db/recipes/drift.json similarity index 100% rename from internal/classification/db/recipes/drift.json rename to pkg/classification/db/recipes/drift.json diff --git a/internal/classification/db/recipes/dropbox.json b/pkg/classification/db/recipes/dropbox.json similarity index 100% rename from internal/classification/db/recipes/dropbox.json rename to pkg/classification/db/recipes/dropbox.json diff --git a/internal/classification/db/recipes/dropcontact.json b/pkg/classification/db/recipes/dropcontact.json similarity index 100% rename from internal/classification/db/recipes/dropcontact.json rename to pkg/classification/db/recipes/dropcontact.json diff --git a/internal/classification/db/recipes/dyn_oracle.json b/pkg/classification/db/recipes/dyn_oracle.json similarity index 100% rename from internal/classification/db/recipes/dyn_oracle.json rename to pkg/classification/db/recipes/dyn_oracle.json diff --git a/internal/classification/db/recipes/easypost.json b/pkg/classification/db/recipes/easypost.json similarity index 100% rename from internal/classification/db/recipes/easypost.json rename to pkg/classification/db/recipes/easypost.json diff --git a/internal/classification/db/recipes/edgecast.json b/pkg/classification/db/recipes/edgecast.json similarity index 100% rename from internal/classification/db/recipes/edgecast.json rename to pkg/classification/db/recipes/edgecast.json diff --git a/internal/classification/db/recipes/elastic.json b/pkg/classification/db/recipes/elastic.json similarity index 100% rename from internal/classification/db/recipes/elastic.json rename to pkg/classification/db/recipes/elastic.json diff --git a/internal/classification/db/recipes/elasticsearch.json b/pkg/classification/db/recipes/elasticsearch.json similarity index 100% rename from internal/classification/db/recipes/elasticsearch.json rename to pkg/classification/db/recipes/elasticsearch.json diff --git a/internal/classification/db/recipes/emburse.json b/pkg/classification/db/recipes/emburse.json similarity index 100% rename from internal/classification/db/recipes/emburse.json rename to pkg/classification/db/recipes/emburse.json diff --git a/internal/classification/db/recipes/enboarder.json b/pkg/classification/db/recipes/enboarder.json similarity index 100% rename from internal/classification/db/recipes/enboarder.json rename to pkg/classification/db/recipes/enboarder.json diff --git a/internal/classification/db/recipes/envoy.json b/pkg/classification/db/recipes/envoy.json similarity index 100% rename from internal/classification/db/recipes/envoy.json rename to pkg/classification/db/recipes/envoy.json diff --git a/internal/classification/db/recipes/esante_gouv.json b/pkg/classification/db/recipes/esante_gouv.json similarity index 100% rename from internal/classification/db/recipes/esante_gouv.json rename to pkg/classification/db/recipes/esante_gouv.json diff --git a/internal/classification/db/recipes/essendex.json b/pkg/classification/db/recipes/essendex.json similarity index 100% rename from internal/classification/db/recipes/essendex.json rename to pkg/classification/db/recipes/essendex.json diff --git a/internal/classification/db/recipes/etcd.json b/pkg/classification/db/recipes/etcd.json similarity index 100% rename from internal/classification/db/recipes/etcd.json rename to pkg/classification/db/recipes/etcd.json diff --git a/internal/classification/db/recipes/exoscale_cloud_apis.json b/pkg/classification/db/recipes/exoscale_cloud_apis.json similarity index 100% rename from internal/classification/db/recipes/exoscale_cloud_apis.json rename to pkg/classification/db/recipes/exoscale_cloud_apis.json diff --git a/internal/classification/db/recipes/expensify.json b/pkg/classification/db/recipes/expensify.json similarity index 100% rename from internal/classification/db/recipes/expensify.json rename to pkg/classification/db/recipes/expensify.json diff --git a/internal/classification/db/recipes/facebook.json b/pkg/classification/db/recipes/facebook.json similarity index 100% rename from internal/classification/db/recipes/facebook.json rename to pkg/classification/db/recipes/facebook.json diff --git a/internal/classification/db/recipes/fauna.json b/pkg/classification/db/recipes/fauna.json similarity index 100% rename from internal/classification/db/recipes/fauna.json rename to pkg/classification/db/recipes/fauna.json diff --git a/internal/classification/db/recipes/firebase.json b/pkg/classification/db/recipes/firebase.json similarity index 100% rename from internal/classification/db/recipes/firebase.json rename to pkg/classification/db/recipes/firebase.json diff --git a/internal/classification/db/recipes/firebird.json b/pkg/classification/db/recipes/firebird.json similarity index 100% rename from internal/classification/db/recipes/firebird.json rename to pkg/classification/db/recipes/firebird.json diff --git a/internal/classification/db/recipes/fluentd.json b/pkg/classification/db/recipes/fluentd.json similarity index 100% rename from internal/classification/db/recipes/fluentd.json rename to pkg/classification/db/recipes/fluentd.json diff --git a/internal/classification/db/recipes/forestadmin.json b/pkg/classification/db/recipes/forestadmin.json similarity index 100% rename from internal/classification/db/recipes/forestadmin.json rename to pkg/classification/db/recipes/forestadmin.json diff --git a/internal/classification/db/recipes/fountain.json b/pkg/classification/db/recipes/fountain.json similarity index 100% rename from internal/classification/db/recipes/fountain.json rename to pkg/classification/db/recipes/fountain.json diff --git a/internal/classification/db/recipes/france_billet.json b/pkg/classification/db/recipes/france_billet.json similarity index 100% rename from internal/classification/db/recipes/france_billet.json rename to pkg/classification/db/recipes/france_billet.json diff --git a/internal/classification/db/recipes/freshworks.json b/pkg/classification/db/recipes/freshworks.json similarity index 100% rename from internal/classification/db/recipes/freshworks.json rename to pkg/classification/db/recipes/freshworks.json diff --git a/internal/classification/db/recipes/front.json b/pkg/classification/db/recipes/front.json similarity index 100% rename from internal/classification/db/recipes/front.json rename to pkg/classification/db/recipes/front.json diff --git a/internal/classification/db/recipes/ftp_sftp.json b/pkg/classification/db/recipes/ftp_sftp.json similarity index 100% rename from internal/classification/db/recipes/ftp_sftp.json rename to pkg/classification/db/recipes/ftp_sftp.json diff --git a/internal/classification/db/recipes/galileo.json b/pkg/classification/db/recipes/galileo.json similarity index 100% rename from internal/classification/db/recipes/galileo.json rename to pkg/classification/db/recipes/galileo.json diff --git a/internal/classification/db/recipes/gandi.json b/pkg/classification/db/recipes/gandi.json similarity index 100% rename from internal/classification/db/recipes/gandi.json rename to pkg/classification/db/recipes/gandi.json diff --git a/internal/classification/db/recipes/geckoboard.json b/pkg/classification/db/recipes/geckoboard.json similarity index 100% rename from internal/classification/db/recipes/geckoboard.json rename to pkg/classification/db/recipes/geckoboard.json diff --git a/internal/classification/db/recipes/gfycat.json b/pkg/classification/db/recipes/gfycat.json similarity index 100% rename from internal/classification/db/recipes/gfycat.json rename to pkg/classification/db/recipes/gfycat.json diff --git a/internal/classification/db/recipes/gitea.json b/pkg/classification/db/recipes/gitea.json similarity index 100% rename from internal/classification/db/recipes/gitea.json rename to pkg/classification/db/recipes/gitea.json diff --git a/internal/classification/db/recipes/github.json b/pkg/classification/db/recipes/github.json similarity index 100% rename from internal/classification/db/recipes/github.json rename to pkg/classification/db/recipes/github.json diff --git a/internal/classification/db/recipes/gitlab.json b/pkg/classification/db/recipes/gitlab.json similarity index 100% rename from internal/classification/db/recipes/gitlab.json rename to pkg/classification/db/recipes/gitlab.json diff --git a/internal/classification/db/recipes/glesys.json b/pkg/classification/db/recipes/glesys.json similarity index 100% rename from internal/classification/db/recipes/glesys.json rename to pkg/classification/db/recipes/glesys.json diff --git a/internal/classification/db/recipes/gocardless.json b/pkg/classification/db/recipes/gocardless.json similarity index 100% rename from internal/classification/db/recipes/gocardless.json rename to pkg/classification/db/recipes/gocardless.json diff --git a/internal/classification/db/recipes/google_ads.json b/pkg/classification/db/recipes/google_ads.json similarity index 100% rename from internal/classification/db/recipes/google_ads.json rename to pkg/classification/db/recipes/google_ads.json diff --git a/internal/classification/db/recipes/google_analytics.json b/pkg/classification/db/recipes/google_analytics.json similarity index 100% rename from internal/classification/db/recipes/google_analytics.json rename to pkg/classification/db/recipes/google_analytics.json diff --git a/internal/classification/db/recipes/google_cloud_apis.json b/pkg/classification/db/recipes/google_cloud_apis.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_apis.json rename to pkg/classification/db/recipes/google_cloud_apis.json diff --git a/internal/classification/db/recipes/google_cloud_bigquery.json b/pkg/classification/db/recipes/google_cloud_bigquery.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_bigquery.json rename to pkg/classification/db/recipes/google_cloud_bigquery.json diff --git a/internal/classification/db/recipes/google_cloud_bigtable.json b/pkg/classification/db/recipes/google_cloud_bigtable.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_bigtable.json rename to pkg/classification/db/recipes/google_cloud_bigtable.json diff --git a/internal/classification/db/recipes/google_cloud_dataflow.json b/pkg/classification/db/recipes/google_cloud_dataflow.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_dataflow.json rename to pkg/classification/db/recipes/google_cloud_dataflow.json diff --git a/internal/classification/db/recipes/google_cloud_datastore.json b/pkg/classification/db/recipes/google_cloud_datastore.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_datastore.json rename to pkg/classification/db/recipes/google_cloud_datastore.json diff --git a/internal/classification/db/recipes/google_cloud_firestore.json b/pkg/classification/db/recipes/google_cloud_firestore.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_firestore.json rename to pkg/classification/db/recipes/google_cloud_firestore.json diff --git a/internal/classification/db/recipes/google_cloud_key_management.json b/pkg/classification/db/recipes/google_cloud_key_management.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_key_management.json rename to pkg/classification/db/recipes/google_cloud_key_management.json diff --git a/internal/classification/db/recipes/google_cloud_pub_sub.json b/pkg/classification/db/recipes/google_cloud_pub_sub.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_pub_sub.json rename to pkg/classification/db/recipes/google_cloud_pub_sub.json diff --git a/internal/classification/db/recipes/google_cloud_secret_manager.json b/pkg/classification/db/recipes/google_cloud_secret_manager.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_secret_manager.json rename to pkg/classification/db/recipes/google_cloud_secret_manager.json diff --git a/internal/classification/db/recipes/google_cloud_spanner.json b/pkg/classification/db/recipes/google_cloud_spanner.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_spanner.json rename to pkg/classification/db/recipes/google_cloud_spanner.json diff --git a/internal/classification/db/recipes/google_cloud_storage.json b/pkg/classification/db/recipes/google_cloud_storage.json similarity index 100% rename from internal/classification/db/recipes/google_cloud_storage.json rename to pkg/classification/db/recipes/google_cloud_storage.json diff --git a/internal/classification/db/recipes/google_maps.json b/pkg/classification/db/recipes/google_maps.json similarity index 100% rename from internal/classification/db/recipes/google_maps.json rename to pkg/classification/db/recipes/google_maps.json diff --git a/internal/classification/db/recipes/google_recaptcha.json b/pkg/classification/db/recipes/google_recaptcha.json similarity index 100% rename from internal/classification/db/recipes/google_recaptcha.json rename to pkg/classification/db/recipes/google_recaptcha.json diff --git a/internal/classification/db/recipes/google_service_apis.json b/pkg/classification/db/recipes/google_service_apis.json similarity index 100% rename from internal/classification/db/recipes/google_service_apis.json rename to pkg/classification/db/recipes/google_service_apis.json diff --git a/internal/classification/db/recipes/google_spreadsheets.json b/pkg/classification/db/recipes/google_spreadsheets.json similarity index 100% rename from internal/classification/db/recipes/google_spreadsheets.json rename to pkg/classification/db/recipes/google_spreadsheets.json diff --git a/internal/classification/db/recipes/google_tag_manager.json b/pkg/classification/db/recipes/google_tag_manager.json similarity index 100% rename from internal/classification/db/recipes/google_tag_manager.json rename to pkg/classification/db/recipes/google_tag_manager.json diff --git a/internal/classification/db/recipes/google_workspace_apis.json b/pkg/classification/db/recipes/google_workspace_apis.json similarity index 100% rename from internal/classification/db/recipes/google_workspace_apis.json rename to pkg/classification/db/recipes/google_workspace_apis.json diff --git a/internal/classification/db/recipes/gouv_fr_data.json b/pkg/classification/db/recipes/gouv_fr_data.json similarity index 100% rename from internal/classification/db/recipes/gouv_fr_data.json rename to pkg/classification/db/recipes/gouv_fr_data.json diff --git a/internal/classification/db/recipes/gravatar.json b/pkg/classification/db/recipes/gravatar.json similarity index 100% rename from internal/classification/db/recipes/gravatar.json rename to pkg/classification/db/recipes/gravatar.json diff --git a/internal/classification/db/recipes/gravity_payments.json b/pkg/classification/db/recipes/gravity_payments.json similarity index 100% rename from internal/classification/db/recipes/gravity_payments.json rename to pkg/classification/db/recipes/gravity_payments.json diff --git a/internal/classification/db/recipes/greenhouse.json b/pkg/classification/db/recipes/greenhouse.json similarity index 100% rename from internal/classification/db/recipes/greenhouse.json rename to pkg/classification/db/recipes/greenhouse.json diff --git a/internal/classification/db/recipes/hashicorp_vault.json b/pkg/classification/db/recipes/hashicorp_vault.json similarity index 100% rename from internal/classification/db/recipes/hashicorp_vault.json rename to pkg/classification/db/recipes/hashicorp_vault.json diff --git a/internal/classification/db/recipes/have_i_been_pwned.json b/pkg/classification/db/recipes/have_i_been_pwned.json similarity index 100% rename from internal/classification/db/recipes/have_i_been_pwned.json rename to pkg/classification/db/recipes/have_i_been_pwned.json diff --git a/internal/classification/db/recipes/heap.json b/pkg/classification/db/recipes/heap.json similarity index 100% rename from internal/classification/db/recipes/heap.json rename to pkg/classification/db/recipes/heap.json diff --git a/internal/classification/db/recipes/hellosign.json b/pkg/classification/db/recipes/hellosign.json similarity index 100% rename from internal/classification/db/recipes/hellosign.json rename to pkg/classification/db/recipes/hellosign.json diff --git a/internal/classification/db/recipes/heroku.json b/pkg/classification/db/recipes/heroku.json similarity index 100% rename from internal/classification/db/recipes/heroku.json rename to pkg/classification/db/recipes/heroku.json diff --git a/internal/classification/db/recipes/hiscox.json b/pkg/classification/db/recipes/hiscox.json similarity index 100% rename from internal/classification/db/recipes/hiscox.json rename to pkg/classification/db/recipes/hiscox.json diff --git a/internal/classification/db/recipes/hmrc_gov_uk.json b/pkg/classification/db/recipes/hmrc_gov_uk.json similarity index 100% rename from internal/classification/db/recipes/hmrc_gov_uk.json rename to pkg/classification/db/recipes/hmrc_gov_uk.json diff --git a/internal/classification/db/recipes/honeybadger.json b/pkg/classification/db/recipes/honeybadger.json similarity index 100% rename from internal/classification/db/recipes/honeybadger.json rename to pkg/classification/db/recipes/honeybadger.json diff --git a/internal/classification/db/recipes/hotjar.json b/pkg/classification/db/recipes/hotjar.json similarity index 100% rename from internal/classification/db/recipes/hotjar.json rename to pkg/classification/db/recipes/hotjar.json diff --git a/internal/classification/db/recipes/hubspot.json b/pkg/classification/db/recipes/hubspot.json similarity index 100% rename from internal/classification/db/recipes/hubspot.json rename to pkg/classification/db/recipes/hubspot.json diff --git a/internal/classification/db/recipes/hugging_face.json b/pkg/classification/db/recipes/hugging_face.json similarity index 100% rename from internal/classification/db/recipes/hugging_face.json rename to pkg/classification/db/recipes/hugging_face.json diff --git a/internal/classification/db/recipes/hunter.json b/pkg/classification/db/recipes/hunter.json similarity index 100% rename from internal/classification/db/recipes/hunter.json rename to pkg/classification/db/recipes/hunter.json diff --git a/internal/classification/db/recipes/hypersql.json b/pkg/classification/db/recipes/hypersql.json similarity index 100% rename from internal/classification/db/recipes/hypersql.json rename to pkg/classification/db/recipes/hypersql.json diff --git a/internal/classification/db/recipes/iagility.json b/pkg/classification/db/recipes/iagility.json similarity index 100% rename from internal/classification/db/recipes/iagility.json rename to pkg/classification/db/recipes/iagility.json diff --git a/internal/classification/db/recipes/iban.json b/pkg/classification/db/recipes/iban.json similarity index 100% rename from internal/classification/db/recipes/iban.json rename to pkg/classification/db/recipes/iban.json diff --git a/internal/classification/db/recipes/ibm_db2.json b/pkg/classification/db/recipes/ibm_db2.json similarity index 100% rename from internal/classification/db/recipes/ibm_db2.json rename to pkg/classification/db/recipes/ibm_db2.json diff --git a/internal/classification/db/recipes/iceberg_technology.json b/pkg/classification/db/recipes/iceberg_technology.json similarity index 100% rename from internal/classification/db/recipes/iceberg_technology.json rename to pkg/classification/db/recipes/iceberg_technology.json diff --git a/internal/classification/db/recipes/influxdb.json b/pkg/classification/db/recipes/influxdb.json similarity index 100% rename from internal/classification/db/recipes/influxdb.json rename to pkg/classification/db/recipes/influxdb.json diff --git a/internal/classification/db/recipes/instagram.json b/pkg/classification/db/recipes/instagram.json similarity index 100% rename from internal/classification/db/recipes/instagram.json rename to pkg/classification/db/recipes/instagram.json diff --git a/internal/classification/db/recipes/instana.json b/pkg/classification/db/recipes/instana.json similarity index 100% rename from internal/classification/db/recipes/instana.json rename to pkg/classification/db/recipes/instana.json diff --git a/internal/classification/db/recipes/intercom.json b/pkg/classification/db/recipes/intercom.json similarity index 100% rename from internal/classification/db/recipes/intercom.json rename to pkg/classification/db/recipes/intercom.json diff --git a/internal/classification/db/recipes/intuit.json b/pkg/classification/db/recipes/intuit.json similarity index 100% rename from internal/classification/db/recipes/intuit.json rename to pkg/classification/db/recipes/intuit.json diff --git a/internal/classification/db/recipes/ipdata.json b/pkg/classification/db/recipes/ipdata.json similarity index 100% rename from internal/classification/db/recipes/ipdata.json rename to pkg/classification/db/recipes/ipdata.json diff --git a/internal/classification/db/recipes/ipify_org.json b/pkg/classification/db/recipes/ipify_org.json similarity index 100% rename from internal/classification/db/recipes/ipify_org.json rename to pkg/classification/db/recipes/ipify_org.json diff --git a/internal/classification/db/recipes/ipregistry.json b/pkg/classification/db/recipes/ipregistry.json similarity index 100% rename from internal/classification/db/recipes/ipregistry.json rename to pkg/classification/db/recipes/ipregistry.json diff --git a/internal/classification/db/recipes/iproov.json b/pkg/classification/db/recipes/iproov.json similarity index 100% rename from internal/classification/db/recipes/iproov.json rename to pkg/classification/db/recipes/iproov.json diff --git a/internal/classification/db/recipes/ipstack.json b/pkg/classification/db/recipes/ipstack.json similarity index 100% rename from internal/classification/db/recipes/ipstack.json rename to pkg/classification/db/recipes/ipstack.json diff --git a/internal/classification/db/recipes/iris_openbooks_freeagent.json b/pkg/classification/db/recipes/iris_openbooks_freeagent.json similarity index 100% rename from internal/classification/db/recipes/iris_openbooks_freeagent.json rename to pkg/classification/db/recipes/iris_openbooks_freeagent.json diff --git a/internal/classification/db/recipes/izberg_marketplace.json b/pkg/classification/db/recipes/izberg_marketplace.json similarity index 100% rename from internal/classification/db/recipes/izberg_marketplace.json rename to pkg/classification/db/recipes/izberg_marketplace.json diff --git a/internal/classification/db/recipes/jfrog.json b/pkg/classification/db/recipes/jfrog.json similarity index 100% rename from internal/classification/db/recipes/jfrog.json rename to pkg/classification/db/recipes/jfrog.json diff --git a/internal/classification/db/recipes/jsdelivr.json b/pkg/classification/db/recipes/jsdelivr.json similarity index 100% rename from internal/classification/db/recipes/jsdelivr.json rename to pkg/classification/db/recipes/jsdelivr.json diff --git a/internal/classification/db/recipes/jumio.json b/pkg/classification/db/recipes/jumio.json similarity index 100% rename from internal/classification/db/recipes/jumio.json rename to pkg/classification/db/recipes/jumio.json diff --git a/internal/classification/db/recipes/klarna.json b/pkg/classification/db/recipes/klarna.json similarity index 100% rename from internal/classification/db/recipes/klarna.json rename to pkg/classification/db/recipes/klarna.json diff --git a/internal/classification/db/recipes/la_poste.json b/pkg/classification/db/recipes/la_poste.json similarity index 100% rename from internal/classification/db/recipes/la_poste.json rename to pkg/classification/db/recipes/la_poste.json diff --git a/internal/classification/db/recipes/launchdarkly.json b/pkg/classification/db/recipes/launchdarkly.json similarity index 100% rename from internal/classification/db/recipes/launchdarkly.json rename to pkg/classification/db/recipes/launchdarkly.json diff --git a/internal/classification/db/recipes/lengow.json b/pkg/classification/db/recipes/lengow.json similarity index 100% rename from internal/classification/db/recipes/lengow.json rename to pkg/classification/db/recipes/lengow.json diff --git a/internal/classification/db/recipes/lets_enhance.json b/pkg/classification/db/recipes/lets_enhance.json similarity index 100% rename from internal/classification/db/recipes/lets_enhance.json rename to pkg/classification/db/recipes/lets_enhance.json diff --git a/internal/classification/db/recipes/leveldb.json b/pkg/classification/db/recipes/leveldb.json similarity index 100% rename from internal/classification/db/recipes/leveldb.json rename to pkg/classification/db/recipes/leveldb.json diff --git a/internal/classification/db/recipes/lever.json b/pkg/classification/db/recipes/lever.json similarity index 100% rename from internal/classification/db/recipes/lever.json rename to pkg/classification/db/recipes/lever.json diff --git a/internal/classification/db/recipes/lightstep.json b/pkg/classification/db/recipes/lightstep.json similarity index 100% rename from internal/classification/db/recipes/lightstep.json rename to pkg/classification/db/recipes/lightstep.json diff --git a/internal/classification/db/recipes/linkedin.json b/pkg/classification/db/recipes/linkedin.json similarity index 100% rename from internal/classification/db/recipes/linkedin.json rename to pkg/classification/db/recipes/linkedin.json diff --git a/internal/classification/db/recipes/liquid_web_cloud_apis.json b/pkg/classification/db/recipes/liquid_web_cloud_apis.json similarity index 100% rename from internal/classification/db/recipes/liquid_web_cloud_apis.json rename to pkg/classification/db/recipes/liquid_web_cloud_apis.json diff --git a/internal/classification/db/recipes/logrocket.json b/pkg/classification/db/recipes/logrocket.json similarity index 100% rename from internal/classification/db/recipes/logrocket.json rename to pkg/classification/db/recipes/logrocket.json diff --git a/internal/classification/db/recipes/logz_io.json b/pkg/classification/db/recipes/logz_io.json similarity index 100% rename from internal/classification/db/recipes/logz_io.json rename to pkg/classification/db/recipes/logz_io.json diff --git a/internal/classification/db/recipes/mabaya.json b/pkg/classification/db/recipes/mabaya.json similarity index 100% rename from internal/classification/db/recipes/mabaya.json rename to pkg/classification/db/recipes/mabaya.json diff --git a/internal/classification/db/recipes/mailchimp.json b/pkg/classification/db/recipes/mailchimp.json similarity index 100% rename from internal/classification/db/recipes/mailchimp.json rename to pkg/classification/db/recipes/mailchimp.json diff --git a/internal/classification/db/recipes/mailjet.json b/pkg/classification/db/recipes/mailjet.json similarity index 100% rename from internal/classification/db/recipes/mailjet.json rename to pkg/classification/db/recipes/mailjet.json diff --git a/internal/classification/db/recipes/mangopay.json b/pkg/classification/db/recipes/mangopay.json similarity index 100% rename from internal/classification/db/recipes/mangopay.json rename to pkg/classification/db/recipes/mangopay.json diff --git a/internal/classification/db/recipes/mapbox.json b/pkg/classification/db/recipes/mapbox.json similarity index 100% rename from internal/classification/db/recipes/mapbox.json rename to pkg/classification/db/recipes/mapbox.json diff --git a/internal/classification/db/recipes/mariadb.json b/pkg/classification/db/recipes/mariadb.json similarity index 100% rename from internal/classification/db/recipes/mariadb.json rename to pkg/classification/db/recipes/mariadb.json diff --git a/internal/classification/db/recipes/marketo.json b/pkg/classification/db/recipes/marketo.json similarity index 100% rename from internal/classification/db/recipes/marketo.json rename to pkg/classification/db/recipes/marketo.json diff --git a/internal/classification/db/recipes/maxmind.json b/pkg/classification/db/recipes/maxmind.json similarity index 100% rename from internal/classification/db/recipes/maxmind.json rename to pkg/classification/db/recipes/maxmind.json diff --git a/internal/classification/db/recipes/memcached.json b/pkg/classification/db/recipes/memcached.json similarity index 100% rename from internal/classification/db/recipes/memcached.json rename to pkg/classification/db/recipes/memcached.json diff --git a/internal/classification/db/recipes/message_bus.json b/pkg/classification/db/recipes/message_bus.json similarity index 100% rename from internal/classification/db/recipes/message_bus.json rename to pkg/classification/db/recipes/message_bus.json diff --git a/internal/classification/db/recipes/mettle.json b/pkg/classification/db/recipes/mettle.json similarity index 100% rename from internal/classification/db/recipes/mettle.json rename to pkg/classification/db/recipes/mettle.json diff --git a/internal/classification/db/recipes/microsoft.json b/pkg/classification/db/recipes/microsoft.json similarity index 100% rename from internal/classification/db/recipes/microsoft.json rename to pkg/classification/db/recipes/microsoft.json diff --git a/internal/classification/db/recipes/microsoft_azure_apis.json b/pkg/classification/db/recipes/microsoft_azure_apis.json similarity index 100% rename from internal/classification/db/recipes/microsoft_azure_apis.json rename to pkg/classification/db/recipes/microsoft_azure_apis.json diff --git a/internal/classification/db/recipes/microsoft_sql_server.json b/pkg/classification/db/recipes/microsoft_sql_server.json similarity index 100% rename from internal/classification/db/recipes/microsoft_sql_server.json rename to pkg/classification/db/recipes/microsoft_sql_server.json diff --git a/internal/classification/db/recipes/microsoft_teams.json b/pkg/classification/db/recipes/microsoft_teams.json similarity index 100% rename from internal/classification/db/recipes/microsoft_teams.json rename to pkg/classification/db/recipes/microsoft_teams.json diff --git a/internal/classification/db/recipes/mirakl.json b/pkg/classification/db/recipes/mirakl.json similarity index 100% rename from internal/classification/db/recipes/mirakl.json rename to pkg/classification/db/recipes/mirakl.json diff --git a/internal/classification/db/recipes/mixpanel.json b/pkg/classification/db/recipes/mixpanel.json similarity index 100% rename from internal/classification/db/recipes/mixpanel.json rename to pkg/classification/db/recipes/mixpanel.json diff --git a/internal/classification/db/recipes/monday.json b/pkg/classification/db/recipes/monday.json similarity index 100% rename from internal/classification/db/recipes/monday.json rename to pkg/classification/db/recipes/monday.json diff --git a/internal/classification/db/recipes/mondial_relay.json b/pkg/classification/db/recipes/mondial_relay.json similarity index 100% rename from internal/classification/db/recipes/mondial_relay.json rename to pkg/classification/db/recipes/mondial_relay.json diff --git a/internal/classification/db/recipes/mongodb.json b/pkg/classification/db/recipes/mongodb.json similarity index 100% rename from internal/classification/db/recipes/mongodb.json rename to pkg/classification/db/recipes/mongodb.json diff --git a/internal/classification/db/recipes/mux.json b/pkg/classification/db/recipes/mux.json similarity index 100% rename from internal/classification/db/recipes/mux.json rename to pkg/classification/db/recipes/mux.json diff --git a/internal/classification/db/recipes/mysql.json b/pkg/classification/db/recipes/mysql.json similarity index 100% rename from internal/classification/db/recipes/mysql.json rename to pkg/classification/db/recipes/mysql.json diff --git a/internal/classification/db/recipes/name_com.json b/pkg/classification/db/recipes/name_com.json similarity index 100% rename from internal/classification/db/recipes/name_com.json rename to pkg/classification/db/recipes/name_com.json diff --git a/internal/classification/db/recipes/namesilo.json b/pkg/classification/db/recipes/namesilo.json similarity index 100% rename from internal/classification/db/recipes/namesilo.json rename to pkg/classification/db/recipes/namesilo.json diff --git a/internal/classification/db/recipes/nativex_mobvista.json b/pkg/classification/db/recipes/nativex_mobvista.json similarity index 100% rename from internal/classification/db/recipes/nativex_mobvista.json rename to pkg/classification/db/recipes/nativex_mobvista.json diff --git a/internal/classification/db/recipes/neo4j.json b/pkg/classification/db/recipes/neo4j.json similarity index 100% rename from internal/classification/db/recipes/neo4j.json rename to pkg/classification/db/recipes/neo4j.json diff --git a/internal/classification/db/recipes/nethunt_crm.json b/pkg/classification/db/recipes/nethunt_crm.json similarity index 100% rename from internal/classification/db/recipes/nethunt_crm.json rename to pkg/classification/db/recipes/nethunt_crm.json diff --git a/internal/classification/db/recipes/netlify.json b/pkg/classification/db/recipes/netlify.json similarity index 100% rename from internal/classification/db/recipes/netlify.json rename to pkg/classification/db/recipes/netlify.json diff --git a/internal/classification/db/recipes/new_relic.json b/pkg/classification/db/recipes/new_relic.json similarity index 100% rename from internal/classification/db/recipes/new_relic.json rename to pkg/classification/db/recipes/new_relic.json diff --git a/internal/classification/db/recipes/nightfall.json b/pkg/classification/db/recipes/nightfall.json similarity index 100% rename from internal/classification/db/recipes/nightfall.json rename to pkg/classification/db/recipes/nightfall.json diff --git a/internal/classification/db/recipes/nimble.json b/pkg/classification/db/recipes/nimble.json similarity index 100% rename from internal/classification/db/recipes/nimble.json rename to pkg/classification/db/recipes/nimble.json diff --git a/internal/classification/db/recipes/nodemailer.json b/pkg/classification/db/recipes/nodemailer.json similarity index 100% rename from internal/classification/db/recipes/nodemailer.json rename to pkg/classification/db/recipes/nodemailer.json diff --git a/internal/classification/db/recipes/nuxeo.json b/pkg/classification/db/recipes/nuxeo.json similarity index 100% rename from internal/classification/db/recipes/nuxeo.json rename to pkg/classification/db/recipes/nuxeo.json diff --git a/internal/classification/db/recipes/nylas.json b/pkg/classification/db/recipes/nylas.json similarity index 100% rename from internal/classification/db/recipes/nylas.json rename to pkg/classification/db/recipes/nylas.json diff --git a/internal/classification/db/recipes/ocrolus.json b/pkg/classification/db/recipes/ocrolus.json similarity index 100% rename from internal/classification/db/recipes/ocrolus.json rename to pkg/classification/db/recipes/ocrolus.json diff --git a/internal/classification/db/recipes/okta.json b/pkg/classification/db/recipes/okta.json similarity index 100% rename from internal/classification/db/recipes/okta.json rename to pkg/classification/db/recipes/okta.json diff --git a/internal/classification/db/recipes/oney.json b/pkg/classification/db/recipes/oney.json similarity index 100% rename from internal/classification/db/recipes/oney.json rename to pkg/classification/db/recipes/oney.json diff --git a/internal/classification/db/recipes/onfido.json b/pkg/classification/db/recipes/onfido.json similarity index 100% rename from internal/classification/db/recipes/onfido.json rename to pkg/classification/db/recipes/onfido.json diff --git a/internal/classification/db/recipes/openai.json b/pkg/classification/db/recipes/openai.json similarity index 100% rename from internal/classification/db/recipes/openai.json rename to pkg/classification/db/recipes/openai.json diff --git a/internal/classification/db/recipes/openstack_object_storage.json b/pkg/classification/db/recipes/openstack_object_storage.json similarity index 100% rename from internal/classification/db/recipes/openstack_object_storage.json rename to pkg/classification/db/recipes/openstack_object_storage.json diff --git a/internal/classification/db/recipes/opentok.json b/pkg/classification/db/recipes/opentok.json similarity index 100% rename from internal/classification/db/recipes/opentok.json rename to pkg/classification/db/recipes/opentok.json diff --git a/internal/classification/db/recipes/openweather.json b/pkg/classification/db/recipes/openweather.json similarity index 100% rename from internal/classification/db/recipes/openweather.json rename to pkg/classification/db/recipes/openweather.json diff --git a/internal/classification/db/recipes/optimizely.json b/pkg/classification/db/recipes/optimizely.json similarity index 100% rename from internal/classification/db/recipes/optimizely.json rename to pkg/classification/db/recipes/optimizely.json diff --git a/internal/classification/db/recipes/oracle.json b/pkg/classification/db/recipes/oracle.json similarity index 100% rename from internal/classification/db/recipes/oracle.json rename to pkg/classification/db/recipes/oracle.json diff --git a/internal/classification/db/recipes/ovh_cloud_apis.json b/pkg/classification/db/recipes/ovh_cloud_apis.json similarity index 100% rename from internal/classification/db/recipes/ovh_cloud_apis.json rename to pkg/classification/db/recipes/ovh_cloud_apis.json diff --git a/internal/classification/db/recipes/ozone_open_banking_sandbox.json b/pkg/classification/db/recipes/ozone_open_banking_sandbox.json similarity index 100% rename from internal/classification/db/recipes/ozone_open_banking_sandbox.json rename to pkg/classification/db/recipes/ozone_open_banking_sandbox.json diff --git a/internal/classification/db/recipes/pagerduty.json b/pkg/classification/db/recipes/pagerduty.json similarity index 100% rename from internal/classification/db/recipes/pagerduty.json rename to pkg/classification/db/recipes/pagerduty.json diff --git a/internal/classification/db/recipes/pandadoc.json b/pkg/classification/db/recipes/pandadoc.json similarity index 100% rename from internal/classification/db/recipes/pandadoc.json rename to pkg/classification/db/recipes/pandadoc.json diff --git a/internal/classification/db/recipes/payfit.json b/pkg/classification/db/recipes/payfit.json similarity index 100% rename from internal/classification/db/recipes/payfit.json rename to pkg/classification/db/recipes/payfit.json diff --git a/internal/classification/db/recipes/payline.json b/pkg/classification/db/recipes/payline.json similarity index 100% rename from internal/classification/db/recipes/payline.json rename to pkg/classification/db/recipes/payline.json diff --git a/internal/classification/db/recipes/paylocity.json b/pkg/classification/db/recipes/paylocity.json similarity index 100% rename from internal/classification/db/recipes/paylocity.json rename to pkg/classification/db/recipes/paylocity.json diff --git a/internal/classification/db/recipes/payoneer.json b/pkg/classification/db/recipes/payoneer.json similarity index 100% rename from internal/classification/db/recipes/payoneer.json rename to pkg/classification/db/recipes/payoneer.json diff --git a/internal/classification/db/recipes/paypal.json b/pkg/classification/db/recipes/paypal.json similarity index 100% rename from internal/classification/db/recipes/paypal.json rename to pkg/classification/db/recipes/paypal.json diff --git a/internal/classification/db/recipes/payu.json b/pkg/classification/db/recipes/payu.json similarity index 100% rename from internal/classification/db/recipes/payu.json rename to pkg/classification/db/recipes/payu.json diff --git a/internal/classification/db/recipes/phrase.json b/pkg/classification/db/recipes/phrase.json similarity index 100% rename from internal/classification/db/recipes/phrase.json rename to pkg/classification/db/recipes/phrase.json diff --git a/internal/classification/db/recipes/pipedrive.json b/pkg/classification/db/recipes/pipedrive.json similarity index 100% rename from internal/classification/db/recipes/pipedrive.json rename to pkg/classification/db/recipes/pipedrive.json diff --git a/internal/classification/db/recipes/pipeliner.json b/pkg/classification/db/recipes/pipeliner.json similarity index 100% rename from internal/classification/db/recipes/pipeliner.json rename to pkg/classification/db/recipes/pipeliner.json diff --git a/internal/classification/db/recipes/plaid.json b/pkg/classification/db/recipes/plaid.json similarity index 100% rename from internal/classification/db/recipes/plaid.json rename to pkg/classification/db/recipes/plaid.json diff --git a/internal/classification/db/recipes/porkbun.json b/pkg/classification/db/recipes/porkbun.json similarity index 100% rename from internal/classification/db/recipes/porkbun.json rename to pkg/classification/db/recipes/porkbun.json diff --git a/internal/classification/db/recipes/postgresql.json b/pkg/classification/db/recipes/postgresql.json similarity index 100% rename from internal/classification/db/recipes/postgresql.json rename to pkg/classification/db/recipes/postgresql.json diff --git a/internal/classification/db/recipes/posthog.json b/pkg/classification/db/recipes/posthog.json similarity index 100% rename from internal/classification/db/recipes/posthog.json rename to pkg/classification/db/recipes/posthog.json diff --git a/internal/classification/db/recipes/postmark.json b/pkg/classification/db/recipes/postmark.json similarity index 100% rename from internal/classification/db/recipes/postmark.json rename to pkg/classification/db/recipes/postmark.json diff --git a/internal/classification/db/recipes/prestashop.json b/pkg/classification/db/recipes/prestashop.json similarity index 100% rename from internal/classification/db/recipes/prestashop.json rename to pkg/classification/db/recipes/prestashop.json diff --git a/internal/classification/db/recipes/processout.json b/pkg/classification/db/recipes/processout.json similarity index 100% rename from internal/classification/db/recipes/processout.json rename to pkg/classification/db/recipes/processout.json diff --git a/internal/classification/db/recipes/profitbricks_ionos.json b/pkg/classification/db/recipes/profitbricks_ionos.json similarity index 100% rename from internal/classification/db/recipes/profitbricks_ionos.json rename to pkg/classification/db/recipes/profitbricks_ionos.json diff --git a/internal/classification/db/recipes/prometheus.json b/pkg/classification/db/recipes/prometheus.json similarity index 100% rename from internal/classification/db/recipes/prometheus.json rename to pkg/classification/db/recipes/prometheus.json diff --git a/internal/classification/db/recipes/pubnub.json b/pkg/classification/db/recipes/pubnub.json similarity index 100% rename from internal/classification/db/recipes/pubnub.json rename to pkg/classification/db/recipes/pubnub.json diff --git a/internal/classification/db/recipes/pusher.json b/pkg/classification/db/recipes/pusher.json similarity index 100% rename from internal/classification/db/recipes/pusher.json rename to pkg/classification/db/recipes/pusher.json diff --git a/internal/classification/db/recipes/quanta.json b/pkg/classification/db/recipes/quanta.json similarity index 100% rename from internal/classification/db/recipes/quanta.json rename to pkg/classification/db/recipes/quanta.json diff --git a/internal/classification/db/recipes/rabbitmq.json b/pkg/classification/db/recipes/rabbitmq.json similarity index 100% rename from internal/classification/db/recipes/rabbitmq.json rename to pkg/classification/db/recipes/rabbitmq.json diff --git a/internal/classification/db/recipes/rackspace_cloud.json b/pkg/classification/db/recipes/rackspace_cloud.json similarity index 100% rename from internal/classification/db/recipes/rackspace_cloud.json rename to pkg/classification/db/recipes/rackspace_cloud.json diff --git a/internal/classification/db/recipes/raygun.json b/pkg/classification/db/recipes/raygun.json similarity index 100% rename from internal/classification/db/recipes/raygun.json rename to pkg/classification/db/recipes/raygun.json diff --git a/internal/classification/db/recipes/reddit.json b/pkg/classification/db/recipes/reddit.json similarity index 100% rename from internal/classification/db/recipes/reddit.json rename to pkg/classification/db/recipes/reddit.json diff --git a/internal/classification/db/recipes/redis.json b/pkg/classification/db/recipes/redis.json similarity index 100% rename from internal/classification/db/recipes/redis.json rename to pkg/classification/db/recipes/redis.json diff --git a/internal/classification/db/recipes/reportportal.json b/pkg/classification/db/recipes/reportportal.json similarity index 100% rename from internal/classification/db/recipes/reportportal.json rename to pkg/classification/db/recipes/reportportal.json diff --git a/internal/classification/db/recipes/rethinkdb.json b/pkg/classification/db/recipes/rethinkdb.json similarity index 100% rename from internal/classification/db/recipes/rethinkdb.json rename to pkg/classification/db/recipes/rethinkdb.json diff --git a/internal/classification/db/recipes/revolut.json b/pkg/classification/db/recipes/revolut.json similarity index 100% rename from internal/classification/db/recipes/revolut.json rename to pkg/classification/db/recipes/revolut.json diff --git a/internal/classification/db/recipes/rocket_chat.json b/pkg/classification/db/recipes/rocket_chat.json similarity index 100% rename from internal/classification/db/recipes/rocket_chat.json rename to pkg/classification/db/recipes/rocket_chat.json diff --git a/internal/classification/db/recipes/rollbar.json b/pkg/classification/db/recipes/rollbar.json similarity index 100% rename from internal/classification/db/recipes/rollbar.json rename to pkg/classification/db/recipes/rollbar.json diff --git a/internal/classification/db/recipes/runscope.json b/pkg/classification/db/recipes/runscope.json similarity index 100% rename from internal/classification/db/recipes/runscope.json rename to pkg/classification/db/recipes/runscope.json diff --git a/internal/classification/db/recipes/rydoo.json b/pkg/classification/db/recipes/rydoo.json similarity index 100% rename from internal/classification/db/recipes/rydoo.json rename to pkg/classification/db/recipes/rydoo.json diff --git a/internal/classification/db/recipes/sage.json b/pkg/classification/db/recipes/sage.json similarity index 100% rename from internal/classification/db/recipes/sage.json rename to pkg/classification/db/recipes/sage.json diff --git a/internal/classification/db/recipes/sakura.json b/pkg/classification/db/recipes/sakura.json similarity index 100% rename from internal/classification/db/recipes/sakura.json rename to pkg/classification/db/recipes/sakura.json diff --git a/internal/classification/db/recipes/salesforce.json b/pkg/classification/db/recipes/salesforce.json similarity index 100% rename from internal/classification/db/recipes/salesforce.json rename to pkg/classification/db/recipes/salesforce.json diff --git a/internal/classification/db/recipes/sap.json b/pkg/classification/db/recipes/sap.json similarity index 100% rename from internal/classification/db/recipes/sap.json rename to pkg/classification/db/recipes/sap.json diff --git a/internal/classification/db/recipes/sap_hana.json b/pkg/classification/db/recipes/sap_hana.json similarity index 100% rename from internal/classification/db/recipes/sap_hana.json rename to pkg/classification/db/recipes/sap_hana.json diff --git a/internal/classification/db/recipes/satismeter.json b/pkg/classification/db/recipes/satismeter.json similarity index 100% rename from internal/classification/db/recipes/satismeter.json rename to pkg/classification/db/recipes/satismeter.json diff --git a/internal/classification/db/recipes/scaleway_cloud_apis.json b/pkg/classification/db/recipes/scaleway_cloud_apis.json similarity index 100% rename from internal/classification/db/recipes/scaleway_cloud_apis.json rename to pkg/classification/db/recipes/scaleway_cloud_apis.json diff --git a/internal/classification/db/recipes/scalia_ci.json b/pkg/classification/db/recipes/scalia_ci.json similarity index 100% rename from internal/classification/db/recipes/scalia_ci.json rename to pkg/classification/db/recipes/scalia_ci.json diff --git a/internal/classification/db/recipes/scout_apm.json b/pkg/classification/db/recipes/scout_apm.json similarity index 100% rename from internal/classification/db/recipes/scout_apm.json rename to pkg/classification/db/recipes/scout_apm.json diff --git a/internal/classification/db/recipes/seeuletter_mysendingbox.json b/pkg/classification/db/recipes/seeuletter_mysendingbox.json similarity index 100% rename from internal/classification/db/recipes/seeuletter_mysendingbox.json rename to pkg/classification/db/recipes/seeuletter_mysendingbox.json diff --git a/internal/classification/db/recipes/segment.json b/pkg/classification/db/recipes/segment.json similarity index 100% rename from internal/classification/db/recipes/segment.json rename to pkg/classification/db/recipes/segment.json diff --git a/internal/classification/db/recipes/selligent.json b/pkg/classification/db/recipes/selligent.json similarity index 100% rename from internal/classification/db/recipes/selligent.json rename to pkg/classification/db/recipes/selligent.json diff --git a/internal/classification/db/recipes/sendbird.json b/pkg/classification/db/recipes/sendbird.json similarity index 100% rename from internal/classification/db/recipes/sendbird.json rename to pkg/classification/db/recipes/sendbird.json diff --git a/internal/classification/db/recipes/sendgrid.json b/pkg/classification/db/recipes/sendgrid.json similarity index 100% rename from internal/classification/db/recipes/sendgrid.json rename to pkg/classification/db/recipes/sendgrid.json diff --git a/internal/classification/db/recipes/sendinblue.json b/pkg/classification/db/recipes/sendinblue.json similarity index 100% rename from internal/classification/db/recipes/sendinblue.json rename to pkg/classification/db/recipes/sendinblue.json diff --git a/internal/classification/db/recipes/sentry.json b/pkg/classification/db/recipes/sentry.json similarity index 100% rename from internal/classification/db/recipes/sentry.json rename to pkg/classification/db/recipes/sentry.json diff --git a/internal/classification/db/recipes/shipbob.json b/pkg/classification/db/recipes/shipbob.json similarity index 100% rename from internal/classification/db/recipes/shipbob.json rename to pkg/classification/db/recipes/shipbob.json diff --git a/internal/classification/db/recipes/shopify.json b/pkg/classification/db/recipes/shopify.json similarity index 100% rename from internal/classification/db/recipes/shopify.json rename to pkg/classification/db/recipes/shopify.json diff --git a/internal/classification/db/recipes/skyscanner.json b/pkg/classification/db/recipes/skyscanner.json similarity index 100% rename from internal/classification/db/recipes/skyscanner.json rename to pkg/classification/db/recipes/skyscanner.json diff --git a/internal/classification/db/recipes/slack.json b/pkg/classification/db/recipes/slack.json similarity index 100% rename from internal/classification/db/recipes/slack.json rename to pkg/classification/db/recipes/slack.json diff --git a/internal/classification/db/recipes/small_improvements.json b/pkg/classification/db/recipes/small_improvements.json similarity index 100% rename from internal/classification/db/recipes/small_improvements.json rename to pkg/classification/db/recipes/small_improvements.json diff --git a/internal/classification/db/recipes/smb.json b/pkg/classification/db/recipes/smb.json similarity index 100% rename from internal/classification/db/recipes/smb.json rename to pkg/classification/db/recipes/smb.json diff --git a/internal/classification/db/recipes/snowflake.json b/pkg/classification/db/recipes/snowflake.json similarity index 100% rename from internal/classification/db/recipes/snowflake.json rename to pkg/classification/db/recipes/snowflake.json diff --git a/internal/classification/db/recipes/societeinfo.json b/pkg/classification/db/recipes/societeinfo.json similarity index 100% rename from internal/classification/db/recipes/societeinfo.json rename to pkg/classification/db/recipes/societeinfo.json diff --git a/internal/classification/db/recipes/socket_io.json b/pkg/classification/db/recipes/socket_io.json similarity index 100% rename from internal/classification/db/recipes/socket_io.json rename to pkg/classification/db/recipes/socket_io.json diff --git a/internal/classification/db/recipes/softlayer_ibm_cloud.json b/pkg/classification/db/recipes/softlayer_ibm_cloud.json similarity index 100% rename from internal/classification/db/recipes/softlayer_ibm_cloud.json rename to pkg/classification/db/recipes/softlayer_ibm_cloud.json diff --git a/internal/classification/db/recipes/solocal_bridge.json b/pkg/classification/db/recipes/solocal_bridge.json similarity index 100% rename from internal/classification/db/recipes/solocal_bridge.json rename to pkg/classification/db/recipes/solocal_bridge.json diff --git a/internal/classification/db/recipes/splunk.json b/pkg/classification/db/recipes/splunk.json similarity index 100% rename from internal/classification/db/recipes/splunk.json rename to pkg/classification/db/recipes/splunk.json diff --git a/internal/classification/db/recipes/sqlite.json b/pkg/classification/db/recipes/sqlite.json similarity index 100% rename from internal/classification/db/recipes/sqlite.json rename to pkg/classification/db/recipes/sqlite.json diff --git a/internal/classification/db/recipes/sqreen_datadog.json b/pkg/classification/db/recipes/sqreen_datadog.json similarity index 100% rename from internal/classification/db/recipes/sqreen_datadog.json rename to pkg/classification/db/recipes/sqreen_datadog.json diff --git a/internal/classification/db/recipes/square.json b/pkg/classification/db/recipes/square.json similarity index 100% rename from internal/classification/db/recipes/square.json rename to pkg/classification/db/recipes/square.json diff --git a/internal/classification/db/recipes/stackify.json b/pkg/classification/db/recipes/stackify.json similarity index 100% rename from internal/classification/db/recipes/stackify.json rename to pkg/classification/db/recipes/stackify.json diff --git a/internal/classification/db/recipes/statuspage.json b/pkg/classification/db/recipes/statuspage.json similarity index 100% rename from internal/classification/db/recipes/statuspage.json rename to pkg/classification/db/recipes/statuspage.json diff --git a/internal/classification/db/recipes/stripe.json b/pkg/classification/db/recipes/stripe.json similarity index 100% rename from internal/classification/db/recipes/stripe.json rename to pkg/classification/db/recipes/stripe.json diff --git a/internal/classification/db/recipes/tanker.json b/pkg/classification/db/recipes/tanker.json similarity index 100% rename from internal/classification/db/recipes/tanker.json rename to pkg/classification/db/recipes/tanker.json diff --git a/internal/classification/db/recipes/telegram.json b/pkg/classification/db/recipes/telegram.json similarity index 100% rename from internal/classification/db/recipes/telegram.json rename to pkg/classification/db/recipes/telegram.json diff --git a/internal/classification/db/recipes/tencent_cloud_apis.json b/pkg/classification/db/recipes/tencent_cloud_apis.json similarity index 100% rename from internal/classification/db/recipes/tencent_cloud_apis.json rename to pkg/classification/db/recipes/tencent_cloud_apis.json diff --git a/internal/classification/db/recipes/thunes_limonethik.json b/pkg/classification/db/recipes/thunes_limonethik.json similarity index 100% rename from internal/classification/db/recipes/thunes_limonethik.json rename to pkg/classification/db/recipes/thunes_limonethik.json diff --git a/internal/classification/db/recipes/tide.json b/pkg/classification/db/recipes/tide.json similarity index 100% rename from internal/classification/db/recipes/tide.json rename to pkg/classification/db/recipes/tide.json diff --git a/internal/classification/db/recipes/tidelift.json b/pkg/classification/db/recipes/tidelift.json similarity index 100% rename from internal/classification/db/recipes/tidelift.json rename to pkg/classification/db/recipes/tidelift.json diff --git a/internal/classification/db/recipes/tradier.json b/pkg/classification/db/recipes/tradier.json similarity index 100% rename from internal/classification/db/recipes/tradier.json rename to pkg/classification/db/recipes/tradier.json diff --git a/internal/classification/db/recipes/trafficvance.json b/pkg/classification/db/recipes/trafficvance.json similarity index 100% rename from internal/classification/db/recipes/trafficvance.json rename to pkg/classification/db/recipes/trafficvance.json diff --git a/internal/classification/db/recipes/travefy.json b/pkg/classification/db/recipes/travefy.json similarity index 100% rename from internal/classification/db/recipes/travefy.json rename to pkg/classification/db/recipes/travefy.json diff --git a/internal/classification/db/recipes/travis_ci.json b/pkg/classification/db/recipes/travis_ci.json similarity index 100% rename from internal/classification/db/recipes/travis_ci.json rename to pkg/classification/db/recipes/travis_ci.json diff --git a/internal/classification/db/recipes/treezor.json b/pkg/classification/db/recipes/treezor.json similarity index 100% rename from internal/classification/db/recipes/treezor.json rename to pkg/classification/db/recipes/treezor.json diff --git a/internal/classification/db/recipes/trello.json b/pkg/classification/db/recipes/trello.json similarity index 100% rename from internal/classification/db/recipes/trello.json rename to pkg/classification/db/recipes/trello.json diff --git a/internal/classification/db/recipes/twilio.json b/pkg/classification/db/recipes/twilio.json similarity index 100% rename from internal/classification/db/recipes/twilio.json rename to pkg/classification/db/recipes/twilio.json diff --git a/internal/classification/db/recipes/twitter.json b/pkg/classification/db/recipes/twitter.json similarity index 100% rename from internal/classification/db/recipes/twitter.json rename to pkg/classification/db/recipes/twitter.json diff --git a/internal/classification/db/recipes/typeform.json b/pkg/classification/db/recipes/typeform.json similarity index 100% rename from internal/classification/db/recipes/typeform.json rename to pkg/classification/db/recipes/typeform.json diff --git a/internal/classification/db/recipes/unidentified_data_store.json b/pkg/classification/db/recipes/unidentified_data_store.json similarity index 100% rename from internal/classification/db/recipes/unidentified_data_store.json rename to pkg/classification/db/recipes/unidentified_data_store.json diff --git a/internal/classification/db/recipes/unsplash.json b/pkg/classification/db/recipes/unsplash.json similarity index 100% rename from internal/classification/db/recipes/unsplash.json rename to pkg/classification/db/recipes/unsplash.json diff --git a/internal/classification/db/recipes/uploadecare.json b/pkg/classification/db/recipes/uploadecare.json similarity index 100% rename from internal/classification/db/recipes/uploadecare.json rename to pkg/classification/db/recipes/uploadecare.json diff --git a/internal/classification/db/recipes/uptrends.json b/pkg/classification/db/recipes/uptrends.json similarity index 100% rename from internal/classification/db/recipes/uptrends.json rename to pkg/classification/db/recipes/uptrends.json diff --git a/internal/classification/db/recipes/userlike_com.json b/pkg/classification/db/recipes/userlike_com.json similarity index 100% rename from internal/classification/db/recipes/userlike_com.json rename to pkg/classification/db/recipes/userlike_com.json diff --git a/internal/classification/db/recipes/usersnap.json b/pkg/classification/db/recipes/usersnap.json similarity index 100% rename from internal/classification/db/recipes/usersnap.json rename to pkg/classification/db/recipes/usersnap.json diff --git a/internal/classification/db/recipes/vercel.json b/pkg/classification/db/recipes/vercel.json similarity index 100% rename from internal/classification/db/recipes/vercel.json rename to pkg/classification/db/recipes/vercel.json diff --git a/internal/classification/db/recipes/vero.json b/pkg/classification/db/recipes/vero.json similarity index 100% rename from internal/classification/db/recipes/vero.json rename to pkg/classification/db/recipes/vero.json diff --git a/internal/classification/db/recipes/victorops_splunk.json b/pkg/classification/db/recipes/victorops_splunk.json similarity index 100% rename from internal/classification/db/recipes/victorops_splunk.json rename to pkg/classification/db/recipes/victorops_splunk.json diff --git a/internal/classification/db/recipes/vonage.json b/pkg/classification/db/recipes/vonage.json similarity index 100% rename from internal/classification/db/recipes/vonage.json rename to pkg/classification/db/recipes/vonage.json diff --git a/internal/classification/db/recipes/wistia.json b/pkg/classification/db/recipes/wistia.json similarity index 100% rename from internal/classification/db/recipes/wistia.json rename to pkg/classification/db/recipes/wistia.json diff --git a/internal/classification/db/recipes/wordnik.json b/pkg/classification/db/recipes/wordnik.json similarity index 100% rename from internal/classification/db/recipes/wordnik.json rename to pkg/classification/db/recipes/wordnik.json diff --git a/internal/classification/db/recipes/wordpress.json b/pkg/classification/db/recipes/wordpress.json similarity index 100% rename from internal/classification/db/recipes/wordpress.json rename to pkg/classification/db/recipes/wordpress.json diff --git a/internal/classification/db/recipes/workos.json b/pkg/classification/db/recipes/workos.json similarity index 100% rename from internal/classification/db/recipes/workos.json rename to pkg/classification/db/recipes/workos.json diff --git a/internal/classification/db/recipes/wrike.json b/pkg/classification/db/recipes/wrike.json similarity index 100% rename from internal/classification/db/recipes/wrike.json rename to pkg/classification/db/recipes/wrike.json diff --git a/internal/classification/db/recipes/xero.json b/pkg/classification/db/recipes/xero.json similarity index 100% rename from internal/classification/db/recipes/xero.json rename to pkg/classification/db/recipes/xero.json diff --git a/internal/classification/db/recipes/xignite.json b/pkg/classification/db/recipes/xignite.json similarity index 100% rename from internal/classification/db/recipes/xignite.json rename to pkg/classification/db/recipes/xignite.json diff --git a/internal/classification/db/recipes/yandex_cloud_apis.json b/pkg/classification/db/recipes/yandex_cloud_apis.json similarity index 100% rename from internal/classification/db/recipes/yandex_cloud_apis.json rename to pkg/classification/db/recipes/yandex_cloud_apis.json diff --git a/internal/classification/db/recipes/yodlee.json b/pkg/classification/db/recipes/yodlee.json similarity index 100% rename from internal/classification/db/recipes/yodlee.json rename to pkg/classification/db/recipes/yodlee.json diff --git a/internal/classification/db/recipes/youtube.json b/pkg/classification/db/recipes/youtube.json similarity index 100% rename from internal/classification/db/recipes/youtube.json rename to pkg/classification/db/recipes/youtube.json diff --git a/internal/classification/db/recipes/zapier.json b/pkg/classification/db/recipes/zapier.json similarity index 100% rename from internal/classification/db/recipes/zapier.json rename to pkg/classification/db/recipes/zapier.json diff --git a/internal/classification/db/recipes/zendesk.json b/pkg/classification/db/recipes/zendesk.json similarity index 100% rename from internal/classification/db/recipes/zendesk.json rename to pkg/classification/db/recipes/zendesk.json diff --git a/internal/classification/db/recipes/zeplin.json b/pkg/classification/db/recipes/zeplin.json similarity index 100% rename from internal/classification/db/recipes/zeplin.json rename to pkg/classification/db/recipes/zeplin.json diff --git a/internal/classification/db/recipes/zoho.json b/pkg/classification/db/recipes/zoho.json similarity index 100% rename from internal/classification/db/recipes/zoho.json rename to pkg/classification/db/recipes/zoho.json diff --git a/internal/classification/db/subject_mapping.json b/pkg/classification/db/subject_mapping.json similarity index 100% rename from internal/classification/db/subject_mapping.json rename to pkg/classification/db/subject_mapping.json diff --git a/internal/classification/dependencies/dependencies.go b/pkg/classification/dependencies/dependencies.go similarity index 92% rename from internal/classification/dependencies/dependencies.go rename to pkg/classification/dependencies/dependencies.go index 9dd84fb1a..27f29dc07 100644 --- a/internal/classification/dependencies/dependencies.go +++ b/pkg/classification/dependencies/dependencies.go @@ -3,10 +3,10 @@ package dependencies import ( "errors" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/report/dependencies" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/util/classify" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/report/dependencies" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/util/classify" ) type ClassifiedDependency struct { diff --git a/internal/classification/dependencies/dependencies_test.go b/pkg/classification/dependencies/dependencies_test.go similarity index 90% rename from internal/classification/dependencies/dependencies_test.go rename to pkg/classification/dependencies/dependencies_test.go index ce1526ff0..a6fb1626f 100644 --- a/internal/classification/dependencies/dependencies_test.go +++ b/pkg/classification/dependencies/dependencies_test.go @@ -3,11 +3,11 @@ package dependencies_test import ( "testing" - "github.com/bearer/bearer/internal/classification/dependencies" - reportdependencies "github.com/bearer/bearer/internal/report/dependencies" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/util/classify" + "github.com/bearer/bearer/pkg/classification/dependencies" + reportdependencies "github.com/bearer/bearer/pkg/report/dependencies" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/util/classify" "github.com/stretchr/testify/assert" ) diff --git a/internal/classification/frameworks/frameworks.go b/pkg/classification/frameworks/frameworks.go similarity index 93% rename from internal/classification/frameworks/frameworks.go rename to pkg/classification/frameworks/frameworks.go index be29a89b7..0f78b99f9 100644 --- a/internal/classification/frameworks/frameworks.go +++ b/pkg/classification/frameworks/frameworks.go @@ -3,9 +3,9 @@ package frameworks import ( "errors" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/util/classify" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/util/classify" ) type classifiableFramework interface { diff --git a/internal/classification/frameworks/frameworks_test.go b/pkg/classification/frameworks/frameworks_test.go similarity index 93% rename from internal/classification/frameworks/frameworks_test.go rename to pkg/classification/frameworks/frameworks_test.go index 30c631e8e..689f6e016 100644 --- a/internal/classification/frameworks/frameworks_test.go +++ b/pkg/classification/frameworks/frameworks_test.go @@ -3,16 +3,16 @@ package frameworks_test import ( "testing" - "github.com/bearer/bearer/internal/classification/frameworks" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/frameworks/beego" - "github.com/bearer/bearer/internal/report/frameworks/django" - "github.com/bearer/bearer/internal/report/frameworks/dotnet" - "github.com/bearer/bearer/internal/report/frameworks/rails" - "github.com/bearer/bearer/internal/report/frameworks/spring" - "github.com/bearer/bearer/internal/report/frameworks/symfony" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/util/classify" + "github.com/bearer/bearer/pkg/classification/frameworks" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/frameworks/beego" + "github.com/bearer/bearer/pkg/report/frameworks/django" + "github.com/bearer/bearer/pkg/report/frameworks/dotnet" + "github.com/bearer/bearer/pkg/report/frameworks/rails" + "github.com/bearer/bearer/pkg/report/frameworks/spring" + "github.com/bearer/bearer/pkg/report/frameworks/symfony" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/util/classify" "github.com/stretchr/testify/assert" ) diff --git a/internal/classification/interfaces/interfaces.go b/pkg/classification/interfaces/interfaces.go similarity index 96% rename from internal/classification/interfaces/interfaces.go rename to pkg/classification/interfaces/interfaces.go index 6daf18fbb..0253dd55d 100644 --- a/internal/classification/interfaces/interfaces.go +++ b/pkg/classification/interfaces/interfaces.go @@ -5,11 +5,11 @@ import ( "regexp" "strings" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/interfaces" - "github.com/bearer/bearer/internal/util/classify" - "github.com/bearer/bearer/internal/util/url" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/interfaces" + "github.com/bearer/bearer/pkg/util/classify" + "github.com/bearer/bearer/pkg/util/url" ) type ClassifiedInterface struct { diff --git a/internal/classification/interfaces/interfaces_test.go b/pkg/classification/interfaces/interfaces_test.go similarity index 95% rename from internal/classification/interfaces/interfaces_test.go rename to pkg/classification/interfaces/interfaces_test.go index 15823eee3..01329b944 100644 --- a/internal/classification/interfaces/interfaces_test.go +++ b/pkg/classification/interfaces/interfaces_test.go @@ -3,14 +3,14 @@ package interfaces_test import ( "testing" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/classification/interfaces" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/classification/interfaces" - "github.com/bearer/bearer/internal/report/detections" + "github.com/bearer/bearer/pkg/report/detections" - reportinterfaces "github.com/bearer/bearer/internal/report/interfaces" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/util/classify" + reportinterfaces "github.com/bearer/bearer/pkg/report/interfaces" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/util/classify" "github.com/stretchr/testify/assert" ) diff --git a/internal/classification/schema/.snapshots/TestCSharp b/pkg/classification/schema/.snapshots/TestCSharp similarity index 100% rename from internal/classification/schema/.snapshots/TestCSharp rename to pkg/classification/schema/.snapshots/TestCSharp diff --git a/internal/classification/schema/.snapshots/TestCSharpKPI b/pkg/classification/schema/.snapshots/TestCSharpKPI similarity index 100% rename from internal/classification/schema/.snapshots/TestCSharpKPI rename to pkg/classification/schema/.snapshots/TestCSharpKPI diff --git a/internal/classification/schema/.snapshots/TestGo b/pkg/classification/schema/.snapshots/TestGo similarity index 100% rename from internal/classification/schema/.snapshots/TestGo rename to pkg/classification/schema/.snapshots/TestGo diff --git a/internal/classification/schema/.snapshots/TestGoKPI b/pkg/classification/schema/.snapshots/TestGoKPI similarity index 100% rename from internal/classification/schema/.snapshots/TestGoKPI rename to pkg/classification/schema/.snapshots/TestGoKPI diff --git a/internal/classification/schema/.snapshots/TestJava b/pkg/classification/schema/.snapshots/TestJava similarity index 100% rename from internal/classification/schema/.snapshots/TestJava rename to pkg/classification/schema/.snapshots/TestJava diff --git a/internal/classification/schema/.snapshots/TestJavaKPI b/pkg/classification/schema/.snapshots/TestJavaKPI similarity index 100% rename from internal/classification/schema/.snapshots/TestJavaKPI rename to pkg/classification/schema/.snapshots/TestJavaKPI diff --git a/internal/classification/schema/.snapshots/TestJavascript b/pkg/classification/schema/.snapshots/TestJavascript similarity index 100% rename from internal/classification/schema/.snapshots/TestJavascript rename to pkg/classification/schema/.snapshots/TestJavascript diff --git a/internal/classification/schema/.snapshots/TestJavascriptKPI b/pkg/classification/schema/.snapshots/TestJavascriptKPI similarity index 100% rename from internal/classification/schema/.snapshots/TestJavascriptKPI rename to pkg/classification/schema/.snapshots/TestJavascriptKPI diff --git a/internal/classification/schema/.snapshots/TestPHP b/pkg/classification/schema/.snapshots/TestPHP similarity index 100% rename from internal/classification/schema/.snapshots/TestPHP rename to pkg/classification/schema/.snapshots/TestPHP diff --git a/internal/classification/schema/.snapshots/TestPHPKPI b/pkg/classification/schema/.snapshots/TestPHPKPI similarity index 100% rename from internal/classification/schema/.snapshots/TestPHPKPI rename to pkg/classification/schema/.snapshots/TestPHPKPI diff --git a/internal/classification/schema/.snapshots/TestPython b/pkg/classification/schema/.snapshots/TestPython similarity index 100% rename from internal/classification/schema/.snapshots/TestPython rename to pkg/classification/schema/.snapshots/TestPython diff --git a/internal/classification/schema/.snapshots/TestPythonKPI b/pkg/classification/schema/.snapshots/TestPythonKPI similarity index 100% rename from internal/classification/schema/.snapshots/TestPythonKPI rename to pkg/classification/schema/.snapshots/TestPythonKPI diff --git a/internal/classification/schema/.snapshots/TestRuby b/pkg/classification/schema/.snapshots/TestRuby similarity index 100% rename from internal/classification/schema/.snapshots/TestRuby rename to pkg/classification/schema/.snapshots/TestRuby diff --git a/internal/classification/schema/.snapshots/TestRubyKPI b/pkg/classification/schema/.snapshots/TestRubyKPI similarity index 100% rename from internal/classification/schema/.snapshots/TestRubyKPI rename to pkg/classification/schema/.snapshots/TestRubyKPI diff --git a/internal/classification/schema/.snapshots/TestTypescript b/pkg/classification/schema/.snapshots/TestTypescript similarity index 100% rename from internal/classification/schema/.snapshots/TestTypescript rename to pkg/classification/schema/.snapshots/TestTypescript diff --git a/internal/classification/schema/.snapshots/TestTypescriptKPI b/pkg/classification/schema/.snapshots/TestTypescriptKPI similarity index 100% rename from internal/classification/schema/.snapshots/TestTypescriptKPI rename to pkg/classification/schema/.snapshots/TestTypescriptKPI diff --git a/internal/classification/schema/fixtures/csharp.json b/pkg/classification/schema/fixtures/csharp.json similarity index 100% rename from internal/classification/schema/fixtures/csharp.json rename to pkg/classification/schema/fixtures/csharp.json diff --git a/internal/classification/schema/fixtures/go.json b/pkg/classification/schema/fixtures/go.json similarity index 100% rename from internal/classification/schema/fixtures/go.json rename to pkg/classification/schema/fixtures/go.json diff --git a/internal/classification/schema/fixtures/java.json b/pkg/classification/schema/fixtures/java.json similarity index 100% rename from internal/classification/schema/fixtures/java.json rename to pkg/classification/schema/fixtures/java.json diff --git a/internal/classification/schema/fixtures/javascript.json b/pkg/classification/schema/fixtures/javascript.json similarity index 100% rename from internal/classification/schema/fixtures/javascript.json rename to pkg/classification/schema/fixtures/javascript.json diff --git a/internal/classification/schema/fixtures/php.json b/pkg/classification/schema/fixtures/php.json similarity index 100% rename from internal/classification/schema/fixtures/php.json rename to pkg/classification/schema/fixtures/php.json diff --git a/internal/classification/schema/fixtures/python.json b/pkg/classification/schema/fixtures/python.json similarity index 100% rename from internal/classification/schema/fixtures/python.json rename to pkg/classification/schema/fixtures/python.json diff --git a/internal/classification/schema/fixtures/ruby.json b/pkg/classification/schema/fixtures/ruby.json similarity index 100% rename from internal/classification/schema/fixtures/ruby.json rename to pkg/classification/schema/fixtures/ruby.json diff --git a/internal/classification/schema/fixtures/typescript.json b/pkg/classification/schema/fixtures/typescript.json similarity index 100% rename from internal/classification/schema/fixtures/typescript.json rename to pkg/classification/schema/fixtures/typescript.json diff --git a/internal/classification/schema/internal/testhelper/testhelper.go b/pkg/classification/schema/internal/testhelper/testhelper.go similarity index 97% rename from internal/classification/schema/internal/testhelper/testhelper.go rename to pkg/classification/schema/internal/testhelper/testhelper.go index 792b84f27..d1884059c 100644 --- a/internal/classification/schema/internal/testhelper/testhelper.go +++ b/pkg/classification/schema/internal/testhelper/testhelper.go @@ -4,9 +4,9 @@ import ( "encoding/json" "os" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/util/classify" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/util/classify" "github.com/stretchr/testify/assert" ) diff --git a/internal/classification/schema/kpi_test.go b/pkg/classification/schema/kpi_test.go similarity index 97% rename from internal/classification/schema/kpi_test.go rename to pkg/classification/schema/kpi_test.go index 51b100ea1..ab05f513a 100644 --- a/internal/classification/schema/kpi_test.go +++ b/pkg/classification/schema/kpi_test.go @@ -3,9 +3,9 @@ package schema_test import ( "testing" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/classification/schema/internal/testhelper" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/classification/schema/internal/testhelper" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/classification/schema/schema.go b/pkg/classification/schema/schema.go similarity index 98% rename from internal/classification/schema/schema.go rename to pkg/classification/schema/schema.go index e3530cf8b..056418585 100644 --- a/internal/classification/schema/schema.go +++ b/pkg/classification/schema/schema.go @@ -3,12 +3,12 @@ package schema import ( "regexp" - flagtypes "github.com/bearer/bearer/internal/flag/types" + flagtypes "github.com/bearer/bearer/pkg/flag/types" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/util/classify" - "github.com/bearer/bearer/internal/util/normalize_key" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/util/classify" + "github.com/bearer/bearer/pkg/util/normalize_key" ) var regexpIdentifierMatcher = regexp.MustCompile(`(uu)?id$`) diff --git a/internal/classification/schema/schema_test.go b/pkg/classification/schema/schema_test.go similarity index 98% rename from internal/classification/schema/schema_test.go rename to pkg/classification/schema/schema_test.go index c9b83c59d..d0ac2c5c2 100644 --- a/internal/classification/schema/schema_test.go +++ b/pkg/classification/schema/schema_test.go @@ -3,11 +3,11 @@ package schema_test import ( "testing" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/report/detectors" - reportschema "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/util/classify" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/report/detectors" + reportschema "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/util/classify" "github.com/stretchr/testify/assert" ) diff --git a/internal/commands/app.go b/pkg/commands/app.go similarity index 94% rename from internal/commands/app.go rename to pkg/commands/app.go index d90894643..eb780f57b 100644 --- a/internal/commands/app.go +++ b/pkg/commands/app.go @@ -6,16 +6,17 @@ import ( "github.com/spf13/cobra" "github.com/bearer/bearer/cmd/bearer/build" + "github.com/bearer/bearer/pkg/engine" ) // NewApp is the factory method to return CLI -func NewApp(version string, commitSHA string) *cobra.Command { +func NewApp(version string, commitSHA string, engine engine.Engine) *cobra.Command { rootCmd := NewRootCommand() rootCmd.AddCommand( NewCompletionCommand(), NewProcessingWorkerCommand(), NewInitCommand(), - NewScanCommand(), + NewScanCommand(engine), NewIgnoreCommand(), NewVersionCommand(version, commitSHA), ) diff --git a/internal/commands/artifact/run.go b/pkg/commands/artifact/run.go similarity index 82% rename from internal/commands/artifact/run.go rename to pkg/commands/artifact/run.go index 2c6a6b64d..c0e7b9f5e 100644 --- a/internal/commands/artifact/run.go +++ b/pkg/commands/artifact/run.go @@ -15,27 +15,27 @@ import ( "golang.org/x/exp/maps" - "github.com/bearer/bearer/internal/commands/artifact/scanid" - "github.com/bearer/bearer/internal/commands/process/filelist" - "github.com/bearer/bearer/internal/commands/process/filelist/files" - "github.com/bearer/bearer/internal/commands/process/gitrepository" - "github.com/bearer/bearer/internal/commands/process/orchestrator" - "github.com/bearer/bearer/internal/commands/process/orchestrator/work" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/flag" - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/report/basebranchfindings" - reportoutput "github.com/bearer/bearer/internal/report/output" - "github.com/bearer/bearer/internal/report/output/stats" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - scannerstats "github.com/bearer/bearer/internal/scanner/stats" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/ignore" - ignoretypes "github.com/bearer/bearer/internal/util/ignore/types" - outputhandler "github.com/bearer/bearer/internal/util/output" - "github.com/bearer/bearer/internal/version_check" - - "github.com/bearer/bearer/internal/types" + "github.com/bearer/bearer/pkg/commands/artifact/scanid" + "github.com/bearer/bearer/pkg/commands/process/filelist" + "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/commands/process/gitrepository" + "github.com/bearer/bearer/pkg/commands/process/settings" + settingsloader "github.com/bearer/bearer/pkg/commands/process/settings/loader" + "github.com/bearer/bearer/pkg/engine" + "github.com/bearer/bearer/pkg/flag" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/report/basebranchfindings" + reportoutput "github.com/bearer/bearer/pkg/report/output" + "github.com/bearer/bearer/pkg/report/output/stats" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + scannerstats "github.com/bearer/bearer/pkg/scanner/stats" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/ignore" + ignoretypes "github.com/bearer/bearer/pkg/util/ignore/types" + outputhandler "github.com/bearer/bearer/pkg/util/output" + "github.com/bearer/bearer/pkg/version_check" + + "github.com/bearer/bearer/pkg/types" ) // TargetKind represents what kind of artifact bearer scans @@ -70,6 +70,7 @@ type runner struct { scanSettings settings.Config stats *scannerstats.Stats gitContext *gitrepository.Context + engine engine.Engine } // NewRunner initializes Runner that provides scanning functionalities. @@ -80,6 +81,7 @@ func NewRunner( targetPath string, goclocResult *gocloc.Result, stats *scannerstats.Stats, + engine engine.Engine, ) (Runner, error) { r := &runner{ scanSettings: scanSettings, @@ -87,6 +89,7 @@ func NewRunner( goclocResult: goclocResult, stats: stats, gitContext: gitContext, + engine: engine, } scanID, err := scanid.Build(scanSettings, gitContext) @@ -159,24 +162,13 @@ func (r *runner) Scan(ctx context.Context, opts flagtypes.Options) ([]files.File return nil, nil, err } - orchestrator, err := orchestrator.New( - work.Repository{Dir: r.targetPath}, - r.scanSettings, - r.stats, - len(fileList.Files), - ) - if err != nil { - return nil, nil, err - } - defer orchestrator.Close() - var baseBranchFindings *basebranchfindings.Findings if err := repository.WithBaseBranch(func() error { if !opts.Quiet { outputhandler.StdErrLog(fmt.Sprintf("\nScanning base branch %s", r.gitContext.BaseBranch)) } - baseBranchFindings, err = r.scanBaseBranch(orchestrator, fileList) + baseBranchFindings, err = r.scanBaseBranch(fileList) if err != nil { return err } @@ -190,24 +182,27 @@ func (r *runner) Scan(ctx context.Context, opts flagtypes.Options) ([]files.File return nil, nil, err } - if err := orchestrator.Scan(r.reportPath, fileList.Files); err != nil { + if err := r.engine.Scan(&r.scanSettings, r.stats, r.reportPath, r.targetPath, fileList.Files); err != nil { return nil, nil, err } return fileList.Files, baseBranchFindings, nil } -func (r *runner) scanBaseBranch( - orchestrator *orchestrator.Orchestrator, - fileList *files.List, -) (*basebranchfindings.Findings, error) { +func (r *runner) scanBaseBranch(fileList *files.List) (*basebranchfindings.Findings, error) { result := basebranchfindings.New(fileList) if len(fileList.BaseFiles) == 0 { return result, nil } - if err := orchestrator.Scan(r.reportPath+".base", fileList.BaseFiles); err != nil { + if err := r.engine.Scan( + &r.scanSettings, + r.stats, + r.reportPath+".base", + r.targetPath, + fileList.BaseFiles, + ); err != nil { return nil, err } @@ -246,7 +241,7 @@ func getIgnoredFingerprints(settings settings.Config) ( } // Run performs artifact scanning -func Run(ctx context.Context, opts flagtypes.Options) (err error) { +func Run(ctx context.Context, opts flagtypes.Options, engine engine.Engine) (err error) { targetPath, err := file.CanonicalPath(opts.Target) if err != nil { return fmt.Errorf("failed to get absolute target: %w", err) @@ -285,7 +280,11 @@ func Run(ctx context.Context, opts flagtypes.Options) (err error) { outputhandler.StdErrLog("Loading rules") } - scanSettings, err := settings.FromOptions(opts, versionMeta) + if err := engine.Initialize(opts.LogLevel); err != nil { + return fmt.Errorf("failed to initialize engine: %w", err) + } + + scanSettings, err := settingsloader.FromOptions(opts, versionMeta, engine) scanSettings.Target = opts.Target if err != nil { return err @@ -311,7 +310,7 @@ func Run(ctx context.Context, opts flagtypes.Options) (err error) { stats = scannerstats.New() } - r, err := NewRunner(ctx, scanSettings, gitContext, targetPath, inputgocloc, stats) + r, err := NewRunner(ctx, scanSettings, gitContext, targetPath, inputgocloc, stats, engine) if err != nil { return err } @@ -386,11 +385,7 @@ func (r *runner) Report( endTime := time.Now() - reportSupported, err := anySupportedLanguagesPresent(report.Inputgocloc, r.scanSettings) - if err != nil { - return false, err - } - + reportSupported := anySupportedLanguagesPresent(r.engine, report.Inputgocloc, r.scanSettings) if !reportSupported && r.scanSettings.Report.Report != flag.ReportPrivacy && !r.scanSettings.Scan.Quiet { var placeholderStr *strings.Builder placeholderStr, err = getPlaceholderOutput(reportData, report, r.scanSettings, report.Inputgocloc) @@ -405,6 +400,7 @@ func (r *runner) Report( formatStr, err := reportoutput.FormatOutput( reportData, r.scanSettings, + r.engine, report.Inputgocloc, startTime, endTime, @@ -442,9 +438,9 @@ func (r *runner) ReportPath() string { return r.reportPath } -func anySupportedLanguagesPresent(inputgocloc *gocloc.Result, config settings.Config) (bool, error) { +func anySupportedLanguagesPresent(engine engine.Engine, inputgocloc *gocloc.Result, config settings.Config) bool { if inputgocloc == nil { - return true, nil + return true } ruleLanguages := make(map[string]bool) @@ -459,16 +455,14 @@ func anySupportedLanguagesPresent(inputgocloc *gocloc.Result, config settings.Co foundLanguages[strings.ToLower(language.Name)] = true } - for _, supportedLanguage := range maps.Keys(settings.GetSupportedRuleLanguages()) { - _, supportedLangPresent := foundLanguages[supportedLanguage] - - if supportedLangPresent && settings.GetSupportedRuleLanguages()[supportedLanguage] { - return true, nil + for _, supportedLanguage := range engine.GetLanguages() { + if _, supportedLangPresent := foundLanguages[supportedLanguage.ID()]; supportedLangPresent { + return true } } log.Debug().Msg("No language found for which rules are applicable") - return false, nil + return false } func getPlaceholderOutput(reportData *outputtypes.ReportData, report types.Report, config settings.Config, inputgocloc *gocloc.Result) (outputStr *strings.Builder, err error) { diff --git a/internal/commands/artifact/run_test.go b/pkg/commands/artifact/run_test.go similarity index 100% rename from internal/commands/artifact/run_test.go rename to pkg/commands/artifact/run_test.go diff --git a/internal/commands/artifact/scanid/scanid.go b/pkg/commands/artifact/scanid/scanid.go similarity index 93% rename from internal/commands/artifact/scanid/scanid.go rename to pkg/commands/artifact/scanid/scanid.go index 0dbfef123..7093aec19 100644 --- a/internal/commands/artifact/scanid/scanid.go +++ b/pkg/commands/artifact/scanid/scanid.go @@ -11,9 +11,9 @@ import ( "github.com/google/uuid" "github.com/bearer/bearer/cmd/bearer/build" - "github.com/bearer/bearer/internal/commands/process/gitrepository" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/commands/process/gitrepository" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/util/file" ) func Build(scanSettings settings.Config, gitContext *gitrepository.Context) (string, error) { diff --git a/internal/commands/completion.go b/pkg/commands/completion.go similarity index 100% rename from internal/commands/completion.go rename to pkg/commands/completion.go diff --git a/internal/commands/debugprofile/debugprofile.go b/pkg/commands/debugprofile/debugprofile.go similarity index 96% rename from internal/commands/debugprofile/debugprofile.go rename to pkg/commands/debugprofile/debugprofile.go index 409b4af87..f0ecdfaea 100644 --- a/internal/commands/debugprofile/debugprofile.go +++ b/pkg/commands/debugprofile/debugprofile.go @@ -7,7 +7,7 @@ import ( "github.com/rs/zerolog/log" "github.com/spf13/viper" - "github.com/bearer/bearer/internal/flag" + "github.com/bearer/bearer/pkg/flag" ) var cpuFile *os.File diff --git a/internal/commands/ignore.go b/pkg/commands/ignore.go similarity index 98% rename from internal/commands/ignore.go rename to pkg/commands/ignore.go index c6f77722b..56cd208b2 100644 --- a/internal/commands/ignore.go +++ b/pkg/commands/ignore.go @@ -11,10 +11,10 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/bearer/bearer/internal/flag" - "github.com/bearer/bearer/internal/util/ignore" - ignoretypes "github.com/bearer/bearer/internal/util/ignore/types" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/flag" + "github.com/bearer/bearer/pkg/util/ignore" + ignoretypes "github.com/bearer/bearer/pkg/util/ignore/types" + "github.com/bearer/bearer/pkg/util/output" ) var migratedIgnoreComment = "migrated from bearer.yml" diff --git a/internal/commands/init.go b/pkg/commands/init.go similarity index 89% rename from internal/commands/init.go rename to pkg/commands/init.go index f4c0c2020..3a2b39246 100644 --- a/internal/commands/init.go +++ b/pkg/commands/init.go @@ -12,7 +12,7 @@ func NewInitCommand() *cobra.Command { Use: "init", Short: "Generates a default config to `bearer.yml`", RunE: func(cmd *cobra.Command, args []string) error { - if err := ScanFlags.BindForConfigInit(NewScanCommand()); err != nil { + if err := ScanFlags.BindForConfigInit(NewScanCommand(nil)); err != nil { return fmt.Errorf("flag bind error: %w", err) } diff --git a/internal/commands/process/filelist/filelist.go b/pkg/commands/process/filelist/filelist.go similarity index 82% rename from internal/commands/process/filelist/filelist.go rename to pkg/commands/process/filelist/filelist.go index 0ade9ca16..f0c9a68ff 100644 --- a/internal/commands/process/filelist/filelist.go +++ b/pkg/commands/process/filelist/filelist.go @@ -8,11 +8,11 @@ import ( "github.com/hhatto/gocloc" "github.com/rs/zerolog/log" - flfiles "github.com/bearer/bearer/internal/commands/process/filelist/files" - "github.com/bearer/bearer/internal/commands/process/filelist/ignore" - "github.com/bearer/bearer/internal/commands/process/filelist/timeout" - "github.com/bearer/bearer/internal/commands/process/gitrepository" - "github.com/bearer/bearer/internal/commands/process/settings" + flfiles "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/commands/process/filelist/ignore" + "github.com/bearer/bearer/pkg/commands/process/filelist/timeout" + "github.com/bearer/bearer/pkg/commands/process/gitrepository" + "github.com/bearer/bearer/pkg/commands/process/settings" ) // Discover searches directory for files to scan, skipping the ones specified by skip config and assigning timeout speficfied by timeout config diff --git a/internal/commands/process/filelist/filelist_test.go b/pkg/commands/process/filelist/filelist_test.go similarity index 93% rename from internal/commands/process/filelist/filelist_test.go rename to pkg/commands/process/filelist/filelist_test.go index 73fb4bf57..c6fbe5c7c 100644 --- a/internal/commands/process/filelist/filelist_test.go +++ b/pkg/commands/process/filelist/filelist_test.go @@ -4,10 +4,10 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/commands/process/filelist" - "github.com/bearer/bearer/internal/commands/process/filelist/files" - "github.com/bearer/bearer/internal/commands/process/settings" - flagtypes "github.com/bearer/bearer/internal/flag/types" + "github.com/bearer/bearer/pkg/commands/process/filelist" + "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/commands/process/settings" + flagtypes "github.com/bearer/bearer/pkg/flag/types" "github.com/hhatto/gocloc" "github.com/stretchr/testify/assert" ) diff --git a/internal/commands/process/filelist/files/files.go b/pkg/commands/process/filelist/files/files.go similarity index 86% rename from internal/commands/process/filelist/files/files.go rename to pkg/commands/process/filelist/files/files.go index cf8d5517c..1550ef448 100644 --- a/internal/commands/process/filelist/files/files.go +++ b/pkg/commands/process/filelist/files/files.go @@ -3,7 +3,7 @@ package files import ( "time" - "github.com/bearer/bearer/internal/git" + "github.com/bearer/bearer/pkg/git" ) type List struct { diff --git a/internal/commands/process/filelist/ignore/ignore.go b/pkg/commands/process/filelist/ignore/ignore.go similarity index 97% rename from internal/commands/process/filelist/ignore/ignore.go rename to pkg/commands/process/filelist/ignore/ignore.go index c044f4cde..994a04f02 100644 --- a/internal/commands/process/filelist/ignore/ignore.go +++ b/pkg/commands/process/filelist/ignore/ignore.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - "github.com/bearer/bearer/internal/commands/process/settings" + "github.com/bearer/bearer/pkg/commands/process/settings" "github.com/hhatto/gocloc" "github.com/rs/zerolog/log" ignore "github.com/sabhiram/go-gitignore" diff --git a/internal/commands/process/filelist/testdata/happy_path/skip/users/admin.go b/pkg/commands/process/filelist/testdata/happy_path/skip/users/admin.go similarity index 100% rename from internal/commands/process/filelist/testdata/happy_path/skip/users/admin.go rename to pkg/commands/process/filelist/testdata/happy_path/skip/users/admin.go diff --git a/internal/commands/process/filelist/testdata/happy_path/skip/users/minifiedJs.min.js b/pkg/commands/process/filelist/testdata/happy_path/skip/users/minifiedJs.min.js similarity index 100% rename from internal/commands/process/filelist/testdata/happy_path/skip/users/minifiedJs.min.js rename to pkg/commands/process/filelist/testdata/happy_path/skip/users/minifiedJs.min.js diff --git a/internal/commands/process/filelist/testdata/happy_path/skip/users/users.go b/pkg/commands/process/filelist/testdata/happy_path/skip/users/users.go similarity index 100% rename from internal/commands/process/filelist/testdata/happy_path/skip/users/users.go rename to pkg/commands/process/filelist/testdata/happy_path/skip/users/users.go diff --git a/internal/commands/process/filelist/testdata/happy_path/standard/user.go b/pkg/commands/process/filelist/testdata/happy_path/standard/user.go similarity index 100% rename from internal/commands/process/filelist/testdata/happy_path/standard/user.go rename to pkg/commands/process/filelist/testdata/happy_path/standard/user.go diff --git a/internal/commands/process/filelist/timeout/timeout.go b/pkg/commands/process/filelist/timeout/timeout.go similarity index 89% rename from internal/commands/process/filelist/timeout/timeout.go rename to pkg/commands/process/filelist/timeout/timeout.go index 3a2f52107..0aab07f39 100644 --- a/internal/commands/process/filelist/timeout/timeout.go +++ b/pkg/commands/process/filelist/timeout/timeout.go @@ -4,7 +4,7 @@ import ( "io/fs" "time" - "github.com/bearer/bearer/internal/commands/process/settings" + "github.com/bearer/bearer/pkg/commands/process/settings" ) func Assign(fileInfo fs.FileInfo, config settings.Config) time.Duration { diff --git a/internal/commands/process/gitrepository/context.go b/pkg/commands/process/gitrepository/context.go similarity index 98% rename from internal/commands/process/gitrepository/context.go rename to pkg/commands/process/gitrepository/context.go index fe8d481ba..c425537aa 100644 --- a/internal/commands/process/gitrepository/context.go +++ b/pkg/commands/process/gitrepository/context.go @@ -13,8 +13,8 @@ import ( "golang.org/x/oauth2" "gopkg.in/yaml.v3" - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/git" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/git" ) type Context struct { diff --git a/internal/commands/process/gitrepository/gitrepository.go b/pkg/commands/process/gitrepository/gitrepository.go similarity index 93% rename from internal/commands/process/gitrepository/gitrepository.go rename to pkg/commands/process/gitrepository/gitrepository.go index f99cf9686..e6721a009 100644 --- a/internal/commands/process/gitrepository/gitrepository.go +++ b/pkg/commands/process/gitrepository/gitrepository.go @@ -11,12 +11,12 @@ import ( "github.com/hhatto/gocloc" "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/commands/process/filelist/files" - "github.com/bearer/bearer/internal/commands/process/filelist/ignore" - "github.com/bearer/bearer/internal/commands/process/filelist/timeout" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/git" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/commands/process/filelist/ignore" + "github.com/bearer/bearer/pkg/commands/process/filelist/timeout" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/git" + "github.com/bearer/bearer/pkg/util/output" ) type Repository struct { diff --git a/internal/commands/process/orchestrator/orchestrator.go b/pkg/commands/process/orchestrator/orchestrator.go similarity index 87% rename from internal/commands/process/orchestrator/orchestrator.go rename to pkg/commands/process/orchestrator/orchestrator.go index d65809ad6..414442b03 100644 --- a/internal/commands/process/orchestrator/orchestrator.go +++ b/pkg/commands/process/orchestrator/orchestrator.go @@ -10,21 +10,21 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/commands/process/filelist/files" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/scanner/stats" - "github.com/bearer/bearer/internal/util/jsonlines" - bearerprogress "github.com/bearer/bearer/internal/util/progressbar" - "github.com/bearer/bearer/internal/util/tmpfile" - - "github.com/bearer/bearer/internal/commands/process/orchestrator/pool" - "github.com/bearer/bearer/internal/commands/process/orchestrator/work" + "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/scanner/stats" + "github.com/bearer/bearer/pkg/util/jsonlines" + bearerprogress "github.com/bearer/bearer/pkg/util/progressbar" + "github.com/bearer/bearer/pkg/util/tmpfile" + + "github.com/bearer/bearer/pkg/commands/process/orchestrator/pool" + "github.com/bearer/bearer/pkg/commands/process/orchestrator/work" ) type Orchestrator struct { repository work.Repository - config settings.Config + config *settings.Config maxWorkersSemaphore chan struct{} done chan struct{} pool *pool.Pool @@ -33,7 +33,7 @@ type Orchestrator struct { func New( repository work.Repository, - config settings.Config, + config *settings.Config, stats *stats.Stats, estimatedFileCount int, ) (*Orchestrator, error) { @@ -202,7 +202,7 @@ func (orchestrator *Orchestrator) writeFileError(reportFile *os.File, file files orchestrator.reportMutex.Unlock() } -func getParallel(fileCount int, config settings.Config) int { +func getParallel(fileCount int, config *settings.Config) int { if config.Scan.Parallel != 0 { return config.Scan.Parallel } diff --git a/internal/commands/process/orchestrator/pool/pool.go b/pkg/commands/process/orchestrator/pool/pool.go similarity index 89% rename from internal/commands/process/orchestrator/pool/pool.go rename to pkg/commands/process/orchestrator/pool/pool.go index d756983b3..bd8339022 100644 --- a/internal/commands/process/orchestrator/pool/pool.go +++ b/pkg/commands/process/orchestrator/pool/pool.go @@ -9,11 +9,11 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/commands/process/orchestrator/work" - "github.com/bearer/bearer/internal/commands/process/orchestrator/worker" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/scanner/stats" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/orchestrator/work" + "github.com/bearer/bearer/pkg/commands/process/orchestrator/worker" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/scanner/stats" + "github.com/bearer/bearer/pkg/util/output" ) type Pool struct { @@ -25,7 +25,7 @@ type Pool struct { available []*Process } -func New(config settings.Config, stats *stats.Stats) *Pool { +func New(config *settings.Config, stats *stats.Stats) *Pool { executable, err := os.Executable() if err != nil { output.Fatal(fmt.Sprintf("failed to get current command executable %s", err)) diff --git a/internal/commands/process/orchestrator/pool/process.go b/pkg/commands/process/orchestrator/pool/process.go similarity index 95% rename from internal/commands/process/orchestrator/pool/process.go rename to pkg/commands/process/orchestrator/pool/process.go index cbd30561f..82aa6faff 100644 --- a/internal/commands/process/orchestrator/pool/process.go +++ b/pkg/commands/process/orchestrator/pool/process.go @@ -19,10 +19,10 @@ import ( "github.com/rs/zerolog/log" gopsutilprocess "github.com/shirou/gopsutil/v3/process" - "github.com/bearer/bearer/internal/commands/process/orchestrator/work" - "github.com/bearer/bearer/internal/commands/process/orchestrator/worker" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/orchestrator/work" + "github.com/bearer/bearer/pkg/commands/process/orchestrator/worker" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/util/output" ) var ( @@ -46,7 +46,7 @@ type Process struct { type ProcessOptions struct { executable string baseArguments []string - config settings.Config + config *settings.Config } func newProcess(options *ProcessOptions, id string) (*Process, error) { @@ -88,7 +88,7 @@ func newProcess(options *ProcessOptions, id string) (*Process, error) { return process, nil } -func (process *Process) start(config settings.Config) error { +func (process *Process) start(config *settings.Config) error { if err := process.command.Start(); err != nil { close(process.exitChannel) return err @@ -201,7 +201,7 @@ func (process *Process) reduceMemoryUsage() { } } -func (process *Process) initialize(config settings.Config) error { +func (process *Process) initialize(config *settings.Config) error { log.Debug().Msgf("%s initializing", process.id) start := time.Now() killTime := time.Now().Add(config.Worker.TimeoutWorkerOnline) diff --git a/internal/commands/process/orchestrator/work/work.go b/pkg/commands/process/orchestrator/work/work.go similarity index 79% rename from internal/commands/process/orchestrator/work/work.go rename to pkg/commands/process/orchestrator/work/work.go index 71068f6f7..ab2127592 100644 --- a/internal/commands/process/orchestrator/work/work.go +++ b/pkg/commands/process/orchestrator/work/work.go @@ -1,8 +1,8 @@ package work import ( - "github.com/bearer/bearer/internal/commands/process/filelist/files" - "github.com/bearer/bearer/internal/scanner/stats" + "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/scanner/stats" ) type InitializeResponse struct { diff --git a/internal/commands/process/orchestrator/worker/worker.go b/pkg/commands/process/orchestrator/worker/worker.go similarity index 90% rename from internal/commands/process/orchestrator/worker/worker.go rename to pkg/commands/process/orchestrator/worker/worker.go index fe50b76c9..675a226eb 100644 --- a/internal/commands/process/orchestrator/worker/worker.go +++ b/pkg/commands/process/orchestrator/worker/worker.go @@ -16,15 +16,15 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/classification" - "github.com/bearer/bearer/internal/commands/debugprofile" - config "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/report/writer" - "github.com/bearer/bearer/internal/scanner" - "github.com/bearer/bearer/internal/scanner/stats" - - "github.com/bearer/bearer/internal/commands/process/orchestrator/work" + "github.com/bearer/bearer/pkg/classification" + "github.com/bearer/bearer/pkg/commands/debugprofile" + config "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/report/writer" + "github.com/bearer/bearer/pkg/scanner" + "github.com/bearer/bearer/pkg/scanner/stats" + + "github.com/bearer/bearer/pkg/commands/process/orchestrator/work" ) var ErrorTimeoutReached = errors.New("file processing time exceeded") diff --git a/pkg/commands/process/settings/loader/loader.go b/pkg/commands/process/settings/loader/loader.go new file mode 100644 index 000000000..f7a27ba0e --- /dev/null +++ b/pkg/commands/process/settings/loader/loader.go @@ -0,0 +1,78 @@ +package loader + +import ( + "errors" + "fmt" + "slices" + + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/commands/process/settings/policies" + "github.com/bearer/bearer/pkg/commands/process/settings/rules" + "github.com/bearer/bearer/pkg/engine" + "github.com/bearer/bearer/pkg/flag" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/util/ignore" + "github.com/bearer/bearer/pkg/version_check" +) + +func FromOptions( + opts flagtypes.Options, + versionMeta *version_check.VersionMeta, + engine engine.Engine, +) (settings.Config, error) { + policies, err := policies.Load() + if err != nil { + return settings.Config{}, fmt.Errorf("failed to load policies: %w", err) + } + + result, err := rules.Load( + opts.ExternalRuleDir, + opts.RuleOptions, + versionMeta, + engine, + opts.ScanOptions.Force, + ) + if err != nil { + return settings.Config{}, err + } + + ignoredFingerprints, _, _, err := ignore.GetIgnoredFingerprints(opts.GeneralOptions.IgnoreFile, &opts.ScanOptions.Target) + if err != nil { + return settings.Config{}, err + } + + config := settings.Config{ + Client: opts.Client, + Worker: settings.WorkerOptions{ + Timeout: settings.Timeout, + TimeoutFileMinimum: settings.TimeoutFileMinimum, + TimeoutFileMaximum: settings.TimeoutFileMaximum, + TimeoutFileBytesPerSecond: settings.TimeoutFileBytesPerSecond, + TimeoutWorkerOnline: settings.TimeoutWorkerOnline, + FileSizeMaximum: settings.FileSizeMaximum, + ExistingWorker: settings.ExistingWorker, + }, + Scan: opts.ScanOptions, + Report: opts.ReportOptions, + IgnoredFingerprints: ignoredFingerprints, + NoColor: opts.GeneralOptions.NoColor || opts.ReportOptions.Output != "", + DebugProfile: opts.GeneralOptions.DebugProfile, + Debug: opts.GeneralOptions.Debug, + LogLevel: opts.GeneralOptions.LogLevel, + IgnoreFile: opts.GeneralOptions.IgnoreFile, + IgnoreGit: opts.GeneralOptions.IgnoreGit, + Policies: policies, + Rules: result.Rules, + BuiltInRules: result.BuiltInRules, + CacheUsed: result.CacheUsed, + BearerRulesVersion: result.BearerRulesVersion, + } + + if config.Scan.Diff { + if !slices.Contains([]string{flag.ReportSecurity, flag.ReportSaaS}, config.Report.Report) { + return settings.Config{}, errors.New("diff base branch is only supported for the security report") + } + } + + return config, nil +} diff --git a/internal/commands/process/settings/policies/common.rego b/pkg/commands/process/settings/policies/common.rego similarity index 100% rename from internal/commands/process/settings/policies/common.rego rename to pkg/commands/process/settings/policies/common.rego diff --git a/pkg/commands/process/settings/policies/policies.go b/pkg/commands/process/settings/policies/policies.go new file mode 100644 index 000000000..37bcfe761 --- /dev/null +++ b/pkg/commands/process/settings/policies/policies.go @@ -0,0 +1,54 @@ +package policies + +import ( + "embed" + "fmt" + + "gopkg.in/yaml.v2" + + "github.com/bearer/bearer/pkg/commands/process/settings" +) + +//go:embed *.rego +var policiesFS embed.FS + +func Load() (map[string]*settings.Policy, error) { + policies, err := loadDefaultPolicies() + if err != nil { + return nil, err + } + + for _, policy := range policies { + for _, module := range policy.Modules { + if module.Path != "" { + content, err := policiesFS.ReadFile(module.Path) + if err != nil { + return nil, err + } + + module.Content = string(content) + } + } + } + + return policies, nil +} + +//go:embed policies.yml +var defaultPolicies []byte + +func loadDefaultPolicies() (map[string]*settings.Policy, error) { + policiesByType := make(map[string]*settings.Policy) + + var policies []*settings.Policy + err := yaml.Unmarshal(defaultPolicies, &policies) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal policy file %s", err) + } + + for _, policy := range policies { + policiesByType[policy.Type] = policy + } + + return policiesByType, nil +} diff --git a/internal/commands/process/settings/policies.yml b/pkg/commands/process/settings/policies/policies.yml similarity index 71% rename from internal/commands/process/settings/policies.yml rename to pkg/commands/process/settings/policies/policies.yml index 4d8f10565..aefaece06 100644 --- a/internal/commands/process/settings/policies.yml +++ b/pkg/commands/process/settings/policies/policies.yml @@ -3,15 +3,15 @@ policy_failure = data.bearer.risk_policy.policy_failure local_rule_failure = data.bearer.risk_policy.local_rule_failure modules: - - path: policies/common.rego + - path: common.rego name: bearer.common - - path: policies/risk_policy.rego + - path: risk_policy.rego name: bearer.risk_policy - type: privacy_report query: | items = data.bearer.privacy_report.items modules: - - path: policies/common.rego + - path: common.rego name: bearer.common - - path: policies/privacy_report.rego + - path: privacy_report.rego name: bearer.privacy_report diff --git a/internal/commands/process/settings/policies/privacy_report.rego b/pkg/commands/process/settings/policies/privacy_report.rego similarity index 100% rename from internal/commands/process/settings/policies/privacy_report.rego rename to pkg/commands/process/settings/policies/privacy_report.rego diff --git a/internal/commands/process/settings/policies/risk_policy.rego b/pkg/commands/process/settings/policies/risk_policy.rego similarity index 100% rename from internal/commands/process/settings/policies/risk_policy.rego rename to pkg/commands/process/settings/policies/risk_policy.rego diff --git a/internal/commands/process/settings/policies/verifier_policy.rego b/pkg/commands/process/settings/policies/verifier_policy.rego similarity index 100% rename from internal/commands/process/settings/policies/verifier_policy.rego rename to pkg/commands/process/settings/policies/verifier_policy.rego diff --git a/internal/commands/process/settings/processors/db_encrypted.rego b/pkg/commands/process/settings/processors/db_encrypted.rego similarity index 100% rename from internal/commands/process/settings/processors/db_encrypted.rego rename to pkg/commands/process/settings/processors/db_encrypted.rego diff --git a/pkg/commands/process/settings/processors/processors.go b/pkg/commands/process/settings/processors/processors.go new file mode 100644 index 000000000..102371e95 --- /dev/null +++ b/pkg/commands/process/settings/processors/processors.go @@ -0,0 +1,23 @@ +package processors + +import ( + "embed" + "fmt" + + "github.com/bearer/bearer/pkg/util/rego" +) + +//go:embed *.rego +var fs embed.FS + +func Load(name string) ([]rego.Module, error) { + moduleText, err := fs.ReadFile(fmt.Sprintf("%s.rego", name)) + if err != nil { + return nil, err + } + + return []rego.Module{{ + Name: fmt.Sprintf("bearer.%s", name), + Content: string(moduleText), + }}, nil +} diff --git a/internal/commands/process/settings/processors/rails_encrypted.rego b/pkg/commands/process/settings/processors/rails_encrypted.rego similarity index 100% rename from internal/commands/process/settings/processors/rails_encrypted.rego rename to pkg/commands/process/settings/processors/rails_encrypted.rego diff --git a/internal/commands/process/settings/built_in_rules/sql/lang/create_table.yml b/pkg/commands/process/settings/rules/built_in/sql/lang/create_table.yml similarity index 100% rename from internal/commands/process/settings/built_in_rules/sql/lang/create_table.yml rename to pkg/commands/process/settings/rules/built_in/sql/lang/create_table.yml diff --git a/internal/commands/process/settings/built_in_rules/third_party/gitleaks/secret_detection.yml b/pkg/commands/process/settings/rules/built_in/third_party/gitleaks/secret_detection.yml similarity index 100% rename from internal/commands/process/settings/built_in_rules/third_party/gitleaks/secret_detection.yml rename to pkg/commands/process/settings/rules/built_in/third_party/gitleaks/secret_detection.yml diff --git a/pkg/commands/process/settings/rules/loader.go b/pkg/commands/process/settings/rules/loader.go new file mode 100644 index 000000000..8aeb31192 --- /dev/null +++ b/pkg/commands/process/settings/rules/loader.go @@ -0,0 +1,242 @@ +package rules + +import ( + "archive/tar" + "compress/gzip" + "crypto/md5" + "errors" + "fmt" + "io" + "io/fs" + "net/http" + "os" + "path/filepath" + "strings" + "time" + + "github.com/rs/zerolog/log" + "gopkg.in/yaml.v3" + + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/engine" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/util/output" + "github.com/bearer/bearer/pkg/version_check" +) + +func loadDefinitionsFromRemote( + definitions map[string]settings.RuleDefinition, + options flagtypes.RuleOptions, + versionMeta *version_check.VersionMeta, +) error { + if options.DisableDefaultRules { + return nil + } + + if versionMeta.Rules.Version == nil { + log.Debug().Msg("No rule packages found") + return nil + } + + urls := make([]string, 0, len(versionMeta.Rules.Packages)) + for _, value := range versionMeta.Rules.Packages { + log.Debug().Msgf("Added rule package URL %s", value) + urls = append(urls, value) + } + + if err := readDefinitionsFromUrls(definitions, urls); err != nil { + return fmt.Errorf("loading rules failed: %s", err) + } + + return nil +} + +func readDefinitionsFromUrls(ruleDefinitions map[string]settings.RuleDefinition, languageDownloads []string) (err error) { + bearerRulesDir := bearerRulesDir() + if _, err := os.Stat(bearerRulesDir); errors.Is(err, os.ErrNotExist) { + err := os.Mkdir(bearerRulesDir, os.ModePerm) + if err != nil { + return fmt.Errorf("could not create bearer-rules directory: %s", err) + } + } + + for _, languagePackageUrl := range languageDownloads { + // Prepare filepath + urlHash := md5.Sum([]byte(languagePackageUrl)) + filepath, err := filepath.Abs(filepath.Join(bearerRulesDir, fmt.Sprintf("%x.tar.gz", urlHash))) + + if err != nil { + return err + } + + if _, err := os.Stat(filepath); err == nil { + log.Trace().Msgf("Using local cache for rule package: %s", languagePackageUrl) + file, err := os.Open(filepath) + if err != nil { + return err + } + defer file.Close() + + if err = readRuleDefinitionZip(ruleDefinitions, file); err != nil { + return err + } + } else { + log.Trace().Msgf("Downloading rule package: %s", languagePackageUrl) + httpClient := &http.Client{Timeout: 60 * time.Second} + resp, err := httpClient.Get(languagePackageUrl) + if err != nil { + return err + } + defer resp.Body.Close() + + // Create file in rules dir + file, err := os.Create(filepath) + if err != nil { + return err + } + defer file.Close() + + // Copy the contents of the downloaded archive to the file + if _, err := io.Copy(file, resp.Body); err != nil { + return err + } + // reset file pointer to start of file + _, err = file.Seek(0, 0) + if err != nil { + return err + } + + if err = readRuleDefinitionZip(ruleDefinitions, file); err != nil { + return err + } + } + } + + return nil +} + +func readRuleDefinitionZip(ruleDefinitions map[string]settings.RuleDefinition, file *os.File) error { + gzr, err := gzip.NewReader(file) + if err != nil { + return err + } + defer gzr.Close() + + tr := tar.NewReader(gzr) + for { + header, err := tr.Next() + if err == io.EOF { + break + } else if err != nil { + return err + } + + if !isRuleFile(header.Name) { + continue + } + + data := make([]byte, header.Size) + _, err = io.ReadFull(tr, data) + if err != nil { + return fmt.Errorf("failed to read file %s: %w", header.Name, err) + } + + var ruleDefinition settings.RuleDefinition + err = yaml.Unmarshal(data, &ruleDefinition) + if err != nil { + return fmt.Errorf("failed to unmarshal rule %s: %w", header.Name, err) + } + + id := ruleDefinition.Metadata.ID + _, ruleExists := ruleDefinitions[id] + if ruleExists { + return fmt.Errorf("duplicate built-in rule ID %s", id) + } + + ruleDefinitions[id] = ruleDefinition + } + + return nil +} + +func loadCustomDefinitions(engine engine.Engine, definitions map[string]settings.RuleDefinition, isBuiltIn bool, dir fs.FS) error { + loadedDefinitions := make(map[string]settings.RuleDefinition) + if err := fs.WalkDir(dir, ".", func(path string, dirEntry fs.DirEntry, err error) error { + if err != nil { + return err + } + + if dirEntry.IsDir() { + return nil + } + + filename := dirEntry.Name() + ext := filepath.Ext(filename) + + if ext != ".yaml" && ext != ".yml" { + return nil + } + + entry, err := fs.ReadFile(dir, path) + if err != nil { + return fmt.Errorf("failed to read file %s: %w", path, err) + } + + var ruleDefinition settings.RuleDefinition + err = yaml.Unmarshal(entry, &ruleDefinition) + if err != nil { + output.StdErrLog(validateCustomRuleSchema(entry, filename)) + return fmt.Errorf("rule file was invalid") + } + + if ruleDefinition.Metadata == nil { + log.Debug().Msgf("rule file has invalid metadata %s", path) + return nil + } + + id := ruleDefinition.Metadata.ID + if id == "" { + log.Debug().Msgf("rule file missing metadata.id %s", path) + return nil + } + + supported := isBuiltIn + for _, languageID := range ruleDefinition.Languages { + language := engine.GetLanguageById(languageID) + if language != nil { + supported = true + } + } + + if !supported { + log.Debug().Msgf( + "rule file has no supported languages[%s] %s", + strings.Join(ruleDefinition.Languages, ", "), + path, + ) + return nil + } + + if _, exists := loadedDefinitions[id]; exists { + return fmt.Errorf("duplicate rule ID %s", id) + } + + loadedDefinitions[id] = ruleDefinition + + return nil + }); err != nil { + return err + } + + for id, definition := range loadedDefinitions { + if validateCustomRuleDefinition(loadedDefinitions, &definition) { + definitions[id] = definition + } + } + + return nil +} + +func bearerRulesDir() string { + return filepath.Join(os.TempDir(), "bearer-rules") +} diff --git a/pkg/commands/process/settings/rules/rules.go b/pkg/commands/process/settings/rules/rules.go new file mode 100644 index 000000000..48b5e6b41 --- /dev/null +++ b/pkg/commands/process/settings/rules/rules.go @@ -0,0 +1,290 @@ +package rules + +import ( + "embed" + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/rs/zerolog/log" + "gopkg.in/yaml.v2" + + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/engine" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/report/customdetectors" + "github.com/bearer/bearer/pkg/util/set" + "github.com/bearer/bearer/pkg/version_check" +) + +const ( + defaultRuleType = customdetectors.TypeRisk + defaultAuxiliaryRuleType = customdetectors.TypeVerifier +) + +type LoadRulesResult struct { + BuiltInRules map[string]*settings.Rule + Rules map[string]*settings.Rule + CacheUsed bool + BearerRulesVersion string +} + +//go:embed built_in/* +var builtInRulesFS embed.FS + +func Load( + externalRuleDirs []string, + options flagtypes.RuleOptions, + versionMeta *version_check.VersionMeta, + engine engine.Engine, + force bool, +) ( + result LoadRulesResult, + err error, +) { + definitions := make(map[string]settings.RuleDefinition) + builtInDefinitions := make(map[string]settings.RuleDefinition) + + if versionMeta.Rules.Version != nil { + result.BearerRulesVersion = *versionMeta.Rules.Version + } + + log.Debug().Msg("Loading rules") + + if err := loadDefinitionsFromRemote(definitions, options, versionMeta); err != nil { + return result, fmt.Errorf("error loading remote rules: %w", err) + } + + if err := loadCustomDefinitions(engine, builtInDefinitions, true, builtInRulesFS); err != nil { + return result, fmt.Errorf("error loading built-in rules: %w", err) + } + + for _, dir := range externalRuleDirs { + if strings.HasPrefix(dir, "~/") { + dirname, _ := os.UserHomeDir() + dir = filepath.Join(dirname, dir[2:]) + } + log.Debug().Msgf("loading external rules from: %s", dir) + if err := loadCustomDefinitions(engine, definitions, false, os.DirFS(dir)); err != nil { + return result, fmt.Errorf("external rules %w", err) + } + } + + if err := validateRuleOptionIDs(options, definitions, builtInDefinitions); err != nil { + return result, err + } + + enabledRules := getEnabledRules(options, definitions, nil) + builtInRules := getEnabledRules(options, builtInDefinitions, enabledRules) + + result.Rules = BuildRules(definitions, enabledRules) + result.BuiltInRules = BuildRules(builtInDefinitions, builtInRules) + + for _, definition := range definitions { + id := definition.Metadata.ID + if _, enabled := enabledRules[id]; enabled { + definitionYAML, err := yaml.Marshal(&definition) + if err != nil { + return result, err + } + + if err := engine.LoadRule(string(definitionYAML)); err != nil { + return result, fmt.Errorf("engine failed to load rule %s: %w", id, err) + } + } + } + + return result, nil +} + +func getFilterRuleReferences(definition *settings.RuleDefinition) set.Set[string] { + result := set.New[string]() + + var addFilter func(filter settings.PatternFilter) + + addPatterns := func(patterns []settings.RulePattern) { + for _, pattern := range patterns { + for _, filter := range pattern.Filters { + addFilter(filter) + } + } + } + + addFilter = func(filter settings.PatternFilter) { + if filter.Detection != "" { + result.Add(filter.Detection) + } + + if filter.Not != nil { + addFilter(*filter.Not) + } + + for _, subFilter := range filter.Either { + addFilter(subFilter) + } + } + + addPatterns(definition.Patterns) + for _, auxiliaryDefinition := range definition.Auxiliary { + addPatterns(auxiliaryDefinition.Patterns) + } + + return result +} + +func getSanitizers(definition *settings.RuleDefinition) set.Set[string] { + result := set.New[string]() + + if definition.SanitizerRuleID != "" { + result.Add(definition.SanitizerRuleID) + } + + for _, auxiliaryDefinition := range definition.Auxiliary { + if auxiliaryDefinition.SanitizerRuleID != "" { + result.Add(auxiliaryDefinition.SanitizerRuleID) + } + } + + return result +} + +func getEnabledRules( + options flagtypes.RuleOptions, + definitions map[string]settings.RuleDefinition, + rules map[string]struct{}, +) map[string]struct{} { + enabledRules := make(map[string]struct{}) + + for ruleId := range rules { + enabledRules[ruleId] = struct{}{} + } + + var enableRule func(definition settings.RuleDefinition) + enableRule = func(definition settings.RuleDefinition) { + if definition.Disabled { + return + } + + id := definition.Metadata.ID + + if _, alreadyEnabled := enabledRules[id]; alreadyEnabled { + return + } + + enabledRules[id] = struct{}{} + + for _, dependencyID := range definition.Detectors { + enabledRules[dependencyID] = struct{}{} + } + + for _, importedRuleID := range definition.Imports { + if importedDefinition, exists := definitions[importedRuleID]; exists { + enableRule(importedDefinition) + } + } + } + + for _, definition := range definitions { + id := definition.Metadata.ID + + if len(options.OnlyRule) > 0 && !options.OnlyRule[id] { + continue + } + + if options.SkipRule[id] { + continue + } + + enableRule(definition) + } + + return enabledRules +} + +func BuildRules( + definitions map[string]settings.RuleDefinition, + enabledRules map[string]struct{}, +) map[string]*settings.Rule { + rules := make(map[string]*settings.Rule) + + for _, definition := range definitions { + id := definition.Metadata.ID + + if _, enabled := enabledRules[id]; !enabled { + continue + } + + ruleType := definition.Type + if len(ruleType) == 0 { + ruleType = defaultRuleType + } + + // build rule trigger + ruleTrigger := settings.RuleTrigger{ + MatchOn: settings.PRESENCE, + DataTypesRequired: false, + } + + if definition.Trigger != nil { + if definition.Trigger.MatchOn != nil { + ruleTrigger.MatchOn = *definition.Trigger.MatchOn + } + if definition.Trigger.DataTypesRequired != nil { + ruleTrigger.DataTypesRequired = *definition.Trigger.DataTypesRequired + } + if definition.Trigger.RequiredDetection != nil { + ruleTrigger.RequiredDetection = definition.Trigger.RequiredDetection + } + } + + isLocal := false + for _, rulePattern := range definition.Patterns { + if strings.Contains(rulePattern.Pattern, "$") { + isLocal = true + break + } + } + + rules[id] = &settings.Rule{ + Id: id, + Type: ruleType, + AssociatedRecipe: definition.Metadata.AssociatedRecipe, + Trigger: ruleTrigger, + IsLocal: isLocal, + SkipDataTypes: definition.SkipDataTypes, + OnlyDataTypes: definition.OnlyDataTypes, + Severity: definition.Severity, + Description: definition.Metadata.Description, + RemediationMessage: definition.Metadata.RemediationMessage, + Stored: definition.Stored, + Detectors: definition.Detectors, + Processors: definition.Processors, + AutoEncrytPrefix: definition.AutoEncrytPrefix, + CWEIDs: definition.Metadata.CWEIDs, + Languages: definition.Languages, + ParamParenting: definition.ParamParenting, + Patterns: definition.Patterns, + SanitizerRuleID: definition.SanitizerRuleID, + DocumentationUrl: definition.Metadata.DocumentationUrl, + HasDetailedContext: definition.HasDetailedContext, + DependencyCheck: definition.DependencyCheck, + Dependency: definition.Dependency, + } + + for _, auxiliaryDefinition := range definition.Auxiliary { + rules[auxiliaryDefinition.Id] = &settings.Rule{ + Id: auxiliaryDefinition.Id, + Type: defaultAuxiliaryRuleType, + Languages: definition.Languages, + ParamParenting: auxiliaryDefinition.ParamParenting, + Patterns: auxiliaryDefinition.Patterns, + SanitizerRuleID: auxiliaryDefinition.SanitizerRuleID, + Stored: auxiliaryDefinition.Stored, + IsAuxilary: true, + } + } + } + + return rules +} diff --git a/pkg/commands/process/settings/rules/validation.go b/pkg/commands/process/settings/rules/validation.go new file mode 100644 index 000000000..cd6db5d98 --- /dev/null +++ b/pkg/commands/process/settings/rules/validation.go @@ -0,0 +1,204 @@ +package rules + +import ( + "bytes" + "fmt" + "net/http" + "path/filepath" + "sort" + "strings" + + "github.com/rs/zerolog/log" + "github.com/xeipuuv/gojsonschema" + "sigs.k8s.io/yaml" + + "github.com/bearer/bearer/pkg/commands/process/settings" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/report/customdetectors" + "github.com/bearer/bearer/pkg/util/output" + "github.com/bearer/bearer/pkg/util/set" +) + +const SCHEMA_URL = "https://raw.githubusercontent.com/Bearer/bearer-rules/main/scripts/rule_schema.json" + +var builtinRuleIDs = []string{ + "datatype", + "insecure_url", + "string_literal", +} + +func validateCustomRuleSchema(entry []byte, filename string) string { + validationStr := &strings.Builder{} + validationStr.WriteString(fmt.Sprintf("Failed to load %s\nValidating against %s\n\n", filename, SCHEMA_URL)) + schema, err := loadSchema(SCHEMA_URL) + if err != nil { + validationStr.WriteString("Could not load schema to validate") + return validationStr.String() + } + + jsonData, err := yaml.YAMLToJSON(entry) + if err != nil { + validationStr.WriteString("File format is invalid") + return validationStr.String() + } + + result, err := validateData(jsonData, schema) + if err != nil { + validationStr.WriteString("Could not apply validation") + return validationStr.String() + } + + if result.Valid() { + validationStr.WriteString("Format of appears valid but could not be loaded") + } else { + validationStr.WriteString(fmt.Sprintf("%s validation issues found:\n", filename)) + for _, desc := range result.Errors() { + validationStr.WriteString(fmt.Sprintf("- %s\n", desc)) + } + fmt.Print("\n") + } + return validationStr.String() +} + +func loadSchema(url string) (*gojsonschema.Schema, error) { + response, err := http.Get(url) + if err != nil { + return nil, err + } + defer response.Body.Close() + + var buf bytes.Buffer + _, err = buf.ReadFrom(response.Body) + if err != nil { + return nil, err + } + + loader := gojsonschema.NewStringLoader(buf.String()) + return gojsonschema.NewSchema(loader) +} + +func validateData(data []byte, schema *gojsonschema.Schema) (*gojsonschema.Result, error) { + loader := gojsonschema.NewStringLoader(string(data)) + return schema.Validate(loader) +} + +func validateCustomRuleDefinition(allDefinitions map[string]settings.RuleDefinition, definition *settings.RuleDefinition) bool { + metadata := definition.Metadata + + valid := true + fail := func(message string) { + valid = false + log.Debug().Msgf("%s: %s", metadata.ID, message) + } + + visibleRuleIDs := set.New[string]() + visibleRuleIDs.Add(metadata.ID) + visibleRuleIDs.AddAll(builtinRuleIDs) + + for _, importedID := range definition.Imports { + visibleRuleIDs.Add(importedID) + + importedDefinition, exists := allDefinitions[importedID] + + if !exists { + fail(fmt.Sprintf("import of unknown rule '%s'", importedID)) + continue + } + + if importedDefinition.Type != customdetectors.TypeShared { + fail(fmt.Sprintf("imported rule '%s' is not of type 'shared'", importedID)) + } + } + + for _, auxiliaryDefinition := range definition.Auxiliary { + visibleRuleIDs.Add(auxiliaryDefinition.Id) + } + + for _, filterRuleID := range getFilterRuleReferences(definition).Items() { + if !visibleRuleIDs.Has(filterRuleID) { + fail(fmt.Sprintf("filter references invalid or non-imported rule '%s'", filterRuleID)) + } + } + + for _, sanitizerRuleID := range getSanitizers(definition).Items() { + if !visibleRuleIDs.Has(sanitizerRuleID) { + fail(fmt.Sprintf("sanitizer references invalid or non-imported rule '%s'", sanitizerRuleID)) + } + } + + if metadata.ID == "" { + fail("metadata.id must be specified") + } + + if definition.Type == customdetectors.TypeShared { + metadata := definition.Metadata + if metadata != nil { + if metadata.CWEIDs != nil { + fail("cwe ids cannot be specified for a shared rule") + } + + if metadata.RemediationMessage != "" { + fail("remediation message cannot be specified for a shared rule") + } + } + + if definition.Severity != "" { + fail("severity cannot be specified for a shared rule") + } + } + + if !valid { + log.Debug().Msgf("%s ignored due to validation errors", metadata.ID) + } + + return valid +} + +func validateRuleOptionIDs( + options flagtypes.RuleOptions, + definitions map[string]settings.RuleDefinition, + builtInDefinitions map[string]settings.RuleDefinition, +) error { + var invalidRuleIDs []string + + for id := range options.OnlyRule { + _, existsInDefinition := definitions[id] + _, existsInBuiltInDefinition := builtInDefinitions[id] + + if !existsInBuiltInDefinition && !existsInDefinition { + invalidRuleIDs = append(invalidRuleIDs, id) + } + } + var invalidSkipRuleIDs []string + for id := range options.SkipRule { + _, existsInDefinition := definitions[id] + _, existsInBuiltInDefinition := builtInDefinitions[id] + + if !existsInBuiltInDefinition && !existsInDefinition { + invalidSkipRuleIDs = append(invalidSkipRuleIDs, id) + } + } + + if len(invalidSkipRuleIDs) > 0 { + sort.Strings(invalidSkipRuleIDs) + output.StdErrLog(fmt.Sprintf("Warning: rule IDs %s given to be skipped but were not found", strings.Join(invalidSkipRuleIDs, ","))) + } + if len(invalidRuleIDs) > 0 { + return fmt.Errorf("invalid rule IDs in only option: %s", strings.Join(invalidRuleIDs, ",")) + } + + return nil +} + +func isRuleFile(path string) bool { + if strings.Contains(path, ".snapshots") { + return false + } + + ext := filepath.Ext(path) + if ext != ".yaml" && ext != ".yml" { + return false + } + + return strings.Contains(path, "/") +} diff --git a/internal/commands/process/settings/settings.go b/pkg/commands/process/settings/settings.go similarity index 73% rename from internal/commands/process/settings/settings.go rename to pkg/commands/process/settings/settings.go index 2f383a76a..b5809968b 100644 --- a/internal/commands/process/settings/settings.go +++ b/pkg/commands/process/settings/settings.go @@ -1,23 +1,15 @@ package settings import ( - "embed" - "errors" - "fmt" "time" - "golang.org/x/exp/slices" - "gopkg.in/yaml.v3" - "github.com/bearer/bearer/api" - "github.com/bearer/bearer/internal/flag" - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/util/ignore" - ignoretypes "github.com/bearer/bearer/internal/util/ignore/types" - "github.com/bearer/bearer/internal/util/rego" - "github.com/bearer/bearer/internal/version_check" - - globaltypes "github.com/bearer/bearer/internal/types" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + ignoretypes "github.com/bearer/bearer/pkg/util/ignore/types" + "github.com/bearer/bearer/pkg/util/regex" + "github.com/bearer/bearer/pkg/util/rego" + + globaltypes "github.com/bearer/bearer/pkg/types" ) var ( @@ -68,8 +60,23 @@ type Config struct { IgnoreGit bool `mapstructure:"ignore_git" json:"ignore_git" yaml:"ignore_git"` } +type Processor struct { + Query string `mapstructure:"query" json:"query" yaml:"query"` + Modules Modules `mapstructure:"modules" json:"modules" yaml:"modules"` +} + type Modules []*PolicyModule +func (modules Modules) ToRegoModules() (output []rego.Module) { + for _, module := range modules { + output = append(output, rego.Module{ + Name: module.Name, + Content: module.Content, + }) + } + return +} + type Policy struct { Type string `mapstructure:"type" json:"type" yaml:"type"` Query string `mapstructure:"query" json:"query" yaml:"query"` @@ -102,13 +109,6 @@ const ( DefaultScope = NESTED_SCOPE ) -type LoadRulesResult struct { - BuiltInRules map[string]*Rule - Rules map[string]*Rule - CacheUsed bool - BearerRulesVersion string -} - type RuleTrigger struct { MatchOn MatchOn `mapstructure:"match_on" json:"match_on" yaml:"match_on"` DataTypesRequired bool `mapstructure:"data_types_required" json:"data_types_required" yaml:"data_types_required"` @@ -137,7 +137,7 @@ type RuleDefinition struct { Imports []string `mapstructure:"imports" json:"imports" yaml:"imports"` ParamParenting bool `mapstructure:"param_parenting" json:"param_parenting" yaml:"param_parenting"` Patterns []RulePattern `mapstructure:"patterns" json:"patterns" yaml:"patterns"` - SanitizerRuleID string `mapstructure:"sanitizer" json:"sanitizer" yaml:"sanitizer"` + SanitizerRuleID string `mapstructure:"sanitizer" json:"sanitizer,omitempty" yaml:"sanitizer,omitempty"` Stored bool `mapstructure:"stored" json:"stored" yaml:"stored"` Detectors []string `mapstructure:"detectors" json:"detectors,omitempty" yaml:"detectors,omitempty"` Processors []string `mapstructure:"processors" json:"processors,omitempty" yaml:"processors,omitempty"` @@ -152,6 +152,7 @@ type RuleDefinition struct { Auxiliary []Auxiliary `mapstructure:"auxiliary" json:"auxiliary" yaml:"auxiliary"` DependencyCheck bool `mapstructure:"dependency_check" json:"dependency_check" yaml:"dependency_check"` Dependency *Dependency `mapstructure:"dependency" json:"dependency" yaml:"dependency"` + Text string `mapstructure:"-" json:"-" yaml:"-"` } type Dependency struct { @@ -165,7 +166,7 @@ type Auxiliary struct { Type string `mapstructure:"type" json:"type" yaml:"type"` Languages []string `mapstructure:"languages" json:"languages" yaml:"languages"` Patterns []RulePattern `mapstructure:"patterns" json:"patterns" yaml:"patterns"` - SanitizerRuleID string `mapstructure:"sanitizer" json:"sanitizer" yaml:"sanitizer"` + SanitizerRuleID string `mapstructure:"sanitizer" json:"sanitizer,omitempty" yaml:"sanitizer,omitempty"` RootSingularize bool `mapstructure:"root_singularize" yaml:"root_singularize" ` RootLowercase bool `mapstructure:"root_lowercase" yaml:"root_lowercase"` @@ -219,168 +220,36 @@ type RuleReferenceImport struct { } type PatternFilter struct { - Not *PatternFilter `mapstructure:"not" json:"not" yaml:"not"` - Either []PatternFilter `mapstructure:"either" json:"either" yaml:"either"` - Variable string `mapstructure:"variable" json:"variable" yaml:"variable"` - Detection string `mapstructure:"detection" json:"detection" yaml:"detection"` - Scope RuleReferenceScope `mapstructure:"scope" json:"scope" yaml:"scope"` - Filters []PatternFilter `mapstructure:"filters" json:"filters" yaml:"filters"` - Imports []RuleReferenceImport `mapstructure:"imports" json:"imports" yaml:"imports"` + Not *PatternFilter `mapstructure:"not" json:"not,omitempty" yaml:"not,omitempty"` + Either []PatternFilter `mapstructure:"either" json:"either,omitempty" yaml:"either,omitempty"` + Variable string `mapstructure:"variable" json:"variable,omitempty" yaml:"variable,omitempty"` + Type string `mapstructure:"type" json:"type,omitempty" yaml:"type,omitempty"` + StaticType string `mapstructure:"static_type" json:"static_type,omitempty" yaml:"static_type,omitempty"` + Detection string `mapstructure:"detection" json:"detection,omitempty" yaml:"detection,omitempty"` + Scope RuleReferenceScope `mapstructure:"scope" json:"scope,omitempty" yaml:"scope,omitempty"` + IsSource bool `mapstructure:"is_source" json:"is_source" yaml:"is_source"` + Filters []PatternFilter `mapstructure:"filters" json:"filters,omitempty" yaml:"filters,omitempty"` + Imports []RuleReferenceImport `mapstructure:"imports" json:"imports,omitempty" yaml:"imports,omitempty"` // Contains is deprecated in favour of Scope - Contains *bool `mapstructure:"contains" json:"contains" yaml:"contains"` - Regex *Regexp `mapstructure:"regex" json:"regex" yaml:"regex"` - Values []string `mapstructure:"values" json:"values" yaml:"values"` - LengthLessThan *int `mapstructure:"length_less_than" json:"length_less_than" yaml:"length_less_than"` - LessThan *int `mapstructure:"less_than" json:"less_than" yaml:"less_than"` - LessThanOrEqual *int `mapstructure:"less_than_or_equal" json:"less_than_or_equal" yaml:"less_than_or_equal"` - GreaterThan *int `mapstructure:"greater_than" json:"greater_than" yaml:"greater_than"` - GreaterThanOrEqual *int `mapstructure:"greater_than_or_equal" json:"greater_than_or_equal" yaml:"greater_than_or_equal"` - StringRegex *Regexp `mapstructure:"string_regex" json:"string_regex" yaml:"string_regex"` - EntropyGreaterThan *float64 `mapstructure:"entropy_greater_than" json:"entropy_greater_than" yaml:"entropy_greater_than"` - FilenameRegex *Regexp `mapstructure:"filename_regex" json:"filename_regex" yaml:"filename_regex"` + Contains *bool `mapstructure:"contains" json:"contains,omitempty" yaml:"contains,omitempty"` + Regex *regex.SerializableRegexp `mapstructure:"regex" json:"regex,omitempty" yaml:"regex,omitempty"` + Values []string `mapstructure:"values" json:"values,omitempty" yaml:"values,omitempty"` + LengthLessThan *int `mapstructure:"length_less_than" json:"length_less_than,omitempty" yaml:"length_less_than,omitempty"` + LessThan *int `mapstructure:"less_than" json:"less_than,omitempty" yaml:"less_than,omitempty"` + LessThanOrEqual *int `mapstructure:"less_than_or_equal" json:"less_than_or_equal,omitempty" yaml:"less_than_or_equal,omitempty"` + GreaterThan *int `mapstructure:"greater_than" json:"greater_than,omitempty" yaml:"greater_than,omitempty"` + GreaterThanOrEqual *int `mapstructure:"greater_than_or_equal" json:"greater_than_or_equal,omitempty" yaml:"greater_than_or_equal,omitempty"` + StringRegex *regex.SerializableRegexp `mapstructure:"string_regex" json:"string_regex,omitempty" yaml:"string_regex,omitempty"` + EntropyGreaterThan *float64 `mapstructure:"entropy_greater_than" json:"entropy_greater_than,omitempty" yaml:"entropy_greater_than,omitempty"` + FilenameRegex *regex.SerializableRegexp `mapstructure:"filename_regex" json:"filename_regex,omitempty" yaml:"filename_regex,omitempty"` } type RulePattern struct { Pattern string `mapstructure:"pattern" json:"pattern" yaml:"pattern"` - Focus string `mapstructure:"focus" json:"focus" yaml:"focus"` + Focus string `mapstructure:"focus" json:"focus,omitempty" yaml:"focus,omitempty"` Filters []PatternFilter `mapstructure:"filters" json:"filters" yaml:"filters"` } -type Processor struct { - Query string `mapstructure:"query" json:"query" yaml:"query"` - Modules Modules `mapstructure:"modules" json:"modules" yaml:"modules"` -} - -type MetaVar struct { - Input string `mapstructure:"input" json:"input" yaml:"input"` - Output int `mapstructure:"output" json:"output" yaml:"output"` - Regex string `mapstructure:"regex" json:"regex" yaml:"regex"` -} - -//go:embed policies.yml -var defaultPolicies []byte - -//go:embed built_in_rules/* -var buildInRulesFs embed.FS - -//go:embed policies/* -var policiesFs embed.FS - -//go:embed processors/* -var processorsFs embed.FS - -func (rule *Rule) PolicyType() bool { - return rule.Type == "risk" -} - -func (rule *Rule) GetSeverity() string { - if rule.Severity == "" { - return globaltypes.LevelLow - } - - return rule.Severity -} - -func (rule *Rule) Language() string { - if rule.Languages == nil { - return "secret" - } - - switch rule.Languages[0] { - case "java": - return "Java" - case "javascript": - return "JavaScript" - case "ruby": - return "Ruby" - case "sql": - return "SQL" - case "go": - return "Go" - case "php": - return "PHP" - case "python": - return "Python" - default: - return rule.Languages[0] - } -} - -func defaultWorkerOptions() WorkerOptions { - return WorkerOptions{ - Timeout: Timeout, - TimeoutFileMinimum: TimeoutFileMinimum, - TimeoutFileMaximum: TimeoutFileMaximum, - TimeoutFileBytesPerSecond: TimeoutFileBytesPerSecond, - TimeoutWorkerOnline: TimeoutWorkerOnline, - FileSizeMaximum: FileSizeMaximum, - ExistingWorker: ExistingWorker, - } -} - -func FromOptions(opts flagtypes.Options, versionMeta *version_check.VersionMeta) (Config, error) { - policies, err := DefaultPolicies() - if err != nil { - return Config{}, err - } - workerOptions := defaultWorkerOptions() - result, err := loadRules( - opts.ExternalRuleDir, - opts.RuleOptions, - versionMeta, - opts.ScanOptions.Force, - ) - if err != nil { - return Config{}, err - } - - for key := range policies { - policy := policies[key] - - for _, module := range policy.Modules { - if module.Path != "" { - content, err := policiesFs.ReadFile(module.Path) - if err != nil { - return Config{}, err - } - module.Content = string(content) - } - } - } - - ignoredFingerprints, _, _, err := ignore.GetIgnoredFingerprints(opts.GeneralOptions.IgnoreFile, &opts.ScanOptions.Target) - if err != nil { - return Config{}, err - } - - config := Config{ - Client: opts.Client, - Worker: workerOptions, - Scan: opts.ScanOptions, - Report: opts.ReportOptions, - IgnoredFingerprints: ignoredFingerprints, - NoColor: opts.GeneralOptions.NoColor || opts.ReportOptions.Output != "", - DebugProfile: opts.GeneralOptions.DebugProfile, - Debug: opts.GeneralOptions.Debug, - LogLevel: opts.GeneralOptions.LogLevel, - IgnoreFile: opts.GeneralOptions.IgnoreFile, - IgnoreGit: opts.GeneralOptions.IgnoreGit, - Policies: policies, - Rules: result.Rules, - BuiltInRules: result.BuiltInRules, - CacheUsed: result.CacheUsed, - BearerRulesVersion: result.BearerRulesVersion, - } - - if config.Scan.Diff { - if !slices.Contains([]string{flag.ReportSecurity, flag.ReportSaaS}, config.Report.Report) { - return Config{}, errors.New("diff base branch is only supported for the security report") - } - } - - return config, nil -} - func (rulePattern *RulePattern) UnmarshalYAML(unmarshal func(interface{}) error) error { // Try to parse as a string var pattern string @@ -419,38 +288,20 @@ func (filter *PatternFilter) UnmarshalYAML(unmarshal func(interface{}) error) er return nil } -func DefaultPolicies() (map[string]*Policy, error) { - policies := make(map[string]*Policy) - var policy []*Policy - - err := yaml.Unmarshal(defaultPolicies, &policy) - if err != nil { - return nil, fmt.Errorf("failed to unmarshal policy file %s", err) - } - - for _, policy := range policy { - policies[policy.Type] = policy - } - - return policies, nil +type MetaVar struct { + Input string `mapstructure:"input" json:"input" yaml:"input"` + Output int `mapstructure:"output" json:"output" yaml:"output"` + Regex string `mapstructure:"regex" json:"regex" yaml:"regex"` } -func ProcessorRegoModuleText(processorName string) (string, error) { - processorPath := fmt.Sprintf("processors/%s.rego", processorName) - data, err := processorsFs.ReadFile(processorPath) - if err != nil { - return "", err - } - - return string(data), nil +func (rule *Rule) PolicyType() bool { + return rule.Type == "risk" } -func (modules Modules) ToRegoModules() (output []rego.Module) { - for _, module := range modules { - output = append(output, rego.Module{ - Name: module.Name, - Content: module.Content, - }) +func (rule *Rule) GetSeverity() string { + if rule.Severity == "" { + return globaltypes.LevelLow } - return + + return rule.Severity } diff --git a/internal/commands/processing_worker.go b/pkg/commands/processing_worker.go similarity index 86% rename from internal/commands/processing_worker.go rename to pkg/commands/processing_worker.go index 4148395c0..56875338b 100644 --- a/internal/commands/processing_worker.go +++ b/pkg/commands/processing_worker.go @@ -7,10 +7,10 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/bearer/bearer/internal/commands/debugprofile" - "github.com/bearer/bearer/internal/commands/process/orchestrator/worker" - "github.com/bearer/bearer/internal/flag" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/debugprofile" + "github.com/bearer/bearer/pkg/commands/process/orchestrator/worker" + "github.com/bearer/bearer/pkg/flag" + "github.com/bearer/bearer/pkg/util/output" ) func NewProcessingWorkerCommand() *cobra.Command { diff --git a/internal/commands/scan.go b/pkg/commands/scan.go similarity index 88% rename from internal/commands/scan.go rename to pkg/commands/scan.go index a0eff5d7c..1deb072fd 100644 --- a/internal/commands/scan.go +++ b/pkg/commands/scan.go @@ -3,11 +3,12 @@ package commands import ( "fmt" - "github.com/bearer/bearer/internal/commands/artifact" - "github.com/bearer/bearer/internal/commands/debugprofile" - "github.com/bearer/bearer/internal/flag" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/artifact" + "github.com/bearer/bearer/pkg/commands/debugprofile" + "github.com/bearer/bearer/pkg/engine" + "github.com/bearer/bearer/pkg/flag" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/output" "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -38,7 +39,7 @@ var ScanFlags = flag.Flags{ flag.GeneralFlagGroup, } -func NewScanCommand() *cobra.Command { +func NewScanCommand(engine engine.Engine) *cobra.Command { cmd := &cobra.Command{ Use: "scan [flags] ", Aliases: []string{"s"}, @@ -84,7 +85,7 @@ func NewScanCommand() *cobra.Command { cmd.SilenceUsage = true - err = artifact.Run(cmd.Context(), options) + err = artifact.Run(cmd.Context(), options, engine) debugprofile.Stop() return err }, diff --git a/internal/commands/version.go b/pkg/commands/version.go similarity index 90% rename from internal/commands/version.go rename to pkg/commands/version.go index 768ba8d97..f3350d85e 100644 --- a/internal/commands/version.go +++ b/pkg/commands/version.go @@ -7,9 +7,9 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/bearer/bearer/internal/flag" - "github.com/bearer/bearer/internal/util/output" - "github.com/bearer/bearer/internal/version_check" + "github.com/bearer/bearer/pkg/flag" + "github.com/bearer/bearer/pkg/util/output" + "github.com/bearer/bearer/pkg/version_check" ) func NewVersionCommand(version string, commitSHA string) *cobra.Command { diff --git a/internal/detectors/beego/.snapshots/TestDetectorReportDatabases b/pkg/detectors/beego/.snapshots/TestDetectorReportDatabases similarity index 100% rename from internal/detectors/beego/.snapshots/TestDetectorReportDatabases rename to pkg/detectors/beego/.snapshots/TestDetectorReportDatabases diff --git a/internal/detectors/beego/beego.go b/pkg/detectors/beego/beego.go similarity index 91% rename from internal/detectors/beego/beego.go rename to pkg/detectors/beego/beego.go index 6ce37b08a..e64e6f7f0 100644 --- a/internal/detectors/beego/beego.go +++ b/pkg/detectors/beego/beego.go @@ -5,13 +5,13 @@ import ( "github.com/smacker/go-tree-sitter/golang" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/golang_util" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks/beego" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/golang_util" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks/beego" + "github.com/bearer/bearer/pkg/util/file" ) const ormPackage = "github.com/beego/beego/v2/client/orm" diff --git a/internal/detectors/beego/beego_test.go b/pkg/detectors/beego/beego_test.go similarity index 74% rename from internal/detectors/beego/beego_test.go rename to pkg/detectors/beego/beego_test.go index a835bddb6..014b1ccff 100644 --- a/internal/detectors/beego/beego_test.go +++ b/pkg/detectors/beego/beego_test.go @@ -6,8 +6,8 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - reportdetectors "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + reportdetectors "github.com/bearer/bearer/pkg/report/detectors" ) const detectorType = reportdetectors.DetectorBeego diff --git a/internal/detectors/beego/testdata/beego/database.go b/pkg/detectors/beego/testdata/beego/database.go similarity index 100% rename from internal/detectors/beego/testdata/beego/database.go rename to pkg/detectors/beego/testdata/beego/database.go diff --git a/internal/detectors/beego/testdata/beego/database2.go b/pkg/detectors/beego/testdata/beego/database2.go similarity index 100% rename from internal/detectors/beego/testdata/beego/database2.go rename to pkg/detectors/beego/testdata/beego/database2.go diff --git a/internal/detectors/beego/testdata/beego/go.mod b/pkg/detectors/beego/testdata/beego/go.mod similarity index 100% rename from internal/detectors/beego/testdata/beego/go.mod rename to pkg/detectors/beego/testdata/beego/go.mod diff --git a/internal/detectors/beego/testdata/beego/main.go b/pkg/detectors/beego/testdata/beego/main.go similarity index 100% rename from internal/detectors/beego/testdata/beego/main.go rename to pkg/detectors/beego/testdata/beego/main.go diff --git a/internal/detectors/beego/testdata/go_not_beego/go.mod b/pkg/detectors/beego/testdata/go_not_beego/go.mod similarity index 100% rename from internal/detectors/beego/testdata/go_not_beego/go.mod rename to pkg/detectors/beego/testdata/go_not_beego/go.mod diff --git a/internal/detectors/beego/testdata/go_not_beego/main.go b/pkg/detectors/beego/testdata/go_not_beego/main.go similarity index 100% rename from internal/detectors/beego/testdata/go_not_beego/main.go rename to pkg/detectors/beego/testdata/go_not_beego/main.go diff --git a/internal/detectors/beego/testdata/not_go/Gemfile b/pkg/detectors/beego/testdata/not_go/Gemfile similarity index 100% rename from internal/detectors/beego/testdata/not_go/Gemfile rename to pkg/detectors/beego/testdata/not_go/Gemfile diff --git a/internal/detectors/csharp/.snapshots/TestDetectorReportDataTypes b/pkg/detectors/csharp/.snapshots/TestDetectorReportDataTypes similarity index 100% rename from internal/detectors/csharp/.snapshots/TestDetectorReportDataTypes rename to pkg/detectors/csharp/.snapshots/TestDetectorReportDataTypes diff --git a/internal/detectors/csharp/.snapshots/TestDetectorReportInterfaces b/pkg/detectors/csharp/.snapshots/TestDetectorReportInterfaces similarity index 100% rename from internal/detectors/csharp/.snapshots/TestDetectorReportInterfaces rename to pkg/detectors/csharp/.snapshots/TestDetectorReportInterfaces diff --git a/internal/detectors/csharp/csharp.go b/pkg/detectors/csharp/csharp.go similarity index 87% rename from internal/detectors/csharp/csharp.go rename to pkg/detectors/csharp/csharp.go index a71f0839f..eb2f9b9d7 100644 --- a/internal/detectors/csharp/csharp.go +++ b/pkg/detectors/csharp/csharp.go @@ -5,17 +5,17 @@ import ( "github.com/smacker/go-tree-sitter/csharp" - "github.com/bearer/bearer/internal/detectors/csharp/datatype" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/interfacedetector" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/csharp/datatype" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/interfacedetector" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" ) var ( diff --git a/internal/detectors/csharp/csharp_test.go b/pkg/detectors/csharp/csharp_test.go similarity index 74% rename from internal/detectors/csharp/csharp_test.go rename to pkg/detectors/csharp/csharp_test.go index effafd778..017d4ec94 100644 --- a/internal/detectors/csharp/csharp_test.go +++ b/pkg/detectors/csharp/csharp_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/csharp" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/csharp" + "github.com/bearer/bearer/pkg/parser/nodeid" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" ) const detectorType = detectortypes.DetectorCSharp diff --git a/internal/detectors/csharp/datatype/datatype.go b/pkg/detectors/csharp/datatype/datatype.go similarity index 93% rename from internal/detectors/csharp/datatype/datatype.go rename to pkg/detectors/csharp/datatype/datatype.go index c8fc03a18..95cfd4347 100644 --- a/internal/detectors/csharp/datatype/datatype.go +++ b/pkg/detectors/csharp/datatype/datatype.go @@ -3,14 +3,14 @@ package datatype import ( "strings" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" "github.com/smacker/go-tree-sitter/csharp" ) diff --git a/internal/detectors/csharp/testdata/datatypes/datatypes.cs b/pkg/detectors/csharp/testdata/datatypes/datatypes.cs similarity index 100% rename from internal/detectors/csharp/testdata/datatypes/datatypes.cs rename to pkg/detectors/csharp/testdata/datatypes/datatypes.cs diff --git a/internal/detectors/csharp/testdata/project/config.cs b/pkg/detectors/csharp/testdata/project/config.cs similarity index 100% rename from internal/detectors/csharp/testdata/project/config.cs rename to pkg/detectors/csharp/testdata/project/config.cs diff --git a/internal/detectors/csharp/testdata/project/urls.cs b/pkg/detectors/csharp/testdata/project/urls.cs similarity index 100% rename from internal/detectors/csharp/testdata/project/urls.cs rename to pkg/detectors/csharp/testdata/project/urls.cs diff --git a/internal/detectors/custom/config/config.go b/pkg/detectors/custom/config/config.go similarity index 95% rename from internal/detectors/custom/config/config.go rename to pkg/detectors/custom/config/config.go index ff66d8d62..3364fb4a7 100644 --- a/internal/detectors/custom/config/config.go +++ b/pkg/detectors/custom/config/config.go @@ -1,7 +1,7 @@ package config import ( - "github.com/bearer/bearer/internal/commands/process/settings" + "github.com/bearer/bearer/pkg/commands/process/settings" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/custom/custom.go b/pkg/detectors/custom/custom.go similarity index 91% rename from internal/detectors/custom/custom.go rename to pkg/detectors/custom/custom.go index e5fa83203..8d20546bd 100644 --- a/internal/detectors/custom/custom.go +++ b/pkg/detectors/custom/custom.go @@ -12,23 +12,23 @@ import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/detectors/custom/config" - sqldetector "github.com/bearer/bearer/internal/detectors/sql/custom_detector" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - language "github.com/bearer/bearer/internal/parser/custom" - parserdatatype "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/report/detections" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/util/file" - - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/parser/sitter/sql" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/detectors/custom/config" + sqldetector "github.com/bearer/bearer/pkg/detectors/sql/custom_detector" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + language "github.com/bearer/bearer/pkg/parser/custom" + parserdatatype "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/report/detections" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/util/file" + + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/parser/sitter/sql" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" ) var insecureUrlPattern = regexp.MustCompile(`^http[^s]`) diff --git a/internal/detectors/dependencies/buildgradle/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/buildgradle/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/buildgradle/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/buildgradle/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/buildgradle/buildgradle.go b/pkg/detectors/dependencies/buildgradle/buildgradle.go similarity index 52% rename from internal/detectors/dependencies/buildgradle/buildgradle.go rename to pkg/detectors/dependencies/buildgradle/buildgradle.go index 3f7b524ae..8741dfb79 100644 --- a/internal/detectors/dependencies/buildgradle/buildgradle.go +++ b/pkg/detectors/dependencies/buildgradle/buildgradle.go @@ -1,9 +1,9 @@ package buildgradle import ( - grdlparser "github.com/bearer/bearer/internal/detectors/dependencies/buildgradle/parser" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/util/file" + grdlparser "github.com/bearer/bearer/pkg/detectors/dependencies/buildgradle/parser" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/util/file" ) // Discover parses build.gradle file and add discovered dependencies to report diff --git a/internal/detectors/dependencies/buildgradle/buildgradle_test.go b/pkg/detectors/dependencies/buildgradle/buildgradle_test.go similarity index 76% rename from internal/detectors/dependencies/buildgradle/buildgradle_test.go rename to pkg/detectors/dependencies/buildgradle/buildgradle_test.go index e4717fd07..ccfab8617 100644 --- a/internal/detectors/dependencies/buildgradle/buildgradle_test.go +++ b/pkg/detectors/dependencies/buildgradle/buildgradle_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/buildgradle/parser/parser.go b/pkg/detectors/dependencies/buildgradle/parser/parser.go similarity index 93% rename from internal/detectors/dependencies/buildgradle/parser/parser.go rename to pkg/detectors/dependencies/buildgradle/parser/parser.go index 0d54a5702..c4c300c6d 100644 --- a/internal/detectors/dependencies/buildgradle/parser/parser.go +++ b/pkg/detectors/dependencies/buildgradle/parser/parser.go @@ -5,9 +5,9 @@ import ( "os" "regexp" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/linescanner" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/linescanner" "github.com/rs/zerolog/log" ) diff --git a/internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/checksums/checksums.lock b/pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/checksums/checksums.lock similarity index 100% rename from internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/checksums/checksums.lock rename to pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/checksums/checksums.lock diff --git a/internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock b/pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock similarity index 100% rename from internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock rename to pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock diff --git a/internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/dependencies-accessors/gc.properties b/pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/dependencies-accessors/gc.properties similarity index 100% rename from internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/dependencies-accessors/gc.properties rename to pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/dependencies-accessors/gc.properties diff --git a/internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/fileChanges/last-build.bin b/pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/fileChanges/last-build.bin similarity index 100% rename from internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/fileChanges/last-build.bin rename to pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/fileChanges/last-build.bin diff --git a/internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/fileHashes/fileHashes.lock b/pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/fileHashes/fileHashes.lock similarity index 100% rename from internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/fileHashes/fileHashes.lock rename to pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/fileHashes/fileHashes.lock diff --git a/internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/gc.properties b/pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/gc.properties similarity index 100% rename from internal/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/gc.properties rename to pkg/detectors/dependencies/buildgradle/testdata/.gradle/7.3.3/gc.properties diff --git a/internal/detectors/dependencies/buildgradle/testdata/.gradle/vcs-1/gc.properties b/pkg/detectors/dependencies/buildgradle/testdata/.gradle/vcs-1/gc.properties similarity index 100% rename from internal/detectors/dependencies/buildgradle/testdata/.gradle/vcs-1/gc.properties rename to pkg/detectors/dependencies/buildgradle/testdata/.gradle/vcs-1/gc.properties diff --git a/internal/detectors/dependencies/buildgradle/testdata/build.gradle b/pkg/detectors/dependencies/buildgradle/testdata/build.gradle similarity index 100% rename from internal/detectors/dependencies/buildgradle/testdata/build.gradle rename to pkg/detectors/dependencies/buildgradle/testdata/build.gradle diff --git a/internal/detectors/dependencies/composerjson/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/composerjson/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/composerjson/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/composerjson/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/composerjson/composerjson.go b/pkg/detectors/dependencies/composerjson/composerjson.go similarity index 88% rename from internal/detectors/dependencies/composerjson/composerjson.go rename to pkg/detectors/dependencies/composerjson/composerjson.go index 0e65153c7..cce3a5057 100644 --- a/internal/detectors/dependencies/composerjson/composerjson.go +++ b/pkg/detectors/dependencies/composerjson/composerjson.go @@ -4,10 +4,10 @@ import ( "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/javascript" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" ) var language = javascript.GetLanguage() diff --git a/internal/detectors/dependencies/composerjson/composerjson_test.go b/pkg/detectors/dependencies/composerjson/composerjson_test.go similarity index 76% rename from internal/detectors/dependencies/composerjson/composerjson_test.go rename to pkg/detectors/dependencies/composerjson/composerjson_test.go index 7eb1b3de5..e6716d019 100644 --- a/internal/detectors/dependencies/composerjson/composerjson_test.go +++ b/pkg/detectors/dependencies/composerjson/composerjson_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/composerjson/testdata/composer.json b/pkg/detectors/dependencies/composerjson/testdata/composer.json similarity index 100% rename from internal/detectors/dependencies/composerjson/testdata/composer.json rename to pkg/detectors/dependencies/composerjson/testdata/composer.json diff --git a/internal/detectors/dependencies/composerlock/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/composerlock/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/composerlock/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/composerlock/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/composerlock/composerlock.go b/pkg/detectors/dependencies/composerlock/composerlock.go similarity index 89% rename from internal/detectors/dependencies/composerlock/composerlock.go rename to pkg/detectors/dependencies/composerlock/composerlock.go index 3923ded47..187e1817c 100644 --- a/internal/detectors/dependencies/composerlock/composerlock.go +++ b/pkg/detectors/dependencies/composerlock/composerlock.go @@ -4,10 +4,10 @@ import ( "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/javascript" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" ) var language = javascript.GetLanguage() diff --git a/internal/detectors/dependencies/composerlock/composerlock_test.go b/pkg/detectors/dependencies/composerlock/composerlock_test.go similarity index 76% rename from internal/detectors/dependencies/composerlock/composerlock_test.go rename to pkg/detectors/dependencies/composerlock/composerlock_test.go index baf45b4de..200fefb3c 100644 --- a/internal/detectors/dependencies/composerlock/composerlock_test.go +++ b/pkg/detectors/dependencies/composerlock/composerlock_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/composerlock/testdata/composer.lock b/pkg/detectors/dependencies/composerlock/testdata/composer.lock similarity index 100% rename from internal/detectors/dependencies/composerlock/testdata/composer.lock rename to pkg/detectors/dependencies/composerlock/testdata/composer.lock diff --git a/internal/detectors/dependencies/dependencies.go b/pkg/detectors/dependencies/dependencies.go similarity index 62% rename from internal/detectors/dependencies/dependencies.go rename to pkg/detectors/dependencies/dependencies.go index cd36505fe..395939c96 100644 --- a/internal/detectors/dependencies/dependencies.go +++ b/pkg/detectors/dependencies/dependencies.go @@ -1,33 +1,33 @@ package dependencies import ( - "github.com/bearer/bearer/internal/detectors/dependencies/buildgradle" - "github.com/bearer/bearer/internal/detectors/dependencies/composerjson" - "github.com/bearer/bearer/internal/detectors/dependencies/composerlock" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/detectors/dependencies/gemfile" - "github.com/bearer/bearer/internal/detectors/dependencies/gosum" - "github.com/bearer/bearer/internal/detectors/dependencies/ivy" - "github.com/bearer/bearer/internal/detectors/dependencies/mvnplugin" - "github.com/bearer/bearer/internal/detectors/dependencies/npm" - "github.com/bearer/bearer/internal/detectors/dependencies/nuget" - packageconfig "github.com/bearer/bearer/internal/detectors/dependencies/package-config" - packagejson "github.com/bearer/bearer/internal/detectors/dependencies/package-json" - paketdependencies "github.com/bearer/bearer/internal/detectors/dependencies/paket-dependencies" - "github.com/bearer/bearer/internal/detectors/dependencies/pipdeptree" - "github.com/bearer/bearer/internal/detectors/dependencies/piplock" - "github.com/bearer/bearer/internal/detectors/dependencies/poetry" - pomxml "github.com/bearer/bearer/internal/detectors/dependencies/pom-xml" - projectjson "github.com/bearer/bearer/internal/detectors/dependencies/project-json" - "github.com/bearer/bearer/internal/detectors/dependencies/pyproject" - "github.com/bearer/bearer/internal/detectors/dependencies/requirements" - "github.com/bearer/bearer/internal/detectors/dependencies/yarnlock" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/dependencies" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/dependencies/buildgradle" + "github.com/bearer/bearer/pkg/detectors/dependencies/composerjson" + "github.com/bearer/bearer/pkg/detectors/dependencies/composerlock" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/detectors/dependencies/gemfile" + "github.com/bearer/bearer/pkg/detectors/dependencies/gosum" + "github.com/bearer/bearer/pkg/detectors/dependencies/ivy" + "github.com/bearer/bearer/pkg/detectors/dependencies/mvnplugin" + "github.com/bearer/bearer/pkg/detectors/dependencies/npm" + "github.com/bearer/bearer/pkg/detectors/dependencies/nuget" + packageconfig "github.com/bearer/bearer/pkg/detectors/dependencies/package-config" + packagejson "github.com/bearer/bearer/pkg/detectors/dependencies/package-json" + paketdependencies "github.com/bearer/bearer/pkg/detectors/dependencies/paket-dependencies" + "github.com/bearer/bearer/pkg/detectors/dependencies/pipdeptree" + "github.com/bearer/bearer/pkg/detectors/dependencies/piplock" + "github.com/bearer/bearer/pkg/detectors/dependencies/poetry" + pomxml "github.com/bearer/bearer/pkg/detectors/dependencies/pom-xml" + projectjson "github.com/bearer/bearer/pkg/detectors/dependencies/project-json" + "github.com/bearer/bearer/pkg/detectors/dependencies/pyproject" + "github.com/bearer/bearer/pkg/detectors/dependencies/requirements" + "github.com/bearer/bearer/pkg/detectors/dependencies/yarnlock" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/dependencies" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/util/file" ) type detector struct{} diff --git a/internal/detectors/dependencies/depsbase/depsbase.go b/pkg/detectors/dependencies/depsbase/depsbase.go similarity index 100% rename from internal/detectors/dependencies/depsbase/depsbase.go rename to pkg/detectors/dependencies/depsbase/depsbase.go diff --git a/internal/detectors/dependencies/gemfile/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/gemfile/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/gemfile/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/gemfile/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/gemfile/gemfile-lock.go b/pkg/detectors/dependencies/gemfile/gemfile-lock.go similarity index 95% rename from internal/detectors/dependencies/gemfile/gemfile-lock.go rename to pkg/detectors/dependencies/gemfile/gemfile-lock.go index b520c0be3..2605e33b8 100644 --- a/internal/detectors/dependencies/gemfile/gemfile-lock.go +++ b/pkg/detectors/dependencies/gemfile/gemfile-lock.go @@ -5,9 +5,9 @@ import ( "os" "regexp" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/linescanner" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/linescanner" "github.com/rs/zerolog/log" ) diff --git a/internal/detectors/dependencies/gemfile/gemfile-lock_test.go b/pkg/detectors/dependencies/gemfile/gemfile-lock_test.go similarity index 76% rename from internal/detectors/dependencies/gemfile/gemfile-lock_test.go rename to pkg/detectors/dependencies/gemfile/gemfile-lock_test.go index 7e0f3fc67..2aa40c05e 100644 --- a/internal/detectors/dependencies/gemfile/gemfile-lock_test.go +++ b/pkg/detectors/dependencies/gemfile/gemfile-lock_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/gemfile/testdata/Gemfile.lock b/pkg/detectors/dependencies/gemfile/testdata/Gemfile.lock similarity index 100% rename from internal/detectors/dependencies/gemfile/testdata/Gemfile.lock rename to pkg/detectors/dependencies/gemfile/testdata/Gemfile.lock diff --git a/internal/detectors/dependencies/gosum/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/gosum/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/gosum/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/gosum/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/gosum/go.go b/pkg/detectors/dependencies/gosum/go.go similarity index 86% rename from internal/detectors/dependencies/gosum/go.go rename to pkg/detectors/dependencies/gosum/go.go index 26060cc4f..b1dfc9e73 100644 --- a/internal/detectors/dependencies/gosum/go.go +++ b/pkg/detectors/dependencies/gosum/go.go @@ -6,9 +6,9 @@ import ( "os" "strings" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/linescanner" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/linescanner" "github.com/rs/zerolog/log" ) diff --git a/internal/detectors/dependencies/gosum/go_test.go b/pkg/detectors/dependencies/gosum/go_test.go similarity index 76% rename from internal/detectors/dependencies/gosum/go_test.go rename to pkg/detectors/dependencies/gosum/go_test.go index b77108b2b..21e5ecacd 100644 --- a/internal/detectors/dependencies/gosum/go_test.go +++ b/pkg/detectors/dependencies/gosum/go_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/gosum/testdata/go.sum b/pkg/detectors/dependencies/gosum/testdata/go.sum similarity index 100% rename from internal/detectors/dependencies/gosum/testdata/go.sum rename to pkg/detectors/dependencies/gosum/testdata/go.sum diff --git a/internal/detectors/dependencies/ivy/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/ivy/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/ivy/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/ivy/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/ivy/ivy.go b/pkg/detectors/dependencies/ivy/ivy.go similarity index 92% rename from internal/detectors/dependencies/ivy/ivy.go rename to pkg/detectors/dependencies/ivy/ivy.go index 0300dd743..d99ca2d27 100644 --- a/internal/detectors/dependencies/ivy/ivy.go +++ b/pkg/detectors/dependencies/ivy/ivy.go @@ -8,11 +8,11 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/sitter/xml" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/sitter/xml" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" ) var language = xml.GetLanguage() diff --git a/internal/detectors/dependencies/ivy/ivy_test.go b/pkg/detectors/dependencies/ivy/ivy_test.go similarity index 76% rename from internal/detectors/dependencies/ivy/ivy_test.go rename to pkg/detectors/dependencies/ivy/ivy_test.go index 1bba30906..71f073887 100644 --- a/internal/detectors/dependencies/ivy/ivy_test.go +++ b/pkg/detectors/dependencies/ivy/ivy_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/ivy/testdata/ivy-report.xml b/pkg/detectors/dependencies/ivy/testdata/ivy-report.xml similarity index 100% rename from internal/detectors/dependencies/ivy/testdata/ivy-report.xml rename to pkg/detectors/dependencies/ivy/testdata/ivy-report.xml diff --git a/internal/detectors/dependencies/mvnplugin/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/mvnplugin/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/mvnplugin/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/mvnplugin/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/mvnplugin/mvnplugin.go b/pkg/detectors/dependencies/mvnplugin/mvnplugin.go similarity index 89% rename from internal/detectors/dependencies/mvnplugin/mvnplugin.go rename to pkg/detectors/dependencies/mvnplugin/mvnplugin.go index 22bca4248..7bce365eb 100644 --- a/internal/detectors/dependencies/mvnplugin/mvnplugin.go +++ b/pkg/detectors/dependencies/mvnplugin/mvnplugin.go @@ -1,10 +1,10 @@ package mvnplugin import ( - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/dependencies/mvnplugin/mvnplugin_test.go b/pkg/detectors/dependencies/mvnplugin/mvnplugin_test.go similarity index 76% rename from internal/detectors/dependencies/mvnplugin/mvnplugin_test.go rename to pkg/detectors/dependencies/mvnplugin/mvnplugin_test.go index 692e3d256..2d48de0f1 100644 --- a/internal/detectors/dependencies/mvnplugin/mvnplugin_test.go +++ b/pkg/detectors/dependencies/mvnplugin/mvnplugin_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/mvnplugin/testdata/maven-dependencies.json b/pkg/detectors/dependencies/mvnplugin/testdata/maven-dependencies.json similarity index 100% rename from internal/detectors/dependencies/mvnplugin/testdata/maven-dependencies.json rename to pkg/detectors/dependencies/mvnplugin/testdata/maven-dependencies.json diff --git a/internal/detectors/dependencies/npm/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/npm/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/npm/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/npm/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/npm/npm.go b/pkg/detectors/dependencies/npm/npm.go similarity index 93% rename from internal/detectors/dependencies/npm/npm.go rename to pkg/detectors/dependencies/npm/npm.go index 0b4209daa..1a2aadc6f 100644 --- a/internal/detectors/dependencies/npm/npm.go +++ b/pkg/detectors/dependencies/npm/npm.go @@ -1,10 +1,10 @@ package npm import ( - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/dependencies/npm/npm_test.go b/pkg/detectors/dependencies/npm/npm_test.go similarity index 76% rename from internal/detectors/dependencies/npm/npm_test.go rename to pkg/detectors/dependencies/npm/npm_test.go index e5d20dd1f..10fa5a267 100644 --- a/internal/detectors/dependencies/npm/npm_test.go +++ b/pkg/detectors/dependencies/npm/npm_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/npm/testdata/npm-shrinkwrap.json b/pkg/detectors/dependencies/npm/testdata/npm-shrinkwrap.json similarity index 100% rename from internal/detectors/dependencies/npm/testdata/npm-shrinkwrap.json rename to pkg/detectors/dependencies/npm/testdata/npm-shrinkwrap.json diff --git a/internal/detectors/dependencies/npm/testdata/package-lock.json b/pkg/detectors/dependencies/npm/testdata/package-lock.json similarity index 100% rename from internal/detectors/dependencies/npm/testdata/package-lock.json rename to pkg/detectors/dependencies/npm/testdata/package-lock.json diff --git a/internal/detectors/dependencies/nuget/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/nuget/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/nuget/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/nuget/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/nuget/nuget.go b/pkg/detectors/dependencies/nuget/nuget.go similarity index 93% rename from internal/detectors/dependencies/nuget/nuget.go rename to pkg/detectors/dependencies/nuget/nuget.go index 814cd5719..524c5b1d2 100644 --- a/internal/detectors/dependencies/nuget/nuget.go +++ b/pkg/detectors/dependencies/nuget/nuget.go @@ -1,10 +1,10 @@ package nuget import ( - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/dependencies/nuget/nuget_test.go b/pkg/detectors/dependencies/nuget/nuget_test.go similarity index 76% rename from internal/detectors/dependencies/nuget/nuget_test.go rename to pkg/detectors/dependencies/nuget/nuget_test.go index bd4e009d1..527c1563f 100644 --- a/internal/detectors/dependencies/nuget/nuget_test.go +++ b/pkg/detectors/dependencies/nuget/nuget_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/nuget/testdata/packages.lock.json b/pkg/detectors/dependencies/nuget/testdata/packages.lock.json similarity index 100% rename from internal/detectors/dependencies/nuget/testdata/packages.lock.json rename to pkg/detectors/dependencies/nuget/testdata/packages.lock.json diff --git a/internal/detectors/dependencies/package-config/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/package-config/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/package-config/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/package-config/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/package-config/package-config.go b/pkg/detectors/dependencies/package-config/package-config.go similarity index 86% rename from internal/detectors/dependencies/package-config/package-config.go rename to pkg/detectors/dependencies/package-config/package-config.go index 33428838e..000af4994 100644 --- a/internal/detectors/dependencies/package-config/package-config.go +++ b/pkg/detectors/dependencies/package-config/package-config.go @@ -3,11 +3,11 @@ package packageconfig import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/sitter/xml" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/sitter/xml" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" ) var language = xml.GetLanguage() diff --git a/internal/detectors/dependencies/package-config/package-config_test.go b/pkg/detectors/dependencies/package-config/package-config_test.go similarity index 76% rename from internal/detectors/dependencies/package-config/package-config_test.go rename to pkg/detectors/dependencies/package-config/package-config_test.go index 17c71859e..1919a4651 100644 --- a/internal/detectors/dependencies/package-config/package-config_test.go +++ b/pkg/detectors/dependencies/package-config/package-config_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/package-config/testdata/packages.config b/pkg/detectors/dependencies/package-config/testdata/packages.config similarity index 100% rename from internal/detectors/dependencies/package-config/testdata/packages.config rename to pkg/detectors/dependencies/package-config/testdata/packages.config diff --git a/internal/detectors/dependencies/package-json/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/package-json/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/package-json/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/package-json/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/package-json/package-json.go b/pkg/detectors/dependencies/package-json/package-json.go similarity index 87% rename from internal/detectors/dependencies/package-json/package-json.go rename to pkg/detectors/dependencies/package-json/package-json.go index f7416faf2..ca4490545 100644 --- a/internal/detectors/dependencies/package-json/package-json.go +++ b/pkg/detectors/dependencies/package-json/package-json.go @@ -1,10 +1,10 @@ package packagejson import ( - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/dependencies/package-json/package-json_test.go b/pkg/detectors/dependencies/package-json/package-json_test.go similarity index 76% rename from internal/detectors/dependencies/package-json/package-json_test.go rename to pkg/detectors/dependencies/package-json/package-json_test.go index 39e1e4985..dae92520d 100644 --- a/internal/detectors/dependencies/package-json/package-json_test.go +++ b/pkg/detectors/dependencies/package-json/package-json_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/package-json/testdata/package.json b/pkg/detectors/dependencies/package-json/testdata/package.json similarity index 100% rename from internal/detectors/dependencies/package-json/testdata/package.json rename to pkg/detectors/dependencies/package-json/testdata/package.json diff --git a/internal/detectors/dependencies/paket-dependencies/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/paket-dependencies/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/paket-dependencies/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/paket-dependencies/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/paket-dependencies/paket-dependencies.go b/pkg/detectors/dependencies/paket-dependencies/paket-dependencies.go similarity index 93% rename from internal/detectors/dependencies/paket-dependencies/paket-dependencies.go rename to pkg/detectors/dependencies/paket-dependencies/paket-dependencies.go index e5c094126..5f740305b 100644 --- a/internal/detectors/dependencies/paket-dependencies/paket-dependencies.go +++ b/pkg/detectors/dependencies/paket-dependencies/paket-dependencies.go @@ -6,9 +6,9 @@ import ( "regexp" "strings" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/linescanner" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/linescanner" "github.com/rs/zerolog/log" ) diff --git a/internal/detectors/dependencies/paket-dependencies/paket-dependencies_test.go b/pkg/detectors/dependencies/paket-dependencies/paket-dependencies_test.go similarity index 76% rename from internal/detectors/dependencies/paket-dependencies/paket-dependencies_test.go rename to pkg/detectors/dependencies/paket-dependencies/paket-dependencies_test.go index 9cff490ea..94bd073e2 100644 --- a/internal/detectors/dependencies/paket-dependencies/paket-dependencies_test.go +++ b/pkg/detectors/dependencies/paket-dependencies/paket-dependencies_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/paket-dependencies/testdata/paket.dependencies b/pkg/detectors/dependencies/paket-dependencies/testdata/paket.dependencies similarity index 100% rename from internal/detectors/dependencies/paket-dependencies/testdata/paket.dependencies rename to pkg/detectors/dependencies/paket-dependencies/testdata/paket.dependencies diff --git a/internal/detectors/dependencies/pipdeptree/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/pipdeptree/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/pipdeptree/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/pipdeptree/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/pipdeptree/pipdeptree.go b/pkg/detectors/dependencies/pipdeptree/pipdeptree.go similarity index 87% rename from internal/detectors/dependencies/pipdeptree/pipdeptree.go rename to pkg/detectors/dependencies/pipdeptree/pipdeptree.go index 5a4d2f080..61f535d01 100644 --- a/internal/detectors/dependencies/pipdeptree/pipdeptree.go +++ b/pkg/detectors/dependencies/pipdeptree/pipdeptree.go @@ -1,10 +1,10 @@ package pipdeptree import ( - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/dependencies/pipdeptree/pipdeptree_test.go b/pkg/detectors/dependencies/pipdeptree/pipdeptree_test.go similarity index 76% rename from internal/detectors/dependencies/pipdeptree/pipdeptree_test.go rename to pkg/detectors/dependencies/pipdeptree/pipdeptree_test.go index 429b90c56..c89927381 100644 --- a/internal/detectors/dependencies/pipdeptree/pipdeptree_test.go +++ b/pkg/detectors/dependencies/pipdeptree/pipdeptree_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/pipdeptree/testdata/pipdeptree.json b/pkg/detectors/dependencies/pipdeptree/testdata/pipdeptree.json similarity index 100% rename from internal/detectors/dependencies/pipdeptree/testdata/pipdeptree.json rename to pkg/detectors/dependencies/pipdeptree/testdata/pipdeptree.json diff --git a/internal/detectors/dependencies/piplock/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/piplock/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/piplock/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/piplock/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/piplock/piplock.go b/pkg/detectors/dependencies/piplock/piplock.go similarity index 86% rename from internal/detectors/dependencies/piplock/piplock.go rename to pkg/detectors/dependencies/piplock/piplock.go index 9d0025ad4..73d5e6071 100644 --- a/internal/detectors/dependencies/piplock/piplock.go +++ b/pkg/detectors/dependencies/piplock/piplock.go @@ -1,10 +1,10 @@ package piplock import ( - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/dependencies/piplock/piplock_test.go b/pkg/detectors/dependencies/piplock/piplock_test.go similarity index 76% rename from internal/detectors/dependencies/piplock/piplock_test.go rename to pkg/detectors/dependencies/piplock/piplock_test.go index 6f1dea60f..2c83dcbc7 100644 --- a/internal/detectors/dependencies/piplock/piplock_test.go +++ b/pkg/detectors/dependencies/piplock/piplock_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/piplock/testdata/Pipfile.lock b/pkg/detectors/dependencies/piplock/testdata/Pipfile.lock similarity index 100% rename from internal/detectors/dependencies/piplock/testdata/Pipfile.lock rename to pkg/detectors/dependencies/piplock/testdata/Pipfile.lock diff --git a/internal/detectors/dependencies/poetry/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/poetry/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/poetry/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/poetry/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/poetry/poetry.go b/pkg/detectors/dependencies/poetry/poetry.go similarity index 87% rename from internal/detectors/dependencies/poetry/poetry.go rename to pkg/detectors/dependencies/poetry/poetry.go index bd7f0ed72..f84194267 100644 --- a/internal/detectors/dependencies/poetry/poetry.go +++ b/pkg/detectors/dependencies/poetry/poetry.go @@ -4,10 +4,10 @@ import ( "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/toml" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" ) var language = toml.GetLanguage() diff --git a/internal/detectors/dependencies/poetry/poetry_test.go b/pkg/detectors/dependencies/poetry/poetry_test.go similarity index 76% rename from internal/detectors/dependencies/poetry/poetry_test.go rename to pkg/detectors/dependencies/poetry/poetry_test.go index 69c908901..9c2b0a5fb 100644 --- a/internal/detectors/dependencies/poetry/poetry_test.go +++ b/pkg/detectors/dependencies/poetry/poetry_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/poetry/testdata/poetry.lock b/pkg/detectors/dependencies/poetry/testdata/poetry.lock similarity index 100% rename from internal/detectors/dependencies/poetry/testdata/poetry.lock rename to pkg/detectors/dependencies/poetry/testdata/poetry.lock diff --git a/internal/detectors/dependencies/pom-xml/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/pom-xml/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/pom-xml/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/pom-xml/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/pom-xml/pom-xml.go b/pkg/detectors/dependencies/pom-xml/pom-xml.go similarity index 87% rename from internal/detectors/dependencies/pom-xml/pom-xml.go rename to pkg/detectors/dependencies/pom-xml/pom-xml.go index 4be013438..2c314bddc 100644 --- a/internal/detectors/dependencies/pom-xml/pom-xml.go +++ b/pkg/detectors/dependencies/pom-xml/pom-xml.go @@ -3,11 +3,11 @@ package pomxml import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/sitter/xml" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/sitter/xml" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" ) var language = xml.GetLanguage() diff --git a/internal/detectors/dependencies/pom-xml/pom-xml_test.go b/pkg/detectors/dependencies/pom-xml/pom-xml_test.go similarity index 76% rename from internal/detectors/dependencies/pom-xml/pom-xml_test.go rename to pkg/detectors/dependencies/pom-xml/pom-xml_test.go index 2cf9cdd70..03045dd2a 100644 --- a/internal/detectors/dependencies/pom-xml/pom-xml_test.go +++ b/pkg/detectors/dependencies/pom-xml/pom-xml_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/pom-xml/testdata/large-file/pom.xml b/pkg/detectors/dependencies/pom-xml/testdata/large-file/pom.xml similarity index 100% rename from internal/detectors/dependencies/pom-xml/testdata/large-file/pom.xml rename to pkg/detectors/dependencies/pom-xml/testdata/large-file/pom.xml diff --git a/internal/detectors/dependencies/pom-xml/testdata/v1/pom.xml b/pkg/detectors/dependencies/pom-xml/testdata/v1/pom.xml similarity index 100% rename from internal/detectors/dependencies/pom-xml/testdata/v1/pom.xml rename to pkg/detectors/dependencies/pom-xml/testdata/v1/pom.xml diff --git a/internal/detectors/dependencies/pom-xml/testdata/v2-iso/pom.xml b/pkg/detectors/dependencies/pom-xml/testdata/v2-iso/pom.xml similarity index 100% rename from internal/detectors/dependencies/pom-xml/testdata/v2-iso/pom.xml rename to pkg/detectors/dependencies/pom-xml/testdata/v2-iso/pom.xml diff --git a/internal/detectors/dependencies/pom-xml/testdata/v2/pom.xml b/pkg/detectors/dependencies/pom-xml/testdata/v2/pom.xml similarity index 100% rename from internal/detectors/dependencies/pom-xml/testdata/v2/pom.xml rename to pkg/detectors/dependencies/pom-xml/testdata/v2/pom.xml diff --git a/internal/detectors/dependencies/project-json/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/project-json/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/project-json/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/project-json/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/project-json/project-json.go b/pkg/detectors/dependencies/project-json/project-json.go similarity index 87% rename from internal/detectors/dependencies/project-json/project-json.go rename to pkg/detectors/dependencies/project-json/project-json.go index 272b2b5ff..b556ae0ae 100644 --- a/internal/detectors/dependencies/project-json/project-json.go +++ b/pkg/detectors/dependencies/project-json/project-json.go @@ -1,10 +1,10 @@ package projectjson import ( - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/dependencies/project-json/project-json_test.go b/pkg/detectors/dependencies/project-json/project-json_test.go similarity index 76% rename from internal/detectors/dependencies/project-json/project-json_test.go rename to pkg/detectors/dependencies/project-json/project-json_test.go index 28106bbfd..7127e7da7 100644 --- a/internal/detectors/dependencies/project-json/project-json_test.go +++ b/pkg/detectors/dependencies/project-json/project-json_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/project-json/testdata/project.json b/pkg/detectors/dependencies/project-json/testdata/project.json similarity index 100% rename from internal/detectors/dependencies/project-json/testdata/project.json rename to pkg/detectors/dependencies/project-json/testdata/project.json diff --git a/internal/detectors/dependencies/pyproject/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/pyproject/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/pyproject/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/pyproject/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/pyproject/pyproject.go b/pkg/detectors/dependencies/pyproject/pyproject.go similarity index 86% rename from internal/detectors/dependencies/pyproject/pyproject.go rename to pkg/detectors/dependencies/pyproject/pyproject.go index 36e676b1b..f73a279bf 100644 --- a/internal/detectors/dependencies/pyproject/pyproject.go +++ b/pkg/detectors/dependencies/pyproject/pyproject.go @@ -4,10 +4,10 @@ import ( "github.com/rs/zerolog/log" "github.com/smacker/go-tree-sitter/toml" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" ) var language = toml.GetLanguage() diff --git a/internal/detectors/dependencies/pyproject/pyproject_test.go b/pkg/detectors/dependencies/pyproject/pyproject_test.go similarity index 76% rename from internal/detectors/dependencies/pyproject/pyproject_test.go rename to pkg/detectors/dependencies/pyproject/pyproject_test.go index b4721444c..3bf124a1f 100644 --- a/internal/detectors/dependencies/pyproject/pyproject_test.go +++ b/pkg/detectors/dependencies/pyproject/pyproject_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/pyproject/testdata/pyproject.toml b/pkg/detectors/dependencies/pyproject/testdata/pyproject.toml similarity index 100% rename from internal/detectors/dependencies/pyproject/testdata/pyproject.toml rename to pkg/detectors/dependencies/pyproject/testdata/pyproject.toml diff --git a/internal/detectors/dependencies/requirements/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/requirements/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/requirements/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/requirements/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/requirements/requirements.go b/pkg/detectors/dependencies/requirements/requirements.go similarity index 85% rename from internal/detectors/dependencies/requirements/requirements.go rename to pkg/detectors/dependencies/requirements/requirements.go index 2904db4b3..5975ba031 100644 --- a/internal/detectors/dependencies/requirements/requirements.go +++ b/pkg/detectors/dependencies/requirements/requirements.go @@ -5,9 +5,9 @@ import ( "os" "regexp" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/linescanner" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/linescanner" "github.com/rs/zerolog/log" ) diff --git a/internal/detectors/dependencies/requirements/requirements_test.go b/pkg/detectors/dependencies/requirements/requirements_test.go similarity index 76% rename from internal/detectors/dependencies/requirements/requirements_test.go rename to pkg/detectors/dependencies/requirements/requirements_test.go index ed2c1deab..a73f83431 100644 --- a/internal/detectors/dependencies/requirements/requirements_test.go +++ b/pkg/detectors/dependencies/requirements/requirements_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/dependencies/requirements/testdata/requirements.txt b/pkg/detectors/dependencies/requirements/testdata/requirements.txt similarity index 100% rename from internal/detectors/dependencies/requirements/testdata/requirements.txt rename to pkg/detectors/dependencies/requirements/testdata/requirements.txt diff --git a/internal/detectors/dependencies/yarnlock/.snapshots/TestDependenciesReport b/pkg/detectors/dependencies/yarnlock/.snapshots/TestDependenciesReport similarity index 100% rename from internal/detectors/dependencies/yarnlock/.snapshots/TestDependenciesReport rename to pkg/detectors/dependencies/yarnlock/.snapshots/TestDependenciesReport diff --git a/internal/detectors/dependencies/yarnlock/testdata/yarn.lock b/pkg/detectors/dependencies/yarnlock/testdata/yarn.lock similarity index 100% rename from internal/detectors/dependencies/yarnlock/testdata/yarn.lock rename to pkg/detectors/dependencies/yarnlock/testdata/yarn.lock diff --git a/internal/detectors/dependencies/yarnlock/yarnlock.go b/pkg/detectors/dependencies/yarnlock/yarnlock.go similarity index 92% rename from internal/detectors/dependencies/yarnlock/yarnlock.go rename to pkg/detectors/dependencies/yarnlock/yarnlock.go index f006d6326..4ea1cfb86 100644 --- a/internal/detectors/dependencies/yarnlock/yarnlock.go +++ b/pkg/detectors/dependencies/yarnlock/yarnlock.go @@ -6,9 +6,9 @@ import ( "regexp" "strings" - "github.com/bearer/bearer/internal/detectors/dependencies/depsbase" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/linescanner" + "github.com/bearer/bearer/pkg/detectors/dependencies/depsbase" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/linescanner" "github.com/rs/zerolog/log" ) diff --git a/internal/detectors/dependencies/yarnlock/yarnlock_test.go b/pkg/detectors/dependencies/yarnlock/yarnlock_test.go similarity index 76% rename from internal/detectors/dependencies/yarnlock/yarnlock_test.go rename to pkg/detectors/dependencies/yarnlock/yarnlock_test.go index 469211d90..9d1ac41bc 100644 --- a/internal/detectors/dependencies/yarnlock/yarnlock_test.go +++ b/pkg/detectors/dependencies/yarnlock/yarnlock_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/detectors.go b/pkg/detectors/detectors.go similarity index 75% rename from internal/detectors/detectors.go rename to pkg/detectors/detectors.go index d55194d3e..1bf41636f 100644 --- a/internal/detectors/detectors.go +++ b/pkg/detectors/detectors.go @@ -9,43 +9,43 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/detectors/beego" - "github.com/bearer/bearer/internal/detectors/csharp" - "github.com/bearer/bearer/internal/detectors/custom" - "github.com/bearer/bearer/internal/detectors/dependencies" - "github.com/bearer/bearer/internal/detectors/django" - "github.com/bearer/bearer/internal/detectors/dotnet" - "github.com/bearer/bearer/internal/detectors/envfile" - "github.com/bearer/bearer/internal/detectors/gitleaks" - "github.com/bearer/bearer/internal/detectors/golang" - "github.com/bearer/bearer/internal/detectors/graphql" - "github.com/bearer/bearer/internal/detectors/html" - "github.com/bearer/bearer/internal/detectors/ipynb" - "github.com/bearer/bearer/internal/detectors/java" - "github.com/bearer/bearer/internal/detectors/javascript" - "github.com/bearer/bearer/internal/detectors/openapi" - "github.com/bearer/bearer/internal/detectors/php" - "github.com/bearer/bearer/internal/detectors/proto" - "github.com/bearer/bearer/internal/detectors/python" - "github.com/bearer/bearer/internal/detectors/rails" - "github.com/bearer/bearer/internal/detectors/ruby" - "github.com/bearer/bearer/internal/detectors/simple" - "github.com/bearer/bearer/internal/detectors/spring" - "github.com/bearer/bearer/internal/detectors/sql" - "github.com/bearer/bearer/internal/detectors/symfony" - "github.com/bearer/bearer/internal/detectors/tsx" - "github.com/bearer/bearer/internal/detectors/typescript" - "github.com/bearer/bearer/internal/detectors/yamlconfig" - "github.com/bearer/bearer/internal/scanner" - "github.com/bearer/bearer/internal/scanner/stats" - "github.com/bearer/bearer/internal/util/file" - - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser/nodeid" - - reporttypes "github.com/bearer/bearer/internal/report" - reportdetectors "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/detectors/beego" + "github.com/bearer/bearer/pkg/detectors/csharp" + "github.com/bearer/bearer/pkg/detectors/custom" + "github.com/bearer/bearer/pkg/detectors/dependencies" + "github.com/bearer/bearer/pkg/detectors/django" + "github.com/bearer/bearer/pkg/detectors/dotnet" + "github.com/bearer/bearer/pkg/detectors/envfile" + "github.com/bearer/bearer/pkg/detectors/gitleaks" + "github.com/bearer/bearer/pkg/detectors/golang" + "github.com/bearer/bearer/pkg/detectors/graphql" + "github.com/bearer/bearer/pkg/detectors/html" + "github.com/bearer/bearer/pkg/detectors/ipynb" + "github.com/bearer/bearer/pkg/detectors/java" + "github.com/bearer/bearer/pkg/detectors/javascript" + "github.com/bearer/bearer/pkg/detectors/openapi" + "github.com/bearer/bearer/pkg/detectors/php" + "github.com/bearer/bearer/pkg/detectors/proto" + "github.com/bearer/bearer/pkg/detectors/python" + "github.com/bearer/bearer/pkg/detectors/rails" + "github.com/bearer/bearer/pkg/detectors/ruby" + "github.com/bearer/bearer/pkg/detectors/simple" + "github.com/bearer/bearer/pkg/detectors/spring" + "github.com/bearer/bearer/pkg/detectors/sql" + "github.com/bearer/bearer/pkg/detectors/symfony" + "github.com/bearer/bearer/pkg/detectors/tsx" + "github.com/bearer/bearer/pkg/detectors/typescript" + "github.com/bearer/bearer/pkg/detectors/yamlconfig" + "github.com/bearer/bearer/pkg/scanner" + "github.com/bearer/bearer/pkg/scanner/stats" + "github.com/bearer/bearer/pkg/util/file" + + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser/nodeid" + + reporttypes "github.com/bearer/bearer/pkg/report" + reportdetectors "github.com/bearer/bearer/pkg/report/detectors" ) type InitializedDetector struct { diff --git a/internal/detectors/django/.snapshots/TestDetectorReportDatabases b/pkg/detectors/django/.snapshots/TestDetectorReportDatabases similarity index 100% rename from internal/detectors/django/.snapshots/TestDetectorReportDatabases rename to pkg/detectors/django/.snapshots/TestDetectorReportDatabases diff --git a/internal/detectors/django/django.go b/pkg/detectors/django/django.go similarity index 88% rename from internal/detectors/django/django.go rename to pkg/detectors/django/django.go index 4c2b10e69..39244ab1e 100644 --- a/internal/detectors/django/django.go +++ b/pkg/detectors/django/django.go @@ -4,12 +4,12 @@ import ( "errors" "strings" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks/django" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks/django" + "github.com/bearer/bearer/pkg/util/file" "github.com/smacker/go-tree-sitter/python" ) diff --git a/internal/detectors/django/django_test.go b/pkg/detectors/django/django_test.go similarity index 74% rename from internal/detectors/django/django_test.go rename to pkg/detectors/django/django_test.go index ecde1161f..ec84e148e 100644 --- a/internal/detectors/django/django_test.go +++ b/pkg/detectors/django/django_test.go @@ -6,8 +6,8 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - reportdetectors "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + reportdetectors "github.com/bearer/bearer/pkg/report/detectors" ) const detectorType = reportdetectors.DetectorDjango diff --git a/internal/detectors/django/testdata/django/manage.py b/pkg/detectors/django/testdata/django/manage.py similarity index 100% rename from internal/detectors/django/testdata/django/manage.py rename to pkg/detectors/django/testdata/django/manage.py diff --git a/internal/detectors/django/testdata/django/myapp/settings.py b/pkg/detectors/django/testdata/django/myapp/settings.py similarity index 100% rename from internal/detectors/django/testdata/django/myapp/settings.py rename to pkg/detectors/django/testdata/django/myapp/settings.py diff --git a/internal/detectors/django/testdata/not_django/manage.py b/pkg/detectors/django/testdata/not_django/manage.py similarity index 100% rename from internal/detectors/django/testdata/not_django/manage.py rename to pkg/detectors/django/testdata/not_django/manage.py diff --git a/internal/detectors/dotnet/.snapshots/TestDetectorReportDbContexts b/pkg/detectors/dotnet/.snapshots/TestDetectorReportDbContexts similarity index 100% rename from internal/detectors/dotnet/.snapshots/TestDetectorReportDbContexts rename to pkg/detectors/dotnet/.snapshots/TestDetectorReportDbContexts diff --git a/internal/detectors/dotnet/dotnet.go b/pkg/detectors/dotnet/dotnet.go similarity index 89% rename from internal/detectors/dotnet/dotnet.go rename to pkg/detectors/dotnet/dotnet.go index 31d8e83d9..7711694af 100644 --- a/internal/detectors/dotnet/dotnet.go +++ b/pkg/detectors/dotnet/dotnet.go @@ -4,12 +4,12 @@ import ( "os" "path/filepath" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks/dotnet" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks/dotnet" + "github.com/bearer/bearer/pkg/util/file" "github.com/smacker/go-tree-sitter/csharp" ) diff --git a/internal/detectors/dotnet/dotnet_test.go b/pkg/detectors/dotnet/dotnet_test.go similarity index 76% rename from internal/detectors/dotnet/dotnet_test.go rename to pkg/detectors/dotnet/dotnet_test.go index 7dfacaa23..4b01d70e1 100644 --- a/internal/detectors/dotnet/dotnet_test.go +++ b/pkg/detectors/dotnet/dotnet_test.go @@ -6,9 +6,9 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" - reportdetectors "github.com/bearer/bearer/internal/report/detectors" + reportdetectors "github.com/bearer/bearer/pkg/report/detectors" ) const detectorType = reportdetectors.DetectorDotnet diff --git a/internal/detectors/dotnet/testdata/project/db_contexts/multiple/Startup.cs b/pkg/detectors/dotnet/testdata/project/db_contexts/multiple/Startup.cs similarity index 100% rename from internal/detectors/dotnet/testdata/project/db_contexts/multiple/Startup.cs rename to pkg/detectors/dotnet/testdata/project/db_contexts/multiple/Startup.cs diff --git a/internal/detectors/dotnet/testdata/project/db_contexts/multiple/TodoApi.csproj b/pkg/detectors/dotnet/testdata/project/db_contexts/multiple/TodoApi.csproj similarity index 100% rename from internal/detectors/dotnet/testdata/project/db_contexts/multiple/TodoApi.csproj rename to pkg/detectors/dotnet/testdata/project/db_contexts/multiple/TodoApi.csproj diff --git a/internal/detectors/dotnet/testdata/project/db_contexts/multiple/nested/Startup.cs b/pkg/detectors/dotnet/testdata/project/db_contexts/multiple/nested/Startup.cs similarity index 100% rename from internal/detectors/dotnet/testdata/project/db_contexts/multiple/nested/Startup.cs rename to pkg/detectors/dotnet/testdata/project/db_contexts/multiple/nested/Startup.cs diff --git a/internal/detectors/dotnet/testdata/project/multiple/MvcMovie.csproj b/pkg/detectors/dotnet/testdata/project/multiple/MvcMovie.csproj similarity index 100% rename from internal/detectors/dotnet/testdata/project/multiple/MvcMovie.csproj rename to pkg/detectors/dotnet/testdata/project/multiple/MvcMovie.csproj diff --git a/internal/detectors/dotnet/testdata/project/multiple/TodoApi.csproj b/pkg/detectors/dotnet/testdata/project/multiple/TodoApi.csproj similarity index 100% rename from internal/detectors/dotnet/testdata/project/multiple/TodoApi.csproj rename to pkg/detectors/dotnet/testdata/project/multiple/TodoApi.csproj diff --git a/internal/detectors/dotnet/testdata/project/single/TodoApi.csproj b/pkg/detectors/dotnet/testdata/project/single/TodoApi.csproj similarity index 100% rename from internal/detectors/dotnet/testdata/project/single/TodoApi.csproj rename to pkg/detectors/dotnet/testdata/project/single/TodoApi.csproj diff --git a/internal/detectors/dotnet/testdata/project/test/TodoApiTests.csproj b/pkg/detectors/dotnet/testdata/project/test/TodoApiTests.csproj similarity index 100% rename from internal/detectors/dotnet/testdata/project/test/TodoApiTests.csproj rename to pkg/detectors/dotnet/testdata/project/test/TodoApiTests.csproj diff --git a/internal/detectors/envfile/.snapshots/TestDetectorReportVariables b/pkg/detectors/envfile/.snapshots/TestDetectorReportVariables similarity index 100% rename from internal/detectors/envfile/.snapshots/TestDetectorReportVariables rename to pkg/detectors/envfile/.snapshots/TestDetectorReportVariables diff --git a/internal/detectors/envfile/envfile.go b/pkg/detectors/envfile/envfile.go similarity index 77% rename from internal/detectors/envfile/envfile.go rename to pkg/detectors/envfile/envfile.go index b858a1220..70c7cdd0a 100644 --- a/internal/detectors/envfile/envfile.go +++ b/pkg/detectors/envfile/envfile.go @@ -6,14 +6,14 @@ import ( "github.com/smacker/go-tree-sitter/bash" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/interfaces" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - reportinterface "github.com/bearer/bearer/internal/report/interfaces" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/interfaces" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + reportinterface "github.com/bearer/bearer/pkg/report/interfaces" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/util/file" ) var ( diff --git a/internal/detectors/envfile/envfile_test.go b/pkg/detectors/envfile/envfile_test.go similarity index 77% rename from internal/detectors/envfile/envfile_test.go rename to pkg/detectors/envfile/envfile_test.go index 60779a924..8aee09f5d 100644 --- a/internal/detectors/envfile/envfile_test.go +++ b/pkg/detectors/envfile/envfile_test.go @@ -6,8 +6,8 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" ) const detectorType = detectors.DetectorEnvFile diff --git a/internal/detectors/envfile/testdata/variables/.envrc.example b/pkg/detectors/envfile/testdata/variables/.envrc.example similarity index 100% rename from internal/detectors/envfile/testdata/variables/.envrc.example rename to pkg/detectors/envfile/testdata/variables/.envrc.example diff --git a/internal/detectors/gitleaks/.snapshots/TestSecretLeaks b/pkg/detectors/gitleaks/.snapshots/TestSecretLeaks similarity index 100% rename from internal/detectors/gitleaks/.snapshots/TestSecretLeaks rename to pkg/detectors/gitleaks/.snapshots/TestSecretLeaks diff --git a/internal/detectors/gitleaks/gitlab_config.toml b/pkg/detectors/gitleaks/gitlab_config.toml similarity index 100% rename from internal/detectors/gitleaks/gitlab_config.toml rename to pkg/detectors/gitleaks/gitlab_config.toml diff --git a/internal/detectors/gitleaks/gitleaks.go b/pkg/detectors/gitleaks/gitleaks.go similarity index 83% rename from internal/detectors/gitleaks/gitleaks.go rename to pkg/detectors/gitleaks/gitleaks.go index 4c29f8cf5..e6286d1e1 100644 --- a/internal/detectors/gitleaks/gitleaks.go +++ b/pkg/detectors/gitleaks/gitleaks.go @@ -5,12 +5,12 @@ import ( "log" "strings" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/secret" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/secret" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/util/file" "github.com/pelletier/go-toml" "github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/detect" diff --git a/internal/detectors/gitleaks/gitleaks_test.go b/pkg/detectors/gitleaks/gitleaks_test.go similarity index 62% rename from internal/detectors/gitleaks/gitleaks_test.go rename to pkg/detectors/gitleaks/gitleaks_test.go index 747ffae7e..bd376627b 100644 --- a/internal/detectors/gitleaks/gitleaks_test.go +++ b/pkg/detectors/gitleaks/gitleaks_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/gitleaks" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/gitleaks" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/parser/nodeid" ) const detectorType = detectortypes.DetectorGitleaks diff --git a/internal/detectors/gitleaks/testdata/aws.js b/pkg/detectors/gitleaks/testdata/aws.js similarity index 100% rename from internal/detectors/gitleaks/testdata/aws.js rename to pkg/detectors/gitleaks/testdata/aws.js diff --git a/internal/detectors/gitleaks/testdata/regex/rsa.pem b/pkg/detectors/gitleaks/testdata/regex/rsa.pem similarity index 100% rename from internal/detectors/gitleaks/testdata/regex/rsa.pem rename to pkg/detectors/gitleaks/testdata/regex/rsa.pem diff --git a/internal/detectors/golang/.snapshots/TestDetectorReportDataTypes b/pkg/detectors/golang/.snapshots/TestDetectorReportDataTypes similarity index 100% rename from internal/detectors/golang/.snapshots/TestDetectorReportDataTypes rename to pkg/detectors/golang/.snapshots/TestDetectorReportDataTypes diff --git a/internal/detectors/golang/.snapshots/TestDetectorReportInterfacesPaths b/pkg/detectors/golang/.snapshots/TestDetectorReportInterfacesPaths similarity index 100% rename from internal/detectors/golang/.snapshots/TestDetectorReportInterfacesPaths rename to pkg/detectors/golang/.snapshots/TestDetectorReportInterfacesPaths diff --git a/internal/detectors/golang/.snapshots/TestDetectorReportInterfacesProject b/pkg/detectors/golang/.snapshots/TestDetectorReportInterfacesProject similarity index 100% rename from internal/detectors/golang/.snapshots/TestDetectorReportInterfacesProject rename to pkg/detectors/golang/.snapshots/TestDetectorReportInterfacesProject diff --git a/internal/detectors/golang/datatype/datatype.go b/pkg/detectors/golang/datatype/datatype.go similarity index 94% rename from internal/detectors/golang/datatype/datatype.go rename to pkg/detectors/golang/datatype/datatype.go index c951b7f33..de68ad3b4 100644 --- a/internal/detectors/golang/datatype/datatype.go +++ b/pkg/detectors/golang/datatype/datatype.go @@ -3,14 +3,14 @@ package datatype import ( "strings" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" "github.com/smacker/go-tree-sitter/golang" ) diff --git a/internal/detectors/golang/golang.go b/pkg/detectors/golang/golang.go similarity index 88% rename from internal/detectors/golang/golang.go rename to pkg/detectors/golang/golang.go index 200c78102..ee0e302bb 100644 --- a/internal/detectors/golang/golang.go +++ b/pkg/detectors/golang/golang.go @@ -6,19 +6,19 @@ import ( "github.com/go-enry/go-enry/v2/regex" "github.com/smacker/go-tree-sitter/golang" - "github.com/bearer/bearer/internal/detectors/golang/datatype" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/golang_util" - "github.com/bearer/bearer/internal/parser/interfacedetector" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/normalize_key" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/golang/datatype" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/golang_util" + "github.com/bearer/bearer/pkg/parser/interfacedetector" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/normalize_key" + "github.com/bearer/bearer/pkg/util/stringutil" ) var ( diff --git a/internal/detectors/golang/golang_test.go b/pkg/detectors/golang/golang_test.go similarity index 80% rename from internal/detectors/golang/golang_test.go rename to pkg/detectors/golang/golang_test.go index 9324e829d..909fef161 100644 --- a/internal/detectors/golang/golang_test.go +++ b/pkg/detectors/golang/golang_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/golang" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/golang" + "github.com/bearer/bearer/pkg/parser/nodeid" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" ) const detectorType = detectortypes.DetectorGo diff --git a/internal/detectors/golang/testdata/datatypes/datatype.go b/pkg/detectors/golang/testdata/datatypes/datatype.go similarity index 100% rename from internal/detectors/golang/testdata/datatypes/datatype.go rename to pkg/detectors/golang/testdata/datatypes/datatype.go diff --git a/internal/detectors/golang/testdata/paths/paths.go b/pkg/detectors/golang/testdata/paths/paths.go similarity index 100% rename from internal/detectors/golang/testdata/paths/paths.go rename to pkg/detectors/golang/testdata/paths/paths.go diff --git a/internal/detectors/golang/testdata/project/config.go b/pkg/detectors/golang/testdata/project/config.go similarity index 100% rename from internal/detectors/golang/testdata/project/config.go rename to pkg/detectors/golang/testdata/project/config.go diff --git a/internal/detectors/golang/testdata/project/urls.go b/pkg/detectors/golang/testdata/project/urls.go similarity index 100% rename from internal/detectors/golang/testdata/project/urls.go rename to pkg/detectors/golang/testdata/project/urls.go diff --git a/internal/detectors/graphql/.snapshots/TestBuildReportSchema b/pkg/detectors/graphql/.snapshots/TestBuildReportSchema similarity index 100% rename from internal/detectors/graphql/.snapshots/TestBuildReportSchema rename to pkg/detectors/graphql/.snapshots/TestBuildReportSchema diff --git a/internal/detectors/graphql/graphql.go b/pkg/detectors/graphql/graphql.go similarity index 85% rename from internal/detectors/graphql/graphql.go rename to pkg/detectors/graphql/graphql.go index 90b315368..f46d038f5 100644 --- a/internal/detectors/graphql/graphql.go +++ b/pkg/detectors/graphql/graphql.go @@ -3,17 +3,17 @@ package graphql import ( "strings" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - parserschema "github.com/bearer/bearer/internal/parser/schema" - "github.com/bearer/bearer/internal/parser/sitter/graphql" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/pluralize" - - reporttypes "github.com/bearer/bearer/internal/report" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + parserschema "github.com/bearer/bearer/pkg/parser/schema" + "github.com/bearer/bearer/pkg/parser/sitter/graphql" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/pluralize" + + reporttypes "github.com/bearer/bearer/pkg/report" ) var ( diff --git a/internal/detectors/graphql/graphql_test.go b/pkg/detectors/graphql/graphql_test.go similarity index 62% rename from internal/detectors/graphql/graphql_test.go rename to pkg/detectors/graphql/graphql_test.go index 7aa73a9e2..0ee6d2e01 100644 --- a/internal/detectors/graphql/graphql_test.go +++ b/pkg/detectors/graphql/graphql_test.go @@ -4,11 +4,11 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/graphql" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/parser/nodeid" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/graphql" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/parser/nodeid" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/graphql/testdata/schemas/schema.graphql b/pkg/detectors/graphql/testdata/schemas/schema.graphql similarity index 100% rename from internal/detectors/graphql/testdata/schemas/schema.graphql rename to pkg/detectors/graphql/testdata/schemas/schema.graphql diff --git a/internal/detectors/html/.snapshots/TestDetectorReportInterfaces b/pkg/detectors/html/.snapshots/TestDetectorReportInterfaces similarity index 100% rename from internal/detectors/html/.snapshots/TestDetectorReportInterfaces rename to pkg/detectors/html/.snapshots/TestDetectorReportInterfaces diff --git a/internal/detectors/html/html.go b/pkg/detectors/html/html.go similarity index 84% rename from internal/detectors/html/html.go rename to pkg/detectors/html/html.go index 368d4ff18..3ae5ac23f 100644 --- a/internal/detectors/html/html.go +++ b/pkg/detectors/html/html.go @@ -1,17 +1,17 @@ package html import ( - "github.com/bearer/bearer/internal/detectors/javascript" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/interfaces" - "github.com/bearer/bearer/internal/parser/nodeid" - html "github.com/bearer/bearer/internal/parser/sitter/html2" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - interfacetype "github.com/bearer/bearer/internal/report/interfaces" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/javascript" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/interfaces" + "github.com/bearer/bearer/pkg/parser/nodeid" + html "github.com/bearer/bearer/pkg/parser/sitter/html2" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + interfacetype "github.com/bearer/bearer/pkg/report/interfaces" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/util/file" ) var ( diff --git a/internal/detectors/html/html_test.go b/pkg/detectors/html/html_test.go similarity index 64% rename from internal/detectors/html/html_test.go rename to pkg/detectors/html/html_test.go index ff259117e..9ab5ed23e 100644 --- a/internal/detectors/html/html_test.go +++ b/pkg/detectors/html/html_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/html" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/html" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/parser/nodeid" ) const detectorType = detectortypes.DetectorHTML diff --git a/internal/detectors/html/testdata/project/app.vue b/pkg/detectors/html/testdata/project/app.vue similarity index 100% rename from internal/detectors/html/testdata/project/app.vue rename to pkg/detectors/html/testdata/project/app.vue diff --git a/internal/detectors/html/testdata/project/base.html.twig b/pkg/detectors/html/testdata/project/base.html.twig similarity index 100% rename from internal/detectors/html/testdata/project/base.html.twig rename to pkg/detectors/html/testdata/project/base.html.twig diff --git a/internal/detectors/html/testdata/project/google_analytics.html b/pkg/detectors/html/testdata/project/google_analytics.html similarity index 100% rename from internal/detectors/html/testdata/project/google_analytics.html rename to pkg/detectors/html/testdata/project/google_analytics.html diff --git a/internal/detectors/html/testdata/project/index.cshtml b/pkg/detectors/html/testdata/project/index.cshtml similarity index 100% rename from internal/detectors/html/testdata/project/index.cshtml rename to pkg/detectors/html/testdata/project/index.cshtml diff --git a/internal/detectors/html/testdata/project/index.ejs b/pkg/detectors/html/testdata/project/index.ejs similarity index 100% rename from internal/detectors/html/testdata/project/index.ejs rename to pkg/detectors/html/testdata/project/index.ejs diff --git a/internal/detectors/html/testdata/project/index.handlebars b/pkg/detectors/html/testdata/project/index.handlebars similarity index 100% rename from internal/detectors/html/testdata/project/index.handlebars rename to pkg/detectors/html/testdata/project/index.handlebars diff --git a/internal/detectors/html/testdata/project/index.html b/pkg/detectors/html/testdata/project/index.html similarity index 100% rename from internal/detectors/html/testdata/project/index.html rename to pkg/detectors/html/testdata/project/index.html diff --git a/internal/detectors/html/testdata/project/index.html.erb b/pkg/detectors/html/testdata/project/index.html.erb similarity index 100% rename from internal/detectors/html/testdata/project/index.html.erb rename to pkg/detectors/html/testdata/project/index.html.erb diff --git a/internal/detectors/html/testdata/project/index.html.twig b/pkg/detectors/html/testdata/project/index.html.twig similarity index 100% rename from internal/detectors/html/testdata/project/index.html.twig rename to pkg/detectors/html/testdata/project/index.html.twig diff --git a/internal/detectors/html/testdata/project/index.jinja b/pkg/detectors/html/testdata/project/index.jinja similarity index 100% rename from internal/detectors/html/testdata/project/index.jinja rename to pkg/detectors/html/testdata/project/index.jinja diff --git a/internal/detectors/html/testdata/project/index.liquid b/pkg/detectors/html/testdata/project/index.liquid similarity index 100% rename from internal/detectors/html/testdata/project/index.liquid rename to pkg/detectors/html/testdata/project/index.liquid diff --git a/internal/detectors/html/testdata/project/index.mustache b/pkg/detectors/html/testdata/project/index.mustache similarity index 100% rename from internal/detectors/html/testdata/project/index.mustache rename to pkg/detectors/html/testdata/project/index.mustache diff --git a/internal/detectors/html/testdata/project/index.phtml b/pkg/detectors/html/testdata/project/index.phtml similarity index 100% rename from internal/detectors/html/testdata/project/index.phtml rename to pkg/detectors/html/testdata/project/index.phtml diff --git a/internal/detectors/internal/testhelper/testhelper.go b/pkg/detectors/internal/testhelper/testhelper.go similarity index 89% rename from internal/detectors/internal/testhelper/testhelper.go rename to pkg/detectors/internal/testhelper/testhelper.go index 1803526ab..a26fc6488 100644 --- a/internal/detectors/internal/testhelper/testhelper.go +++ b/pkg/detectors/internal/testhelper/testhelper.go @@ -7,19 +7,19 @@ import ( "path/filepath" "strings" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - - "github.com/bearer/bearer/internal/report/dependencies" - "github.com/bearer/bearer/internal/report/detections" - reportdetectors "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks" - "github.com/bearer/bearer/internal/report/interfaces" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/report/schema/datatype" - "github.com/bearer/bearer/internal/report/secret" - "github.com/bearer/bearer/internal/report/source" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + + "github.com/bearer/bearer/pkg/report/dependencies" + "github.com/bearer/bearer/pkg/report/detections" + reportdetectors "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks" + "github.com/bearer/bearer/pkg/report/interfaces" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/report/schema/datatype" + "github.com/bearer/bearer/pkg/report/secret" + "github.com/bearer/bearer/pkg/report/source" "github.com/stretchr/testify/assert" ) diff --git a/internal/detectors/ipynb/.snapshots/TestDetectorReportInterfaces b/pkg/detectors/ipynb/.snapshots/TestDetectorReportInterfaces similarity index 100% rename from internal/detectors/ipynb/.snapshots/TestDetectorReportInterfaces rename to pkg/detectors/ipynb/.snapshots/TestDetectorReportInterfaces diff --git a/internal/detectors/ipynb/ipynb.go b/pkg/detectors/ipynb/ipynb.go similarity index 87% rename from internal/detectors/ipynb/ipynb.go rename to pkg/detectors/ipynb/ipynb.go index 06e01adf4..57609fbf3 100644 --- a/internal/detectors/ipynb/ipynb.go +++ b/pkg/detectors/ipynb/ipynb.go @@ -4,13 +4,13 @@ import ( "strconv" "strings" - "github.com/bearer/bearer/internal/detectors/python" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/detectors/python" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" jslang "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/ipynb/ipynb_test.go b/pkg/detectors/ipynb/ipynb_test.go similarity index 64% rename from internal/detectors/ipynb/ipynb_test.go rename to pkg/detectors/ipynb/ipynb_test.go index c892496df..4a4e0cb1c 100644 --- a/internal/detectors/ipynb/ipynb_test.go +++ b/pkg/detectors/ipynb/ipynb_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/ipynb" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/ipynb" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/parser/nodeid" ) const detectorType = detectortypes.DetectorIPYNB diff --git a/internal/detectors/ipynb/testdata/notebooks/small.ipynb b/pkg/detectors/ipynb/testdata/notebooks/small.ipynb similarity index 100% rename from internal/detectors/ipynb/testdata/notebooks/small.ipynb rename to pkg/detectors/ipynb/testdata/notebooks/small.ipynb diff --git a/internal/detectors/java/.snapshots/TestDetectorReportDataTypes b/pkg/detectors/java/.snapshots/TestDetectorReportDataTypes similarity index 100% rename from internal/detectors/java/.snapshots/TestDetectorReportDataTypes rename to pkg/detectors/java/.snapshots/TestDetectorReportDataTypes diff --git a/internal/detectors/java/.snapshots/TestDetectorReportPaths b/pkg/detectors/java/.snapshots/TestDetectorReportPaths similarity index 100% rename from internal/detectors/java/.snapshots/TestDetectorReportPaths rename to pkg/detectors/java/.snapshots/TestDetectorReportPaths diff --git a/internal/detectors/java/.snapshots/TestDetectorReportVariables b/pkg/detectors/java/.snapshots/TestDetectorReportVariables similarity index 100% rename from internal/detectors/java/.snapshots/TestDetectorReportVariables rename to pkg/detectors/java/.snapshots/TestDetectorReportVariables diff --git a/internal/detectors/java/datatype/datatype.go b/pkg/detectors/java/datatype/datatype.go similarity index 89% rename from internal/detectors/java/datatype/datatype.go rename to pkg/detectors/java/datatype/datatype.go index 796d7df77..689c86888 100644 --- a/internal/detectors/java/datatype/datatype.go +++ b/pkg/detectors/java/datatype/datatype.go @@ -3,14 +3,14 @@ package datatype import ( "strings" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" "github.com/smacker/go-tree-sitter/java" ) diff --git a/internal/detectors/java/java.go b/pkg/detectors/java/java.go similarity index 85% rename from internal/detectors/java/java.go rename to pkg/detectors/java/java.go index f425457fd..2da839e2a 100644 --- a/internal/detectors/java/java.go +++ b/pkg/detectors/java/java.go @@ -5,16 +5,16 @@ import ( "github.com/smacker/go-tree-sitter/java" - "github.com/bearer/bearer/internal/detectors/java/datatype" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/interfacedetector" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/java/datatype" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/interfacedetector" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" + "github.com/bearer/bearer/pkg/util/file" ) var ( diff --git a/internal/detectors/java/java_test.go b/pkg/detectors/java/java_test.go similarity index 80% rename from internal/detectors/java/java_test.go rename to pkg/detectors/java/java_test.go index fdbea0500..4cad63a67 100644 --- a/internal/detectors/java/java_test.go +++ b/pkg/detectors/java/java_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/java" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/java" + "github.com/bearer/bearer/pkg/parser/nodeid" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" ) const detectorType = detectortypes.DetectorJava diff --git a/internal/detectors/java/testdata/datatype/datatype.java b/pkg/detectors/java/testdata/datatype/datatype.java similarity index 100% rename from internal/detectors/java/testdata/datatype/datatype.java rename to pkg/detectors/java/testdata/datatype/datatype.java diff --git a/internal/detectors/java/testdata/paths/config.java b/pkg/detectors/java/testdata/paths/config.java similarity index 100% rename from internal/detectors/java/testdata/paths/config.java rename to pkg/detectors/java/testdata/paths/config.java diff --git a/internal/detectors/java/testdata/variables/config.java b/pkg/detectors/java/testdata/variables/config.java similarity index 100% rename from internal/detectors/java/testdata/variables/config.java rename to pkg/detectors/java/testdata/variables/config.java diff --git a/internal/detectors/javascript/.snapshots/TestDetectorReportDatatypes b/pkg/detectors/javascript/.snapshots/TestDetectorReportDatatypes similarity index 100% rename from internal/detectors/javascript/.snapshots/TestDetectorReportDatatypes rename to pkg/detectors/javascript/.snapshots/TestDetectorReportDatatypes diff --git a/internal/detectors/javascript/.snapshots/TestDetectorReportGeneral b/pkg/detectors/javascript/.snapshots/TestDetectorReportGeneral similarity index 100% rename from internal/detectors/javascript/.snapshots/TestDetectorReportGeneral rename to pkg/detectors/javascript/.snapshots/TestDetectorReportGeneral diff --git a/internal/detectors/javascript/datatype/datatype.go b/pkg/detectors/javascript/datatype/datatype.go similarity index 63% rename from internal/detectors/javascript/datatype/datatype.go rename to pkg/detectors/javascript/datatype/datatype.go index 3952db60b..a33b1c2dc 100644 --- a/internal/detectors/javascript/datatype/datatype.go +++ b/pkg/detectors/javascript/datatype/datatype.go @@ -1,13 +1,13 @@ package datatype import ( - "github.com/bearer/bearer/internal/parser" - parserdatatype "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + parserdatatype "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" ) func Discover(report report.Report, tree *parser.Tree, idGenerator nodeid.Generator) { diff --git a/internal/detectors/javascript/datatype/objects.go b/pkg/detectors/javascript/datatype/objects.go similarity index 97% rename from internal/detectors/javascript/datatype/objects.go rename to pkg/detectors/javascript/datatype/objects.go index be8ff62f4..a2d8536e6 100644 --- a/internal/detectors/javascript/datatype/objects.go +++ b/pkg/detectors/javascript/datatype/objects.go @@ -3,10 +3,10 @@ package datatype import ( "strings" - "github.com/bearer/bearer/internal/parser" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" - "github.com/bearer/bearer/internal/report/schema" + "github.com/bearer/bearer/pkg/report/schema" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/javascript/datatype/properties.go b/pkg/detectors/javascript/datatype/properties.go similarity index 92% rename from internal/detectors/javascript/datatype/properties.go rename to pkg/detectors/javascript/datatype/properties.go index 263f6bbd3..cd69fc02a 100644 --- a/internal/detectors/javascript/datatype/properties.go +++ b/pkg/detectors/javascript/datatype/properties.go @@ -1,12 +1,12 @@ package datatype import ( - "github.com/bearer/bearer/internal/parser" - parserdatatype "github.com/bearer/bearer/internal/parser/datatype" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + parserdatatype "github.com/bearer/bearer/pkg/parser/datatype" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/javascript/javascript.go b/pkg/detectors/javascript/javascript.go similarity index 89% rename from internal/detectors/javascript/javascript.go rename to pkg/detectors/javascript/javascript.go index f41d8ea72..b86ed1324 100644 --- a/internal/detectors/javascript/javascript.go +++ b/pkg/detectors/javascript/javascript.go @@ -8,16 +8,16 @@ import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/detectors/javascript/datatype" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/interfacedetector" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/javascript/datatype" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/interfacedetector" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" + "github.com/bearer/bearer/pkg/util/file" ) var ( diff --git a/internal/detectors/javascript/javascript_test.go b/pkg/detectors/javascript/javascript_test.go similarity index 80% rename from internal/detectors/javascript/javascript_test.go rename to pkg/detectors/javascript/javascript_test.go index 923039c11..59e3e6675 100644 --- a/internal/detectors/javascript/javascript_test.go +++ b/pkg/detectors/javascript/javascript_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/javascript" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/javascript" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/parser/nodeid" ) const detectorType = detectortypes.DetectorJavascript diff --git a/internal/detectors/javascript/testdata/datatypes/datatypes.js b/pkg/detectors/javascript/testdata/datatypes/datatypes.js similarity index 100% rename from internal/detectors/javascript/testdata/datatypes/datatypes.js rename to pkg/detectors/javascript/testdata/datatypes/datatypes.js diff --git a/internal/detectors/javascript/testdata/datatypes_performance/angular1.8.min.js b/pkg/detectors/javascript/testdata/datatypes_performance/angular1.8.min.js similarity index 100% rename from internal/detectors/javascript/testdata/datatypes_performance/angular1.8.min.js rename to pkg/detectors/javascript/testdata/datatypes_performance/angular1.8.min.js diff --git a/internal/detectors/javascript/testdata/general/paths/main.js b/pkg/detectors/javascript/testdata/general/paths/main.js similarity index 100% rename from internal/detectors/javascript/testdata/general/paths/main.js rename to pkg/detectors/javascript/testdata/general/paths/main.js diff --git a/internal/detectors/javascript/testdata/general/variables/config.js b/pkg/detectors/javascript/testdata/general/variables/config.js similarity index 100% rename from internal/detectors/javascript/testdata/general/variables/config.js rename to pkg/detectors/javascript/testdata/general/variables/config.js diff --git a/internal/detectors/javascript/util/util.go b/pkg/detectors/javascript/util/util.go similarity index 96% rename from internal/detectors/javascript/util/util.go rename to pkg/detectors/javascript/util/util.go index 20d0430ca..da7caaabd 100644 --- a/internal/detectors/javascript/util/util.go +++ b/pkg/detectors/javascript/util/util.go @@ -1,8 +1,8 @@ package util import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/util/stringutil" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/openapi/.snapshots/TestDetectorV2json b/pkg/detectors/openapi/.snapshots/TestDetectorV2json similarity index 100% rename from internal/detectors/openapi/.snapshots/TestDetectorV2json rename to pkg/detectors/openapi/.snapshots/TestDetectorV2json diff --git a/internal/detectors/openapi/.snapshots/TestDetectorV2yaml b/pkg/detectors/openapi/.snapshots/TestDetectorV2yaml similarity index 100% rename from internal/detectors/openapi/.snapshots/TestDetectorV2yaml rename to pkg/detectors/openapi/.snapshots/TestDetectorV2yaml diff --git a/internal/detectors/openapi/.snapshots/TestDetectorV3json b/pkg/detectors/openapi/.snapshots/TestDetectorV3json similarity index 100% rename from internal/detectors/openapi/.snapshots/TestDetectorV3json rename to pkg/detectors/openapi/.snapshots/TestDetectorV3json diff --git a/internal/detectors/openapi/.snapshots/TestDetectorV3yaml b/pkg/detectors/openapi/.snapshots/TestDetectorV3yaml similarity index 100% rename from internal/detectors/openapi/.snapshots/TestDetectorV3yaml rename to pkg/detectors/openapi/.snapshots/TestDetectorV3yaml diff --git a/internal/detectors/openapi/.snapshots/TestOtherjson b/pkg/detectors/openapi/.snapshots/TestOtherjson similarity index 100% rename from internal/detectors/openapi/.snapshots/TestOtherjson rename to pkg/detectors/openapi/.snapshots/TestOtherjson diff --git a/internal/detectors/openapi/json/objects.go b/pkg/detectors/openapi/json/objects.go similarity index 81% rename from internal/detectors/openapi/json/objects.go rename to pkg/detectors/openapi/json/objects.go index ed068a983..a86832ab8 100644 --- a/internal/detectors/openapi/json/objects.go +++ b/pkg/detectors/openapi/json/objects.go @@ -1,10 +1,10 @@ package json import ( - "github.com/bearer/bearer/internal/detectors/openapi/queries" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/detectors/openapi/queries" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/openapi/json/operationId.go b/pkg/detectors/openapi/json/operationId.go similarity index 82% rename from internal/detectors/openapi/json/operationId.go rename to pkg/detectors/openapi/json/operationId.go index 297e4a066..09bd1d90d 100644 --- a/internal/detectors/openapi/json/operationId.go +++ b/pkg/detectors/openapi/json/operationId.go @@ -1,10 +1,10 @@ package json import ( - "github.com/bearer/bearer/internal/detectors/openapi/queries" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/detectors/openapi/queries" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/openapi/json/paths.go b/pkg/detectors/openapi/json/paths.go similarity index 82% rename from internal/detectors/openapi/json/paths.go rename to pkg/detectors/openapi/json/paths.go index 13fda3337..4b376aa27 100644 --- a/internal/detectors/openapi/json/paths.go +++ b/pkg/detectors/openapi/json/paths.go @@ -1,9 +1,9 @@ package json import ( - "github.com/bearer/bearer/internal/detectors/openapi/queries" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/operations/operationshelper" + "github.com/bearer/bearer/pkg/detectors/openapi/queries" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/operations/operationshelper" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/openapi/openapi.go b/pkg/detectors/openapi/openapi.go similarity index 83% rename from internal/detectors/openapi/openapi.go rename to pkg/detectors/openapi/openapi.go index 66ba2149f..7dedcd330 100644 --- a/internal/detectors/openapi/openapi.go +++ b/pkg/detectors/openapi/openapi.go @@ -5,20 +5,20 @@ import ( "encoding/json" "os" - "github.com/bearer/bearer/internal/detectors/openapi/v2json" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/openapi/v2json" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/util/file" "github.com/rs/zerolog/log" "golang.org/x/mod/semver" "sigs.k8s.io/yaml" // Need to use this as some features use custom JSON unmarshalling - "github.com/bearer/bearer/internal/detectors/openapi/v2yaml" - "github.com/bearer/bearer/internal/detectors/openapi/v3json" - "github.com/bearer/bearer/internal/detectors/openapi/v3yaml" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/openapi/v2yaml" + "github.com/bearer/bearer/pkg/detectors/openapi/v3json" + "github.com/bearer/bearer/pkg/detectors/openapi/v3yaml" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/report/detectors" - reporttypes "github.com/bearer/bearer/internal/report" + reporttypes "github.com/bearer/bearer/pkg/report" ) type version struct { diff --git a/internal/detectors/openapi/openapi_test.go b/pkg/detectors/openapi/openapi_test.go similarity index 80% rename from internal/detectors/openapi/openapi_test.go rename to pkg/detectors/openapi/openapi_test.go index 828791fae..76fbb998d 100644 --- a/internal/detectors/openapi/openapi_test.go +++ b/pkg/detectors/openapi/openapi_test.go @@ -4,11 +4,11 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/detectors/openapi" - "github.com/bearer/bearer/internal/parser/nodeid" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/detectors/openapi" + "github.com/bearer/bearer/pkg/parser/nodeid" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/openapi/queries/objects.go b/pkg/detectors/openapi/queries/objects.go similarity index 88% rename from internal/detectors/openapi/queries/objects.go rename to pkg/detectors/openapi/queries/objects.go index f497d9e10..a7e69d3c2 100644 --- a/internal/detectors/openapi/queries/objects.go +++ b/pkg/detectors/openapi/queries/objects.go @@ -1,11 +1,11 @@ package queries import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/report/schema/schemahelper" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/util/stringutil" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/openapi/queries/operationId.go b/pkg/detectors/openapi/queries/operationId.go similarity index 87% rename from internal/detectors/openapi/queries/operationId.go rename to pkg/detectors/openapi/queries/operationId.go index 94ca730b2..1d85d73c2 100644 --- a/internal/detectors/openapi/queries/operationId.go +++ b/pkg/detectors/openapi/queries/operationId.go @@ -1,10 +1,10 @@ package queries import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema/schemahelper" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/util/stringutil" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/openapi/queries/paths.go b/pkg/detectors/openapi/queries/paths.go similarity index 78% rename from internal/detectors/openapi/queries/paths.go rename to pkg/detectors/openapi/queries/paths.go index a2e94e843..f9a8a0d2a 100644 --- a/internal/detectors/openapi/queries/paths.go +++ b/pkg/detectors/openapi/queries/paths.go @@ -1,10 +1,10 @@ package queries import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/operations" - "github.com/bearer/bearer/internal/report/operations/operationshelper" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/operations" + "github.com/bearer/bearer/pkg/report/operations/operationshelper" + "github.com/bearer/bearer/pkg/util/stringutil" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/openapi/queries/queries.go b/pkg/detectors/openapi/queries/queries.go similarity index 67% rename from internal/detectors/openapi/queries/queries.go rename to pkg/detectors/openapi/queries/queries.go index 8c7f1d92e..cd9f2a08c 100644 --- a/internal/detectors/openapi/queries/queries.go +++ b/pkg/detectors/openapi/queries/queries.go @@ -1,7 +1,7 @@ package queries import ( - "github.com/bearer/bearer/internal/parser" + "github.com/bearer/bearer/pkg/parser" ) type ChildMatch interface { diff --git a/internal/detectors/openapi/queries/urls.go b/pkg/detectors/openapi/queries/urls.go similarity index 93% rename from internal/detectors/openapi/queries/urls.go rename to pkg/detectors/openapi/queries/urls.go index 407cb95f1..82420765c 100644 --- a/internal/detectors/openapi/queries/urls.go +++ b/pkg/detectors/openapi/queries/urls.go @@ -5,8 +5,8 @@ import ( "encoding/json" "os" - "github.com/bearer/bearer/internal/report/operations" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/report/operations" + "github.com/bearer/bearer/pkg/util/file" "gopkg.in/yaml.v3" ) diff --git a/internal/detectors/openapi/queries/v2parameters.go b/pkg/detectors/openapi/queries/v2parameters.go similarity index 76% rename from internal/detectors/openapi/queries/v2parameters.go rename to pkg/detectors/openapi/queries/v2parameters.go index 8f8b274a0..e1512f1e0 100644 --- a/internal/detectors/openapi/queries/v2parameters.go +++ b/pkg/detectors/openapi/queries/v2parameters.go @@ -1,11 +1,11 @@ package queries import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/report/schema/schemahelper" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/util/stringutil" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/openapi/queries/v3parameters.go b/pkg/detectors/openapi/queries/v3parameters.go similarity index 83% rename from internal/detectors/openapi/queries/v3parameters.go rename to pkg/detectors/openapi/queries/v3parameters.go index 6094dd9cf..fe3845133 100644 --- a/internal/detectors/openapi/queries/v3parameters.go +++ b/pkg/detectors/openapi/queries/v3parameters.go @@ -1,11 +1,11 @@ package queries import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/report/schema/schemahelper" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/util/stringutil" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/openapi/reportadder/reportadder.go b/pkg/detectors/openapi/reportadder/reportadder.go similarity index 83% rename from internal/detectors/openapi/reportadder/reportadder.go rename to pkg/detectors/openapi/reportadder/reportadder.go index 4fdf58610..d423a22a7 100644 --- a/internal/detectors/openapi/reportadder/reportadder.go +++ b/pkg/detectors/openapi/reportadder/reportadder.go @@ -3,14 +3,14 @@ package reportadder import ( "sort" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - reporttypes "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/report/schema/schemahelper" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + reporttypes "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" ) type SortableSchema struct { diff --git a/internal/detectors/openapi/testdata/arrayjson/packages.json b/pkg/detectors/openapi/testdata/arrayjson/packages.json similarity index 100% rename from internal/detectors/openapi/testdata/arrayjson/packages.json rename to pkg/detectors/openapi/testdata/arrayjson/packages.json diff --git a/internal/detectors/openapi/testdata/v2json/petstore-swagger.json b/pkg/detectors/openapi/testdata/v2json/petstore-swagger.json similarity index 100% rename from internal/detectors/openapi/testdata/v2json/petstore-swagger.json rename to pkg/detectors/openapi/testdata/v2json/petstore-swagger.json diff --git a/internal/detectors/openapi/testdata/v2yaml/petstore-swagger.yaml b/pkg/detectors/openapi/testdata/v2yaml/petstore-swagger.yaml similarity index 100% rename from internal/detectors/openapi/testdata/v2yaml/petstore-swagger.yaml rename to pkg/detectors/openapi/testdata/v2yaml/petstore-swagger.yaml diff --git a/internal/detectors/openapi/testdata/v3json/petstore-openapi.json b/pkg/detectors/openapi/testdata/v3json/petstore-openapi.json similarity index 100% rename from internal/detectors/openapi/testdata/v3json/petstore-openapi.json rename to pkg/detectors/openapi/testdata/v3json/petstore-openapi.json diff --git a/internal/detectors/openapi/testdata/v3yaml/petstore-openapi.yaml b/pkg/detectors/openapi/testdata/v3yaml/petstore-openapi.yaml similarity index 100% rename from internal/detectors/openapi/testdata/v3yaml/petstore-openapi.yaml rename to pkg/detectors/openapi/testdata/v3yaml/petstore-openapi.yaml diff --git a/internal/detectors/openapi/v2json/v2json.go b/pkg/detectors/openapi/v2json/v2json.go similarity index 73% rename from internal/detectors/openapi/v2json/v2json.go rename to pkg/detectors/openapi/v2json/v2json.go index 902322df9..054a9775e 100644 --- a/internal/detectors/openapi/v2json/v2json.go +++ b/pkg/detectors/openapi/v2json/v2json.go @@ -1,15 +1,15 @@ package v2json import ( - "github.com/bearer/bearer/internal/detectors/openapi/json" - "github.com/bearer/bearer/internal/detectors/openapi/queries" - "github.com/bearer/bearer/internal/detectors/openapi/reportadder" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - reporttypes "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/operations/operationshelper" - "github.com/bearer/bearer/internal/report/schema/schemahelper" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/openapi/json" + "github.com/bearer/bearer/pkg/detectors/openapi/queries" + "github.com/bearer/bearer/pkg/detectors/openapi/reportadder" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + reporttypes "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/operations/operationshelper" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/util/file" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/openapi/v2yaml/v2yml.go b/pkg/detectors/openapi/v2yaml/v2yml.go similarity index 73% rename from internal/detectors/openapi/v2yaml/v2yml.go rename to pkg/detectors/openapi/v2yaml/v2yml.go index c2742e358..5abfb8e3d 100644 --- a/internal/detectors/openapi/v2yaml/v2yml.go +++ b/pkg/detectors/openapi/v2yaml/v2yml.go @@ -1,15 +1,15 @@ package v2yaml import ( - "github.com/bearer/bearer/internal/detectors/openapi/queries" - "github.com/bearer/bearer/internal/detectors/openapi/reportadder" - yamlparser "github.com/bearer/bearer/internal/detectors/openapi/yaml" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - reporttypes "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/operations/operationshelper" - "github.com/bearer/bearer/internal/report/schema/schemahelper" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/openapi/queries" + "github.com/bearer/bearer/pkg/detectors/openapi/reportadder" + yamlparser "github.com/bearer/bearer/pkg/detectors/openapi/yaml" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + reporttypes "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/operations/operationshelper" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/util/file" "github.com/smacker/go-tree-sitter/yaml" ) diff --git a/internal/detectors/openapi/v3json/v3json.go b/pkg/detectors/openapi/v3json/v3json.go similarity index 73% rename from internal/detectors/openapi/v3json/v3json.go rename to pkg/detectors/openapi/v3json/v3json.go index 71ef2c6b9..6505f06be 100644 --- a/internal/detectors/openapi/v3json/v3json.go +++ b/pkg/detectors/openapi/v3json/v3json.go @@ -1,15 +1,15 @@ package v3json import ( - "github.com/bearer/bearer/internal/detectors/openapi/json" - "github.com/bearer/bearer/internal/detectors/openapi/queries" - "github.com/bearer/bearer/internal/detectors/openapi/reportadder" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - reporttypes "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/operations/operationshelper" - "github.com/bearer/bearer/internal/report/schema/schemahelper" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/openapi/json" + "github.com/bearer/bearer/pkg/detectors/openapi/queries" + "github.com/bearer/bearer/pkg/detectors/openapi/reportadder" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + reporttypes "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/operations/operationshelper" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/util/file" "github.com/smacker/go-tree-sitter/javascript" ) diff --git a/internal/detectors/openapi/v3yaml/v3yml.go b/pkg/detectors/openapi/v3yaml/v3yml.go similarity index 73% rename from internal/detectors/openapi/v3yaml/v3yml.go rename to pkg/detectors/openapi/v3yaml/v3yml.go index 7bb4104bb..903fbd6ce 100644 --- a/internal/detectors/openapi/v3yaml/v3yml.go +++ b/pkg/detectors/openapi/v3yaml/v3yml.go @@ -1,15 +1,15 @@ package v3yaml import ( - "github.com/bearer/bearer/internal/detectors/openapi/queries" - "github.com/bearer/bearer/internal/detectors/openapi/reportadder" - yamlparser "github.com/bearer/bearer/internal/detectors/openapi/yaml" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - reporttypes "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/operations/operationshelper" - "github.com/bearer/bearer/internal/report/schema/schemahelper" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/openapi/queries" + "github.com/bearer/bearer/pkg/detectors/openapi/reportadder" + yamlparser "github.com/bearer/bearer/pkg/detectors/openapi/yaml" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + reporttypes "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/operations/operationshelper" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/util/file" "github.com/smacker/go-tree-sitter/yaml" ) diff --git a/internal/detectors/openapi/yaml/objects.go b/pkg/detectors/openapi/yaml/objects.go similarity index 84% rename from internal/detectors/openapi/yaml/objects.go rename to pkg/detectors/openapi/yaml/objects.go index 3645ece81..15e5394ab 100644 --- a/internal/detectors/openapi/yaml/objects.go +++ b/pkg/detectors/openapi/yaml/objects.go @@ -1,10 +1,10 @@ package yaml import ( - "github.com/bearer/bearer/internal/detectors/openapi/queries" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/detectors/openapi/queries" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" "github.com/smacker/go-tree-sitter/yaml" ) diff --git a/internal/detectors/openapi/yaml/operationId.go b/pkg/detectors/openapi/yaml/operationId.go similarity index 84% rename from internal/detectors/openapi/yaml/operationId.go rename to pkg/detectors/openapi/yaml/operationId.go index 55a96d230..29ba3b2f6 100644 --- a/internal/detectors/openapi/yaml/operationId.go +++ b/pkg/detectors/openapi/yaml/operationId.go @@ -1,10 +1,10 @@ package yaml import ( - "github.com/bearer/bearer/internal/detectors/openapi/queries" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema/schemahelper" + "github.com/bearer/bearer/pkg/detectors/openapi/queries" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema/schemahelper" "github.com/smacker/go-tree-sitter/yaml" ) diff --git a/internal/detectors/openapi/yaml/paths.go b/pkg/detectors/openapi/yaml/paths.go similarity index 85% rename from internal/detectors/openapi/yaml/paths.go rename to pkg/detectors/openapi/yaml/paths.go index fcfdf7032..0f6ade5d1 100644 --- a/internal/detectors/openapi/yaml/paths.go +++ b/pkg/detectors/openapi/yaml/paths.go @@ -1,9 +1,9 @@ package yaml import ( - "github.com/bearer/bearer/internal/detectors/openapi/queries" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/operations/operationshelper" + "github.com/bearer/bearer/pkg/detectors/openapi/queries" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/operations/operationshelper" "github.com/smacker/go-tree-sitter/yaml" ) diff --git a/internal/detectors/php/.snapshots/TestDetectorReportContext b/pkg/detectors/php/.snapshots/TestDetectorReportContext similarity index 100% rename from internal/detectors/php/.snapshots/TestDetectorReportContext rename to pkg/detectors/php/.snapshots/TestDetectorReportContext diff --git a/internal/detectors/php/.snapshots/TestDetectorReportDatatype b/pkg/detectors/php/.snapshots/TestDetectorReportDatatype similarity index 100% rename from internal/detectors/php/.snapshots/TestDetectorReportDatatype rename to pkg/detectors/php/.snapshots/TestDetectorReportDatatype diff --git a/internal/detectors/php/.snapshots/TestDetectorReportIgnore b/pkg/detectors/php/.snapshots/TestDetectorReportIgnore similarity index 100% rename from internal/detectors/php/.snapshots/TestDetectorReportIgnore rename to pkg/detectors/php/.snapshots/TestDetectorReportIgnore diff --git a/internal/detectors/php/.snapshots/TestDetectorReportInterfaces1 b/pkg/detectors/php/.snapshots/TestDetectorReportInterfaces1 similarity index 100% rename from internal/detectors/php/.snapshots/TestDetectorReportInterfaces1 rename to pkg/detectors/php/.snapshots/TestDetectorReportInterfaces1 diff --git a/internal/detectors/php/.snapshots/TestDetectorReportInterfaces2 b/pkg/detectors/php/.snapshots/TestDetectorReportInterfaces2 similarity index 100% rename from internal/detectors/php/.snapshots/TestDetectorReportInterfaces2 rename to pkg/detectors/php/.snapshots/TestDetectorReportInterfaces2 diff --git a/internal/detectors/php/context/assignment_expression.go b/pkg/detectors/php/context/assignment_expression.go similarity index 80% rename from internal/detectors/php/context/assignment_expression.go rename to pkg/detectors/php/context/assignment_expression.go index 2622858c9..25deb3f77 100644 --- a/internal/detectors/php/context/assignment_expression.go +++ b/pkg/detectors/php/context/assignment_expression.go @@ -1,8 +1,8 @@ package context import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/variables" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/variables" ) func variableAssignmentExpression(node *parser.Node) *variables.Variable { diff --git a/internal/detectors/php/context/finder.go b/pkg/detectors/php/context/finder.go similarity index 89% rename from internal/detectors/php/context/finder.go rename to pkg/detectors/php/context/finder.go index 6d9b451df..3155bc066 100644 --- a/internal/detectors/php/context/finder.go +++ b/pkg/detectors/php/context/finder.go @@ -1,10 +1,10 @@ package context import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/context" - "github.com/bearer/bearer/internal/report/variables" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/context" + "github.com/bearer/bearer/pkg/report/variables" + "github.com/bearer/bearer/pkg/util/stringutil" ) func FindContext(tree *parser.Tree) *context.Resolver { diff --git a/internal/detectors/php/context/property_element.go b/pkg/detectors/php/context/property_element.go similarity index 87% rename from internal/detectors/php/context/property_element.go rename to pkg/detectors/php/context/property_element.go index e4b433f3f..9e43410e4 100644 --- a/internal/detectors/php/context/property_element.go +++ b/pkg/detectors/php/context/property_element.go @@ -1,8 +1,8 @@ package context import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/variables" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/variables" ) func variablePropertyElement(node *parser.Node) *variables.Variable { diff --git a/internal/detectors/php/datatype/datatype.go b/pkg/detectors/php/datatype/datatype.go similarity index 86% rename from internal/detectors/php/datatype/datatype.go rename to pkg/detectors/php/datatype/datatype.go index 55fef0e01..6e5e9af61 100644 --- a/internal/detectors/php/datatype/datatype.go +++ b/pkg/detectors/php/datatype/datatype.go @@ -1,16 +1,16 @@ package datatype import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/report/detections" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" - - "github.com/bearer/bearer/internal/parser/nodeid" - php "github.com/bearer/bearer/internal/parser/sitter/php2" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/report/detections" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" + + "github.com/bearer/bearer/pkg/parser/nodeid" + php "github.com/bearer/bearer/pkg/parser/sitter/php2" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" ) var classesQuery = parser.QueryMustCompile(php.GetLanguage(), diff --git a/internal/detectors/php/datatype/properties.go b/pkg/detectors/php/datatype/properties.go similarity index 90% rename from internal/detectors/php/datatype/properties.go rename to pkg/detectors/php/datatype/properties.go index e5303c514..c308d2774 100644 --- a/internal/detectors/php/datatype/properties.go +++ b/pkg/detectors/php/datatype/properties.go @@ -1,12 +1,12 @@ package datatype import ( - "github.com/bearer/bearer/internal/parser" - parserdatatype "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - php "github.com/bearer/bearer/internal/parser/sitter/php2" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + parserdatatype "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/parser/nodeid" + php "github.com/bearer/bearer/pkg/parser/sitter/php2" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/php/php.go b/pkg/detectors/php/php.go similarity index 87% rename from internal/detectors/php/php.go rename to pkg/detectors/php/php.go index 9fb9916cf..c8641a7b2 100644 --- a/internal/detectors/php/php.go +++ b/pkg/detectors/php/php.go @@ -4,24 +4,24 @@ import ( "os" "regexp" - "github.com/bearer/bearer/internal/detectors/html" - "github.com/bearer/bearer/internal/detectors/php/context" - "github.com/bearer/bearer/internal/detectors/php/datatype" - "github.com/bearer/bearer/internal/parser/interfacedetector" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/parser/schema" - php "github.com/bearer/bearer/internal/parser/sitter/php2" + "github.com/bearer/bearer/pkg/detectors/html" + "github.com/bearer/bearer/pkg/detectors/php/context" + "github.com/bearer/bearer/pkg/detectors/php/datatype" + "github.com/bearer/bearer/pkg/parser/interfacedetector" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/parser/schema" + php "github.com/bearer/bearer/pkg/parser/sitter/php2" sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - reporttypes "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + reporttypes "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" ) var ( diff --git a/internal/detectors/php/php_test.go b/pkg/detectors/php/php_test.go similarity index 87% rename from internal/detectors/php/php_test.go rename to pkg/detectors/php/php_test.go index f6c8d381a..d2c1e8a9f 100644 --- a/internal/detectors/php/php_test.go +++ b/pkg/detectors/php/php_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/php" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/php" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/parser/nodeid" ) const detectorType = detectortypes.DetectorPHP diff --git a/internal/detectors/php/testdata/context/context.php b/pkg/detectors/php/testdata/context/context.php similarity index 100% rename from internal/detectors/php/testdata/context/context.php rename to pkg/detectors/php/testdata/context/context.php diff --git a/internal/detectors/php/testdata/datatype/datatype.php b/pkg/detectors/php/testdata/datatype/datatype.php similarity index 100% rename from internal/detectors/php/testdata/datatype/datatype.php rename to pkg/detectors/php/testdata/datatype/datatype.php diff --git a/internal/detectors/php/testdata/ignore/phive b/pkg/detectors/php/testdata/ignore/phive similarity index 100% rename from internal/detectors/php/testdata/ignore/phive rename to pkg/detectors/php/testdata/ignore/phive diff --git a/internal/detectors/php/testdata/paths/paths.php b/pkg/detectors/php/testdata/paths/paths.php similarity index 100% rename from internal/detectors/php/testdata/paths/paths.php rename to pkg/detectors/php/testdata/paths/paths.php diff --git a/internal/detectors/php/testdata/variables/config.php b/pkg/detectors/php/testdata/variables/config.php similarity index 100% rename from internal/detectors/php/testdata/variables/config.php rename to pkg/detectors/php/testdata/variables/config.php diff --git a/internal/detectors/proto/.snapshots/TestBuildReportSchema b/pkg/detectors/proto/.snapshots/TestBuildReportSchema similarity index 100% rename from internal/detectors/proto/.snapshots/TestBuildReportSchema rename to pkg/detectors/proto/.snapshots/TestBuildReportSchema diff --git a/internal/detectors/proto/proto.go b/pkg/detectors/proto/proto.go similarity index 87% rename from internal/detectors/proto/proto.go rename to pkg/detectors/proto/proto.go index 87fee5b9e..a74fcea7d 100644 --- a/internal/detectors/proto/proto.go +++ b/pkg/detectors/proto/proto.go @@ -5,16 +5,16 @@ import ( "github.com/smacker/go-tree-sitter/protobuf" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/pluralize" - - "github.com/bearer/bearer/internal/parser/nodeid" - parserschema "github.com/bearer/bearer/internal/parser/schema" - reporttypes "github.com/bearer/bearer/internal/report" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/pluralize" + + "github.com/bearer/bearer/pkg/parser/nodeid" + parserschema "github.com/bearer/bearer/pkg/parser/schema" + reporttypes "github.com/bearer/bearer/pkg/report" ) var ( diff --git a/internal/detectors/proto/proto_test.go b/pkg/detectors/proto/proto_test.go similarity index 62% rename from internal/detectors/proto/proto_test.go rename to pkg/detectors/proto/proto_test.go index d5c05dbf8..85b3135eb 100644 --- a/internal/detectors/proto/proto_test.go +++ b/pkg/detectors/proto/proto_test.go @@ -4,12 +4,12 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/proto" - "github.com/bearer/bearer/internal/parser/nodeid" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/proto" + "github.com/bearer/bearer/pkg/parser/nodeid" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/proto/testdata/protos/schema.proto b/pkg/detectors/proto/testdata/protos/schema.proto similarity index 100% rename from internal/detectors/proto/testdata/protos/schema.proto rename to pkg/detectors/proto/testdata/protos/schema.proto diff --git a/internal/detectors/python/.snapshots/TestDetectorReportDatatype b/pkg/detectors/python/.snapshots/TestDetectorReportDatatype similarity index 100% rename from internal/detectors/python/.snapshots/TestDetectorReportDatatype rename to pkg/detectors/python/.snapshots/TestDetectorReportDatatype diff --git a/internal/detectors/python/.snapshots/TestDetectorReportInterfacePaths b/pkg/detectors/python/.snapshots/TestDetectorReportInterfacePaths similarity index 100% rename from internal/detectors/python/.snapshots/TestDetectorReportInterfacePaths rename to pkg/detectors/python/.snapshots/TestDetectorReportInterfacePaths diff --git a/internal/detectors/python/.snapshots/TestDetectorReportInterfaceProjects b/pkg/detectors/python/.snapshots/TestDetectorReportInterfaceProjects similarity index 100% rename from internal/detectors/python/.snapshots/TestDetectorReportInterfaceProjects rename to pkg/detectors/python/.snapshots/TestDetectorReportInterfaceProjects diff --git a/internal/detectors/python/datatype/datatype.go b/pkg/detectors/python/datatype/datatype.go similarity index 89% rename from internal/detectors/python/datatype/datatype.go rename to pkg/detectors/python/datatype/datatype.go index 7ef8192ff..63dc1d1d9 100644 --- a/internal/detectors/python/datatype/datatype.go +++ b/pkg/detectors/python/datatype/datatype.go @@ -1,14 +1,14 @@ package datatype import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" "github.com/smacker/go-tree-sitter/python" ) diff --git a/internal/detectors/python/datatype/properties.go b/pkg/detectors/python/datatype/properties.go similarity index 93% rename from internal/detectors/python/datatype/properties.go rename to pkg/detectors/python/datatype/properties.go index 019f7f5c9..e8cc1aca1 100644 --- a/internal/detectors/python/datatype/properties.go +++ b/pkg/detectors/python/datatype/properties.go @@ -3,11 +3,11 @@ package datatype import ( "strings" - "github.com/bearer/bearer/internal/parser" - parserdatatype "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + parserdatatype "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" "github.com/smacker/go-tree-sitter/python" ) diff --git a/internal/detectors/python/python.go b/pkg/detectors/python/python.go similarity index 91% rename from internal/detectors/python/python.go rename to pkg/detectors/python/python.go index 201d5842b..4608872d7 100644 --- a/internal/detectors/python/python.go +++ b/pkg/detectors/python/python.go @@ -5,16 +5,16 @@ import ( "github.com/smacker/go-tree-sitter/python" - "github.com/bearer/bearer/internal/detectors/python/datatype" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/interfacedetector" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/python/datatype" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/interfacedetector" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" + "github.com/bearer/bearer/pkg/util/file" ) const environItem = "environ" diff --git a/internal/detectors/python/python_test.go b/pkg/detectors/python/python_test.go similarity index 81% rename from internal/detectors/python/python_test.go rename to pkg/detectors/python/python_test.go index 25d4f1917..50a8b0f1b 100644 --- a/internal/detectors/python/python_test.go +++ b/pkg/detectors/python/python_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/python" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/python" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/parser/nodeid" ) const detectorType = detectortypes.DetectorPython diff --git a/internal/detectors/python/testdata/datatype/datatype.py b/pkg/detectors/python/testdata/datatype/datatype.py similarity index 100% rename from internal/detectors/python/testdata/datatype/datatype.py rename to pkg/detectors/python/testdata/datatype/datatype.py diff --git a/internal/detectors/python/testdata/paths/main.py b/pkg/detectors/python/testdata/paths/main.py similarity index 100% rename from internal/detectors/python/testdata/paths/main.py rename to pkg/detectors/python/testdata/paths/main.py diff --git a/internal/detectors/python/testdata/project/config.py b/pkg/detectors/python/testdata/project/config.py similarity index 100% rename from internal/detectors/python/testdata/project/config.py rename to pkg/detectors/python/testdata/project/config.py diff --git a/internal/detectors/python/testdata/project/urls.py b/pkg/detectors/python/testdata/project/urls.py similarity index 100% rename from internal/detectors/python/testdata/project/urls.py rename to pkg/detectors/python/testdata/project/urls.py diff --git a/internal/detectors/rails/.snapshots/TestBuildReportCaches b/pkg/detectors/rails/.snapshots/TestBuildReportCaches similarity index 100% rename from internal/detectors/rails/.snapshots/TestBuildReportCaches rename to pkg/detectors/rails/.snapshots/TestBuildReportCaches diff --git a/internal/detectors/rails/.snapshots/TestBuildReportDatabaseSchema b/pkg/detectors/rails/.snapshots/TestBuildReportDatabaseSchema similarity index 100% rename from internal/detectors/rails/.snapshots/TestBuildReportDatabaseSchema rename to pkg/detectors/rails/.snapshots/TestBuildReportDatabaseSchema diff --git a/internal/detectors/rails/.snapshots/TestBuildReportMultipleDatabases b/pkg/detectors/rails/.snapshots/TestBuildReportMultipleDatabases similarity index 100% rename from internal/detectors/rails/.snapshots/TestBuildReportMultipleDatabases rename to pkg/detectors/rails/.snapshots/TestBuildReportMultipleDatabases diff --git a/internal/detectors/rails/.snapshots/TestBuildReportSingleDatabase b/pkg/detectors/rails/.snapshots/TestBuildReportSingleDatabase similarity index 100% rename from internal/detectors/rails/.snapshots/TestBuildReportSingleDatabase rename to pkg/detectors/rails/.snapshots/TestBuildReportSingleDatabase diff --git a/internal/detectors/rails/.snapshots/TestBuildReportStorageProviders b/pkg/detectors/rails/.snapshots/TestBuildReportStorageProviders similarity index 100% rename from internal/detectors/rails/.snapshots/TestBuildReportStorageProviders rename to pkg/detectors/rails/.snapshots/TestBuildReportStorageProviders diff --git a/internal/detectors/rails/cache/cache.go b/pkg/detectors/rails/cache/cache.go similarity index 75% rename from internal/detectors/rails/cache/cache.go rename to pkg/detectors/rails/cache/cache.go index 2538c49aa..8dc910949 100644 --- a/internal/detectors/rails/cache/cache.go +++ b/pkg/detectors/rails/cache/cache.go @@ -3,11 +3,11 @@ package cache import ( "github.com/smacker/go-tree-sitter/ruby" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks/rails" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks/rails" + "github.com/bearer/bearer/pkg/util/file" ) var ( diff --git a/internal/detectors/rails/rails.go b/pkg/detectors/rails/rails.go similarity index 89% rename from internal/detectors/rails/rails.go rename to pkg/detectors/rails/rails.go index 93d78e36a..fc38b8764 100644 --- a/internal/detectors/rails/rails.go +++ b/pkg/detectors/rails/rails.go @@ -8,17 +8,17 @@ import ( "github.com/rs/zerolog/log" "gopkg.in/yaml.v3" - "github.com/bearer/bearer/internal/detectors/rails/cache" - "github.com/bearer/bearer/internal/detectors/rails/schema_rb" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks/rails" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/maputil" - "github.com/bearer/bearer/internal/util/pointers" + "github.com/bearer/bearer/pkg/detectors/rails/cache" + "github.com/bearer/bearer/pkg/detectors/rails/schema_rb" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks/rails" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/maputil" + "github.com/bearer/bearer/pkg/util/pointers" ) var ( diff --git a/internal/detectors/rails/rails_test.go b/pkg/detectors/rails/rails_test.go similarity index 81% rename from internal/detectors/rails/rails_test.go rename to pkg/detectors/rails/rails_test.go index 421ce71dc..a7259bd9d 100644 --- a/internal/detectors/rails/rails_test.go +++ b/pkg/detectors/rails/rails_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/detectors/rails" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/detectors/rails" + "github.com/bearer/bearer/pkg/parser/nodeid" ) var detectorType = detectortypes.DetectorRails diff --git a/internal/detectors/rails/schema_rb/schema_rb.go b/pkg/detectors/rails/schema_rb/schema_rb.go similarity index 88% rename from internal/detectors/rails/schema_rb/schema_rb.go rename to pkg/detectors/rails/schema_rb/schema_rb.go index 35d67a22b..06e18f0b8 100644 --- a/internal/detectors/rails/schema_rb/schema_rb.go +++ b/pkg/detectors/rails/schema_rb/schema_rb.go @@ -5,14 +5,14 @@ import ( "github.com/smacker/go-tree-sitter/ruby" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - parserschema "github.com/bearer/bearer/internal/parser/schema" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/pluralize" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + parserschema "github.com/bearer/bearer/pkg/parser/schema" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/pluralize" ) var ( diff --git a/internal/detectors/rails/testdata/cache/bin/rails b/pkg/detectors/rails/testdata/cache/bin/rails similarity index 100% rename from internal/detectors/rails/testdata/cache/bin/rails rename to pkg/detectors/rails/testdata/cache/bin/rails diff --git a/internal/detectors/rails/testdata/cache/config/application.rb b/pkg/detectors/rails/testdata/cache/config/application.rb similarity index 100% rename from internal/detectors/rails/testdata/cache/config/application.rb rename to pkg/detectors/rails/testdata/cache/config/application.rb diff --git a/internal/detectors/rails/testdata/cache/config/environments/production.rb b/pkg/detectors/rails/testdata/cache/config/environments/production.rb similarity index 100% rename from internal/detectors/rails/testdata/cache/config/environments/production.rb rename to pkg/detectors/rails/testdata/cache/config/environments/production.rb diff --git a/internal/detectors/rails/testdata/database/multiple/bin/rails b/pkg/detectors/rails/testdata/database/multiple/bin/rails similarity index 100% rename from internal/detectors/rails/testdata/database/multiple/bin/rails rename to pkg/detectors/rails/testdata/database/multiple/bin/rails diff --git a/internal/detectors/rails/testdata/database/multiple/config/database.yml b/pkg/detectors/rails/testdata/database/multiple/config/database.yml similarity index 100% rename from internal/detectors/rails/testdata/database/multiple/config/database.yml rename to pkg/detectors/rails/testdata/database/multiple/config/database.yml diff --git a/internal/detectors/rails/testdata/database/single/bin/rails b/pkg/detectors/rails/testdata/database/single/bin/rails similarity index 100% rename from internal/detectors/rails/testdata/database/single/bin/rails rename to pkg/detectors/rails/testdata/database/single/bin/rails diff --git a/internal/detectors/rails/testdata/database/single/config/database.yml b/pkg/detectors/rails/testdata/database/single/config/database.yml similarity index 100% rename from internal/detectors/rails/testdata/database/single/config/database.yml rename to pkg/detectors/rails/testdata/database/single/config/database.yml diff --git a/internal/detectors/rails/testdata/schema/bin/rails b/pkg/detectors/rails/testdata/schema/bin/rails similarity index 100% rename from internal/detectors/rails/testdata/schema/bin/rails rename to pkg/detectors/rails/testdata/schema/bin/rails diff --git a/internal/detectors/rails/testdata/schema/db/schema.rb b/pkg/detectors/rails/testdata/schema/db/schema.rb similarity index 100% rename from internal/detectors/rails/testdata/schema/db/schema.rb rename to pkg/detectors/rails/testdata/schema/db/schema.rb diff --git a/internal/detectors/rails/testdata/storage/bin/rails b/pkg/detectors/rails/testdata/storage/bin/rails similarity index 100% rename from internal/detectors/rails/testdata/storage/bin/rails rename to pkg/detectors/rails/testdata/storage/bin/rails diff --git a/internal/detectors/rails/testdata/storage/config/storage.yml b/pkg/detectors/rails/testdata/storage/config/storage.yml similarity index 100% rename from internal/detectors/rails/testdata/storage/config/storage.yml rename to pkg/detectors/rails/testdata/storage/config/storage.yml diff --git a/internal/detectors/ruby/.snapshots/TestDetectorReportDatatype b/pkg/detectors/ruby/.snapshots/TestDetectorReportDatatype similarity index 100% rename from internal/detectors/ruby/.snapshots/TestDetectorReportDatatype rename to pkg/detectors/ruby/.snapshots/TestDetectorReportDatatype diff --git a/internal/detectors/ruby/.snapshots/TestDetectorReportInterfacesPaths b/pkg/detectors/ruby/.snapshots/TestDetectorReportInterfacesPaths similarity index 100% rename from internal/detectors/ruby/.snapshots/TestDetectorReportInterfacesPaths rename to pkg/detectors/ruby/.snapshots/TestDetectorReportInterfacesPaths diff --git a/internal/detectors/ruby/.snapshots/TestDetectorReportInterfacesVariables b/pkg/detectors/ruby/.snapshots/TestDetectorReportInterfacesVariables similarity index 100% rename from internal/detectors/ruby/.snapshots/TestDetectorReportInterfacesVariables rename to pkg/detectors/ruby/.snapshots/TestDetectorReportInterfacesVariables diff --git a/internal/detectors/ruby/datatype/class_assignment.go b/pkg/detectors/ruby/datatype/class_assignment.go similarity index 94% rename from internal/detectors/ruby/datatype/class_assignment.go rename to pkg/detectors/ruby/datatype/class_assignment.go index bc0342a27..9223bdbf7 100644 --- a/internal/detectors/ruby/datatype/class_assignment.go +++ b/pkg/detectors/ruby/datatype/class_assignment.go @@ -3,9 +3,9 @@ package datatype import ( "strings" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" "github.com/smacker/go-tree-sitter/ruby" ) diff --git a/internal/detectors/ruby/datatype/datatype.go b/pkg/detectors/ruby/datatype/datatype.go similarity index 91% rename from internal/detectors/ruby/datatype/datatype.go rename to pkg/detectors/ruby/datatype/datatype.go index f552fd3fd..004be79a3 100644 --- a/internal/detectors/ruby/datatype/datatype.go +++ b/pkg/detectors/ruby/datatype/datatype.go @@ -3,11 +3,11 @@ package datatype import ( "strings" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" "github.com/smacker/go-tree-sitter/ruby" ) diff --git a/internal/detectors/ruby/datatype/properties.go b/pkg/detectors/ruby/datatype/properties.go similarity index 96% rename from internal/detectors/ruby/datatype/properties.go rename to pkg/detectors/ruby/datatype/properties.go index 5990323f8..bc81648ce 100644 --- a/internal/detectors/ruby/datatype/properties.go +++ b/pkg/detectors/ruby/datatype/properties.go @@ -3,12 +3,12 @@ package datatype import ( "strings" - "github.com/bearer/bearer/internal/parser" - parserdatatype "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/parser" + parserdatatype "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" + "github.com/bearer/bearer/pkg/util/stringutil" sitter "github.com/smacker/go-tree-sitter" "github.com/smacker/go-tree-sitter/ruby" ) diff --git a/internal/detectors/ruby/datatype/structures.go b/pkg/detectors/ruby/datatype/structures.go similarity index 92% rename from internal/detectors/ruby/datatype/structures.go rename to pkg/detectors/ruby/datatype/structures.go index 64d543dc8..ce2e654c3 100644 --- a/internal/detectors/ruby/datatype/structures.go +++ b/pkg/detectors/ruby/datatype/structures.go @@ -1,9 +1,9 @@ package datatype import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" "github.com/smacker/go-tree-sitter/ruby" ) diff --git a/internal/detectors/ruby/ruby.go b/pkg/detectors/ruby/ruby.go similarity index 86% rename from internal/detectors/ruby/ruby.go rename to pkg/detectors/ruby/ruby.go index 8769a2582..4d86b92dc 100644 --- a/internal/detectors/ruby/ruby.go +++ b/pkg/detectors/ruby/ruby.go @@ -4,19 +4,19 @@ import ( "regexp" "strings" - "github.com/bearer/bearer/internal/detectors/ruby/datatype" - "github.com/bearer/bearer/internal/util/file" - - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/interfacedetector" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/detectors/ruby/datatype" + "github.com/bearer/bearer/pkg/util/file" + + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/interfacedetector" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" + "github.com/bearer/bearer/pkg/util/regex" "github.com/smacker/go-tree-sitter/ruby" ) diff --git a/internal/detectors/ruby/ruby_test.go b/pkg/detectors/ruby/ruby_test.go similarity index 81% rename from internal/detectors/ruby/ruby_test.go rename to pkg/detectors/ruby/ruby_test.go index 9220e5167..c6518a7da 100644 --- a/internal/detectors/ruby/ruby_test.go +++ b/pkg/detectors/ruby/ruby_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/ruby" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/ruby" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/parser/nodeid" ) const detectorType = detectortypes.DetectorRuby diff --git a/internal/detectors/ruby/testdata/datatype/datatype.rb b/pkg/detectors/ruby/testdata/datatype/datatype.rb similarity index 100% rename from internal/detectors/ruby/testdata/datatype/datatype.rb rename to pkg/detectors/ruby/testdata/datatype/datatype.rb diff --git a/internal/detectors/ruby/testdata/paths/main.rb b/pkg/detectors/ruby/testdata/paths/main.rb similarity index 100% rename from internal/detectors/ruby/testdata/paths/main.rb rename to pkg/detectors/ruby/testdata/paths/main.rb diff --git a/internal/detectors/ruby/testdata/variables/config.rb b/pkg/detectors/ruby/testdata/variables/config.rb similarity index 100% rename from internal/detectors/ruby/testdata/variables/config.rb rename to pkg/detectors/ruby/testdata/variables/config.rb diff --git a/internal/detectors/simple/.snapshots/TestBuildReportInterfaces b/pkg/detectors/simple/.snapshots/TestBuildReportInterfaces similarity index 100% rename from internal/detectors/simple/.snapshots/TestBuildReportInterfaces rename to pkg/detectors/simple/.snapshots/TestBuildReportInterfaces diff --git a/internal/detectors/simple/simple.go b/pkg/detectors/simple/simple.go similarity index 81% rename from internal/detectors/simple/simple.go rename to pkg/detectors/simple/simple.go index f80b73b64..0bd60acf6 100644 --- a/internal/detectors/simple/simple.go +++ b/pkg/detectors/simple/simple.go @@ -4,16 +4,16 @@ import ( "os" "regexp" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser/interfaces" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - interfacestype "github.com/bearer/bearer/internal/report/interfaces" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/linescanner" - "github.com/bearer/bearer/internal/util/pointers" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser/interfaces" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + interfacestype "github.com/bearer/bearer/pkg/report/interfaces" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/linescanner" + "github.com/bearer/bearer/pkg/util/pointers" "github.com/go-enry/go-enry/v2" ) diff --git a/internal/detectors/simple/simple_test.go b/pkg/detectors/simple/simple_test.go similarity index 77% rename from internal/detectors/simple/simple_test.go rename to pkg/detectors/simple/simple_test.go index 8c064e01b..965845118 100644 --- a/internal/detectors/simple/simple_test.go +++ b/pkg/detectors/simple/simple_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/detectors/simple/testdata/project/structure.sql b/pkg/detectors/simple/testdata/project/structure.sql similarity index 100% rename from internal/detectors/simple/testdata/project/structure.sql rename to pkg/detectors/simple/testdata/project/structure.sql diff --git a/internal/detectors/simple/testdata/project/unknown.pl b/pkg/detectors/simple/testdata/project/unknown.pl similarity index 100% rename from internal/detectors/simple/testdata/project/unknown.pl rename to pkg/detectors/simple/testdata/project/unknown.pl diff --git a/internal/detectors/spring/.snapshots/TestBuildReportDataStores b/pkg/detectors/spring/.snapshots/TestBuildReportDataStores similarity index 100% rename from internal/detectors/spring/.snapshots/TestBuildReportDataStores rename to pkg/detectors/spring/.snapshots/TestBuildReportDataStores diff --git a/internal/detectors/spring/spring.go b/pkg/detectors/spring/spring.go similarity index 91% rename from internal/detectors/spring/spring.go rename to pkg/detectors/spring/spring.go index 9c6f807fd..65e95d808 100644 --- a/internal/detectors/spring/spring.go +++ b/pkg/detectors/spring/spring.go @@ -9,14 +9,14 @@ import ( "github.com/rs/zerolog/log" "gopkg.in/yaml.v3" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks/spring" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/linescanner" - "github.com/bearer/bearer/internal/util/pointers" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks/spring" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/linescanner" + "github.com/bearer/bearer/pkg/util/pointers" ) var ( diff --git a/internal/detectors/spring/spring_test.go b/pkg/detectors/spring/spring_test.go similarity index 87% rename from internal/detectors/spring/spring_test.go rename to pkg/detectors/spring/spring_test.go index e3a5e58bd..77ea5998a 100644 --- a/internal/detectors/spring/spring_test.go +++ b/pkg/detectors/spring/spring_test.go @@ -7,8 +7,8 @@ import ( "github.com/bradleyjkemp/cupaloy" "github.com/stretchr/testify/assert" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - reportdetectors "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + reportdetectors "github.com/bearer/bearer/pkg/report/detectors" ) const detectorType = reportdetectors.DetectorSpring diff --git a/internal/detectors/spring/testdata/java_not_spring/pom.xml b/pkg/detectors/spring/testdata/java_not_spring/pom.xml similarity index 100% rename from internal/detectors/spring/testdata/java_not_spring/pom.xml rename to pkg/detectors/spring/testdata/java_not_spring/pom.xml diff --git a/internal/detectors/spring/testdata/java_not_spring/src/main/Application.java b/pkg/detectors/spring/testdata/java_not_spring/src/main/Application.java similarity index 100% rename from internal/detectors/spring/testdata/java_not_spring/src/main/Application.java rename to pkg/detectors/spring/testdata/java_not_spring/src/main/Application.java diff --git a/internal/detectors/spring/testdata/java_not_spring/src/main/resources/application.properties b/pkg/detectors/spring/testdata/java_not_spring/src/main/resources/application.properties similarity index 100% rename from internal/detectors/spring/testdata/java_not_spring/src/main/resources/application.properties rename to pkg/detectors/spring/testdata/java_not_spring/src/main/resources/application.properties diff --git a/internal/detectors/spring/testdata/not_java/Gemfile b/pkg/detectors/spring/testdata/not_java/Gemfile similarity index 100% rename from internal/detectors/spring/testdata/not_java/Gemfile rename to pkg/detectors/spring/testdata/not_java/Gemfile diff --git a/internal/detectors/spring/testdata/spring/pom.xml b/pkg/detectors/spring/testdata/spring/pom.xml similarity index 100% rename from internal/detectors/spring/testdata/spring/pom.xml rename to pkg/detectors/spring/testdata/spring/pom.xml diff --git a/internal/detectors/spring/testdata/spring/src/main/Application.java b/pkg/detectors/spring/testdata/spring/src/main/Application.java similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/Application.java rename to pkg/detectors/spring/testdata/spring/src/main/Application.java diff --git a/internal/detectors/spring/testdata/spring/src/main/ignore/application.properties b/pkg/detectors/spring/testdata/spring/src/main/ignore/application.properties similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/ignore/application.properties rename to pkg/detectors/spring/testdata/spring/src/main/ignore/application.properties diff --git a/internal/detectors/spring/testdata/spring/src/main/ignore/application.yml b/pkg/detectors/spring/testdata/spring/src/main/ignore/application.yml similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/ignore/application.yml rename to pkg/detectors/spring/testdata/spring/src/main/ignore/application.yml diff --git a/internal/detectors/spring/testdata/spring/src/main/ignore2/application.properties b/pkg/detectors/spring/testdata/spring/src/main/ignore2/application.properties similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/ignore2/application.properties rename to pkg/detectors/spring/testdata/spring/src/main/ignore2/application.properties diff --git a/internal/detectors/spring/testdata/spring/src/main/ignore2/application.yml b/pkg/detectors/spring/testdata/spring/src/main/ignore2/application.yml similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/ignore2/application.yml rename to pkg/detectors/spring/testdata/spring/src/main/ignore2/application.yml diff --git a/internal/detectors/spring/testdata/spring/src/main/resources/application.properties b/pkg/detectors/spring/testdata/spring/src/main/resources/application.properties similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/resources/application.properties rename to pkg/detectors/spring/testdata/spring/src/main/resources/application.properties diff --git a/internal/detectors/spring/testdata/spring/src/main/resources/application.yml b/pkg/detectors/spring/testdata/spring/src/main/resources/application.yml similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/resources/application.yml rename to pkg/detectors/spring/testdata/spring/src/main/resources/application.yml diff --git a/internal/detectors/spring/testdata/spring/src/main/resources2/application.properties b/pkg/detectors/spring/testdata/spring/src/main/resources2/application.properties similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/resources2/application.properties rename to pkg/detectors/spring/testdata/spring/src/main/resources2/application.properties diff --git a/internal/detectors/spring/testdata/spring/src/main/resources2/application.yml b/pkg/detectors/spring/testdata/spring/src/main/resources2/application.yml similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/resources2/application.yml rename to pkg/detectors/spring/testdata/spring/src/main/resources2/application.yml diff --git a/internal/detectors/spring/testdata/spring/src/main/resources3/application.properties b/pkg/detectors/spring/testdata/spring/src/main/resources3/application.properties similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/resources3/application.properties rename to pkg/detectors/spring/testdata/spring/src/main/resources3/application.properties diff --git a/internal/detectors/spring/testdata/spring/src/main/resources3/application.yml b/pkg/detectors/spring/testdata/spring/src/main/resources3/application.yml similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/resources3/application.yml rename to pkg/detectors/spring/testdata/spring/src/main/resources3/application.yml diff --git a/internal/detectors/spring/testdata/spring/src/main/resources4/application.properties b/pkg/detectors/spring/testdata/spring/src/main/resources4/application.properties similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/resources4/application.properties rename to pkg/detectors/spring/testdata/spring/src/main/resources4/application.properties diff --git a/internal/detectors/spring/testdata/spring/src/main/resources4/application.yml b/pkg/detectors/spring/testdata/spring/src/main/resources4/application.yml similarity index 100% rename from internal/detectors/spring/testdata/spring/src/main/resources4/application.yml rename to pkg/detectors/spring/testdata/spring/src/main/resources4/application.yml diff --git a/internal/detectors/sql/custom_detector/compile_pattern.go b/pkg/detectors/sql/custom_detector/compile_pattern.go similarity index 83% rename from internal/detectors/sql/custom_detector/compile_pattern.go rename to pkg/detectors/sql/custom_detector/compile_pattern.go index c2b76a9c5..443d0fcfe 100644 --- a/internal/detectors/sql/custom_detector/compile_pattern.go +++ b/pkg/detectors/sql/custom_detector/compile_pattern.go @@ -3,12 +3,12 @@ package customdetector import ( "regexp" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/detectors/custom/config" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/custom" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/detectors/custom/config" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/custom" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/util/file" ) var tableNameRegex = regexp.MustCompile(`\$TABLE_NAME`) diff --git a/internal/detectors/sql/custom_detector/custom_detector.go b/pkg/detectors/sql/custom_detector/custom_detector.go similarity index 87% rename from internal/detectors/sql/custom_detector/custom_detector.go rename to pkg/detectors/sql/custom_detector/custom_detector.go index 44a206b73..8aae13965 100644 --- a/internal/detectors/sql/custom_detector/custom_detector.go +++ b/pkg/detectors/sql/custom_detector/custom_detector.go @@ -3,9 +3,9 @@ package customdetector import ( "strings" - "github.com/bearer/bearer/internal/detectors/custom/config" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/sitter/sql" + "github.com/bearer/bearer/pkg/detectors/custom/config" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/sitter/sql" ) var language = sql.GetLanguage() diff --git a/internal/detectors/sql/custom_detector/extract_arguments.go b/pkg/detectors/sql/custom_detector/extract_arguments.go similarity index 86% rename from internal/detectors/sql/custom_detector/extract_arguments.go rename to pkg/detectors/sql/custom_detector/extract_arguments.go index 8f45e8fd7..a19efc72a 100644 --- a/internal/detectors/sql/custom_detector/extract_arguments.go +++ b/pkg/detectors/sql/custom_detector/extract_arguments.go @@ -1,11 +1,11 @@ package customdetector import ( - "github.com/bearer/bearer/internal/detectors/sql/util" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/detectors/sql/util" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" ) func (detector *Detector) ExtractArguments(node *parser.Node, idGenerator nodeid.Generator) (map[parser.NodeID]*schemadatatype.DataType, error) { diff --git a/internal/detectors/sql/sql.go b/pkg/detectors/sql/sql.go similarity index 70% rename from internal/detectors/sql/sql.go rename to pkg/detectors/sql/sql.go index d0908aa6e..02f5ee8bb 100644 --- a/internal/detectors/sql/sql.go +++ b/pkg/detectors/sql/sql.go @@ -1,13 +1,13 @@ package sql import ( - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/util/file" - reporttypes "github.com/bearer/bearer/internal/report" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + reporttypes "github.com/bearer/bearer/pkg/report" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" ) type detector struct { diff --git a/internal/detectors/sql/util/util.go b/pkg/detectors/sql/util/util.go similarity index 96% rename from internal/detectors/sql/util/util.go rename to pkg/detectors/sql/util/util.go index 29dc1c3c3..d13615ef2 100644 --- a/internal/detectors/sql/util/util.go +++ b/pkg/detectors/sql/util/util.go @@ -4,7 +4,7 @@ import ( "regexp" "strings" - "github.com/bearer/bearer/internal/report/schema" + "github.com/bearer/bearer/pkg/report/schema" ) func StripQuotes(value string) string { diff --git a/internal/detectors/symfony/.snapshots/TestBuildReportDataStores b/pkg/detectors/symfony/.snapshots/TestBuildReportDataStores similarity index 100% rename from internal/detectors/symfony/.snapshots/TestBuildReportDataStores rename to pkg/detectors/symfony/.snapshots/TestBuildReportDataStores diff --git a/internal/detectors/symfony/symfony.go b/pkg/detectors/symfony/symfony.go similarity index 87% rename from internal/detectors/symfony/symfony.go rename to pkg/detectors/symfony/symfony.go index 004735435..ada890bfc 100644 --- a/internal/detectors/symfony/symfony.go +++ b/pkg/detectors/symfony/symfony.go @@ -8,14 +8,14 @@ import ( "gopkg.in/yaml.v3" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks/symfony" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/maputil" - "github.com/bearer/bearer/internal/util/pointers" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks/symfony" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/maputil" + "github.com/bearer/bearer/pkg/util/pointers" ) var ( diff --git a/internal/detectors/symfony/symfony_test.go b/pkg/detectors/symfony/symfony_test.go similarity index 87% rename from internal/detectors/symfony/symfony_test.go rename to pkg/detectors/symfony/symfony_test.go index 5cf71d20e..212cf011d 100644 --- a/internal/detectors/symfony/symfony_test.go +++ b/pkg/detectors/symfony/symfony_test.go @@ -7,9 +7,9 @@ import ( "github.com/bradleyjkemp/cupaloy" "github.com/stretchr/testify/assert" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" - reportdetectors "github.com/bearer/bearer/internal/report/detectors" + reportdetectors "github.com/bearer/bearer/pkg/report/detectors" ) const detectorType = reportdetectors.DetectorSymfony diff --git a/internal/detectors/symfony/testdata/not_php/package.json b/pkg/detectors/symfony/testdata/not_php/package.json similarity index 100% rename from internal/detectors/symfony/testdata/not_php/package.json rename to pkg/detectors/symfony/testdata/not_php/package.json diff --git a/internal/detectors/symfony/testdata/php_not_symfony/composer.json b/pkg/detectors/symfony/testdata/php_not_symfony/composer.json similarity index 100% rename from internal/detectors/symfony/testdata/php_not_symfony/composer.json rename to pkg/detectors/symfony/testdata/php_not_symfony/composer.json diff --git a/internal/detectors/symfony/testdata/symfony/app/config/config.yml b/pkg/detectors/symfony/testdata/symfony/app/config/config.yml similarity index 100% rename from internal/detectors/symfony/testdata/symfony/app/config/config.yml rename to pkg/detectors/symfony/testdata/symfony/app/config/config.yml diff --git a/internal/detectors/symfony/testdata/symfony/composer.json b/pkg/detectors/symfony/testdata/symfony/composer.json similarity index 100% rename from internal/detectors/symfony/testdata/symfony/composer.json rename to pkg/detectors/symfony/testdata/symfony/composer.json diff --git a/internal/detectors/symfony/testdata/symfony/config/packages/doctrine.yml b/pkg/detectors/symfony/testdata/symfony/config/packages/doctrine.yml similarity index 100% rename from internal/detectors/symfony/testdata/symfony/config/packages/doctrine.yml rename to pkg/detectors/symfony/testdata/symfony/config/packages/doctrine.yml diff --git a/internal/detectors/symfony/testdata/symfony/src/AppBundle/AppBundle.php b/pkg/detectors/symfony/testdata/symfony/src/AppBundle/AppBundle.php similarity index 100% rename from internal/detectors/symfony/testdata/symfony/src/AppBundle/AppBundle.php rename to pkg/detectors/symfony/testdata/symfony/src/AppBundle/AppBundle.php diff --git a/internal/detectors/tsx/.snapshots/TestDetectorReportGeneral b/pkg/detectors/tsx/.snapshots/TestDetectorReportGeneral similarity index 100% rename from internal/detectors/tsx/.snapshots/TestDetectorReportGeneral rename to pkg/detectors/tsx/.snapshots/TestDetectorReportGeneral diff --git a/internal/detectors/tsx/testdata/general/config.tsx b/pkg/detectors/tsx/testdata/general/config.tsx similarity index 100% rename from internal/detectors/tsx/testdata/general/config.tsx rename to pkg/detectors/tsx/testdata/general/config.tsx diff --git a/internal/detectors/tsx/tsx.go b/pkg/detectors/tsx/tsx.go similarity index 87% rename from internal/detectors/tsx/tsx.go rename to pkg/detectors/tsx/tsx.go index 6d7a19333..668af4521 100644 --- a/internal/detectors/tsx/tsx.go +++ b/pkg/detectors/tsx/tsx.go @@ -7,16 +7,16 @@ import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/detectors/types" - typescript_datatype "github.com/bearer/bearer/internal/detectors/typescript/datatype" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/interfacedetector" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/types" + typescript_datatype "github.com/bearer/bearer/pkg/detectors/typescript/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/interfacedetector" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" + "github.com/bearer/bearer/pkg/util/file" ) var ( diff --git a/internal/detectors/tsx/tsx_test.go b/pkg/detectors/tsx/tsx_test.go similarity index 64% rename from internal/detectors/tsx/tsx_test.go rename to pkg/detectors/tsx/tsx_test.go index b231a9dec..3777d291f 100644 --- a/internal/detectors/tsx/tsx_test.go +++ b/pkg/detectors/tsx/tsx_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/tsx" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/tsx" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/parser/nodeid" ) const detectorType = detectortypes.DetectorJavascript diff --git a/internal/detectors/types/types.go b/pkg/detectors/types/types.go similarity index 71% rename from internal/detectors/types/types.go rename to pkg/detectors/types/types.go index 94cdce6ff..11f330f8c 100644 --- a/internal/detectors/types/types.go +++ b/pkg/detectors/types/types.go @@ -1,8 +1,8 @@ package types import ( - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/util/file" ) type DetectorConstructor func() Detector diff --git a/internal/detectors/typescript/.snapshots/TestDetectorReportDatatype b/pkg/detectors/typescript/.snapshots/TestDetectorReportDatatype similarity index 100% rename from internal/detectors/typescript/.snapshots/TestDetectorReportDatatype rename to pkg/detectors/typescript/.snapshots/TestDetectorReportDatatype diff --git a/internal/detectors/typescript/.snapshots/TestDetectorReportGeneral b/pkg/detectors/typescript/.snapshots/TestDetectorReportGeneral similarity index 100% rename from internal/detectors/typescript/.snapshots/TestDetectorReportGeneral rename to pkg/detectors/typescript/.snapshots/TestDetectorReportGeneral diff --git a/internal/detectors/typescript/.snapshots/TestDetectorReportKnex b/pkg/detectors/typescript/.snapshots/TestDetectorReportKnex similarity index 100% rename from internal/detectors/typescript/.snapshots/TestDetectorReportKnex rename to pkg/detectors/typescript/.snapshots/TestDetectorReportKnex diff --git a/internal/detectors/typescript/datatype/datatype.go b/pkg/detectors/typescript/datatype/datatype.go similarity index 93% rename from internal/detectors/typescript/datatype/datatype.go rename to pkg/detectors/typescript/datatype/datatype.go index 1b299f35b..0ff2efaab 100644 --- a/internal/detectors/typescript/datatype/datatype.go +++ b/pkg/detectors/typescript/datatype/datatype.go @@ -3,15 +3,15 @@ package datatype import ( "strings" - "github.com/bearer/bearer/internal/detectors/typescript/datatype/knex" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/datatype" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - schemadatatype "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/detectors/typescript/datatype/knex" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/datatype" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + schemadatatype "github.com/bearer/bearer/pkg/report/schema/datatype" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/typescript/datatype/knex/functions.go b/pkg/detectors/typescript/datatype/knex/functions.go similarity index 91% rename from internal/detectors/typescript/datatype/knex/functions.go rename to pkg/detectors/typescript/datatype/knex/functions.go index 80ad87136..8b9ff1572 100644 --- a/internal/detectors/typescript/datatype/knex/functions.go +++ b/pkg/detectors/typescript/datatype/knex/functions.go @@ -3,11 +3,11 @@ package knex import ( "sort" - "github.com/bearer/bearer/internal/detectors/javascript/util" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - reportknex "github.com/bearer/bearer/internal/report/frameworks/knex" + "github.com/bearer/bearer/pkg/detectors/javascript/util" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + reportknex "github.com/bearer/bearer/pkg/report/frameworks/knex" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/typescript/datatype/knex/knex.go b/pkg/detectors/typescript/datatype/knex/knex.go similarity index 71% rename from internal/detectors/typescript/datatype/knex/knex.go rename to pkg/detectors/typescript/datatype/knex/knex.go index 2ca01255e..a3cdab3e2 100644 --- a/internal/detectors/typescript/datatype/knex/knex.go +++ b/pkg/detectors/typescript/datatype/knex/knex.go @@ -1,9 +1,9 @@ package knex import ( - "github.com/bearer/bearer/internal/detectors/javascript/util" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report" + "github.com/bearer/bearer/pkg/detectors/javascript/util" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/typescript/datatype/knex/table.go b/pkg/detectors/typescript/datatype/knex/table.go similarity index 89% rename from internal/detectors/typescript/datatype/knex/table.go rename to pkg/detectors/typescript/datatype/knex/table.go index ff851f283..fab7ef45e 100644 --- a/internal/detectors/typescript/datatype/knex/table.go +++ b/pkg/detectors/typescript/datatype/knex/table.go @@ -1,10 +1,10 @@ package knex import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - reportknex "github.com/bearer/bearer/internal/report/frameworks/knex" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + reportknex "github.com/bearer/bearer/pkg/report/frameworks/knex" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/detectors/typescript/testdata/datatype/schema.ts b/pkg/detectors/typescript/testdata/datatype/schema.ts similarity index 100% rename from internal/detectors/typescript/testdata/datatype/schema.ts rename to pkg/detectors/typescript/testdata/datatype/schema.ts diff --git a/internal/detectors/typescript/testdata/datatype_knex/datatype_knex.ts b/pkg/detectors/typescript/testdata/datatype_knex/datatype_knex.ts similarity index 100% rename from internal/detectors/typescript/testdata/datatype_knex/datatype_knex.ts rename to pkg/detectors/typescript/testdata/datatype_knex/datatype_knex.ts diff --git a/internal/detectors/typescript/testdata/general/variables/config.ts b/pkg/detectors/typescript/testdata/general/variables/config.ts similarity index 100% rename from internal/detectors/typescript/testdata/general/variables/config.ts rename to pkg/detectors/typescript/testdata/general/variables/config.ts diff --git a/internal/detectors/typescript/typescript.go b/pkg/detectors/typescript/typescript.go similarity index 87% rename from internal/detectors/typescript/typescript.go rename to pkg/detectors/typescript/typescript.go index 7589e2f1c..ddca9350d 100644 --- a/internal/detectors/typescript/typescript.go +++ b/pkg/detectors/typescript/typescript.go @@ -7,16 +7,16 @@ import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/detectors/typescript/datatype" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/interfacedetector" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/detectors/typescript/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/interfacedetector" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" + "github.com/bearer/bearer/pkg/util/file" ) var ( diff --git a/internal/detectors/typescript/typescript_test.go b/pkg/detectors/typescript/typescript_test.go similarity index 80% rename from internal/detectors/typescript/typescript_test.go rename to pkg/detectors/typescript/typescript_test.go index 2670f035d..72f7cc938 100644 --- a/internal/detectors/typescript/typescript_test.go +++ b/pkg/detectors/typescript/typescript_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/typescript" - detectortypes "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/typescript" + detectortypes "github.com/bearer/bearer/pkg/report/detectors" - "github.com/bearer/bearer/internal/detectors" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/parser/nodeid" ) const detectorType = detectortypes.DetectorJavascript diff --git a/internal/detectors/yamlconfig/.snapshots/TestDetectorReportInterfaces b/pkg/detectors/yamlconfig/.snapshots/TestDetectorReportInterfaces similarity index 100% rename from internal/detectors/yamlconfig/.snapshots/TestDetectorReportInterfaces rename to pkg/detectors/yamlconfig/.snapshots/TestDetectorReportInterfaces diff --git a/internal/detectors/yamlconfig/.snapshots/TestDetectorReportVariables b/pkg/detectors/yamlconfig/.snapshots/TestDetectorReportVariables similarity index 100% rename from internal/detectors/yamlconfig/.snapshots/TestDetectorReportVariables rename to pkg/detectors/yamlconfig/.snapshots/TestDetectorReportVariables diff --git a/internal/detectors/yamlconfig/testdata/project/.github/workflows/workflow-github.yml b/pkg/detectors/yamlconfig/testdata/project/.github/workflows/workflow-github.yml similarity index 100% rename from internal/detectors/yamlconfig/testdata/project/.github/workflows/workflow-github.yml rename to pkg/detectors/yamlconfig/testdata/project/.github/workflows/workflow-github.yml diff --git a/internal/detectors/yamlconfig/testdata/project/config/parameters.yml.j2 b/pkg/detectors/yamlconfig/testdata/project/config/parameters.yml.j2 similarity index 100% rename from internal/detectors/yamlconfig/testdata/project/config/parameters.yml.j2 rename to pkg/detectors/yamlconfig/testdata/project/config/parameters.yml.j2 diff --git a/internal/detectors/yamlconfig/testdata/project/docker-compose.yml.tpl b/pkg/detectors/yamlconfig/testdata/project/docker-compose.yml.tpl similarity index 100% rename from internal/detectors/yamlconfig/testdata/project/docker-compose.yml.tpl rename to pkg/detectors/yamlconfig/testdata/project/docker-compose.yml.tpl diff --git a/internal/detectors/yamlconfig/testdata/project/locale.en.yml b/pkg/detectors/yamlconfig/testdata/project/locale.en.yml similarity index 100% rename from internal/detectors/yamlconfig/testdata/project/locale.en.yml rename to pkg/detectors/yamlconfig/testdata/project/locale.en.yml diff --git a/internal/detectors/yamlconfig/testdata/project/locales/client.hu.yml b/pkg/detectors/yamlconfig/testdata/project/locales/client.hu.yml similarity index 100% rename from internal/detectors/yamlconfig/testdata/project/locales/client.hu.yml rename to pkg/detectors/yamlconfig/testdata/project/locales/client.hu.yml diff --git a/internal/detectors/yamlconfig/testdata/project/locales/en.yml b/pkg/detectors/yamlconfig/testdata/project/locales/en.yml similarity index 100% rename from internal/detectors/yamlconfig/testdata/project/locales/en.yml rename to pkg/detectors/yamlconfig/testdata/project/locales/en.yml diff --git a/internal/detectors/yamlconfig/testdata/project/translations/en.yml b/pkg/detectors/yamlconfig/testdata/project/translations/en.yml similarity index 100% rename from internal/detectors/yamlconfig/testdata/project/translations/en.yml rename to pkg/detectors/yamlconfig/testdata/project/translations/en.yml diff --git a/internal/detectors/yamlconfig/yamlconfig.go b/pkg/detectors/yamlconfig/yamlconfig.go similarity index 87% rename from internal/detectors/yamlconfig/yamlconfig.go rename to pkg/detectors/yamlconfig/yamlconfig.go index a6e8fc707..9d67418b4 100644 --- a/internal/detectors/yamlconfig/yamlconfig.go +++ b/pkg/detectors/yamlconfig/yamlconfig.go @@ -11,17 +11,17 @@ import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/detectors/types" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/interfaces" - "github.com/bearer/bearer/internal/report" - reportinterface "github.com/bearer/bearer/internal/report/interfaces" - "github.com/bearer/bearer/internal/util/file" - - "github.com/bearer/bearer/internal/parser/sitter/config_variables" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" + "github.com/bearer/bearer/pkg/detectors/types" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/interfaces" + "github.com/bearer/bearer/pkg/report" + reportinterface "github.com/bearer/bearer/pkg/report/interfaces" + "github.com/bearer/bearer/pkg/util/file" + + "github.com/bearer/bearer/pkg/parser/sitter/config_variables" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" ) var ( diff --git a/internal/detectors/yamlconfig/yamlconfig_test.go b/pkg/detectors/yamlconfig/yamlconfig_test.go similarity index 83% rename from internal/detectors/yamlconfig/yamlconfig_test.go rename to pkg/detectors/yamlconfig/yamlconfig_test.go index fe330320b..cccb6a40c 100644 --- a/internal/detectors/yamlconfig/yamlconfig_test.go +++ b/pkg/detectors/yamlconfig/yamlconfig_test.go @@ -6,8 +6,8 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/detectors/internal/testhelper" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/detectors/internal/testhelper" + "github.com/bearer/bearer/pkg/report/detectors" ) const detectorType = detectors.DetectorYamlConfig diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go new file mode 100644 index 000000000..13d27b9d5 --- /dev/null +++ b/pkg/engine/engine.go @@ -0,0 +1,17 @@ +package engine + +import ( + "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/scanner/stats" +) + +type Engine interface { + GetLanguages() []language.Language + GetLanguageById(id string) language.Language + Initialize(logLevel string) error + LoadRule(yamlDefinition string) error + Scan(config *settings.Config, stats *stats.Stats, reportPath, targetPath string, files []files.File) error + Close() +} diff --git a/pkg/engine/implementation/implementation.go b/pkg/engine/implementation/implementation.go new file mode 100644 index 000000000..2869d270c --- /dev/null +++ b/pkg/engine/implementation/implementation.go @@ -0,0 +1,66 @@ +package implementation + +import ( + "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/commands/process/orchestrator" + "github.com/bearer/bearer/pkg/commands/process/orchestrator/work" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/engine" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/scanner/stats" +) + +type implementation struct { + languages []language.Language + orchestrator *orchestrator.Orchestrator +} + +func New(languages []language.Language) engine.Engine { + return &implementation{languages: languages} +} + +func (engine *implementation) GetLanguages() []language.Language { + return engine.languages +} + +func (engine *implementation) GetLanguageById(id string) language.Language { + for _, language := range engine.languages { + if language.ID() == id { + return language + } + } + + return nil +} + +func (engine *implementation) Initialize(logLevel string) error { + return nil +} + +func (engine *implementation) LoadRule(yamlDefinition string) error { + return nil +} + +func (engine *implementation) Scan( + config *settings.Config, + stats *stats.Stats, + reportPath, + targetPath string, + files []files.File, +) error { + if engine.orchestrator == nil { + var err error + engine.orchestrator, err = orchestrator.New(work.Repository{Dir: targetPath}, config, stats, len(files)) + if err != nil { + return err + } + } + + return engine.orchestrator.Scan(reportPath, files) +} + +func (engine *implementation) Close() { + if engine.orchestrator != nil { + engine.orchestrator.Close() + } +} diff --git a/internal/flag/general_flags.go b/pkg/flag/general_flags.go similarity index 98% rename from internal/flag/general_flags.go rename to pkg/flag/general_flags.go index d5c0eb1ac..bd5a7ec60 100644 --- a/internal/flag/general_flags.go +++ b/pkg/flag/general_flags.go @@ -1,9 +1,10 @@ package flag import ( - "github.com/bearer/bearer/api" - flagtypes "github.com/bearer/bearer/internal/flag/types" "github.com/rs/zerolog/log" + + "github.com/bearer/bearer/api" + flagtypes "github.com/bearer/bearer/pkg/flag/types" ) const ( diff --git a/internal/flag/ignore_add_flags.go b/pkg/flag/ignore_add_flags.go similarity index 96% rename from internal/flag/ignore_add_flags.go rename to pkg/flag/ignore_add_flags.go index b9027deca..e103b158b 100644 --- a/internal/flag/ignore_add_flags.go +++ b/pkg/flag/ignore_add_flags.go @@ -1,6 +1,6 @@ package flag -import flagtypes "github.com/bearer/bearer/internal/flag/types" +import flagtypes "github.com/bearer/bearer/pkg/flag/types" type ignoreAddFlagGroup struct{ flagGroupBase } diff --git a/internal/flag/ignore_migrate_flags.go b/pkg/flag/ignore_migrate_flags.go similarity index 92% rename from internal/flag/ignore_migrate_flags.go rename to pkg/flag/ignore_migrate_flags.go index b326d85a1..8935cc1b2 100644 --- a/internal/flag/ignore_migrate_flags.go +++ b/pkg/flag/ignore_migrate_flags.go @@ -1,6 +1,6 @@ package flag -import flagtypes "github.com/bearer/bearer/internal/flag/types" +import flagtypes "github.com/bearer/bearer/pkg/flag/types" type ignoreMigrateFlagGroup struct{ flagGroupBase } diff --git a/internal/flag/ignore_show_flags.go b/pkg/flag/ignore_show_flags.go similarity index 90% rename from internal/flag/ignore_show_flags.go rename to pkg/flag/ignore_show_flags.go index 89876fd16..cceeb6fce 100644 --- a/internal/flag/ignore_show_flags.go +++ b/pkg/flag/ignore_show_flags.go @@ -1,6 +1,6 @@ package flag -import flagtypes "github.com/bearer/bearer/internal/flag/types" +import flagtypes "github.com/bearer/bearer/pkg/flag/types" type ignoreShowFlagGroup struct{ flagGroupBase } diff --git a/internal/flag/options.go b/pkg/flag/options.go similarity index 97% rename from internal/flag/options.go rename to pkg/flag/options.go index 42f69fa39..20d44c2bf 100644 --- a/internal/flag/options.go +++ b/pkg/flag/options.go @@ -11,9 +11,9 @@ import ( "github.com/spf13/pflag" "github.com/spf13/viper" - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/types" - "github.com/bearer/bearer/internal/util/set" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/types" + "github.com/bearer/bearer/pkg/util/set" ) type Flags []flagtypes.FlagGroup diff --git a/internal/flag/options_test.go b/pkg/flag/options_test.go similarity index 100% rename from internal/flag/options_test.go rename to pkg/flag/options_test.go diff --git a/internal/flag/report_flags.go b/pkg/flag/report_flags.go similarity index 96% rename from internal/flag/report_flags.go rename to pkg/flag/report_flags.go index bd3ffe543..730371ac6 100644 --- a/internal/flag/report_flags.go +++ b/pkg/flag/report_flags.go @@ -4,10 +4,10 @@ import ( "errors" "strings" - flagtypes "github.com/bearer/bearer/internal/flag/types" - globaltypes "github.com/bearer/bearer/internal/types" - "github.com/bearer/bearer/internal/util/set" - sliceutil "github.com/bearer/bearer/internal/util/slices" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + globaltypes "github.com/bearer/bearer/pkg/types" + "github.com/bearer/bearer/pkg/util/set" + sliceutil "github.com/bearer/bearer/pkg/util/slices" ) var ( diff --git a/internal/flag/repository_flags.go b/pkg/flag/repository_flags.go similarity index 98% rename from internal/flag/repository_flags.go rename to pkg/flag/repository_flags.go index b1c37f9b9..06120fff9 100644 --- a/internal/flag/repository_flags.go +++ b/pkg/flag/repository_flags.go @@ -1,6 +1,6 @@ package flag -import flagtypes "github.com/bearer/bearer/internal/flag/types" +import flagtypes "github.com/bearer/bearer/pkg/flag/types" type repositoryFlagGroup struct{ flagGroupBase } diff --git a/internal/flag/repository_flags_test.go b/pkg/flag/repository_flags_test.go similarity index 100% rename from internal/flag/repository_flags_test.go rename to pkg/flag/repository_flags_test.go diff --git a/internal/flag/rule_flags.go b/pkg/flag/rule_flags.go similarity index 95% rename from internal/flag/rule_flags.go rename to pkg/flag/rule_flags.go index 89dc0f052..4a17f0f11 100644 --- a/internal/flag/rule_flags.go +++ b/pkg/flag/rule_flags.go @@ -1,6 +1,6 @@ package flag -import flagtypes "github.com/bearer/bearer/internal/flag/types" +import flagtypes "github.com/bearer/bearer/pkg/flag/types" type ruleFlagGroup struct{ flagGroupBase } diff --git a/internal/flag/scan_flags.go b/pkg/flag/scan_flags.go similarity index 99% rename from internal/flag/scan_flags.go rename to pkg/flag/scan_flags.go index 6490259d2..fd5ee8c56 100644 --- a/internal/flag/scan_flags.go +++ b/pkg/flag/scan_flags.go @@ -6,7 +6,7 @@ import ( "strings" "time" - flagtypes "github.com/bearer/bearer/internal/flag/types" + flagtypes "github.com/bearer/bearer/pkg/flag/types" "github.com/spf13/viper" ) diff --git a/internal/flag/test_helper.go b/pkg/flag/test_helper.go similarity index 93% rename from internal/flag/test_helper.go rename to pkg/flag/test_helper.go index cb3fd8fc8..c9338cf91 100644 --- a/internal/flag/test_helper.go +++ b/pkg/flag/test_helper.go @@ -3,7 +3,7 @@ package flag import ( "testing" - flagtypes "github.com/bearer/bearer/internal/flag/types" + flagtypes "github.com/bearer/bearer/pkg/flag/types" "github.com/spf13/viper" "github.com/stretchr/testify/assert" ) diff --git a/internal/flag/types/types.go b/pkg/flag/types/types.go similarity index 99% rename from internal/flag/types/types.go rename to pkg/flag/types/types.go index f9efadfcb..9b2bc636b 100644 --- a/internal/flag/types/types.go +++ b/pkg/flag/types/types.go @@ -4,7 +4,7 @@ import ( "time" "github.com/bearer/bearer/api" - "github.com/bearer/bearer/internal/util/set" + "github.com/bearer/bearer/pkg/util/set" ) type Flag struct { diff --git a/internal/flag/worker_flags.go b/pkg/flag/worker_flags.go similarity index 95% rename from internal/flag/worker_flags.go rename to pkg/flag/worker_flags.go index 8509318a4..5abb59f88 100644 --- a/internal/flag/worker_flags.go +++ b/pkg/flag/worker_flags.go @@ -1,6 +1,6 @@ package flag -import flagtypes "github.com/bearer/bearer/internal/flag/types" +import flagtypes "github.com/bearer/bearer/pkg/flag/types" type workerFlagGroup struct{ flagGroupBase } diff --git a/internal/git/branch.go b/pkg/git/branch.go similarity index 100% rename from internal/git/branch.go rename to pkg/git/branch.go diff --git a/internal/git/checkout.go b/pkg/git/checkout.go similarity index 100% rename from internal/git/checkout.go rename to pkg/git/checkout.go diff --git a/internal/git/commits.go b/pkg/git/commits.go similarity index 100% rename from internal/git/commits.go rename to pkg/git/commits.go diff --git a/internal/git/diff.go b/pkg/git/diff.go similarity index 98% rename from internal/git/diff.go rename to pkg/git/diff.go index 635f3864f..3fa0f5262 100644 --- a/internal/git/diff.go +++ b/pkg/git/diff.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/bearer/bearer/internal/util/linescanner" + "github.com/bearer/bearer/pkg/util/linescanner" ) type ChunkRange struct { diff --git a/internal/git/diff_test.go b/pkg/git/diff_test.go similarity index 99% rename from internal/git/diff_test.go rename to pkg/git/diff_test.go index 877ba8ef3..563e73a9e 100644 --- a/internal/git/diff_test.go +++ b/pkg/git/diff_test.go @@ -7,7 +7,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/bearer/bearer/internal/git" + "github.com/bearer/bearer/pkg/git" ) var _ = Describe("Diff", func() { diff --git a/internal/git/fetch.go b/pkg/git/fetch.go similarity index 100% rename from internal/git/fetch.go rename to pkg/git/fetch.go diff --git a/internal/git/git.go b/pkg/git/git.go similarity index 98% rename from internal/git/git.go rename to pkg/git/git.go index d12845bbc..dd5f85afe 100644 --- a/internal/git/git.go +++ b/pkg/git/git.go @@ -14,7 +14,7 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/util/file" ) var ( diff --git a/internal/git/git_suite_test.go b/pkg/git/git_suite_test.go similarity index 100% rename from internal/git/git_suite_test.go rename to pkg/git/git_suite_test.go diff --git a/internal/git/git_test.go b/pkg/git/git_test.go similarity index 93% rename from internal/git/git_test.go rename to pkg/git/git_test.go index 4241deeda..e78656eb7 100644 --- a/internal/git/git_test.go +++ b/pkg/git/git_test.go @@ -7,8 +7,8 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/bearer/bearer/internal/git" - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/git" + "github.com/bearer/bearer/pkg/util/file" ) var _ = Describe("GetRoot", func() { diff --git a/internal/git/remote.go b/pkg/git/remote.go similarity index 100% rename from internal/git/remote.go rename to pkg/git/remote.go diff --git a/internal/git/tree.go b/pkg/git/tree.go similarity index 100% rename from internal/git/tree.go rename to pkg/git/tree.go diff --git a/internal/languages/golang/.snapshots/TestImport--main.yml b/pkg/languages/golang/.snapshots/TestImport--main.yml similarity index 100% rename from internal/languages/golang/.snapshots/TestImport--main.yml rename to pkg/languages/golang/.snapshots/TestImport--main.yml diff --git a/internal/languages/golang/.snapshots/TestScope--scope.yml b/pkg/languages/golang/.snapshots/TestScope--scope.yml similarity index 100% rename from internal/languages/golang/.snapshots/TestScope--scope.yml rename to pkg/languages/golang/.snapshots/TestScope--scope.yml diff --git a/internal/languages/golang/.snapshots/flow/TestFlow--different-line.yml b/pkg/languages/golang/.snapshots/flow/TestFlow--different-line.yml similarity index 100% rename from internal/languages/golang/.snapshots/flow/TestFlow--different-line.yml rename to pkg/languages/golang/.snapshots/flow/TestFlow--different-line.yml diff --git a/internal/languages/golang/.snapshots/flow/TestFlow--same-line.yml b/pkg/languages/golang/.snapshots/flow/TestFlow--same-line.yml similarity index 100% rename from internal/languages/golang/.snapshots/flow/TestFlow--same-line.yml rename to pkg/languages/golang/.snapshots/flow/TestFlow--same-line.yml diff --git a/internal/languages/golang/analyzer/analyzer.go b/pkg/languages/golang/analyzer/analyzer.go similarity index 98% rename from internal/languages/golang/analyzer/analyzer.go rename to pkg/languages/golang/analyzer/analyzer.go index 7eadf1f01..1024a90b8 100644 --- a/internal/languages/golang/analyzer/analyzer.go +++ b/pkg/languages/golang/analyzer/analyzer.go @@ -7,9 +7,9 @@ import ( sitter "github.com/smacker/go-tree-sitter" "golang.org/x/exp/slices" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/util/stringutil" ) var versionRegex = regexp.MustCompile(`\Av\d+\z`) diff --git a/internal/languages/golang/detectors/.snapshots/TestGoObjects-object_class b/pkg/languages/golang/detectors/.snapshots/TestGoObjects-object_class similarity index 100% rename from internal/languages/golang/detectors/.snapshots/TestGoObjects-object_class rename to pkg/languages/golang/detectors/.snapshots/TestGoObjects-object_class diff --git a/internal/languages/golang/detectors/.snapshots/TestGoObjects-object_no_class b/pkg/languages/golang/detectors/.snapshots/TestGoObjects-object_no_class similarity index 100% rename from internal/languages/golang/detectors/.snapshots/TestGoObjects-object_no_class rename to pkg/languages/golang/detectors/.snapshots/TestGoObjects-object_no_class diff --git a/internal/languages/golang/detectors/.snapshots/TestGoString-string b/pkg/languages/golang/detectors/.snapshots/TestGoString-string similarity index 100% rename from internal/languages/golang/detectors/.snapshots/TestGoString-string rename to pkg/languages/golang/detectors/.snapshots/TestGoString-string diff --git a/internal/languages/golang/detectors/detectors_test.go b/pkg/languages/golang/detectors/detectors_test.go similarity index 78% rename from internal/languages/golang/detectors/detectors_test.go rename to pkg/languages/golang/detectors/detectors_test.go index 664de39e7..a6fe4e0c5 100644 --- a/internal/languages/golang/detectors/detectors_test.go +++ b/pkg/languages/golang/detectors/detectors_test.go @@ -3,8 +3,8 @@ package detectors_test import ( "testing" - "github.com/bearer/bearer/internal/languages/golang" - "github.com/bearer/bearer/internal/scanner/detectors/testhelper" + "github.com/bearer/bearer/pkg/languages/golang" + "github.com/bearer/bearer/pkg/scanner/detectors/testhelper" ) func TestGoObjects(t *testing.T) { diff --git a/internal/languages/golang/detectors/object/object.go b/pkg/languages/golang/detectors/object/object.go similarity index 91% rename from internal/languages/golang/detectors/object/object.go rename to pkg/languages/golang/detectors/object/object.go index 2730c7fc2..963fa350e 100644 --- a/internal/languages/golang/detectors/object/object.go +++ b/pkg/languages/golang/detectors/object/object.go @@ -1,13 +1,13 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ruleset" ) type objectDetector struct { diff --git a/internal/languages/golang/detectors/object/projection.go b/pkg/languages/golang/detectors/object/projection.go similarity index 90% rename from internal/languages/golang/detectors/object/projection.go rename to pkg/languages/golang/detectors/object/projection.go index c2df6d7ad..9ea3adc64 100644 --- a/internal/languages/golang/detectors/object/projection.go +++ b/pkg/languages/golang/detectors/object/projection.go @@ -1,10 +1,10 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) func (detector *objectDetector) getProjections( diff --git a/internal/languages/golang/detectors/string/string.go b/pkg/languages/golang/detectors/string/string.go similarity index 87% rename from internal/languages/golang/detectors/string/string.go rename to pkg/languages/golang/detectors/string/string.go index f04857450..d5cd3eda8 100644 --- a/internal/languages/golang/detectors/string/string.go +++ b/pkg/languages/golang/detectors/string/string.go @@ -4,13 +4,13 @@ import ( "fmt" "regexp" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/util/stringutil" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) var ( diff --git a/internal/languages/golang/detectors/testdata/class.go b/pkg/languages/golang/detectors/testdata/class.go similarity index 100% rename from internal/languages/golang/detectors/testdata/class.go rename to pkg/languages/golang/detectors/testdata/class.go diff --git a/internal/languages/golang/detectors/testdata/no_class.go b/pkg/languages/golang/detectors/testdata/no_class.go similarity index 100% rename from internal/languages/golang/detectors/testdata/no_class.go rename to pkg/languages/golang/detectors/testdata/no_class.go diff --git a/internal/languages/golang/detectors/testdata/string.go b/pkg/languages/golang/detectors/testdata/string.go similarity index 100% rename from internal/languages/golang/detectors/testdata/string.go rename to pkg/languages/golang/detectors/testdata/string.go diff --git a/internal/languages/golang/golang.go b/pkg/languages/golang/golang.go similarity index 52% rename from internal/languages/golang/golang.go rename to pkg/languages/golang/golang.go index ba2412322..a88d1d0ad 100644 --- a/internal/languages/golang/golang.go +++ b/pkg/languages/golang/golang.go @@ -4,22 +4,22 @@ import ( sitter "github.com/smacker/go-tree-sitter" "github.com/smacker/go-tree-sitter/golang" - // golang "github.com/bearer/bearer/internal/parser/sitter/golang2" - - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - - "github.com/bearer/bearer/internal/languages/golang/analyzer" - "github.com/bearer/bearer/internal/languages/golang/detectors/object" - stringdetector "github.com/bearer/bearer/internal/languages/golang/detectors/string" - "github.com/bearer/bearer/internal/languages/golang/pattern" - "github.com/bearer/bearer/internal/scanner/detectors/datatype" - "github.com/bearer/bearer/internal/scanner/detectors/insecureurl" - "github.com/bearer/bearer/internal/scanner/detectors/stringliteral" - "github.com/bearer/bearer/internal/scanner/language" + // golang "github.com/bearer/bearer/pkg/parser/sitter/golang2" + + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + + "github.com/bearer/bearer/pkg/languages/golang/analyzer" + "github.com/bearer/bearer/pkg/languages/golang/detectors/object" + stringdetector "github.com/bearer/bearer/pkg/languages/golang/detectors/string" + "github.com/bearer/bearer/pkg/languages/golang/pattern" + "github.com/bearer/bearer/pkg/scanner/detectors/datatype" + "github.com/bearer/bearer/pkg/scanner/detectors/insecureurl" + "github.com/bearer/bearer/pkg/scanner/detectors/stringliteral" + "github.com/bearer/bearer/pkg/scanner/language" ) type implementation struct { @@ -34,6 +34,10 @@ func (*implementation) ID() string { return "go" } +func (*implementation) DisplayName() string { + return "Go" +} + func (*implementation) EnryLanguages() []string { return []string{"Go"} } diff --git a/internal/languages/golang/golang_test.go b/pkg/languages/golang/golang_test.go similarity index 91% rename from internal/languages/golang/golang_test.go rename to pkg/languages/golang/golang_test.go index 2a3c2837c..877f36af3 100644 --- a/internal/languages/golang/golang_test.go +++ b/pkg/languages/golang/golang_test.go @@ -4,7 +4,7 @@ import ( _ "embed" "testing" - "github.com/bearer/bearer/internal/languages/testhelper" + "github.com/bearer/bearer/pkg/languages/testhelper" ) //go:embed testdata/logger.yml diff --git a/internal/languages/golang/pattern/pattern.go b/pkg/languages/golang/pattern/pattern.go similarity index 96% rename from internal/languages/golang/pattern/pattern.go rename to pkg/languages/golang/pattern/pattern.go index 7ba2c15e9..09e7636a1 100644 --- a/internal/languages/golang/pattern/pattern.go +++ b/pkg/languages/golang/pattern/pattern.go @@ -6,9 +6,9 @@ import ( "slices" "strings" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/util/regex" ) var ( diff --git a/internal/languages/golang/testdata/import/main.go b/pkg/languages/golang/testdata/import/main.go similarity index 100% rename from internal/languages/golang/testdata/import/main.go rename to pkg/languages/golang/testdata/import/main.go diff --git a/internal/languages/golang/testdata/import_rule.yml b/pkg/languages/golang/testdata/import_rule.yml similarity index 100% rename from internal/languages/golang/testdata/import_rule.yml rename to pkg/languages/golang/testdata/import_rule.yml diff --git a/internal/languages/golang/testdata/logger.yml b/pkg/languages/golang/testdata/logger.yml similarity index 100% rename from internal/languages/golang/testdata/logger.yml rename to pkg/languages/golang/testdata/logger.yml diff --git a/internal/languages/golang/testdata/scope/scope.go b/pkg/languages/golang/testdata/scope/scope.go similarity index 100% rename from internal/languages/golang/testdata/scope/scope.go rename to pkg/languages/golang/testdata/scope/scope.go diff --git a/internal/languages/golang/testdata/scope_rule.yml b/pkg/languages/golang/testdata/scope_rule.yml similarity index 100% rename from internal/languages/golang/testdata/scope_rule.yml rename to pkg/languages/golang/testdata/scope_rule.yml diff --git a/internal/languages/golang/testdata/testcases/flow/different-line.go b/pkg/languages/golang/testdata/testcases/flow/different-line.go similarity index 100% rename from internal/languages/golang/testdata/testcases/flow/different-line.go rename to pkg/languages/golang/testdata/testcases/flow/different-line.go diff --git a/internal/languages/golang/testdata/testcases/flow/same-line.go b/pkg/languages/golang/testdata/testcases/flow/same-line.go similarity index 100% rename from internal/languages/golang/testdata/testcases/flow/same-line.go rename to pkg/languages/golang/testdata/testcases/flow/same-line.go diff --git a/internal/languages/java/.snapshots/TestPattern-catch_types_is_a_container_type b/pkg/languages/java/.snapshots/TestPattern-catch_types_is_a_container_type similarity index 100% rename from internal/languages/java/.snapshots/TestPattern-catch_types_is_a_container_type rename to pkg/languages/java/.snapshots/TestPattern-catch_types_is_a_container_type diff --git a/internal/languages/java/.snapshots/TestPattern-method_params_is_a_container_type b/pkg/languages/java/.snapshots/TestPattern-method_params_is_a_container_type similarity index 100% rename from internal/languages/java/.snapshots/TestPattern-method_params_is_a_container_type rename to pkg/languages/java/.snapshots/TestPattern-method_params_is_a_container_type diff --git a/internal/languages/java/.snapshots/TestScope--scope.yml b/pkg/languages/java/.snapshots/TestScope--scope.yml similarity index 100% rename from internal/languages/java/.snapshots/TestScope--scope.yml rename to pkg/languages/java/.snapshots/TestScope--scope.yml diff --git a/internal/languages/java/.snapshots/flow/TestFlow--different-line.yml b/pkg/languages/java/.snapshots/flow/TestFlow--different-line.yml similarity index 100% rename from internal/languages/java/.snapshots/flow/TestFlow--different-line.yml rename to pkg/languages/java/.snapshots/flow/TestFlow--different-line.yml diff --git a/internal/languages/java/.snapshots/flow/TestFlow--same-line.yml b/pkg/languages/java/.snapshots/flow/TestFlow--same-line.yml similarity index 100% rename from internal/languages/java/.snapshots/flow/TestFlow--same-line.yml rename to pkg/languages/java/.snapshots/flow/TestFlow--same-line.yml diff --git a/internal/languages/java/analyzer/analyzer.go b/pkg/languages/java/analyzer/analyzer.go similarity index 98% rename from internal/languages/java/analyzer/analyzer.go rename to pkg/languages/java/analyzer/analyzer.go index 723a35078..1c883beb1 100644 --- a/internal/languages/java/analyzer/analyzer.go +++ b/pkg/languages/java/analyzer/analyzer.go @@ -5,8 +5,8 @@ import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" ) // methods that use `this` in their result diff --git a/internal/languages/java/detectors/.snapshots/TestJavaObjects-object_class b/pkg/languages/java/detectors/.snapshots/TestJavaObjects-object_class similarity index 100% rename from internal/languages/java/detectors/.snapshots/TestJavaObjects-object_class rename to pkg/languages/java/detectors/.snapshots/TestJavaObjects-object_class diff --git a/internal/languages/java/detectors/.snapshots/TestJavaObjects-object_no_class b/pkg/languages/java/detectors/.snapshots/TestJavaObjects-object_no_class similarity index 100% rename from internal/languages/java/detectors/.snapshots/TestJavaObjects-object_no_class rename to pkg/languages/java/detectors/.snapshots/TestJavaObjects-object_no_class diff --git a/internal/languages/java/detectors/.snapshots/TestJavaString-string b/pkg/languages/java/detectors/.snapshots/TestJavaString-string similarity index 100% rename from internal/languages/java/detectors/.snapshots/TestJavaString-string rename to pkg/languages/java/detectors/.snapshots/TestJavaString-string diff --git a/internal/languages/java/detectors/detectors_test.go b/pkg/languages/java/detectors/detectors_test.go similarity index 79% rename from internal/languages/java/detectors/detectors_test.go rename to pkg/languages/java/detectors/detectors_test.go index 57e36ed32..d15936f6e 100644 --- a/internal/languages/java/detectors/detectors_test.go +++ b/pkg/languages/java/detectors/detectors_test.go @@ -3,8 +3,8 @@ package detectors_test import ( "testing" - "github.com/bearer/bearer/internal/languages/java" - "github.com/bearer/bearer/internal/scanner/detectors/testhelper" + "github.com/bearer/bearer/pkg/languages/java" + "github.com/bearer/bearer/pkg/scanner/detectors/testhelper" ) func TestJavaObjects(t *testing.T) { diff --git a/internal/languages/java/detectors/object/object.go b/pkg/languages/java/detectors/object/object.go similarity index 91% rename from internal/languages/java/detectors/object/object.go rename to pkg/languages/java/detectors/object/object.go index 1a5a5aa75..21213849e 100644 --- a/internal/languages/java/detectors/object/object.go +++ b/pkg/languages/java/detectors/object/object.go @@ -1,12 +1,12 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) type objectDetector struct { diff --git a/internal/languages/java/detectors/object/projection.go b/pkg/languages/java/detectors/object/projection.go similarity index 84% rename from internal/languages/java/detectors/object/projection.go rename to pkg/languages/java/detectors/object/projection.go index 4eaa6ea66..4a1071f70 100644 --- a/internal/languages/java/detectors/object/projection.go +++ b/pkg/languages/java/detectors/object/projection.go @@ -1,10 +1,10 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) func (detector *objectDetector) getProjections( diff --git a/internal/languages/java/detectors/string/string.go b/pkg/languages/java/detectors/string/string.go similarity index 71% rename from internal/languages/java/detectors/string/string.go rename to pkg/languages/java/detectors/string/string.go index 372675893..2bf51995b 100644 --- a/internal/languages/java/detectors/string/string.go +++ b/pkg/languages/java/detectors/string/string.go @@ -1,13 +1,13 @@ package string import ( - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/util/stringutil" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) type stringDetector struct { diff --git a/internal/languages/java/detectors/testdata/class.java b/pkg/languages/java/detectors/testdata/class.java similarity index 100% rename from internal/languages/java/detectors/testdata/class.java rename to pkg/languages/java/detectors/testdata/class.java diff --git a/internal/languages/java/detectors/testdata/no_class.java b/pkg/languages/java/detectors/testdata/no_class.java similarity index 100% rename from internal/languages/java/detectors/testdata/no_class.java rename to pkg/languages/java/detectors/testdata/no_class.java diff --git a/internal/languages/java/detectors/testdata/string.java b/pkg/languages/java/detectors/testdata/string.java similarity index 100% rename from internal/languages/java/detectors/testdata/string.java rename to pkg/languages/java/detectors/testdata/string.java diff --git a/internal/languages/java/java.go b/pkg/languages/java/java.go similarity index 54% rename from internal/languages/java/java.go rename to pkg/languages/java/java.go index 4d0b67d82..fba897957 100644 --- a/internal/languages/java/java.go +++ b/pkg/languages/java/java.go @@ -4,20 +4,20 @@ import ( sitter "github.com/smacker/go-tree-sitter" "github.com/smacker/go-tree-sitter/java" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - - "github.com/bearer/bearer/internal/languages/java/analyzer" - "github.com/bearer/bearer/internal/languages/java/detectors/object" - stringdetector "github.com/bearer/bearer/internal/languages/java/detectors/string" - "github.com/bearer/bearer/internal/languages/java/pattern" - "github.com/bearer/bearer/internal/scanner/detectors/datatype" - "github.com/bearer/bearer/internal/scanner/detectors/insecureurl" - "github.com/bearer/bearer/internal/scanner/detectors/stringliteral" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + + "github.com/bearer/bearer/pkg/languages/java/analyzer" + "github.com/bearer/bearer/pkg/languages/java/detectors/object" + stringdetector "github.com/bearer/bearer/pkg/languages/java/detectors/string" + "github.com/bearer/bearer/pkg/languages/java/pattern" + "github.com/bearer/bearer/pkg/scanner/detectors/datatype" + "github.com/bearer/bearer/pkg/scanner/detectors/insecureurl" + "github.com/bearer/bearer/pkg/scanner/detectors/stringliteral" + "github.com/bearer/bearer/pkg/scanner/language" ) type implementation struct { @@ -32,6 +32,10 @@ func (*implementation) ID() string { return "java" } +func (*implementation) DisplayName() string { + return "Java" +} + func (*implementation) EnryLanguages() []string { return []string{"Java"} } diff --git a/internal/languages/java/java_test.go b/pkg/languages/java/java_test.go similarity index 82% rename from internal/languages/java/java_test.go rename to pkg/languages/java/java_test.go index fd9039409..084921d7d 100644 --- a/internal/languages/java/java_test.go +++ b/pkg/languages/java/java_test.go @@ -6,9 +6,9 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/languages/java" - "github.com/bearer/bearer/internal/languages/testhelper" - patternquerybuilder "github.com/bearer/bearer/internal/scanner/detectors/customrule/patternquery/builder" + "github.com/bearer/bearer/pkg/languages/java" + "github.com/bearer/bearer/pkg/languages/testhelper" + patternquerybuilder "github.com/bearer/bearer/pkg/scanner/detectors/customrule/patternquery/builder" ) //go:embed testdata/logger.yml diff --git a/internal/languages/java/pattern/pattern.go b/pkg/languages/java/pattern/pattern.go similarity index 95% rename from internal/languages/java/pattern/pattern.go rename to pkg/languages/java/pattern/pattern.go index 65fca7f21..1bc3775b9 100644 --- a/internal/languages/java/pattern/pattern.go +++ b/pkg/languages/java/pattern/pattern.go @@ -6,9 +6,9 @@ import ( "slices" "strings" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/util/regex" ) var ( diff --git a/internal/languages/java/testdata/logger.yml b/pkg/languages/java/testdata/logger.yml similarity index 100% rename from internal/languages/java/testdata/logger.yml rename to pkg/languages/java/testdata/logger.yml diff --git a/internal/languages/java/testdata/scope/scope.java b/pkg/languages/java/testdata/scope/scope.java similarity index 100% rename from internal/languages/java/testdata/scope/scope.java rename to pkg/languages/java/testdata/scope/scope.java diff --git a/internal/languages/java/testdata/scope_rule.yml b/pkg/languages/java/testdata/scope_rule.yml similarity index 100% rename from internal/languages/java/testdata/scope_rule.yml rename to pkg/languages/java/testdata/scope_rule.yml diff --git a/internal/languages/java/testdata/testcases/flow/different-line.java b/pkg/languages/java/testdata/testcases/flow/different-line.java similarity index 100% rename from internal/languages/java/testdata/testcases/flow/different-line.java rename to pkg/languages/java/testdata/testcases/flow/different-line.java diff --git a/internal/languages/java/testdata/testcases/flow/same-line.java b/pkg/languages/java/testdata/testcases/flow/same-line.java similarity index 100% rename from internal/languages/java/testdata/testcases/flow/same-line.java rename to pkg/languages/java/testdata/testcases/flow/same-line.java diff --git a/internal/languages/javascript/.snapshots/TestPatternVariables--main.yml b/pkg/languages/javascript/.snapshots/TestPatternVariables--main.yml similarity index 100% rename from internal/languages/javascript/.snapshots/TestPatternVariables--main.yml rename to pkg/languages/javascript/.snapshots/TestPatternVariables--main.yml diff --git a/internal/languages/javascript/.snapshots/TestScope--scope.yml b/pkg/languages/javascript/.snapshots/TestScope--scope.yml similarity index 100% rename from internal/languages/javascript/.snapshots/TestScope--scope.yml rename to pkg/languages/javascript/.snapshots/TestScope--scope.yml diff --git a/internal/languages/javascript/.snapshots/flow/TestFlow--assigment-expression.yml b/pkg/languages/javascript/.snapshots/flow/TestFlow--assigment-expression.yml similarity index 100% rename from internal/languages/javascript/.snapshots/flow/TestFlow--assigment-expression.yml rename to pkg/languages/javascript/.snapshots/flow/TestFlow--assigment-expression.yml diff --git a/internal/languages/javascript/.snapshots/flow/TestFlow--variable-declarator.yml b/pkg/languages/javascript/.snapshots/flow/TestFlow--variable-declarator.yml similarity index 100% rename from internal/languages/javascript/.snapshots/flow/TestFlow--variable-declarator.yml rename to pkg/languages/javascript/.snapshots/flow/TestFlow--variable-declarator.yml diff --git a/internal/languages/javascript/.snapshots/import/TestImport--import.yml b/pkg/languages/javascript/.snapshots/import/TestImport--import.yml similarity index 100% rename from internal/languages/javascript/.snapshots/import/TestImport--import.yml rename to pkg/languages/javascript/.snapshots/import/TestImport--import.yml diff --git a/internal/languages/javascript/.snapshots/object-deconstructing/TestObjectDeconstructing--deconstructing.yml b/pkg/languages/javascript/.snapshots/object-deconstructing/TestObjectDeconstructing--deconstructing.yml similarity index 100% rename from internal/languages/javascript/.snapshots/object-deconstructing/TestObjectDeconstructing--deconstructing.yml rename to pkg/languages/javascript/.snapshots/object-deconstructing/TestObjectDeconstructing--deconstructing.yml diff --git a/internal/languages/javascript/.snapshots/object-deconstructing/TestObjectDeconstructing--multiple_objects.yml b/pkg/languages/javascript/.snapshots/object-deconstructing/TestObjectDeconstructing--multiple_objects.yml similarity index 100% rename from internal/languages/javascript/.snapshots/object-deconstructing/TestObjectDeconstructing--multiple_objects.yml rename to pkg/languages/javascript/.snapshots/object-deconstructing/TestObjectDeconstructing--multiple_objects.yml diff --git a/internal/languages/javascript/.snapshots/string/TestString--concatanation.yml b/pkg/languages/javascript/.snapshots/string/TestString--concatanation.yml similarity index 100% rename from internal/languages/javascript/.snapshots/string/TestString--concatanation.yml rename to pkg/languages/javascript/.snapshots/string/TestString--concatanation.yml diff --git a/internal/languages/javascript/.snapshots/string/TestString--simple.yml b/pkg/languages/javascript/.snapshots/string/TestString--simple.yml similarity index 100% rename from internal/languages/javascript/.snapshots/string/TestString--simple.yml rename to pkg/languages/javascript/.snapshots/string/TestString--simple.yml diff --git a/internal/languages/javascript/.snapshots/string/TestString--single-quotes.yml b/pkg/languages/javascript/.snapshots/string/TestString--single-quotes.yml similarity index 100% rename from internal/languages/javascript/.snapshots/string/TestString--single-quotes.yml rename to pkg/languages/javascript/.snapshots/string/TestString--single-quotes.yml diff --git a/internal/languages/javascript/.snapshots/string/TestString--template-variable-reconciliation.yml b/pkg/languages/javascript/.snapshots/string/TestString--template-variable-reconciliation.yml similarity index 100% rename from internal/languages/javascript/.snapshots/string/TestString--template-variable-reconciliation.yml rename to pkg/languages/javascript/.snapshots/string/TestString--template-variable-reconciliation.yml diff --git a/internal/languages/javascript/.snapshots/string/TestString--template.yml b/pkg/languages/javascript/.snapshots/string/TestString--template.yml similarity index 100% rename from internal/languages/javascript/.snapshots/string/TestString--template.yml rename to pkg/languages/javascript/.snapshots/string/TestString--template.yml diff --git a/internal/languages/javascript/analyzer/analyzer.go b/pkg/languages/javascript/analyzer/analyzer.go similarity index 98% rename from internal/languages/javascript/analyzer/analyzer.go rename to pkg/languages/javascript/analyzer/analyzer.go index 20e6d159a..7b9a5dbaf 100644 --- a/internal/languages/javascript/analyzer/analyzer.go +++ b/pkg/languages/javascript/analyzer/analyzer.go @@ -6,8 +6,8 @@ import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" ) // methods that use `this` in their result diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptFileTypes-file_type_jsx b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptFileTypes-file_type_jsx similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptFileTypes-file_type_jsx rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptFileTypes-file_type_jsx diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptFileTypes-file_type_tsx b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptFileTypes-file_type_tsx similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptFileTypes-file_type_tsx rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptFileTypes-file_type_tsx diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_class b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_class similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_class rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_class diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_object b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_object similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_object rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_object diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_projection b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_projection similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_projection rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_projection diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_spread b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_spread similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_spread rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptObjectDetector-object_spread diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_assign_eq b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_assign_eq similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_assign_eq rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_assign_eq diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_literal b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_literal similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_literal rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_literal diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_non_literal b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_non_literal similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_non_literal rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptStringDetector-string_non_literal diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_const b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_const similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_const rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_const diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_let b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_let similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_let rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_let diff --git a/internal/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_var b/pkg/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_var similarity index 100% rename from internal/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_var rename to pkg/languages/javascript/detectors/.snapshots/TestJavascriptTypes-typed_object_var diff --git a/internal/languages/javascript/detectors/detectors_test.go b/pkg/languages/javascript/detectors/detectors_test.go similarity index 90% rename from internal/languages/javascript/detectors/detectors_test.go rename to pkg/languages/javascript/detectors/detectors_test.go index 932fba74c..a25447557 100644 --- a/internal/languages/javascript/detectors/detectors_test.go +++ b/pkg/languages/javascript/detectors/detectors_test.go @@ -3,8 +3,8 @@ package detectors_test import ( "testing" - "github.com/bearer/bearer/internal/languages/javascript" - "github.com/bearer/bearer/internal/scanner/detectors/testhelper" + "github.com/bearer/bearer/pkg/languages/javascript" + "github.com/bearer/bearer/pkg/scanner/detectors/testhelper" ) func TestJavascriptObjectDetector(t *testing.T) { diff --git a/internal/languages/javascript/detectors/object/object.go b/pkg/languages/javascript/detectors/object/object.go similarity index 93% rename from internal/languages/javascript/detectors/object/object.go rename to pkg/languages/javascript/detectors/object/object.go index 209f7698b..da00fe36d 100644 --- a/internal/languages/javascript/detectors/object/object.go +++ b/pkg/languages/javascript/detectors/object/object.go @@ -1,14 +1,14 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/util/stringutil" - - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/util/stringutil" + + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) type objectDetector struct { diff --git a/internal/languages/javascript/detectors/object/projection.go b/pkg/languages/javascript/detectors/object/projection.go similarity index 92% rename from internal/languages/javascript/detectors/object/projection.go rename to pkg/languages/javascript/detectors/object/projection.go index 7aa954160..5e4d7af7e 100644 --- a/internal/languages/javascript/detectors/object/projection.go +++ b/pkg/languages/javascript/detectors/object/projection.go @@ -1,13 +1,13 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/util/stringutil" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) func (detector *objectDetector) getProjections( diff --git a/internal/languages/javascript/detectors/string/string.go b/pkg/languages/javascript/detectors/string/string.go similarity index 87% rename from internal/languages/javascript/detectors/string/string.go rename to pkg/languages/javascript/detectors/string/string.go index e82100eee..41d5fe781 100644 --- a/internal/languages/javascript/detectors/string/string.go +++ b/pkg/languages/javascript/detectors/string/string.go @@ -3,13 +3,13 @@ package string import ( "fmt" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/util/stringutil" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) type stringDetector struct { diff --git a/internal/languages/javascript/detectors/testdata/file_type.jsx b/pkg/languages/javascript/detectors/testdata/file_type.jsx similarity index 100% rename from internal/languages/javascript/detectors/testdata/file_type.jsx rename to pkg/languages/javascript/detectors/testdata/file_type.jsx diff --git a/internal/languages/javascript/detectors/testdata/file_type.tsx b/pkg/languages/javascript/detectors/testdata/file_type.tsx similarity index 100% rename from internal/languages/javascript/detectors/testdata/file_type.tsx rename to pkg/languages/javascript/detectors/testdata/file_type.tsx diff --git a/internal/languages/javascript/detectors/testdata/object_class.js b/pkg/languages/javascript/detectors/testdata/object_class.js similarity index 100% rename from internal/languages/javascript/detectors/testdata/object_class.js rename to pkg/languages/javascript/detectors/testdata/object_class.js diff --git a/internal/languages/javascript/detectors/testdata/object_object.js b/pkg/languages/javascript/detectors/testdata/object_object.js similarity index 100% rename from internal/languages/javascript/detectors/testdata/object_object.js rename to pkg/languages/javascript/detectors/testdata/object_object.js diff --git a/internal/languages/javascript/detectors/testdata/object_projection.js b/pkg/languages/javascript/detectors/testdata/object_projection.js similarity index 100% rename from internal/languages/javascript/detectors/testdata/object_projection.js rename to pkg/languages/javascript/detectors/testdata/object_projection.js diff --git a/internal/languages/javascript/detectors/testdata/object_spread.js b/pkg/languages/javascript/detectors/testdata/object_spread.js similarity index 100% rename from internal/languages/javascript/detectors/testdata/object_spread.js rename to pkg/languages/javascript/detectors/testdata/object_spread.js diff --git a/internal/languages/javascript/detectors/testdata/string_assign_eq.js b/pkg/languages/javascript/detectors/testdata/string_assign_eq.js similarity index 100% rename from internal/languages/javascript/detectors/testdata/string_assign_eq.js rename to pkg/languages/javascript/detectors/testdata/string_assign_eq.js diff --git a/internal/languages/javascript/detectors/testdata/string_literal.js b/pkg/languages/javascript/detectors/testdata/string_literal.js similarity index 100% rename from internal/languages/javascript/detectors/testdata/string_literal.js rename to pkg/languages/javascript/detectors/testdata/string_literal.js diff --git a/internal/languages/javascript/detectors/testdata/string_non_literal.js b/pkg/languages/javascript/detectors/testdata/string_non_literal.js similarity index 100% rename from internal/languages/javascript/detectors/testdata/string_non_literal.js rename to pkg/languages/javascript/detectors/testdata/string_non_literal.js diff --git a/internal/languages/javascript/detectors/testdata/typed_object_const.ts b/pkg/languages/javascript/detectors/testdata/typed_object_const.ts similarity index 100% rename from internal/languages/javascript/detectors/testdata/typed_object_const.ts rename to pkg/languages/javascript/detectors/testdata/typed_object_const.ts diff --git a/internal/languages/javascript/detectors/testdata/typed_object_let.ts b/pkg/languages/javascript/detectors/testdata/typed_object_let.ts similarity index 100% rename from internal/languages/javascript/detectors/testdata/typed_object_let.ts rename to pkg/languages/javascript/detectors/testdata/typed_object_let.ts diff --git a/internal/languages/javascript/detectors/testdata/typed_object_var.ts b/pkg/languages/javascript/detectors/testdata/typed_object_var.ts similarity index 100% rename from internal/languages/javascript/detectors/testdata/typed_object_var.ts rename to pkg/languages/javascript/detectors/testdata/typed_object_var.ts diff --git a/internal/languages/javascript/javascript.go b/pkg/languages/javascript/javascript.go similarity index 55% rename from internal/languages/javascript/javascript.go rename to pkg/languages/javascript/javascript.go index e9b2033be..b498b9a72 100644 --- a/internal/languages/javascript/javascript.go +++ b/pkg/languages/javascript/javascript.go @@ -4,20 +4,20 @@ import ( sitter "github.com/smacker/go-tree-sitter" "github.com/smacker/go-tree-sitter/typescript/tsx" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - - "github.com/bearer/bearer/internal/languages/javascript/analyzer" - "github.com/bearer/bearer/internal/languages/javascript/detectors/object" - stringdetector "github.com/bearer/bearer/internal/languages/javascript/detectors/string" - "github.com/bearer/bearer/internal/languages/javascript/pattern" - "github.com/bearer/bearer/internal/scanner/detectors/datatype" - "github.com/bearer/bearer/internal/scanner/detectors/insecureurl" - "github.com/bearer/bearer/internal/scanner/detectors/stringliteral" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + + "github.com/bearer/bearer/pkg/languages/javascript/analyzer" + "github.com/bearer/bearer/pkg/languages/javascript/detectors/object" + stringdetector "github.com/bearer/bearer/pkg/languages/javascript/detectors/string" + "github.com/bearer/bearer/pkg/languages/javascript/pattern" + "github.com/bearer/bearer/pkg/scanner/detectors/datatype" + "github.com/bearer/bearer/pkg/scanner/detectors/insecureurl" + "github.com/bearer/bearer/pkg/scanner/detectors/stringliteral" + "github.com/bearer/bearer/pkg/scanner/language" ) type implementation struct { @@ -32,6 +32,10 @@ func (*implementation) ID() string { return "javascript" } +func (*implementation) DisplayName() string { + return "JavaScript" +} + func (*implementation) EnryLanguages() []string { return []string{"JavaScript", "TypeScript", "TSX"} } diff --git a/internal/languages/javascript/javascript_test.go b/pkg/languages/javascript/javascript_test.go similarity index 95% rename from internal/languages/javascript/javascript_test.go rename to pkg/languages/javascript/javascript_test.go index 4e7172292..2d47dbb84 100644 --- a/internal/languages/javascript/javascript_test.go +++ b/pkg/languages/javascript/javascript_test.go @@ -4,7 +4,7 @@ import ( _ "embed" "testing" - "github.com/bearer/bearer/internal/languages/testhelper" + "github.com/bearer/bearer/pkg/languages/testhelper" ) //go:embed testdata/import_rule.yml diff --git a/internal/languages/javascript/pattern/pattern.go b/pkg/languages/javascript/pattern/pattern.go similarity index 95% rename from internal/languages/javascript/pattern/pattern.go rename to pkg/languages/javascript/pattern/pattern.go index 40d086938..8b1416fbf 100644 --- a/internal/languages/javascript/pattern/pattern.go +++ b/pkg/languages/javascript/pattern/pattern.go @@ -6,9 +6,9 @@ import ( "slices" "strings" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/util/regex" ) var ( diff --git a/internal/languages/javascript/testdata/datatype.yml b/pkg/languages/javascript/testdata/datatype.yml similarity index 100% rename from internal/languages/javascript/testdata/datatype.yml rename to pkg/languages/javascript/testdata/datatype.yml diff --git a/internal/languages/javascript/testdata/deconstructing.yml b/pkg/languages/javascript/testdata/deconstructing.yml similarity index 100% rename from internal/languages/javascript/testdata/deconstructing.yml rename to pkg/languages/javascript/testdata/deconstructing.yml diff --git a/internal/languages/javascript/testdata/import/import.js b/pkg/languages/javascript/testdata/import/import.js similarity index 100% rename from internal/languages/javascript/testdata/import/import.js rename to pkg/languages/javascript/testdata/import/import.js diff --git a/internal/languages/javascript/testdata/import_rule.yml b/pkg/languages/javascript/testdata/import_rule.yml similarity index 100% rename from internal/languages/javascript/testdata/import_rule.yml rename to pkg/languages/javascript/testdata/import_rule.yml diff --git a/internal/languages/javascript/testdata/insecureURL.yml b/pkg/languages/javascript/testdata/insecureURL.yml similarity index 100% rename from internal/languages/javascript/testdata/insecureURL.yml rename to pkg/languages/javascript/testdata/insecureURL.yml diff --git a/internal/languages/javascript/testdata/pattern_variables/main.js b/pkg/languages/javascript/testdata/pattern_variables/main.js similarity index 100% rename from internal/languages/javascript/testdata/pattern_variables/main.js rename to pkg/languages/javascript/testdata/pattern_variables/main.js diff --git a/internal/languages/javascript/testdata/pattern_variables_rule.yml b/pkg/languages/javascript/testdata/pattern_variables_rule.yml similarity index 100% rename from internal/languages/javascript/testdata/pattern_variables_rule.yml rename to pkg/languages/javascript/testdata/pattern_variables_rule.yml diff --git a/internal/languages/javascript/testdata/scope/scope.js b/pkg/languages/javascript/testdata/scope/scope.js similarity index 100% rename from internal/languages/javascript/testdata/scope/scope.js rename to pkg/languages/javascript/testdata/scope/scope.js diff --git a/internal/languages/javascript/testdata/scope_rule.yml b/pkg/languages/javascript/testdata/scope_rule.yml similarity index 100% rename from internal/languages/javascript/testdata/scope_rule.yml rename to pkg/languages/javascript/testdata/scope_rule.yml diff --git a/internal/languages/javascript/testdata/testcases/flow/assigment-expression.js b/pkg/languages/javascript/testdata/testcases/flow/assigment-expression.js similarity index 100% rename from internal/languages/javascript/testdata/testcases/flow/assigment-expression.js rename to pkg/languages/javascript/testdata/testcases/flow/assigment-expression.js diff --git a/internal/languages/javascript/testdata/testcases/flow/variable-declarator.js b/pkg/languages/javascript/testdata/testcases/flow/variable-declarator.js similarity index 100% rename from internal/languages/javascript/testdata/testcases/flow/variable-declarator.js rename to pkg/languages/javascript/testdata/testcases/flow/variable-declarator.js diff --git a/internal/languages/javascript/testdata/testcases/object-deconstructing/deconstructing.js b/pkg/languages/javascript/testdata/testcases/object-deconstructing/deconstructing.js similarity index 100% rename from internal/languages/javascript/testdata/testcases/object-deconstructing/deconstructing.js rename to pkg/languages/javascript/testdata/testcases/object-deconstructing/deconstructing.js diff --git a/internal/languages/javascript/testdata/testcases/object-deconstructing/multiple_objects.js b/pkg/languages/javascript/testdata/testcases/object-deconstructing/multiple_objects.js similarity index 100% rename from internal/languages/javascript/testdata/testcases/object-deconstructing/multiple_objects.js rename to pkg/languages/javascript/testdata/testcases/object-deconstructing/multiple_objects.js diff --git a/internal/languages/javascript/testdata/testcases/string/concatanation.js b/pkg/languages/javascript/testdata/testcases/string/concatanation.js similarity index 100% rename from internal/languages/javascript/testdata/testcases/string/concatanation.js rename to pkg/languages/javascript/testdata/testcases/string/concatanation.js diff --git a/internal/languages/javascript/testdata/testcases/string/simple.js b/pkg/languages/javascript/testdata/testcases/string/simple.js similarity index 100% rename from internal/languages/javascript/testdata/testcases/string/simple.js rename to pkg/languages/javascript/testdata/testcases/string/simple.js diff --git a/internal/languages/javascript/testdata/testcases/string/single-quotes.js b/pkg/languages/javascript/testdata/testcases/string/single-quotes.js similarity index 100% rename from internal/languages/javascript/testdata/testcases/string/single-quotes.js rename to pkg/languages/javascript/testdata/testcases/string/single-quotes.js diff --git a/internal/languages/javascript/testdata/testcases/string/template-variable-reconciliation.js b/pkg/languages/javascript/testdata/testcases/string/template-variable-reconciliation.js similarity index 100% rename from internal/languages/javascript/testdata/testcases/string/template-variable-reconciliation.js rename to pkg/languages/javascript/testdata/testcases/string/template-variable-reconciliation.js diff --git a/internal/languages/javascript/testdata/testcases/string/template.js b/pkg/languages/javascript/testdata/testcases/string/template.js similarity index 100% rename from internal/languages/javascript/testdata/testcases/string/template.js rename to pkg/languages/javascript/testdata/testcases/string/template.js diff --git a/pkg/languages/languages.go b/pkg/languages/languages.go new file mode 100644 index 000000000..a0c625c18 --- /dev/null +++ b/pkg/languages/languages.go @@ -0,0 +1,22 @@ +package languages + +import ( + "github.com/bearer/bearer/pkg/languages/golang" + "github.com/bearer/bearer/pkg/languages/java" + "github.com/bearer/bearer/pkg/languages/javascript" + "github.com/bearer/bearer/pkg/languages/php" + "github.com/bearer/bearer/pkg/languages/python" + "github.com/bearer/bearer/pkg/languages/ruby" + "github.com/bearer/bearer/pkg/scanner/language" +) + +func Default() []language.Language { + return []language.Language{ + golang.Get(), + java.Get(), + javascript.Get(), + php.Get(), + python.Get(), + ruby.Get(), + } +} diff --git a/internal/languages/php/.snapshots/TestAnalyzer-foreach b/pkg/languages/php/.snapshots/TestAnalyzer-foreach similarity index 100% rename from internal/languages/php/.snapshots/TestAnalyzer-foreach rename to pkg/languages/php/.snapshots/TestAnalyzer-foreach diff --git a/internal/languages/php/.snapshots/TestConst--main.yml b/pkg/languages/php/.snapshots/TestConst--main.yml similarity index 100% rename from internal/languages/php/.snapshots/TestConst--main.yml rename to pkg/languages/php/.snapshots/TestConst--main.yml diff --git a/internal/languages/php/.snapshots/TestPattern-anonymous_function_names_and_bodies_are_unanchored b/pkg/languages/php/.snapshots/TestPattern-anonymous_function_names_and_bodies_are_unanchored similarity index 100% rename from internal/languages/php/.snapshots/TestPattern-anonymous_function_names_and_bodies_are_unanchored rename to pkg/languages/php/.snapshots/TestPattern-anonymous_function_names_and_bodies_are_unanchored diff --git a/internal/languages/php/.snapshots/TestPattern-catch_clauses_and_types_are_unanchored b/pkg/languages/php/.snapshots/TestPattern-catch_clauses_and_types_are_unanchored similarity index 100% rename from internal/languages/php/.snapshots/TestPattern-catch_clauses_and_types_are_unanchored rename to pkg/languages/php/.snapshots/TestPattern-catch_clauses_and_types_are_unanchored diff --git a/internal/languages/php/.snapshots/TestPattern-class_name_in_object_creation_is_unanchored b/pkg/languages/php/.snapshots/TestPattern-class_name_in_object_creation_is_unanchored similarity index 100% rename from internal/languages/php/.snapshots/TestPattern-class_name_in_object_creation_is_unanchored rename to pkg/languages/php/.snapshots/TestPattern-class_name_in_object_creation_is_unanchored diff --git a/internal/languages/php/.snapshots/TestPattern-function_names_and_bodies_are_unanchored b/pkg/languages/php/.snapshots/TestPattern-function_names_and_bodies_are_unanchored similarity index 100% rename from internal/languages/php/.snapshots/TestPattern-function_names_and_bodies_are_unanchored rename to pkg/languages/php/.snapshots/TestPattern-function_names_and_bodies_are_unanchored diff --git a/internal/languages/php/.snapshots/TestPattern-named_arguments_are_unanchored b/pkg/languages/php/.snapshots/TestPattern-named_arguments_are_unanchored similarity index 100% rename from internal/languages/php/.snapshots/TestPattern-named_arguments_are_unanchored rename to pkg/languages/php/.snapshots/TestPattern-named_arguments_are_unanchored diff --git a/internal/languages/php/.snapshots/TestPattern-parameter_names_are_unanchored b/pkg/languages/php/.snapshots/TestPattern-parameter_names_are_unanchored similarity index 100% rename from internal/languages/php/.snapshots/TestPattern-parameter_names_are_unanchored rename to pkg/languages/php/.snapshots/TestPattern-parameter_names_are_unanchored diff --git a/internal/languages/php/.snapshots/TestPattern-property_names_are_unanchored b/pkg/languages/php/.snapshots/TestPattern-property_names_are_unanchored similarity index 100% rename from internal/languages/php/.snapshots/TestPattern-property_names_are_unanchored rename to pkg/languages/php/.snapshots/TestPattern-property_names_are_unanchored diff --git a/internal/languages/php/.snapshots/TestScope--scope.yml b/pkg/languages/php/.snapshots/TestScope--scope.yml similarity index 100% rename from internal/languages/php/.snapshots/TestScope--scope.yml rename to pkg/languages/php/.snapshots/TestScope--scope.yml diff --git a/internal/languages/php/.snapshots/flow/TestFlow--different-line.yml b/pkg/languages/php/.snapshots/flow/TestFlow--different-line.yml similarity index 100% rename from internal/languages/php/.snapshots/flow/TestFlow--different-line.yml rename to pkg/languages/php/.snapshots/flow/TestFlow--different-line.yml diff --git a/internal/languages/php/.snapshots/flow/TestFlow--same-line.yml b/pkg/languages/php/.snapshots/flow/TestFlow--same-line.yml similarity index 100% rename from internal/languages/php/.snapshots/flow/TestFlow--same-line.yml rename to pkg/languages/php/.snapshots/flow/TestFlow--same-line.yml diff --git a/internal/languages/php/analyzer/analyzer.go b/pkg/languages/php/analyzer/analyzer.go similarity index 98% rename from internal/languages/php/analyzer/analyzer.go rename to pkg/languages/php/analyzer/analyzer.go index 17d6a4007..48b7de2d6 100644 --- a/internal/languages/php/analyzer/analyzer.go +++ b/pkg/languages/php/analyzer/analyzer.go @@ -5,8 +5,8 @@ import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" ) type analyzer struct { diff --git a/internal/languages/php/detectors/.snapshots/TestPHPObjects-object_class b/pkg/languages/php/detectors/.snapshots/TestPHPObjects-object_class similarity index 100% rename from internal/languages/php/detectors/.snapshots/TestPHPObjects-object_class rename to pkg/languages/php/detectors/.snapshots/TestPHPObjects-object_class diff --git a/internal/languages/php/detectors/.snapshots/TestPHPObjects-object_no_class b/pkg/languages/php/detectors/.snapshots/TestPHPObjects-object_no_class similarity index 100% rename from internal/languages/php/detectors/.snapshots/TestPHPObjects-object_no_class rename to pkg/languages/php/detectors/.snapshots/TestPHPObjects-object_no_class diff --git a/internal/languages/php/detectors/.snapshots/TestPHPString-string b/pkg/languages/php/detectors/.snapshots/TestPHPString-string similarity index 100% rename from internal/languages/php/detectors/.snapshots/TestPHPString-string rename to pkg/languages/php/detectors/.snapshots/TestPHPString-string diff --git a/internal/languages/php/detectors/detectors_test.go b/pkg/languages/php/detectors/detectors_test.go similarity index 78% rename from internal/languages/php/detectors/detectors_test.go rename to pkg/languages/php/detectors/detectors_test.go index a605de880..a53cab597 100644 --- a/internal/languages/php/detectors/detectors_test.go +++ b/pkg/languages/php/detectors/detectors_test.go @@ -3,8 +3,8 @@ package detectors_test import ( "testing" - "github.com/bearer/bearer/internal/languages/php" - "github.com/bearer/bearer/internal/scanner/detectors/testhelper" + "github.com/bearer/bearer/pkg/languages/php" + "github.com/bearer/bearer/pkg/scanner/detectors/testhelper" ) func TestPHPObjects(t *testing.T) { diff --git a/internal/languages/php/detectors/object/object.go b/pkg/languages/php/detectors/object/object.go similarity index 92% rename from internal/languages/php/detectors/object/object.go rename to pkg/languages/php/detectors/object/object.go index 627d9fda6..4a6824987 100644 --- a/internal/languages/php/detectors/object/object.go +++ b/pkg/languages/php/detectors/object/object.go @@ -1,13 +1,13 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ruleset" ) type objectDetector struct { diff --git a/internal/languages/php/detectors/object/projection.go b/pkg/languages/php/detectors/object/projection.go similarity index 87% rename from internal/languages/php/detectors/object/projection.go rename to pkg/languages/php/detectors/object/projection.go index 5032177b4..f7c57d5e7 100644 --- a/internal/languages/php/detectors/object/projection.go +++ b/pkg/languages/php/detectors/object/projection.go @@ -1,11 +1,11 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/util/stringutil" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) func (detector *objectDetector) getProjections( diff --git a/internal/languages/php/detectors/string/string.go b/pkg/languages/php/detectors/string/string.go similarity index 76% rename from internal/languages/php/detectors/string/string.go rename to pkg/languages/php/detectors/string/string.go index 3cfcd439b..778cc0214 100644 --- a/internal/languages/php/detectors/string/string.go +++ b/pkg/languages/php/detectors/string/string.go @@ -1,12 +1,12 @@ package string import ( - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) type stringDetector struct { diff --git a/internal/languages/php/detectors/testdata/class.php b/pkg/languages/php/detectors/testdata/class.php similarity index 100% rename from internal/languages/php/detectors/testdata/class.php rename to pkg/languages/php/detectors/testdata/class.php diff --git a/internal/languages/php/detectors/testdata/no_class.php b/pkg/languages/php/detectors/testdata/no_class.php similarity index 100% rename from internal/languages/php/detectors/testdata/no_class.php rename to pkg/languages/php/detectors/testdata/no_class.php diff --git a/internal/languages/php/detectors/testdata/string.php b/pkg/languages/php/detectors/testdata/string.php similarity index 100% rename from internal/languages/php/detectors/testdata/string.php rename to pkg/languages/php/detectors/testdata/string.php diff --git a/internal/languages/php/pattern/pattern.go b/pkg/languages/php/pattern/pattern.go similarity index 97% rename from internal/languages/php/pattern/pattern.go rename to pkg/languages/php/pattern/pattern.go index 6363f8cfd..4a40746ae 100644 --- a/internal/languages/php/pattern/pattern.go +++ b/pkg/languages/php/pattern/pattern.go @@ -6,9 +6,9 @@ import ( "slices" "strings" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/util/regex" ) var ( diff --git a/internal/languages/php/php.go b/pkg/languages/php/php.go similarity index 51% rename from internal/languages/php/php.go rename to pkg/languages/php/php.go index 8acfb81bb..9321e6248 100644 --- a/internal/languages/php/php.go +++ b/pkg/languages/php/php.go @@ -1,23 +1,23 @@ package php import ( - php "github.com/bearer/bearer/internal/parser/sitter/php2" + php "github.com/bearer/bearer/pkg/parser/sitter/php2" sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - - "github.com/bearer/bearer/internal/languages/php/analyzer" - "github.com/bearer/bearer/internal/languages/php/detectors/object" - stringdetector "github.com/bearer/bearer/internal/languages/php/detectors/string" - "github.com/bearer/bearer/internal/languages/php/pattern" - "github.com/bearer/bearer/internal/scanner/detectors/datatype" - "github.com/bearer/bearer/internal/scanner/detectors/insecureurl" - "github.com/bearer/bearer/internal/scanner/detectors/stringliteral" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + + "github.com/bearer/bearer/pkg/languages/php/analyzer" + "github.com/bearer/bearer/pkg/languages/php/detectors/object" + stringdetector "github.com/bearer/bearer/pkg/languages/php/detectors/string" + "github.com/bearer/bearer/pkg/languages/php/pattern" + "github.com/bearer/bearer/pkg/scanner/detectors/datatype" + "github.com/bearer/bearer/pkg/scanner/detectors/insecureurl" + "github.com/bearer/bearer/pkg/scanner/detectors/stringliteral" + "github.com/bearer/bearer/pkg/scanner/language" ) type implementation struct { @@ -32,6 +32,10 @@ func (*implementation) ID() string { return "php" } +func (*implementation) DisplayName() string { + return "PHP" +} + func (*implementation) EnryLanguages() []string { return []string{"PHP"} } diff --git a/internal/languages/php/php_test.go b/pkg/languages/php/php_test.go similarity index 85% rename from internal/languages/php/php_test.go rename to pkg/languages/php/php_test.go index 8dccc48c0..a18dce93e 100644 --- a/internal/languages/php/php_test.go +++ b/pkg/languages/php/php_test.go @@ -7,13 +7,13 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/languages/php" - "github.com/bearer/bearer/internal/languages/testhelper" - "github.com/bearer/bearer/internal/scanner/ast" - "github.com/bearer/bearer/internal/scanner/ast/query" - patternquerybuilder "github.com/bearer/bearer/internal/scanner/detectors/customrule/patternquery/builder" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/languages/php" + "github.com/bearer/bearer/pkg/languages/testhelper" + "github.com/bearer/bearer/pkg/scanner/ast" + "github.com/bearer/bearer/pkg/scanner/ast/query" + patternquerybuilder "github.com/bearer/bearer/pkg/scanner/detectors/customrule/patternquery/builder" + "github.com/bearer/bearer/pkg/scanner/ruleset" ) //go:embed testdata/logger.yml diff --git a/internal/languages/php/testdata/logger.yml b/pkg/languages/php/testdata/logger.yml similarity index 100% rename from internal/languages/php/testdata/logger.yml rename to pkg/languages/php/testdata/logger.yml diff --git a/internal/languages/php/testdata/md.yml b/pkg/languages/php/testdata/md.yml similarity index 100% rename from internal/languages/php/testdata/md.yml rename to pkg/languages/php/testdata/md.yml diff --git a/internal/languages/php/testdata/md/main.php b/pkg/languages/php/testdata/md/main.php similarity index 100% rename from internal/languages/php/testdata/md/main.php rename to pkg/languages/php/testdata/md/main.php diff --git a/internal/languages/php/testdata/scope/scope.php b/pkg/languages/php/testdata/scope/scope.php similarity index 100% rename from internal/languages/php/testdata/scope/scope.php rename to pkg/languages/php/testdata/scope/scope.php diff --git a/internal/languages/php/testdata/scope_rule.yml b/pkg/languages/php/testdata/scope_rule.yml similarity index 100% rename from internal/languages/php/testdata/scope_rule.yml rename to pkg/languages/php/testdata/scope_rule.yml diff --git a/internal/languages/php/testdata/testcases/flow/different-line.php b/pkg/languages/php/testdata/testcases/flow/different-line.php similarity index 100% rename from internal/languages/php/testdata/testcases/flow/different-line.php rename to pkg/languages/php/testdata/testcases/flow/different-line.php diff --git a/internal/languages/php/testdata/testcases/flow/same-line.php b/pkg/languages/php/testdata/testcases/flow/same-line.php similarity index 100% rename from internal/languages/php/testdata/testcases/flow/same-line.php rename to pkg/languages/php/testdata/testcases/flow/same-line.php diff --git a/internal/languages/python/.snapshots/TestDatatypes--different-line.yml b/pkg/languages/python/.snapshots/TestDatatypes--different-line.yml similarity index 100% rename from internal/languages/python/.snapshots/TestDatatypes--different-line.yml rename to pkg/languages/python/.snapshots/TestDatatypes--different-line.yml diff --git a/internal/languages/python/.snapshots/TestDatatypes--same-line.yml b/pkg/languages/python/.snapshots/TestDatatypes--same-line.yml similarity index 100% rename from internal/languages/python/.snapshots/TestDatatypes--same-line.yml rename to pkg/languages/python/.snapshots/TestDatatypes--same-line.yml diff --git a/internal/languages/python/.snapshots/TestFlow--flow.yml b/pkg/languages/python/.snapshots/TestFlow--flow.yml similarity index 100% rename from internal/languages/python/.snapshots/TestFlow--flow.yml rename to pkg/languages/python/.snapshots/TestFlow--flow.yml diff --git a/internal/languages/python/.snapshots/TestImport--import.yml b/pkg/languages/python/.snapshots/TestImport--import.yml similarity index 100% rename from internal/languages/python/.snapshots/TestImport--import.yml rename to pkg/languages/python/.snapshots/TestImport--import.yml diff --git a/internal/languages/python/.snapshots/TestPair--pair.yml b/pkg/languages/python/.snapshots/TestPair--pair.yml similarity index 100% rename from internal/languages/python/.snapshots/TestPair--pair.yml rename to pkg/languages/python/.snapshots/TestPair--pair.yml diff --git a/internal/languages/python/.snapshots/TestScope--scope.yml b/pkg/languages/python/.snapshots/TestScope--scope.yml similarity index 100% rename from internal/languages/python/.snapshots/TestScope--scope.yml rename to pkg/languages/python/.snapshots/TestScope--scope.yml diff --git a/internal/languages/python/.snapshots/TestSubscript--subscript.yml b/pkg/languages/python/.snapshots/TestSubscript--subscript.yml similarity index 100% rename from internal/languages/python/.snapshots/TestSubscript--subscript.yml rename to pkg/languages/python/.snapshots/TestSubscript--subscript.yml diff --git a/internal/languages/python/analyzer/analyzer.go b/pkg/languages/python/analyzer/analyzer.go similarity index 98% rename from internal/languages/python/analyzer/analyzer.go rename to pkg/languages/python/analyzer/analyzer.go index 0d7a434ab..21253c7ee 100644 --- a/internal/languages/python/analyzer/analyzer.go +++ b/pkg/languages/python/analyzer/analyzer.go @@ -5,8 +5,8 @@ import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" ) type analyzer struct { diff --git a/internal/languages/python/detectors/.snapshots/TestPythonObjects-object_class b/pkg/languages/python/detectors/.snapshots/TestPythonObjects-object_class similarity index 100% rename from internal/languages/python/detectors/.snapshots/TestPythonObjects-object_class rename to pkg/languages/python/detectors/.snapshots/TestPythonObjects-object_class diff --git a/internal/languages/python/detectors/.snapshots/TestPythonObjects-object_no_class b/pkg/languages/python/detectors/.snapshots/TestPythonObjects-object_no_class similarity index 100% rename from internal/languages/python/detectors/.snapshots/TestPythonObjects-object_no_class rename to pkg/languages/python/detectors/.snapshots/TestPythonObjects-object_no_class diff --git a/internal/languages/python/detectors/.snapshots/TestPythonString-string b/pkg/languages/python/detectors/.snapshots/TestPythonString-string similarity index 100% rename from internal/languages/python/detectors/.snapshots/TestPythonString-string rename to pkg/languages/python/detectors/.snapshots/TestPythonString-string diff --git a/internal/languages/python/detectors/.snapshots/TestPythonString-string_literal b/pkg/languages/python/detectors/.snapshots/TestPythonString-string_literal similarity index 100% rename from internal/languages/python/detectors/.snapshots/TestPythonString-string_literal rename to pkg/languages/python/detectors/.snapshots/TestPythonString-string_literal diff --git a/internal/languages/python/detectors/detectors_test.go b/pkg/languages/python/detectors/detectors_test.go similarity index 81% rename from internal/languages/python/detectors/detectors_test.go rename to pkg/languages/python/detectors/detectors_test.go index d2dc62d48..25affb0e8 100644 --- a/internal/languages/python/detectors/detectors_test.go +++ b/pkg/languages/python/detectors/detectors_test.go @@ -3,8 +3,8 @@ package detectors_test import ( "testing" - "github.com/bearer/bearer/internal/languages/python" - "github.com/bearer/bearer/internal/scanner/detectors/testhelper" + "github.com/bearer/bearer/pkg/languages/python" + "github.com/bearer/bearer/pkg/scanner/detectors/testhelper" ) func TestPythonObjects(t *testing.T) { diff --git a/internal/languages/python/detectors/object/object.go b/pkg/languages/python/detectors/object/object.go similarity index 92% rename from internal/languages/python/detectors/object/object.go rename to pkg/languages/python/detectors/object/object.go index 9fc8016f6..dfa13edc6 100644 --- a/internal/languages/python/detectors/object/object.go +++ b/pkg/languages/python/detectors/object/object.go @@ -1,13 +1,13 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ruleset" ) type objectDetector struct { diff --git a/internal/languages/python/detectors/object/projection.go b/pkg/languages/python/detectors/object/projection.go similarity index 86% rename from internal/languages/python/detectors/object/projection.go rename to pkg/languages/python/detectors/object/projection.go index 54738b761..627a290df 100644 --- a/internal/languages/python/detectors/object/projection.go +++ b/pkg/languages/python/detectors/object/projection.go @@ -1,9 +1,9 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) func (detector *objectDetector) getProjections( diff --git a/internal/languages/python/detectors/string/string.go b/pkg/languages/python/detectors/string/string.go similarity index 88% rename from internal/languages/python/detectors/string/string.go rename to pkg/languages/python/detectors/string/string.go index b3b65b896..1897fc058 100644 --- a/internal/languages/python/detectors/string/string.go +++ b/pkg/languages/python/detectors/string/string.go @@ -4,13 +4,13 @@ import ( "fmt" "regexp" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/util/stringutil" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) var stringRegex = regexp.MustCompile(`\A\w?['"]{1,3}(.*?)['"]{1,3}\z`) diff --git a/internal/languages/python/detectors/testdata/class.py b/pkg/languages/python/detectors/testdata/class.py similarity index 100% rename from internal/languages/python/detectors/testdata/class.py rename to pkg/languages/python/detectors/testdata/class.py diff --git a/internal/languages/python/detectors/testdata/no_class.py b/pkg/languages/python/detectors/testdata/no_class.py similarity index 100% rename from internal/languages/python/detectors/testdata/no_class.py rename to pkg/languages/python/detectors/testdata/no_class.py diff --git a/internal/languages/python/detectors/testdata/string.py b/pkg/languages/python/detectors/testdata/string.py similarity index 100% rename from internal/languages/python/detectors/testdata/string.py rename to pkg/languages/python/detectors/testdata/string.py diff --git a/internal/languages/python/detectors/testdata/string_literal.py b/pkg/languages/python/detectors/testdata/string_literal.py similarity index 100% rename from internal/languages/python/detectors/testdata/string_literal.py rename to pkg/languages/python/detectors/testdata/string_literal.py diff --git a/internal/languages/python/pattern/pattern.go b/pkg/languages/python/pattern/pattern.go similarity index 96% rename from internal/languages/python/pattern/pattern.go rename to pkg/languages/python/pattern/pattern.go index b2964ea70..f6344423d 100644 --- a/internal/languages/python/pattern/pattern.go +++ b/pkg/languages/python/pattern/pattern.go @@ -6,9 +6,9 @@ import ( "slices" "strings" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/util/regex" ) var ( diff --git a/internal/languages/python/python.go b/pkg/languages/python/python.go similarity index 54% rename from internal/languages/python/python.go rename to pkg/languages/python/python.go index 9de500ca8..cb910bbab 100644 --- a/internal/languages/python/python.go +++ b/pkg/languages/python/python.go @@ -4,20 +4,20 @@ import ( sitter "github.com/smacker/go-tree-sitter" "github.com/smacker/go-tree-sitter/python" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - - "github.com/bearer/bearer/internal/languages/python/analyzer" - "github.com/bearer/bearer/internal/languages/python/detectors/object" - stringdetector "github.com/bearer/bearer/internal/languages/python/detectors/string" - "github.com/bearer/bearer/internal/languages/python/pattern" - "github.com/bearer/bearer/internal/scanner/detectors/datatype" - "github.com/bearer/bearer/internal/scanner/detectors/insecureurl" - "github.com/bearer/bearer/internal/scanner/detectors/stringliteral" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + + "github.com/bearer/bearer/pkg/languages/python/analyzer" + "github.com/bearer/bearer/pkg/languages/python/detectors/object" + stringdetector "github.com/bearer/bearer/pkg/languages/python/detectors/string" + "github.com/bearer/bearer/pkg/languages/python/pattern" + "github.com/bearer/bearer/pkg/scanner/detectors/datatype" + "github.com/bearer/bearer/pkg/scanner/detectors/insecureurl" + "github.com/bearer/bearer/pkg/scanner/detectors/stringliteral" + "github.com/bearer/bearer/pkg/scanner/language" ) type implementation struct { @@ -32,6 +32,10 @@ func (*implementation) ID() string { return "python" } +func (*implementation) DisplayName() string { + return "Python" +} + func (*implementation) EnryLanguages() []string { return []string{"Python"} } diff --git a/internal/languages/python/python_test.go b/pkg/languages/python/python_test.go similarity index 95% rename from internal/languages/python/python_test.go rename to pkg/languages/python/python_test.go index c6761a178..d88197e79 100644 --- a/internal/languages/python/python_test.go +++ b/pkg/languages/python/python_test.go @@ -4,7 +4,7 @@ import ( _ "embed" "testing" - "github.com/bearer/bearer/internal/languages/testhelper" + "github.com/bearer/bearer/pkg/languages/testhelper" ) //go:embed testdata/datatypes_rule.yml diff --git a/internal/languages/python/testdata/datatypes/different-line.py b/pkg/languages/python/testdata/datatypes/different-line.py similarity index 100% rename from internal/languages/python/testdata/datatypes/different-line.py rename to pkg/languages/python/testdata/datatypes/different-line.py diff --git a/internal/languages/python/testdata/datatypes/same-line.py b/pkg/languages/python/testdata/datatypes/same-line.py similarity index 100% rename from internal/languages/python/testdata/datatypes/same-line.py rename to pkg/languages/python/testdata/datatypes/same-line.py diff --git a/internal/languages/python/testdata/datatypes_rule.yml b/pkg/languages/python/testdata/datatypes_rule.yml similarity index 100% rename from internal/languages/python/testdata/datatypes_rule.yml rename to pkg/languages/python/testdata/datatypes_rule.yml diff --git a/internal/languages/python/testdata/flow/flow.py b/pkg/languages/python/testdata/flow/flow.py similarity index 100% rename from internal/languages/python/testdata/flow/flow.py rename to pkg/languages/python/testdata/flow/flow.py diff --git a/internal/languages/python/testdata/flow_rule.yml b/pkg/languages/python/testdata/flow_rule.yml similarity index 100% rename from internal/languages/python/testdata/flow_rule.yml rename to pkg/languages/python/testdata/flow_rule.yml diff --git a/internal/languages/python/testdata/import/import.py b/pkg/languages/python/testdata/import/import.py similarity index 100% rename from internal/languages/python/testdata/import/import.py rename to pkg/languages/python/testdata/import/import.py diff --git a/internal/languages/python/testdata/import_rule.yml b/pkg/languages/python/testdata/import_rule.yml similarity index 100% rename from internal/languages/python/testdata/import_rule.yml rename to pkg/languages/python/testdata/import_rule.yml diff --git a/internal/languages/python/testdata/pair/pair.py b/pkg/languages/python/testdata/pair/pair.py similarity index 100% rename from internal/languages/python/testdata/pair/pair.py rename to pkg/languages/python/testdata/pair/pair.py diff --git a/internal/languages/python/testdata/pair_rule.yml b/pkg/languages/python/testdata/pair_rule.yml similarity index 100% rename from internal/languages/python/testdata/pair_rule.yml rename to pkg/languages/python/testdata/pair_rule.yml diff --git a/internal/languages/python/testdata/scope/scope.py b/pkg/languages/python/testdata/scope/scope.py similarity index 100% rename from internal/languages/python/testdata/scope/scope.py rename to pkg/languages/python/testdata/scope/scope.py diff --git a/internal/languages/python/testdata/scope_rule.yml b/pkg/languages/python/testdata/scope_rule.yml similarity index 100% rename from internal/languages/python/testdata/scope_rule.yml rename to pkg/languages/python/testdata/scope_rule.yml diff --git a/internal/languages/python/testdata/subscript/subscript.py b/pkg/languages/python/testdata/subscript/subscript.py similarity index 100% rename from internal/languages/python/testdata/subscript/subscript.py rename to pkg/languages/python/testdata/subscript/subscript.py diff --git a/internal/languages/python/testdata/subscript_rule.yml b/pkg/languages/python/testdata/subscript_rule.yml similarity index 100% rename from internal/languages/python/testdata/subscript_rule.yml rename to pkg/languages/python/testdata/subscript_rule.yml diff --git a/internal/languages/ruby/.snapshots/TestPatternVariables--main.yml b/pkg/languages/ruby/.snapshots/TestPatternVariables--main.yml similarity index 100% rename from internal/languages/ruby/.snapshots/TestPatternVariables--main.yml rename to pkg/languages/ruby/.snapshots/TestPatternVariables--main.yml diff --git a/internal/languages/ruby/.snapshots/TestRuby--call.yml b/pkg/languages/ruby/.snapshots/TestRuby--call.yml similarity index 100% rename from internal/languages/ruby/.snapshots/TestRuby--call.yml rename to pkg/languages/ruby/.snapshots/TestRuby--call.yml diff --git a/internal/languages/ruby/.snapshots/TestRuby--insecure-url.yml b/pkg/languages/ruby/.snapshots/TestRuby--insecure-url.yml similarity index 100% rename from internal/languages/ruby/.snapshots/TestRuby--insecure-url.yml rename to pkg/languages/ruby/.snapshots/TestRuby--insecure-url.yml diff --git a/internal/languages/ruby/.snapshots/TestRuby--object-variable-reconciliation.yml b/pkg/languages/ruby/.snapshots/TestRuby--object-variable-reconciliation.yml similarity index 100% rename from internal/languages/ruby/.snapshots/TestRuby--object-variable-reconciliation.yml rename to pkg/languages/ruby/.snapshots/TestRuby--object-variable-reconciliation.yml diff --git a/internal/languages/ruby/.snapshots/TestRuby--object.yml b/pkg/languages/ruby/.snapshots/TestRuby--object.yml similarity index 100% rename from internal/languages/ruby/.snapshots/TestRuby--object.yml rename to pkg/languages/ruby/.snapshots/TestRuby--object.yml diff --git a/internal/languages/ruby/.snapshots/TestScope--scope.yml b/pkg/languages/ruby/.snapshots/TestScope--scope.yml similarity index 100% rename from internal/languages/ruby/.snapshots/TestScope--scope.yml rename to pkg/languages/ruby/.snapshots/TestScope--scope.yml diff --git a/internal/languages/ruby/analyzer/analyzer.go b/pkg/languages/ruby/analyzer/analyzer.go similarity index 98% rename from internal/languages/ruby/analyzer/analyzer.go rename to pkg/languages/ruby/analyzer/analyzer.go index 3ceb519cb..b34af88de 100644 --- a/internal/languages/ruby/analyzer/analyzer.go +++ b/pkg/languages/ruby/analyzer/analyzer.go @@ -5,8 +5,8 @@ import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" ) // methods that use `self` in their result diff --git a/internal/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_class b/pkg/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_class similarity index 100% rename from internal/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_class rename to pkg/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_class diff --git a/internal/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_hash b/pkg/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_hash similarity index 100% rename from internal/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_hash rename to pkg/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_hash diff --git a/internal/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_projection b/pkg/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_projection similarity index 100% rename from internal/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_projection rename to pkg/languages/ruby/detectors/.snapshots/TestRubyObjectDetector-object_projection diff --git a/internal/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_assign_eq b/pkg/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_assign_eq similarity index 100% rename from internal/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_assign_eq rename to pkg/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_assign_eq diff --git a/internal/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_literal b/pkg/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_literal similarity index 100% rename from internal/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_literal rename to pkg/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_literal diff --git a/internal/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_non_literal b/pkg/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_non_literal similarity index 100% rename from internal/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_non_literal rename to pkg/languages/ruby/detectors/.snapshots/TestRubyStringDetector-string_non_literal diff --git a/internal/languages/ruby/detectors/common/common.go b/pkg/languages/ruby/detectors/common/common.go similarity index 85% rename from internal/languages/ruby/detectors/common/common.go rename to pkg/languages/ruby/detectors/common/common.go index 6730535dd..5396d7db0 100644 --- a/internal/languages/ruby/detectors/common/common.go +++ b/pkg/languages/ruby/detectors/common/common.go @@ -1,6 +1,6 @@ package common -import "github.com/bearer/bearer/internal/scanner/ast/tree" +import "github.com/bearer/bearer/pkg/scanner/ast/tree" func GetLiteralKey(keyNode *tree.Node) string { switch keyNode.Type() { diff --git a/internal/languages/ruby/detectors/detectors_test.go b/pkg/languages/ruby/detectors/detectors_test.go similarity index 85% rename from internal/languages/ruby/detectors/detectors_test.go rename to pkg/languages/ruby/detectors/detectors_test.go index dfe801937..1bbeaa987 100644 --- a/internal/languages/ruby/detectors/detectors_test.go +++ b/pkg/languages/ruby/detectors/detectors_test.go @@ -3,8 +3,8 @@ package detectors_test import ( "testing" - "github.com/bearer/bearer/internal/languages/ruby" - "github.com/bearer/bearer/internal/scanner/detectors/testhelper" + "github.com/bearer/bearer/pkg/languages/ruby" + "github.com/bearer/bearer/pkg/scanner/detectors/testhelper" ) func TestRubyObjectDetector(t *testing.T) { diff --git a/internal/languages/ruby/detectors/object/object.go b/pkg/languages/ruby/detectors/object/object.go similarity index 93% rename from internal/languages/ruby/detectors/object/object.go rename to pkg/languages/ruby/detectors/object/object.go index 5ba27dfd6..044c538e9 100644 --- a/internal/languages/ruby/detectors/object/object.go +++ b/pkg/languages/ruby/detectors/object/object.go @@ -1,14 +1,14 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" - - "github.com/bearer/bearer/internal/languages/ruby/detectors/common" - detectorscommon "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" + + "github.com/bearer/bearer/pkg/languages/ruby/detectors/common" + detectorscommon "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) type objectDetector struct { diff --git a/internal/languages/ruby/detectors/object/projection.go b/pkg/languages/ruby/detectors/object/projection.go similarity index 88% rename from internal/languages/ruby/detectors/object/projection.go rename to pkg/languages/ruby/detectors/object/projection.go index 266a16905..604b399a6 100644 --- a/internal/languages/ruby/detectors/object/projection.go +++ b/pkg/languages/ruby/detectors/object/projection.go @@ -1,11 +1,11 @@ package object import ( - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ast/tree" - "github.com/bearer/bearer/internal/languages/ruby/detectors/common" - detectorscommon "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/languages/ruby/detectors/common" + detectorscommon "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) func (detector *objectDetector) getProjections( diff --git a/internal/languages/ruby/detectors/string/string.go b/pkg/languages/ruby/detectors/string/string.go similarity index 81% rename from internal/languages/ruby/detectors/string/string.go rename to pkg/languages/ruby/detectors/string/string.go index 85c6e1db4..784d676a8 100644 --- a/internal/languages/ruby/detectors/string/string.go +++ b/pkg/languages/ruby/detectors/string/string.go @@ -1,12 +1,12 @@ package string import ( - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) type stringDetector struct { diff --git a/internal/languages/ruby/detectors/testdata/object_class.rb b/pkg/languages/ruby/detectors/testdata/object_class.rb similarity index 100% rename from internal/languages/ruby/detectors/testdata/object_class.rb rename to pkg/languages/ruby/detectors/testdata/object_class.rb diff --git a/internal/languages/ruby/detectors/testdata/object_hash.rb b/pkg/languages/ruby/detectors/testdata/object_hash.rb similarity index 100% rename from internal/languages/ruby/detectors/testdata/object_hash.rb rename to pkg/languages/ruby/detectors/testdata/object_hash.rb diff --git a/internal/languages/ruby/detectors/testdata/object_projection.rb b/pkg/languages/ruby/detectors/testdata/object_projection.rb similarity index 100% rename from internal/languages/ruby/detectors/testdata/object_projection.rb rename to pkg/languages/ruby/detectors/testdata/object_projection.rb diff --git a/internal/languages/ruby/detectors/testdata/string_assign_eq.rb b/pkg/languages/ruby/detectors/testdata/string_assign_eq.rb similarity index 100% rename from internal/languages/ruby/detectors/testdata/string_assign_eq.rb rename to pkg/languages/ruby/detectors/testdata/string_assign_eq.rb diff --git a/internal/languages/ruby/detectors/testdata/string_literal.rb b/pkg/languages/ruby/detectors/testdata/string_literal.rb similarity index 100% rename from internal/languages/ruby/detectors/testdata/string_literal.rb rename to pkg/languages/ruby/detectors/testdata/string_literal.rb diff --git a/internal/languages/ruby/detectors/testdata/string_non_literal.rb b/pkg/languages/ruby/detectors/testdata/string_non_literal.rb similarity index 100% rename from internal/languages/ruby/detectors/testdata/string_non_literal.rb rename to pkg/languages/ruby/detectors/testdata/string_non_literal.rb diff --git a/internal/languages/ruby/pattern/pattern.go b/pkg/languages/ruby/pattern/pattern.go similarity index 96% rename from internal/languages/ruby/pattern/pattern.go rename to pkg/languages/ruby/pattern/pattern.go index 6b92587d8..832b0055a 100644 --- a/internal/languages/ruby/pattern/pattern.go +++ b/pkg/languages/ruby/pattern/pattern.go @@ -6,10 +6,10 @@ import ( "slices" "strings" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/util/regex" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/scanner/language" ) var ( diff --git a/internal/languages/ruby/ruby.go b/pkg/languages/ruby/ruby.go similarity index 54% rename from internal/languages/ruby/ruby.go rename to pkg/languages/ruby/ruby.go index cce31f392..323eb12da 100644 --- a/internal/languages/ruby/ruby.go +++ b/pkg/languages/ruby/ruby.go @@ -4,20 +4,20 @@ import ( sitter "github.com/smacker/go-tree-sitter" "github.com/smacker/go-tree-sitter/ruby" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - - "github.com/bearer/bearer/internal/languages/ruby/analyzer" - "github.com/bearer/bearer/internal/languages/ruby/detectors/object" - stringdetector "github.com/bearer/bearer/internal/languages/ruby/detectors/string" - "github.com/bearer/bearer/internal/languages/ruby/pattern" - "github.com/bearer/bearer/internal/scanner/detectors/datatype" - "github.com/bearer/bearer/internal/scanner/detectors/insecureurl" - "github.com/bearer/bearer/internal/scanner/detectors/stringliteral" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + + "github.com/bearer/bearer/pkg/languages/ruby/analyzer" + "github.com/bearer/bearer/pkg/languages/ruby/detectors/object" + stringdetector "github.com/bearer/bearer/pkg/languages/ruby/detectors/string" + "github.com/bearer/bearer/pkg/languages/ruby/pattern" + "github.com/bearer/bearer/pkg/scanner/detectors/datatype" + "github.com/bearer/bearer/pkg/scanner/detectors/insecureurl" + "github.com/bearer/bearer/pkg/scanner/detectors/stringliteral" + "github.com/bearer/bearer/pkg/scanner/language" ) type implementation struct { @@ -32,6 +32,10 @@ func (*implementation) ID() string { return "ruby" } +func (*implementation) DisplayName() string { + return "Ruby" +} + func (*implementation) EnryLanguages() []string { return []string{"Ruby"} } diff --git a/internal/languages/ruby/ruby_test.go b/pkg/languages/ruby/ruby_test.go similarity index 91% rename from internal/languages/ruby/ruby_test.go rename to pkg/languages/ruby/ruby_test.go index 3e8d6e03e..03a04f0f8 100644 --- a/internal/languages/ruby/ruby_test.go +++ b/pkg/languages/ruby/ruby_test.go @@ -4,7 +4,7 @@ import ( _ "embed" "testing" - "github.com/bearer/bearer/internal/languages/testhelper" + "github.com/bearer/bearer/pkg/languages/testhelper" ) //go:embed testdata/rule.yml diff --git a/internal/languages/ruby/testdata/pattern_variables/main.rb b/pkg/languages/ruby/testdata/pattern_variables/main.rb similarity index 100% rename from internal/languages/ruby/testdata/pattern_variables/main.rb rename to pkg/languages/ruby/testdata/pattern_variables/main.rb diff --git a/internal/languages/ruby/testdata/pattern_variables_rule.yml b/pkg/languages/ruby/testdata/pattern_variables_rule.yml similarity index 100% rename from internal/languages/ruby/testdata/pattern_variables_rule.yml rename to pkg/languages/ruby/testdata/pattern_variables_rule.yml diff --git a/internal/languages/ruby/testdata/rule.yml b/pkg/languages/ruby/testdata/rule.yml similarity index 100% rename from internal/languages/ruby/testdata/rule.yml rename to pkg/languages/ruby/testdata/rule.yml diff --git a/internal/languages/ruby/testdata/scope/scope.rb b/pkg/languages/ruby/testdata/scope/scope.rb similarity index 100% rename from internal/languages/ruby/testdata/scope/scope.rb rename to pkg/languages/ruby/testdata/scope/scope.rb diff --git a/internal/languages/ruby/testdata/scope_rule.yml b/pkg/languages/ruby/testdata/scope_rule.yml similarity index 100% rename from internal/languages/ruby/testdata/scope_rule.yml rename to pkg/languages/ruby/testdata/scope_rule.yml diff --git a/internal/languages/ruby/testdata/testcases/call.rb b/pkg/languages/ruby/testdata/testcases/call.rb similarity index 100% rename from internal/languages/ruby/testdata/testcases/call.rb rename to pkg/languages/ruby/testdata/testcases/call.rb diff --git a/internal/languages/ruby/testdata/testcases/insecure-url.rb b/pkg/languages/ruby/testdata/testcases/insecure-url.rb similarity index 100% rename from internal/languages/ruby/testdata/testcases/insecure-url.rb rename to pkg/languages/ruby/testdata/testcases/insecure-url.rb diff --git a/internal/languages/ruby/testdata/testcases/object-variable-reconciliation.rb b/pkg/languages/ruby/testdata/testcases/object-variable-reconciliation.rb similarity index 100% rename from internal/languages/ruby/testdata/testcases/object-variable-reconciliation.rb rename to pkg/languages/ruby/testdata/testcases/object-variable-reconciliation.rb diff --git a/internal/languages/ruby/testdata/testcases/object.rb b/pkg/languages/ruby/testdata/testcases/object.rb similarity index 100% rename from internal/languages/ruby/testdata/testcases/object.rb rename to pkg/languages/ruby/testdata/testcases/object.rb diff --git a/internal/languages/testhelper/testhelper.go b/pkg/languages/testhelper/testhelper.go similarity index 78% rename from internal/languages/testhelper/testhelper.go rename to pkg/languages/testhelper/testhelper.go index 1a201b79f..550c1919d 100644 --- a/internal/languages/testhelper/testhelper.go +++ b/pkg/languages/testhelper/testhelper.go @@ -12,17 +12,21 @@ import ( "github.com/rs/zerolog" "gopkg.in/yaml.v3" - "github.com/bearer/bearer/internal/commands" - "github.com/bearer/bearer/internal/commands/process/filelist" - "github.com/bearer/bearer/internal/commands/process/filelist/files" - "github.com/bearer/bearer/internal/commands/process/orchestrator/work" - "github.com/bearer/bearer/internal/commands/process/orchestrator/worker" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/flag" - "github.com/bearer/bearer/internal/report/output" - "github.com/bearer/bearer/internal/types" - util "github.com/bearer/bearer/internal/util/output" - "github.com/bearer/bearer/internal/version_check" + "github.com/bearer/bearer/pkg/commands" + "github.com/bearer/bearer/pkg/commands/process/filelist" + "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/commands/process/orchestrator/work" + "github.com/bearer/bearer/pkg/commands/process/orchestrator/worker" + "github.com/bearer/bearer/pkg/commands/process/settings" + settingsloader "github.com/bearer/bearer/pkg/commands/process/settings/loader" + "github.com/bearer/bearer/pkg/commands/process/settings/rules" + engine "github.com/bearer/bearer/pkg/engine/implementation" + "github.com/bearer/bearer/pkg/flag" + "github.com/bearer/bearer/pkg/languages" + "github.com/bearer/bearer/pkg/report/output" + "github.com/bearer/bearer/pkg/types" + util "github.com/bearer/bearer/pkg/util/output" + "github.com/bearer/bearer/pkg/version_check" ) type Runner struct { @@ -33,7 +37,7 @@ type Runner struct { func GetRunner(t *testing.T, ruleBytes []byte, lang string) *Runner { zerolog.SetGlobalLevel(zerolog.InfoLevel) - err := commands.ScanFlags.BindForConfigInit(commands.NewScanCommand()) + err := commands.ScanFlags.BindForConfigInit(commands.NewScanCommand(nil)) if err != nil { t.Fatalf("failed to bind flags: %s", err) } @@ -55,7 +59,9 @@ func GetRunner(t *testing.T, ruleBytes []byte, lang string) *Runner { Message: "", }, } - config, err := settings.FromOptions(configFlags, meta) + + engine := engine.New(languages.Default()) + config, err := settingsloader.FromOptions(configFlags, meta, engine) if err != nil { t.Fatalf("failed to generate default scan settings: %s", err) } @@ -83,14 +89,14 @@ func getRulesFromYaml(t *testing.T, ruleBytes []byte) map[string]*settings.Rule t.Fatalf("failed to unmarshal rule %s", err) } - rules := map[string]settings.RuleDefinition{ + definitions := map[string]settings.RuleDefinition{ ruleDefinition.Metadata.ID: ruleDefinition, } enabledRules := map[string]struct{}{ ruleDefinition.Metadata.ID: {}, } - return settings.BuildRules(rules, enabledRules) + return rules.BuildRules(definitions, enabledRules) } func (runner *Runner) RunTest(t *testing.T, testdataPath string, snapshotPath string) { diff --git a/internal/parser/context/finder.go b/pkg/parser/context/finder.go similarity index 95% rename from internal/parser/context/finder.go rename to pkg/parser/context/finder.go index 23d93bca5..916ab5ae8 100644 --- a/internal/parser/context/finder.go +++ b/pkg/parser/context/finder.go @@ -1,8 +1,8 @@ package context import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/variables" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/variables" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/parser/context/resolver.go b/pkg/parser/context/resolver.go similarity index 93% rename from internal/parser/context/resolver.go rename to pkg/parser/context/resolver.go index d2222cec1..0f537e312 100644 --- a/internal/parser/context/resolver.go +++ b/pkg/parser/context/resolver.go @@ -4,8 +4,8 @@ import ( "errors" "fmt" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/variables" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/variables" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/parser/custom/custom.go b/pkg/parser/custom/custom.go similarity index 82% rename from internal/parser/custom/custom.go rename to pkg/parser/custom/custom.go index 8a94a0fc3..69e46190f 100644 --- a/internal/parser/custom/custom.go +++ b/pkg/parser/custom/custom.go @@ -1,11 +1,11 @@ package custom import ( - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/detectors/custom/config" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/detectors/custom/config" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema/datatype" ) type Detector interface { diff --git a/internal/parser/datatype/datatype.go b/pkg/parser/datatype/datatype.go similarity index 94% rename from internal/parser/datatype/datatype.go rename to pkg/parser/datatype/datatype.go index bcecf2c34..3d90e8e53 100644 --- a/internal/parser/datatype/datatype.go +++ b/pkg/parser/datatype/datatype.go @@ -3,8 +3,8 @@ package datatype import ( "errors" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/schema/datatype" ) type Finder struct { diff --git a/internal/parser/datatype/merge.go b/pkg/parser/datatype/merge.go similarity index 97% rename from internal/parser/datatype/merge.go rename to pkg/parser/datatype/merge.go index b1a3fd4d5..a7e15b3c7 100644 --- a/internal/parser/datatype/merge.go +++ b/pkg/parser/datatype/merge.go @@ -1,7 +1,7 @@ package datatype import ( - "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/report/schema/datatype" ) // MergeDatatypesByPropertyNames iterates trough source properties and adds missing datatypes from enrichment diff --git a/internal/parser/datatype/parented_by.go b/pkg/parser/datatype/parented_by.go similarity index 85% rename from internal/parser/datatype/parented_by.go rename to pkg/parser/datatype/parented_by.go index 6d4c07c6a..cec0e27a7 100644 --- a/internal/parser/datatype/parented_by.go +++ b/pkg/parser/datatype/parented_by.go @@ -1,6 +1,6 @@ package datatype -import "github.com/bearer/bearer/internal/parser" +import "github.com/bearer/bearer/pkg/parser" // IsParentedByNodeID checks if her or any of her parents have a given nodeID func IsParentedByNodeID(nodeID parser.NodeID, node *parser.Node) bool { diff --git a/internal/parser/datatype/property_finder.go b/pkg/parser/datatype/property_finder.go similarity index 90% rename from internal/parser/datatype/property_finder.go rename to pkg/parser/datatype/property_finder.go index b9288d94b..b29e7e056 100644 --- a/internal/parser/datatype/property_finder.go +++ b/pkg/parser/datatype/property_finder.go @@ -1,8 +1,8 @@ package datatype import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/schema/datatype" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/parser/datatype/scope.go b/pkg/parser/datatype/scope.go similarity index 96% rename from internal/parser/datatype/scope.go rename to pkg/parser/datatype/scope.go index 85b13df4f..3e4fdf31b 100644 --- a/internal/parser/datatype/scope.go +++ b/pkg/parser/datatype/scope.go @@ -3,9 +3,9 @@ package datatype import ( "sort" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/schema/datatype" ) type Scope struct { diff --git a/internal/parser/datatype/variable_reconciliation.go b/pkg/parser/datatype/variable_reconciliation.go similarity index 93% rename from internal/parser/datatype/variable_reconciliation.go rename to pkg/parser/datatype/variable_reconciliation.go index 7b4baeb03..32e980873 100644 --- a/internal/parser/datatype/variable_reconciliation.go +++ b/pkg/parser/datatype/variable_reconciliation.go @@ -1,8 +1,8 @@ package datatype import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/schema/datatype" ) type ReconciliationRequest struct { diff --git a/internal/parser/golang_util/golang_util.go b/pkg/parser/golang_util/golang_util.go similarity index 96% rename from internal/parser/golang_util/golang_util.go rename to pkg/parser/golang_util/golang_util.go index e33fea905..fbd19b0b6 100644 --- a/internal/parser/golang_util/golang_util.go +++ b/pkg/parser/golang_util/golang_util.go @@ -6,7 +6,7 @@ import ( "github.com/smacker/go-tree-sitter/golang" - "github.com/bearer/bearer/internal/parser" + "github.com/bearer/bearer/pkg/parser" ) var ( diff --git a/internal/parser/interfacedetector/interfaces.go b/pkg/parser/interfacedetector/interfaces.go similarity index 79% rename from internal/parser/interfacedetector/interfaces.go rename to pkg/parser/interfacedetector/interfaces.go index b7df50a56..32306dd2b 100644 --- a/internal/parser/interfacedetector/interfaces.go +++ b/pkg/parser/interfacedetector/interfaces.go @@ -1,14 +1,14 @@ package interfacedetector import ( - "github.com/bearer/bearer/internal/parser" - parsercontext "github.com/bearer/bearer/internal/parser/context" - "github.com/bearer/bearer/internal/parser/interfaces" - "github.com/bearer/bearer/internal/report" - reportinterface "github.com/bearer/bearer/internal/report/interfaces" + "github.com/bearer/bearer/pkg/parser" + parsercontext "github.com/bearer/bearer/pkg/parser/context" + "github.com/bearer/bearer/pkg/parser/interfaces" + "github.com/bearer/bearer/pkg/report" + reportinterface "github.com/bearer/bearer/pkg/report/interfaces" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/values" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/values" ) type Request struct { diff --git a/internal/parser/interfaces/interfaces.go b/pkg/parser/interfaces/interfaces.go similarity index 71% rename from internal/parser/interfaces/interfaces.go rename to pkg/parser/interfaces/interfaces.go index 8cff02214..43676b531 100644 --- a/internal/parser/interfaces/interfaces.go +++ b/pkg/parser/interfaces/interfaces.go @@ -1,10 +1,10 @@ package interfaces import ( - "github.com/bearer/bearer/internal/parser/interfaces/paths" - "github.com/bearer/bearer/internal/parser/interfaces/urls" - "github.com/bearer/bearer/internal/report/interfaces" - "github.com/bearer/bearer/internal/report/values" + "github.com/bearer/bearer/pkg/parser/interfaces/paths" + "github.com/bearer/bearer/pkg/parser/interfaces/urls" + "github.com/bearer/bearer/pkg/report/interfaces" + "github.com/bearer/bearer/pkg/report/values" ) func KeyIsRelevant(key string) bool { diff --git a/internal/parser/interfaces/paths/paths.go b/pkg/parser/interfaces/paths/paths.go similarity index 88% rename from internal/parser/interfaces/paths/paths.go rename to pkg/parser/interfaces/paths/paths.go index 96f92c273..3e55a4322 100644 --- a/internal/parser/interfaces/paths/paths.go +++ b/pkg/parser/interfaces/paths/paths.go @@ -5,9 +5,9 @@ import ( "regexp" "strings" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/util/normalize_key" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/util/normalize_key" + "github.com/bearer/bearer/pkg/util/regex" ) var ( diff --git a/internal/parser/interfaces/urls/urls.go b/pkg/parser/interfaces/urls/urls.go similarity index 92% rename from internal/parser/interfaces/urls/urls.go rename to pkg/parser/interfaces/urls/urls.go index 65715b1bb..7f9af913d 100644 --- a/internal/parser/interfaces/urls/urls.go +++ b/pkg/parser/interfaces/urls/urls.go @@ -4,10 +4,10 @@ import ( "regexp" "strings" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" - "github.com/bearer/bearer/internal/util/normalize_key" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" + "github.com/bearer/bearer/pkg/util/normalize_key" + "github.com/bearer/bearer/pkg/util/regex" "golang.org/x/net/publicsuffix" ) diff --git a/internal/parser/interfaces/urls/urls_test.go b/pkg/parser/interfaces/urls/urls_test.go similarity index 91% rename from internal/parser/interfaces/urls/urls_test.go rename to pkg/parser/interfaces/urls/urls_test.go index 9df4bdb31..48f5558b0 100644 --- a/internal/parser/interfaces/urls/urls_test.go +++ b/pkg/parser/interfaces/urls/urls_test.go @@ -5,9 +5,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/bearer/bearer/internal/parser/interfaces/urls" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" + "github.com/bearer/bearer/pkg/parser/interfaces/urls" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" ) func TestValueIsRelevant(t *testing.T) { diff --git a/internal/parser/nodeid/nodeid.go b/pkg/parser/nodeid/nodeid.go similarity index 95% rename from internal/parser/nodeid/nodeid.go rename to pkg/parser/nodeid/nodeid.go index 6ffabcc98..531bae9ca 100644 --- a/internal/parser/nodeid/nodeid.go +++ b/pkg/parser/nodeid/nodeid.go @@ -3,7 +3,7 @@ package nodeid import ( "strconv" - "github.com/bearer/bearer/internal/parser" + "github.com/bearer/bearer/pkg/parser" "github.com/google/uuid" ) diff --git a/internal/parser/parser.go b/pkg/parser/parser.go similarity index 98% rename from internal/parser/parser.go rename to pkg/parser/parser.go index 4d0b015cc..4fc83e0f9 100644 --- a/internal/parser/parser.go +++ b/pkg/parser/parser.go @@ -9,10 +9,10 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/stringutil" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/stringutil" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/parser/schema/fieldId.go b/pkg/parser/schema/fieldId.go similarity index 81% rename from internal/parser/schema/fieldId.go rename to pkg/parser/schema/fieldId.go index d918ece1e..fdc23b5a8 100644 --- a/internal/parser/schema/fieldId.go +++ b/pkg/parser/schema/fieldId.go @@ -1,8 +1,8 @@ package schema import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" ) type UUIDHolder struct { diff --git a/internal/parser/schema/schema.go b/pkg/parser/schema/schema.go similarity index 90% rename from internal/parser/schema/schema.go rename to pkg/parser/schema/schema.go index af80639ed..16a7cfe22 100644 --- a/internal/parser/schema/schema.go +++ b/pkg/parser/schema/schema.go @@ -1,9 +1,9 @@ package schema import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/report/values" - "github.com/bearer/bearer/internal/report/variables" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/report/values" + "github.com/bearer/bearer/pkg/report/variables" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/parser/sitter/config_variables/README.md b/pkg/parser/sitter/config_variables/README.md similarity index 100% rename from internal/parser/sitter/config_variables/README.md rename to pkg/parser/sitter/config_variables/README.md diff --git a/internal/parser/sitter/config_variables/binding.go b/pkg/parser/sitter/config_variables/binding.go similarity index 100% rename from internal/parser/sitter/config_variables/binding.go rename to pkg/parser/sitter/config_variables/binding.go diff --git a/internal/parser/sitter/config_variables/binding_test.go b/pkg/parser/sitter/config_variables/binding_test.go similarity index 94% rename from internal/parser/sitter/config_variables/binding_test.go rename to pkg/parser/sitter/config_variables/binding_test.go index 9e6372eea..49c372218 100644 --- a/internal/parser/sitter/config_variables/binding_test.go +++ b/pkg/parser/sitter/config_variables/binding_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/bearer/bearer/internal/parser/sitter/config_variables" + "github.com/bearer/bearer/pkg/parser/sitter/config_variables" sitter "github.com/smacker/go-tree-sitter" ) diff --git a/internal/parser/sitter/config_variables/grammar.js b/pkg/parser/sitter/config_variables/grammar.js similarity index 100% rename from internal/parser/sitter/config_variables/grammar.js rename to pkg/parser/sitter/config_variables/grammar.js diff --git a/internal/parser/sitter/config_variables/package.json b/pkg/parser/sitter/config_variables/package.json similarity index 100% rename from internal/parser/sitter/config_variables/package.json rename to pkg/parser/sitter/config_variables/package.json diff --git a/internal/parser/sitter/config_variables/parser.c b/pkg/parser/sitter/config_variables/parser.c similarity index 100% rename from internal/parser/sitter/config_variables/parser.c rename to pkg/parser/sitter/config_variables/parser.c diff --git a/internal/parser/sitter/config_variables/test/corpus/examples.txt b/pkg/parser/sitter/config_variables/test/corpus/examples.txt similarity index 100% rename from internal/parser/sitter/config_variables/test/corpus/examples.txt rename to pkg/parser/sitter/config_variables/test/corpus/examples.txt diff --git a/internal/parser/sitter/config_variables/tree_sitter/parser.h b/pkg/parser/sitter/config_variables/tree_sitter/parser.h similarity index 100% rename from internal/parser/sitter/config_variables/tree_sitter/parser.h rename to pkg/parser/sitter/config_variables/tree_sitter/parser.h diff --git a/internal/parser/sitter/graphql/README.md b/pkg/parser/sitter/graphql/README.md similarity index 100% rename from internal/parser/sitter/graphql/README.md rename to pkg/parser/sitter/graphql/README.md diff --git a/internal/parser/sitter/graphql/binding.go b/pkg/parser/sitter/graphql/binding.go similarity index 100% rename from internal/parser/sitter/graphql/binding.go rename to pkg/parser/sitter/graphql/binding.go diff --git a/internal/parser/sitter/graphql/parser.c b/pkg/parser/sitter/graphql/parser.c similarity index 100% rename from internal/parser/sitter/graphql/parser.c rename to pkg/parser/sitter/graphql/parser.c diff --git a/internal/parser/sitter/graphql/tree_sitter/parser.h b/pkg/parser/sitter/graphql/tree_sitter/parser.h similarity index 100% rename from internal/parser/sitter/graphql/tree_sitter/parser.h rename to pkg/parser/sitter/graphql/tree_sitter/parser.h diff --git a/internal/parser/sitter/html2/binding.go b/pkg/parser/sitter/html2/binding.go similarity index 100% rename from internal/parser/sitter/html2/binding.go rename to pkg/parser/sitter/html2/binding.go diff --git a/internal/parser/sitter/html2/parser.c b/pkg/parser/sitter/html2/parser.c similarity index 100% rename from internal/parser/sitter/html2/parser.c rename to pkg/parser/sitter/html2/parser.c diff --git a/internal/parser/sitter/html2/readme.md b/pkg/parser/sitter/html2/readme.md similarity index 100% rename from internal/parser/sitter/html2/readme.md rename to pkg/parser/sitter/html2/readme.md diff --git a/internal/parser/sitter/html2/scanner.c b/pkg/parser/sitter/html2/scanner.c similarity index 100% rename from internal/parser/sitter/html2/scanner.c rename to pkg/parser/sitter/html2/scanner.c diff --git a/internal/parser/sitter/html2/tag.h b/pkg/parser/sitter/html2/tag.h similarity index 100% rename from internal/parser/sitter/html2/tag.h rename to pkg/parser/sitter/html2/tag.h diff --git a/internal/parser/sitter/html2/tree_sitter/parser.h b/pkg/parser/sitter/html2/tree_sitter/parser.h similarity index 100% rename from internal/parser/sitter/html2/tree_sitter/parser.h rename to pkg/parser/sitter/html2/tree_sitter/parser.h diff --git a/internal/parser/sitter/php2/README.md b/pkg/parser/sitter/php2/README.md similarity index 100% rename from internal/parser/sitter/php2/README.md rename to pkg/parser/sitter/php2/README.md diff --git a/internal/parser/sitter/php2/binding.go b/pkg/parser/sitter/php2/binding.go similarity index 100% rename from internal/parser/sitter/php2/binding.go rename to pkg/parser/sitter/php2/binding.go diff --git a/internal/parser/sitter/php2/parser.c b/pkg/parser/sitter/php2/parser.c similarity index 100% rename from internal/parser/sitter/php2/parser.c rename to pkg/parser/sitter/php2/parser.c diff --git a/internal/parser/sitter/php2/scanner.c b/pkg/parser/sitter/php2/scanner.c similarity index 100% rename from internal/parser/sitter/php2/scanner.c rename to pkg/parser/sitter/php2/scanner.c diff --git a/internal/parser/sitter/php2/tree_sitter/parser.h b/pkg/parser/sitter/php2/tree_sitter/parser.h similarity index 100% rename from internal/parser/sitter/php2/tree_sitter/parser.h rename to pkg/parser/sitter/php2/tree_sitter/parser.h diff --git a/internal/parser/sitter/sql/README.md b/pkg/parser/sitter/sql/README.md similarity index 100% rename from internal/parser/sitter/sql/README.md rename to pkg/parser/sitter/sql/README.md diff --git a/internal/parser/sitter/sql/binding.go b/pkg/parser/sitter/sql/binding.go similarity index 100% rename from internal/parser/sitter/sql/binding.go rename to pkg/parser/sitter/sql/binding.go diff --git a/internal/parser/sitter/sql/parser.c b/pkg/parser/sitter/sql/parser.c similarity index 100% rename from internal/parser/sitter/sql/parser.c rename to pkg/parser/sitter/sql/parser.c diff --git a/internal/parser/sitter/sql/scanner.cc b/pkg/parser/sitter/sql/scanner.cc similarity index 100% rename from internal/parser/sitter/sql/scanner.cc rename to pkg/parser/sitter/sql/scanner.cc diff --git a/internal/parser/sitter/sql/tree_sitter/parser.h b/pkg/parser/sitter/sql/tree_sitter/parser.h similarity index 100% rename from internal/parser/sitter/sql/tree_sitter/parser.h rename to pkg/parser/sitter/sql/tree_sitter/parser.h diff --git a/internal/parser/sitter/xml/binding.go b/pkg/parser/sitter/xml/binding.go similarity index 100% rename from internal/parser/sitter/xml/binding.go rename to pkg/parser/sitter/xml/binding.go diff --git a/internal/parser/sitter/xml/parser.c b/pkg/parser/sitter/xml/parser.c similarity index 100% rename from internal/parser/sitter/xml/parser.c rename to pkg/parser/sitter/xml/parser.c diff --git a/internal/parser/sitter/xml/readme.md b/pkg/parser/sitter/xml/readme.md similarity index 100% rename from internal/parser/sitter/xml/readme.md rename to pkg/parser/sitter/xml/readme.md diff --git a/internal/parser/sitter/xml/tree_sitter/parser.h b/pkg/parser/sitter/xml/tree_sitter/parser.h similarity index 100% rename from internal/parser/sitter/xml/tree_sitter/parser.h rename to pkg/parser/sitter/xml/tree_sitter/parser.h diff --git a/internal/report/basebranchfindings/basebranchfindings.go b/pkg/report/basebranchfindings/basebranchfindings.go similarity index 92% rename from internal/report/basebranchfindings/basebranchfindings.go rename to pkg/report/basebranchfindings/basebranchfindings.go index 56fa7ed9a..ee45fb966 100644 --- a/internal/report/basebranchfindings/basebranchfindings.go +++ b/pkg/report/basebranchfindings/basebranchfindings.go @@ -3,8 +3,8 @@ package basebranchfindings import ( "slices" - "github.com/bearer/bearer/internal/commands/process/filelist/files" - "github.com/bearer/bearer/internal/git" + "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/git" ) type key struct { diff --git a/internal/report/config/config.go b/pkg/report/config/config.go similarity index 100% rename from internal/report/config/config.go rename to pkg/report/config/config.go diff --git a/internal/report/customdetectors/customdetectors.go b/pkg/report/customdetectors/customdetectors.go similarity index 100% rename from internal/report/customdetectors/customdetectors.go rename to pkg/report/customdetectors/customdetectors.go diff --git a/internal/report/dependencies/dependencies.go b/pkg/report/dependencies/dependencies.go similarity index 88% rename from internal/report/dependencies/dependencies.go rename to pkg/report/dependencies/dependencies.go index a8c5f2d2a..4e411a821 100644 --- a/internal/report/dependencies/dependencies.go +++ b/pkg/report/dependencies/dependencies.go @@ -1,6 +1,6 @@ package dependencies -import "github.com/bearer/bearer/internal/report/detectors" +import "github.com/bearer/bearer/pkg/report/detectors" type Provider string diff --git a/internal/report/detections/detections.go b/pkg/report/detections/detections.go similarity index 94% rename from internal/report/detections/detections.go rename to pkg/report/detections/detections.go index ef0a02ba1..cc69fe1c8 100644 --- a/internal/report/detections/detections.go +++ b/pkg/report/detections/detections.go @@ -3,9 +3,9 @@ package detections import ( "time" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks" - "github.com/bearer/bearer/internal/report/source" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks" + "github.com/bearer/bearer/pkg/report/source" ) type DetectionType string diff --git a/internal/report/detectors/detectors.go b/pkg/report/detectors/detectors.go similarity index 100% rename from internal/report/detectors/detectors.go rename to pkg/report/detectors/detectors.go diff --git a/internal/report/detectors/openapi.go b/pkg/report/detectors/openapi.go similarity index 100% rename from internal/report/detectors/openapi.go rename to pkg/report/detectors/openapi.go diff --git a/internal/report/domain/domain.go b/pkg/report/domain/domain.go similarity index 100% rename from internal/report/domain/domain.go rename to pkg/report/domain/domain.go diff --git a/internal/report/frameworks/beego/beego.go b/pkg/report/frameworks/beego/beego.go similarity index 96% rename from internal/report/frameworks/beego/beego.go rename to pkg/report/frameworks/beego/beego.go index 4fd4d5073..75c45b14f 100644 --- a/internal/report/frameworks/beego/beego.go +++ b/pkg/report/frameworks/beego/beego.go @@ -1,7 +1,7 @@ package beego import ( - "github.com/bearer/bearer/internal/report/frameworks" + "github.com/bearer/bearer/pkg/report/frameworks" ) const TypeDatabase frameworks.Type = "database" diff --git a/internal/report/frameworks/django/django.go b/pkg/report/frameworks/django/django.go similarity index 92% rename from internal/report/frameworks/django/django.go rename to pkg/report/frameworks/django/django.go index bc13d81c5..07c6acc73 100644 --- a/internal/report/frameworks/django/django.go +++ b/pkg/report/frameworks/django/django.go @@ -1,6 +1,6 @@ package django -import "github.com/bearer/bearer/internal/report/frameworks" +import "github.com/bearer/bearer/pkg/report/frameworks" const TypeDatabase frameworks.Type = "database" diff --git a/internal/report/frameworks/dotnet/dotnet.go b/pkg/report/frameworks/dotnet/dotnet.go similarity index 92% rename from internal/report/frameworks/dotnet/dotnet.go rename to pkg/report/frameworks/dotnet/dotnet.go index 5b3b59d79..93aa1e845 100644 --- a/internal/report/frameworks/dotnet/dotnet.go +++ b/pkg/report/frameworks/dotnet/dotnet.go @@ -1,7 +1,7 @@ package dotnet import ( - "github.com/bearer/bearer/internal/report/frameworks" + "github.com/bearer/bearer/pkg/report/frameworks" ) const TypeDatabase frameworks.Type = "database" diff --git a/internal/report/frameworks/frameworks.go b/pkg/report/frameworks/frameworks.go similarity index 100% rename from internal/report/frameworks/frameworks.go rename to pkg/report/frameworks/frameworks.go diff --git a/internal/report/frameworks/knex/knex.go b/pkg/report/frameworks/knex/knex.go similarity index 84% rename from internal/report/frameworks/knex/knex.go rename to pkg/report/frameworks/knex/knex.go index 1c7a1617d..628539631 100644 --- a/internal/report/frameworks/knex/knex.go +++ b/pkg/report/frameworks/knex/knex.go @@ -1,6 +1,6 @@ package knex -import "github.com/bearer/bearer/internal/report/frameworks" +import "github.com/bearer/bearer/pkg/report/frameworks" const TypeFunction frameworks.Type = "knex_function" const TypeSchema frameworks.Type = "knex_schema" diff --git a/internal/report/frameworks/rails/rails.go b/pkg/report/frameworks/rails/rails.go similarity index 97% rename from internal/report/frameworks/rails/rails.go rename to pkg/report/frameworks/rails/rails.go index 60bfad430..d638672e7 100644 --- a/internal/report/frameworks/rails/rails.go +++ b/pkg/report/frameworks/rails/rails.go @@ -3,7 +3,7 @@ package rails import ( "strings" - "github.com/bearer/bearer/internal/report/frameworks" + "github.com/bearer/bearer/pkg/report/frameworks" ) const TypeCache frameworks.Type = "cache" diff --git a/internal/report/frameworks/spring/spring.go b/pkg/report/frameworks/spring/spring.go similarity index 94% rename from internal/report/frameworks/spring/spring.go rename to pkg/report/frameworks/spring/spring.go index ea2aa21d5..4916780ed 100644 --- a/internal/report/frameworks/spring/spring.go +++ b/pkg/report/frameworks/spring/spring.go @@ -1,7 +1,7 @@ package spring import ( - "github.com/bearer/bearer/internal/report/frameworks" + "github.com/bearer/bearer/pkg/report/frameworks" ) const TypeDatabase frameworks.Type = "database" diff --git a/internal/report/frameworks/symfony/symfony.go b/pkg/report/frameworks/symfony/symfony.go similarity index 93% rename from internal/report/frameworks/symfony/symfony.go rename to pkg/report/frameworks/symfony/symfony.go index 5959992b4..c7dd2d161 100644 --- a/internal/report/frameworks/symfony/symfony.go +++ b/pkg/report/frameworks/symfony/symfony.go @@ -1,6 +1,6 @@ package symfony -import "github.com/bearer/bearer/internal/report/frameworks" +import "github.com/bearer/bearer/pkg/report/frameworks" const TypeDatabase frameworks.Type = "database" diff --git a/internal/report/interfaces/interfaces.go b/pkg/report/interfaces/interfaces.go similarity index 86% rename from internal/report/interfaces/interfaces.go rename to pkg/report/interfaces/interfaces.go index 1cc7869af..eaab6b660 100644 --- a/internal/report/interfaces/interfaces.go +++ b/pkg/report/interfaces/interfaces.go @@ -1,7 +1,7 @@ package interfaces import ( - "github.com/bearer/bearer/internal/report/values" + "github.com/bearer/bearer/pkg/report/values" ) type Type string diff --git a/internal/report/operations/operations.go b/pkg/report/operations/operations.go similarity index 100% rename from internal/report/operations/operations.go rename to pkg/report/operations/operations.go diff --git a/internal/report/operations/operationshelper/operationshelper.go b/pkg/report/operations/operationshelper/operationshelper.go similarity index 52% rename from internal/report/operations/operationshelper/operationshelper.go rename to pkg/report/operations/operationshelper/operationshelper.go index 680688f0d..11615efce 100644 --- a/internal/report/operations/operationshelper/operationshelper.go +++ b/pkg/report/operations/operationshelper/operationshelper.go @@ -1,8 +1,8 @@ package operationshelper import ( - "github.com/bearer/bearer/internal/report/operations" - "github.com/bearer/bearer/internal/report/source" + "github.com/bearer/bearer/pkg/report/operations" + "github.com/bearer/bearer/pkg/report/source" ) type Operation struct { diff --git a/internal/report/output/dataflow/components/components.go b/pkg/report/output/dataflow/components/components.go similarity index 94% rename from internal/report/output/dataflow/components/components.go rename to pkg/report/output/dataflow/components/components.go index 2c50405d5..fe95f5906 100644 --- a/internal/report/output/dataflow/components/components.go +++ b/pkg/report/output/dataflow/components/components.go @@ -4,13 +4,13 @@ import ( "regexp" "strings" - "github.com/bearer/bearer/internal/report/output/dataflow/types" + "github.com/bearer/bearer/pkg/report/output/dataflow/types" - dependenciesclassification "github.com/bearer/bearer/internal/classification/dependencies" - frameworkclassification "github.com/bearer/bearer/internal/classification/frameworks" - interfaceclassification "github.com/bearer/bearer/internal/classification/interfaces" - "github.com/bearer/bearer/internal/util/classify" - "github.com/bearer/bearer/internal/util/maputil" + dependenciesclassification "github.com/bearer/bearer/pkg/classification/dependencies" + frameworkclassification "github.com/bearer/bearer/pkg/classification/frameworks" + interfaceclassification "github.com/bearer/bearer/pkg/classification/interfaces" + "github.com/bearer/bearer/pkg/util/classify" + "github.com/bearer/bearer/pkg/util/maputil" ) type Holder struct { diff --git a/internal/report/output/dataflow/components/components_test.go b/pkg/report/output/dataflow/components/components_test.go similarity index 94% rename from internal/report/output/dataflow/components/components_test.go rename to pkg/report/output/dataflow/components/components_test.go index d0cd1a3aa..62cad1cda 100644 --- a/internal/report/output/dataflow/components/components_test.go +++ b/pkg/report/output/dataflow/components/components_test.go @@ -6,12 +6,12 @@ import ( "github.com/stretchr/testify/assert" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/output/dataflow" - "github.com/bearer/bearer/internal/report/output/dataflow/types" - "github.com/bearer/bearer/internal/report/output/detectors" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - globaltypes "github.com/bearer/bearer/internal/types" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/report/output/dataflow" + "github.com/bearer/bearer/pkg/report/output/dataflow/types" + "github.com/bearer/bearer/pkg/report/output/detectors" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + globaltypes "github.com/bearer/bearer/pkg/types" ) func TestDataflowComponents(t *testing.T) { diff --git a/internal/report/output/dataflow/dataflow.go b/pkg/report/output/dataflow/dataflow.go similarity index 89% rename from internal/report/output/dataflow/dataflow.go rename to pkg/report/output/dataflow/dataflow.go index 6050d8d37..292fe0101 100644 --- a/internal/report/output/dataflow/dataflow.go +++ b/pkg/report/output/dataflow/dataflow.go @@ -5,18 +5,18 @@ import ( "encoding/json" "fmt" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/customdetectors" - "github.com/bearer/bearer/internal/report/detections" - reportdetectors "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/output/dataflow/components" - "github.com/bearer/bearer/internal/report/output/dataflow/datatypes" - "github.com/bearer/bearer/internal/report/output/dataflow/detectiondecoder" - fileerrors "github.com/bearer/bearer/internal/report/output/dataflow/file_errors" - "github.com/bearer/bearer/internal/report/output/dataflow/risks" - "github.com/bearer/bearer/internal/report/output/types" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/report/customdetectors" + "github.com/bearer/bearer/pkg/report/detections" + reportdetectors "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/output/dataflow/components" + "github.com/bearer/bearer/pkg/report/output/dataflow/datatypes" + "github.com/bearer/bearer/pkg/report/output/dataflow/detectiondecoder" + fileerrors "github.com/bearer/bearer/pkg/report/output/dataflow/file_errors" + "github.com/bearer/bearer/pkg/report/output/dataflow/risks" + "github.com/bearer/bearer/pkg/report/output/types" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/output" ) var allowedDetections []detections.DetectionType = []detections.DetectionType{ diff --git a/internal/report/output/dataflow/datatypes/datatypes.go b/pkg/report/output/dataflow/datatypes/datatypes.go similarity index 92% rename from internal/report/output/dataflow/datatypes/datatypes.go rename to pkg/report/output/dataflow/datatypes/datatypes.go index 126011d7a..0c5312c47 100644 --- a/internal/report/output/dataflow/datatypes/datatypes.go +++ b/pkg/report/output/dataflow/datatypes/datatypes.go @@ -3,16 +3,16 @@ package datatypes import ( "sort" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/output/dataflow/detectiondecoder" - "github.com/bearer/bearer/internal/report/output/dataflow/types" - "github.com/bearer/bearer/internal/report/schema" - - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/util/classify" - "github.com/bearer/bearer/internal/util/maputil" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/output/dataflow/detectiondecoder" + "github.com/bearer/bearer/pkg/report/output/dataflow/types" + "github.com/bearer/bearer/pkg/report/schema" + + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/util/classify" + "github.com/bearer/bearer/pkg/util/maputil" ) type Holder struct { diff --git a/internal/report/output/dataflow/datatypes/datatypes_test.go b/pkg/report/output/dataflow/datatypes/datatypes_test.go similarity index 95% rename from internal/report/output/dataflow/datatypes/datatypes_test.go rename to pkg/report/output/dataflow/datatypes/datatypes_test.go index 8c60ffe0c..777434f2d 100644 --- a/internal/report/output/dataflow/datatypes/datatypes_test.go +++ b/pkg/report/output/dataflow/datatypes/datatypes_test.go @@ -6,12 +6,12 @@ import ( "github.com/stretchr/testify/assert" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/output/dataflow" - "github.com/bearer/bearer/internal/report/output/dataflow/types" - "github.com/bearer/bearer/internal/report/output/detectors" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - globaltypes "github.com/bearer/bearer/internal/types" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/report/output/dataflow" + "github.com/bearer/bearer/pkg/report/output/dataflow/types" + "github.com/bearer/bearer/pkg/report/output/detectors" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + globaltypes "github.com/bearer/bearer/pkg/types" ) func TestDataflowDataType(t *testing.T) { diff --git a/internal/report/output/dataflow/datatypes/get_extras.go b/pkg/report/output/dataflow/datatypes/get_extras.go similarity index 91% rename from internal/report/output/dataflow/datatypes/get_extras.go rename to pkg/report/output/dataflow/datatypes/get_extras.go index 9da121d9b..e6e603561 100644 --- a/internal/report/output/dataflow/datatypes/get_extras.go +++ b/pkg/report/output/dataflow/datatypes/get_extras.go @@ -5,12 +5,14 @@ import ( "errors" "fmt" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/output/dataflow/types" - regohelper "github.com/bearer/bearer/internal/util/rego" "github.com/open-policy-agent/opa/rego" + + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/commands/process/settings/processors" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/output/dataflow/types" + regohelper "github.com/bearer/bearer/pkg/util/rego" ) type processorInput struct { @@ -287,28 +289,13 @@ func (extras *extrasObj) Get(detection interface{}) *ExtraFields { return extras.data[detectionID] } -func processorModules(processorName string) (modules []regohelper.Module, err error) { - moduleText, err := settings.ProcessorRegoModuleText(processorName) - if err != nil { - return - } - - fullModuleName := fmt.Sprintf("bearer.%s", processorName) - modules = []regohelper.Module{{ - Name: fullModuleName, - Content: moduleText, - }} - - return -} - func runProcessor( processorName string, detections []any, targetDetections []any, rule *settings.Rule, ) (data map[string]*ExtraFields, err error) { - modules, err := processorModules(processorName) + modules, err := processors.Load(processorName) if err != nil { return } diff --git a/internal/report/output/dataflow/detectiondecoder/dependency_classification.go b/pkg/report/output/dataflow/detectiondecoder/dependency_classification.go similarity index 88% rename from internal/report/output/dataflow/detectiondecoder/dependency_classification.go rename to pkg/report/output/dataflow/detectiondecoder/dependency_classification.go index 2d5ec9359..cb7e0a347 100644 --- a/internal/report/output/dataflow/detectiondecoder/dependency_classification.go +++ b/pkg/report/output/dataflow/detectiondecoder/dependency_classification.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - dependenciesclassification "github.com/bearer/bearer/internal/classification/dependencies" + dependenciesclassification "github.com/bearer/bearer/pkg/classification/dependencies" ) func GetClassifiedDependency(detection interface{}) (dependenciesclassification.ClassifiedDependency, error) { diff --git a/internal/report/output/dataflow/detectiondecoder/framework_classification.go b/pkg/report/output/dataflow/detectiondecoder/framework_classification.go similarity index 88% rename from internal/report/output/dataflow/detectiondecoder/framework_classification.go rename to pkg/report/output/dataflow/detectiondecoder/framework_classification.go index f41156a67..5436c12ec 100644 --- a/internal/report/output/dataflow/detectiondecoder/framework_classification.go +++ b/pkg/report/output/dataflow/detectiondecoder/framework_classification.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - frameworkclassification "github.com/bearer/bearer/internal/classification/frameworks" + frameworkclassification "github.com/bearer/bearer/pkg/classification/frameworks" ) func GetClassifiedFramework(detection interface{}) (frameworkclassification.ClassifiedFramework, error) { diff --git a/internal/report/output/dataflow/detectiondecoder/interface_classification.go b/pkg/report/output/dataflow/detectiondecoder/interface_classification.go similarity index 88% rename from internal/report/output/dataflow/detectiondecoder/interface_classification.go rename to pkg/report/output/dataflow/detectiondecoder/interface_classification.go index d7d4086c4..c4d1e1ef9 100644 --- a/internal/report/output/dataflow/detectiondecoder/interface_classification.go +++ b/pkg/report/output/dataflow/detectiondecoder/interface_classification.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - interfaceclassification "github.com/bearer/bearer/internal/classification/interfaces" + interfaceclassification "github.com/bearer/bearer/pkg/classification/interfaces" ) func GetClassifiedInterface(detection interface{}) (interfaceclassification.ClassifiedInterface, error) { diff --git a/internal/report/output/dataflow/detectiondecoder/schema_classification.go b/pkg/report/output/dataflow/detectiondecoder/schema_classification.go similarity index 86% rename from internal/report/output/dataflow/detectiondecoder/schema_classification.go rename to pkg/report/output/dataflow/detectiondecoder/schema_classification.go index 73213002e..8a53d7b92 100644 --- a/internal/report/output/dataflow/detectiondecoder/schema_classification.go +++ b/pkg/report/output/dataflow/detectiondecoder/schema_classification.go @@ -5,10 +5,10 @@ import ( "encoding/json" "fmt" - schemaclassification "github.com/bearer/bearer/internal/classification/schema" + schemaclassification "github.com/bearer/bearer/pkg/classification/schema" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/schema" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/schema" ) func GetSchemaClassification(schema schema.Schema) (schemaclassification.Classification, error) { diff --git a/internal/report/output/dataflow/file_errors/file_errors.go b/pkg/report/output/dataflow/file_errors/file_errors.go similarity index 84% rename from internal/report/output/dataflow/file_errors/file_errors.go rename to pkg/report/output/dataflow/file_errors/file_errors.go index 889902199..30324b03b 100644 --- a/internal/report/output/dataflow/file_errors/file_errors.go +++ b/pkg/report/output/dataflow/file_errors/file_errors.go @@ -1,8 +1,8 @@ package file_errors import ( - "github.com/bearer/bearer/internal/report/detections" - fileerrors "github.com/bearer/bearer/internal/report/output/dataflow/types" + "github.com/bearer/bearer/pkg/report/detections" + fileerrors "github.com/bearer/bearer/pkg/report/output/dataflow/types" ) type Holder struct { diff --git a/internal/report/output/dataflow/formatter.go b/pkg/report/output/dataflow/formatter.go similarity index 70% rename from internal/report/output/dataflow/formatter.go rename to pkg/report/output/dataflow/formatter.go index 74b230754..5fd29eda7 100644 --- a/internal/report/output/dataflow/formatter.go +++ b/pkg/report/output/dataflow/formatter.go @@ -1,10 +1,10 @@ package dataflow import ( - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/flag" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - outputhandler "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/flag" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + outputhandler "github.com/bearer/bearer/pkg/util/output" ) type Formatter struct { diff --git a/internal/report/output/dataflow/risks/risks.go b/pkg/report/output/dataflow/risks/risks.go similarity index 94% rename from internal/report/output/dataflow/risks/risks.go rename to pkg/report/output/dataflow/risks/risks.go index 483e4a1bc..5fca8e204 100644 --- a/internal/report/output/dataflow/risks/risks.go +++ b/pkg/report/output/dataflow/risks/risks.go @@ -4,16 +4,16 @@ import ( "bytes" "encoding/json" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/output/dataflow/detectiondecoder" - "github.com/bearer/bearer/internal/report/output/dataflow/types" - "github.com/bearer/bearer/internal/report/schema" - - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/util/classify" - "github.com/bearer/bearer/internal/util/maputil" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/output/dataflow/detectiondecoder" + "github.com/bearer/bearer/pkg/report/output/dataflow/types" + "github.com/bearer/bearer/pkg/report/schema" + + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/util/classify" + "github.com/bearer/bearer/pkg/util/maputil" ) type Holder struct { diff --git a/internal/report/output/dataflow/risks/risks_test.go b/pkg/report/output/dataflow/risks/risks_test.go similarity index 95% rename from internal/report/output/dataflow/risks/risks_test.go rename to pkg/report/output/dataflow/risks/risks_test.go index 676895dee..d6ed24813 100644 --- a/internal/report/output/dataflow/risks/risks_test.go +++ b/pkg/report/output/dataflow/risks/risks_test.go @@ -6,13 +6,13 @@ import ( "github.com/stretchr/testify/assert" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/customdetectors" - "github.com/bearer/bearer/internal/report/output/dataflow" - "github.com/bearer/bearer/internal/report/output/dataflow/types" - "github.com/bearer/bearer/internal/report/output/detectors" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - globaltypes "github.com/bearer/bearer/internal/types" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/report/customdetectors" + "github.com/bearer/bearer/pkg/report/output/dataflow" + "github.com/bearer/bearer/pkg/report/output/dataflow/types" + "github.com/bearer/bearer/pkg/report/output/detectors" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + globaltypes "github.com/bearer/bearer/pkg/types" ) func TestDataflowRisks(t *testing.T) { diff --git a/internal/report/output/dataflow/types/components.go b/pkg/report/output/dataflow/types/components.go similarity index 100% rename from internal/report/output/dataflow/types/components.go rename to pkg/report/output/dataflow/types/components.go diff --git a/internal/report/output/dataflow/types/datatypes.go b/pkg/report/output/dataflow/types/datatypes.go similarity index 97% rename from internal/report/output/dataflow/types/datatypes.go rename to pkg/report/output/dataflow/types/datatypes.go index 2c892049b..732cc3af6 100644 --- a/internal/report/output/dataflow/types/datatypes.go +++ b/pkg/report/output/dataflow/types/datatypes.go @@ -1,7 +1,7 @@ package types import ( - "github.com/bearer/bearer/internal/report/schema" + "github.com/bearer/bearer/pkg/report/schema" ) type Datatype struct { diff --git a/internal/report/output/dataflow/types/file_errors.go b/pkg/report/output/dataflow/types/file_errors.go similarity index 100% rename from internal/report/output/dataflow/types/file_errors.go rename to pkg/report/output/dataflow/types/file_errors.go diff --git a/internal/report/output/dataflow/types/risks.go b/pkg/report/output/dataflow/types/risks.go similarity index 96% rename from internal/report/output/dataflow/types/risks.go rename to pkg/report/output/dataflow/types/risks.go index d1f086bb2..4896ba241 100644 --- a/internal/report/output/dataflow/types/risks.go +++ b/pkg/report/output/dataflow/types/risks.go @@ -1,6 +1,6 @@ package types -import "github.com/bearer/bearer/internal/report/schema" +import "github.com/bearer/bearer/pkg/report/schema" type RiskDetector struct { DetectorID string `json:"detector_id" yaml:"detector_id"` diff --git a/internal/report/output/detectors/detectors.go b/pkg/report/output/detectors/detectors.go similarity index 69% rename from internal/report/output/detectors/detectors.go rename to pkg/report/output/detectors/detectors.go index 78f04f87b..13b20009c 100644 --- a/internal/report/output/detectors/detectors.go +++ b/pkg/report/output/detectors/detectors.go @@ -6,11 +6,11 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/output/types" - globaltypes "github.com/bearer/bearer/internal/types" - "github.com/bearer/bearer/internal/util/jsonlines" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/report/output/types" + globaltypes "github.com/bearer/bearer/pkg/types" + "github.com/bearer/bearer/pkg/util/jsonlines" + "github.com/bearer/bearer/pkg/util/output" ) func AddReportData( diff --git a/internal/report/output/detectors/formatter.go b/pkg/report/output/detectors/formatter.go similarity index 70% rename from internal/report/output/detectors/formatter.go rename to pkg/report/output/detectors/formatter.go index 5da44aff3..cb6d5bc32 100644 --- a/internal/report/output/detectors/formatter.go +++ b/pkg/report/output/detectors/formatter.go @@ -1,10 +1,10 @@ package detectors import ( - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/flag" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - outputhandler "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/flag" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + outputhandler "github.com/bearer/bearer/pkg/util/output" ) type Formatter struct { diff --git a/internal/report/output/gitlab/.snapshots/TestJuiceShopSarif b/pkg/report/output/gitlab/.snapshots/TestJuiceShopSarif similarity index 100% rename from internal/report/output/gitlab/.snapshots/TestJuiceShopSarif rename to pkg/report/output/gitlab/.snapshots/TestJuiceShopSarif diff --git a/internal/report/output/gitlab/gitlab.go b/pkg/report/output/gitlab/gitlab.go similarity index 95% rename from internal/report/output/gitlab/gitlab.go rename to pkg/report/output/gitlab/gitlab.go index 0317e2b48..2fc49d760 100644 --- a/internal/report/output/gitlab/gitlab.go +++ b/pkg/report/output/gitlab/gitlab.go @@ -6,8 +6,8 @@ import ( "time" "github.com/bearer/bearer/cmd/bearer/build" - gitlab "github.com/bearer/bearer/internal/report/output/gitlab/types" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" + gitlab "github.com/bearer/bearer/pkg/report/output/gitlab/types" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" ) func ReportGitLab( diff --git a/internal/report/output/gitlab/gitlab_test.go b/pkg/report/output/gitlab/gitlab_test.go similarity index 89% rename from internal/report/output/gitlab/gitlab_test.go rename to pkg/report/output/gitlab/gitlab_test.go index d8381b03a..39708cd8a 100644 --- a/internal/report/output/gitlab/gitlab_test.go +++ b/pkg/report/output/gitlab/gitlab_test.go @@ -9,8 +9,8 @@ import ( "github.com/bradleyjkemp/cupaloy" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" - util "github.com/bearer/bearer/internal/util/output" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" + util "github.com/bearer/bearer/pkg/util/output" ) func TestJuiceShopSarif(t *testing.T) { diff --git a/internal/report/output/gitlab/testdata/juice-shop-security-report.json b/pkg/report/output/gitlab/testdata/juice-shop-security-report.json similarity index 100% rename from internal/report/output/gitlab/testdata/juice-shop-security-report.json rename to pkg/report/output/gitlab/testdata/juice-shop-security-report.json diff --git a/internal/report/output/gitlab/types/types.go b/pkg/report/output/gitlab/types/types.go similarity index 100% rename from internal/report/output/gitlab/types/types.go rename to pkg/report/output/gitlab/types/types.go diff --git a/internal/report/output/html/.snapshots/TestBearPublishingPrivacyHtml.html b/pkg/report/output/html/.snapshots/TestBearPublishingPrivacyHtml.html similarity index 100% rename from internal/report/output/html/.snapshots/TestBearPublishingPrivacyHtml.html rename to pkg/report/output/html/.snapshots/TestBearPublishingPrivacyHtml.html diff --git a/internal/report/output/html/.snapshots/TestJuiceShopSecurityHtml.html b/pkg/report/output/html/.snapshots/TestJuiceShopSecurityHtml.html similarity index 100% rename from internal/report/output/html/.snapshots/TestJuiceShopSecurityHtml.html rename to pkg/report/output/html/.snapshots/TestJuiceShopSecurityHtml.html diff --git a/internal/report/output/html/html.go b/pkg/report/output/html/html.go similarity index 93% rename from internal/report/output/html/html.go rename to pkg/report/output/html/html.go index 61a8a04de..6179d8bab 100644 --- a/internal/report/output/html/html.go +++ b/pkg/report/output/html/html.go @@ -10,10 +10,10 @@ import ( term "github.com/buildkite/terminal" "github.com/russross/blackfriday" - html "github.com/bearer/bearer/internal/report/output/html/types" - privacytypes "github.com/bearer/bearer/internal/report/output/privacy/types" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" - "github.com/bearer/bearer/internal/util/maputil" + html "github.com/bearer/bearer/pkg/report/output/html/types" + privacytypes "github.com/bearer/bearer/pkg/report/output/privacy/types" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" + "github.com/bearer/bearer/pkg/util/maputil" ) //go:embed security.tmpl diff --git a/internal/report/output/html/html_test.go b/pkg/report/output/html/html_test.go similarity index 89% rename from internal/report/output/html/html_test.go rename to pkg/report/output/html/html_test.go index cba8aa32b..650cd117d 100644 --- a/internal/report/output/html/html_test.go +++ b/pkg/report/output/html/html_test.go @@ -7,8 +7,8 @@ import ( "github.com/bradleyjkemp/cupaloy" - privacytypes "github.com/bearer/bearer/internal/report/output/privacy/types" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" + privacytypes "github.com/bearer/bearer/pkg/report/output/privacy/types" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" ) func TestJuiceShopSecurityHtml(t *testing.T) { diff --git a/internal/report/output/html/privacy.tmpl b/pkg/report/output/html/privacy.tmpl similarity index 100% rename from internal/report/output/html/privacy.tmpl rename to pkg/report/output/html/privacy.tmpl diff --git a/internal/report/output/html/security.tmpl b/pkg/report/output/html/security.tmpl similarity index 100% rename from internal/report/output/html/security.tmpl rename to pkg/report/output/html/security.tmpl diff --git a/internal/report/output/html/styles.css b/pkg/report/output/html/styles.css similarity index 100% rename from internal/report/output/html/styles.css rename to pkg/report/output/html/styles.css diff --git a/internal/report/output/html/testdata/bear-publishing-privacy-report.json b/pkg/report/output/html/testdata/bear-publishing-privacy-report.json similarity index 100% rename from internal/report/output/html/testdata/bear-publishing-privacy-report.json rename to pkg/report/output/html/testdata/bear-publishing-privacy-report.json diff --git a/internal/report/output/html/testdata/juice-shop-security-report.json b/pkg/report/output/html/testdata/juice-shop-security-report.json similarity index 100% rename from internal/report/output/html/testdata/juice-shop-security-report.json rename to pkg/report/output/html/testdata/juice-shop-security-report.json diff --git a/internal/report/output/html/types/types.go b/pkg/report/output/html/types/types.go similarity index 85% rename from internal/report/output/html/types/types.go rename to pkg/report/output/html/types/types.go index be9dfeb66..5661ee5c2 100644 --- a/internal/report/output/html/types/types.go +++ b/pkg/report/output/html/types/types.go @@ -1,7 +1,7 @@ package types import ( - privacytypes "github.com/bearer/bearer/internal/report/output/privacy/types" + privacytypes "github.com/bearer/bearer/pkg/report/output/privacy/types" ) type GroupedThirdParty struct { diff --git a/internal/report/output/html/wrapper.tmpl b/pkg/report/output/html/wrapper.tmpl similarity index 100% rename from internal/report/output/html/wrapper.tmpl rename to pkg/report/output/html/wrapper.tmpl diff --git a/internal/report/output/output.go b/pkg/report/output/output.go similarity index 79% rename from internal/report/output/output.go rename to pkg/report/output/output.go index 1f0405ffe..199dc423f 100644 --- a/internal/report/output/output.go +++ b/pkg/report/output/output.go @@ -8,18 +8,19 @@ import ( "github.com/google/uuid" "github.com/hhatto/gocloc" - "github.com/bearer/bearer/internal/commands/process/gitrepository" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/flag" - "github.com/bearer/bearer/internal/report/basebranchfindings" - "github.com/bearer/bearer/internal/report/output/dataflow" - "github.com/bearer/bearer/internal/report/output/detectors" - "github.com/bearer/bearer/internal/report/output/privacy" - "github.com/bearer/bearer/internal/report/output/saas" - "github.com/bearer/bearer/internal/report/output/security" - "github.com/bearer/bearer/internal/report/output/stats" - "github.com/bearer/bearer/internal/report/output/types" - globaltypes "github.com/bearer/bearer/internal/types" + "github.com/bearer/bearer/pkg/commands/process/gitrepository" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/engine" + "github.com/bearer/bearer/pkg/flag" + "github.com/bearer/bearer/pkg/report/basebranchfindings" + "github.com/bearer/bearer/pkg/report/output/dataflow" + "github.com/bearer/bearer/pkg/report/output/detectors" + "github.com/bearer/bearer/pkg/report/output/privacy" + "github.com/bearer/bearer/pkg/report/output/saas" + "github.com/bearer/bearer/pkg/report/output/security" + "github.com/bearer/bearer/pkg/report/output/stats" + "github.com/bearer/bearer/pkg/report/output/types" + globaltypes "github.com/bearer/bearer/pkg/types" ) var ErrUndefinedFormat = errors.New("undefined output format") @@ -94,6 +95,7 @@ func GetDataflow( func FormatOutput( reportData *types.ReportData, config settings.Config, + engine engine.Engine, goclocResult *gocloc.Result, startTime time.Time, endTime time.Time, @@ -105,7 +107,7 @@ func FormatOutput( case flag.ReportDataFlow: formatter = dataflow.NewFormatter(reportData, config) case flag.ReportSecurity: - formatter = security.NewFormatter(reportData, config, goclocResult, startTime, endTime) + formatter = security.NewFormatter(reportData, config, engine, goclocResult, startTime, endTime) case flag.ReportPrivacy: formatter = privacy.NewFormatter(reportData, config) case flag.ReportSaaS: diff --git a/internal/report/output/privacy/.snapshots/TestAddReportData b/pkg/report/output/privacy/.snapshots/TestAddReportData similarity index 100% rename from internal/report/output/privacy/.snapshots/TestAddReportData rename to pkg/report/output/privacy/.snapshots/TestAddReportData diff --git a/internal/report/output/privacy/.snapshots/TestBuildCsvString b/pkg/report/output/privacy/.snapshots/TestBuildCsvString similarity index 100% rename from internal/report/output/privacy/.snapshots/TestBuildCsvString rename to pkg/report/output/privacy/.snapshots/TestBuildCsvString diff --git a/internal/report/output/privacy/formatter.go b/pkg/report/output/privacy/formatter.go similarity index 78% rename from internal/report/output/privacy/formatter.go rename to pkg/report/output/privacy/formatter.go index 0e0ecc60b..610fa04c4 100644 --- a/internal/report/output/privacy/formatter.go +++ b/pkg/report/output/privacy/formatter.go @@ -3,11 +3,11 @@ package privacy import ( "fmt" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/flag" - "github.com/bearer/bearer/internal/report/output/html" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - outputhandler "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/flag" + "github.com/bearer/bearer/pkg/report/output/html" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + outputhandler "github.com/bearer/bearer/pkg/util/output" ) type Formatter struct { diff --git a/internal/report/output/privacy/privacy.go b/pkg/report/output/privacy/privacy.go similarity index 95% rename from internal/report/output/privacy/privacy.go rename to pkg/report/output/privacy/privacy.go index 6ed4ee316..d2edf99cc 100644 --- a/internal/report/output/privacy/privacy.go +++ b/pkg/report/output/privacy/privacy.go @@ -8,16 +8,16 @@ import ( "golang.org/x/exp/maps" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/commands/process/settings" - globaltypes "github.com/bearer/bearer/internal/types" - "github.com/bearer/bearer/internal/util/output" - "github.com/bearer/bearer/internal/util/progressbar" - "github.com/bearer/bearer/internal/util/rego" - - "github.com/bearer/bearer/internal/report/output/privacy/types" - "github.com/bearer/bearer/internal/report/output/security" - outputtypes "github.com/bearer/bearer/internal/report/output/types" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/commands/process/settings" + globaltypes "github.com/bearer/bearer/pkg/types" + "github.com/bearer/bearer/pkg/util/output" + "github.com/bearer/bearer/pkg/util/progressbar" + "github.com/bearer/bearer/pkg/util/rego" + + "github.com/bearer/bearer/pkg/report/output/privacy/types" + "github.com/bearer/bearer/pkg/report/output/security" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" ) type RuleInput struct { @@ -108,7 +108,7 @@ func AddReportData(reportData *outputtypes.ReportData, config settings.Config) e output.StdErrLog("Evaluating rules") } - bar := progressbar.GetProgressBar(len(config.Rules), config) + bar := progressbar.GetProgressBar(len(config.Rules), &config) subjectRuleFailures := make(map[string]RuleFailureSummary) thirdPartyRuleFailures := make(map[string]map[string]RuleFailureSummary) diff --git a/internal/report/output/privacy/privacy_test.go b/pkg/report/output/privacy/privacy_test.go similarity index 77% rename from internal/report/output/privacy/privacy_test.go rename to pkg/report/output/privacy/privacy_test.go index af94697e1..88f515512 100644 --- a/internal/report/output/privacy/privacy_test.go +++ b/pkg/report/output/privacy/privacy_test.go @@ -5,18 +5,23 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/commands/process/settings" - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/report/output/dataflow/types" - "github.com/bearer/bearer/internal/report/output/privacy" - "github.com/bearer/bearer/internal/report/output/testhelper" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/version_check" + "github.com/bearer/bearer/pkg/commands/process/settings" + settingsloader "github.com/bearer/bearer/pkg/commands/process/settings/loader" + "github.com/bearer/bearer/pkg/engine" + engineimpl "github.com/bearer/bearer/pkg/engine/implementation" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/languages" + "github.com/bearer/bearer/pkg/report/output/dataflow/types" + "github.com/bearer/bearer/pkg/report/output/privacy" + "github.com/bearer/bearer/pkg/report/output/testhelper" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/version_check" ) func TestBuildCsvString(t *testing.T) { - config, err := generateConfig(flagtypes.ReportOptions{Report: "privacy"}) + engine := engineimpl.New(languages.Default()) + config, err := generateConfig(engine, flagtypes.ReportOptions{Report: "privacy"}) config.Rules = map[string]*settings.Rule{ "ruby_third_parties_sentry": testhelper.RubyThirdPartiesSentryRule(), } @@ -37,7 +42,8 @@ func TestBuildCsvString(t *testing.T) { } func TestAddReportData(t *testing.T) { - config, err := generateConfig(flagtypes.ReportOptions{Report: "privacy"}) + engine := engineimpl.New(languages.Default()) + config, err := generateConfig(engine, flagtypes.ReportOptions{Report: "privacy"}) config.Rules = map[string]*settings.Rule{ "ruby_third_parties_sentry": testhelper.RubyThirdPartiesSentryRule(), } @@ -56,7 +62,7 @@ func TestAddReportData(t *testing.T) { cupaloy.SnapshotT(t, output.PrivacyReport) } -func generateConfig(reportOptions flagtypes.ReportOptions) (settings.Config, error) { +func generateConfig(engine engine.Engine, reportOptions flagtypes.ReportOptions) (settings.Config, error) { opts := flagtypes.Options{ ScanOptions: flagtypes.ScanOptions{ Scanner: []string{"sast"}, @@ -75,7 +81,8 @@ func generateConfig(reportOptions flagtypes.ReportOptions) (settings.Config, err Message: "", }, } - return settings.FromOptions(opts, meta) + + return settingsloader.FromOptions(opts, meta, engine) } func dummyDataflow() *outputtypes.DataFlow { diff --git a/internal/report/output/privacy/types/types.go b/pkg/report/output/privacy/types/types.go similarity index 100% rename from internal/report/output/privacy/types/types.go rename to pkg/report/output/privacy/types/types.go diff --git a/internal/report/output/reviewdog/.snapshots/TestRailsGoatReviewdog b/pkg/report/output/reviewdog/.snapshots/TestRailsGoatReviewdog similarity index 100% rename from internal/report/output/reviewdog/.snapshots/TestRailsGoatReviewdog rename to pkg/report/output/reviewdog/.snapshots/TestRailsGoatReviewdog diff --git a/internal/report/output/reviewdog/reviewdog.go b/pkg/report/output/reviewdog/reviewdog.go similarity index 90% rename from internal/report/output/reviewdog/reviewdog.go rename to pkg/report/output/reviewdog/reviewdog.go index 529249518..4181c5440 100644 --- a/internal/report/output/reviewdog/reviewdog.go +++ b/pkg/report/output/reviewdog/reviewdog.go @@ -1,8 +1,8 @@ package reviewdog import ( - reviewdog "github.com/bearer/bearer/internal/report/output/reviewdog/types" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" + reviewdog "github.com/bearer/bearer/pkg/report/output/reviewdog/types" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" ) func ReportReviewdog(outputDetections map[string][]securitytypes.Finding) (reviewdog.ReviewdogOutput, error) { diff --git a/internal/report/output/reviewdog/reviewdog_test.go b/pkg/report/output/reviewdog/reviewdog_test.go similarity index 83% rename from internal/report/output/reviewdog/reviewdog_test.go rename to pkg/report/output/reviewdog/reviewdog_test.go index 8dd235b79..7c891ab94 100644 --- a/internal/report/output/reviewdog/reviewdog_test.go +++ b/pkg/report/output/reviewdog/reviewdog_test.go @@ -8,9 +8,9 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/report/output/reviewdog" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/report/output/reviewdog" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" + "github.com/bearer/bearer/pkg/util/output" ) func TestRailsGoatReviewdog(t *testing.T) { diff --git a/internal/report/output/reviewdog/testdata/rails-goat-security-report.json b/pkg/report/output/reviewdog/testdata/rails-goat-security-report.json similarity index 100% rename from internal/report/output/reviewdog/testdata/rails-goat-security-report.json rename to pkg/report/output/reviewdog/testdata/rails-goat-security-report.json diff --git a/internal/report/output/reviewdog/types/types.go b/pkg/report/output/reviewdog/types/types.go similarity index 100% rename from internal/report/output/reviewdog/types/types.go rename to pkg/report/output/reviewdog/types/types.go diff --git a/internal/report/output/saas/.snapshots/TestBearerPublishingGitlabMetaSaas b/pkg/report/output/saas/.snapshots/TestBearerPublishingGitlabMetaSaas similarity index 100% rename from internal/report/output/saas/.snapshots/TestBearerPublishingGitlabMetaSaas rename to pkg/report/output/saas/.snapshots/TestBearerPublishingGitlabMetaSaas diff --git a/internal/report/output/saas/.snapshots/TestBearerPublishingSaas b/pkg/report/output/saas/.snapshots/TestBearerPublishingSaas similarity index 100% rename from internal/report/output/saas/.snapshots/TestBearerPublishingSaas rename to pkg/report/output/saas/.snapshots/TestBearerPublishingSaas diff --git a/internal/report/output/saas/formatter.go b/pkg/report/output/saas/formatter.go similarity index 70% rename from internal/report/output/saas/formatter.go rename to pkg/report/output/saas/formatter.go index 1bb455af3..b40e3cd9b 100644 --- a/internal/report/output/saas/formatter.go +++ b/pkg/report/output/saas/formatter.go @@ -1,10 +1,10 @@ package saas import ( - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/flag" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - outputhandler "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/flag" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + outputhandler "github.com/bearer/bearer/pkg/util/output" ) type Formatter struct { diff --git a/internal/report/output/saas/saas.go b/pkg/report/output/saas/saas.go similarity index 90% rename from internal/report/output/saas/saas.go rename to pkg/report/output/saas/saas.go index b63f1b41a..e028d4c64 100644 --- a/internal/report/output/saas/saas.go +++ b/pkg/report/output/saas/saas.go @@ -9,13 +9,13 @@ import ( "golang.org/x/exp/maps" "github.com/bearer/bearer/cmd/bearer/build" - "github.com/bearer/bearer/internal/commands/process/gitrepository" - "github.com/bearer/bearer/internal/commands/process/settings" - saas "github.com/bearer/bearer/internal/report/output/saas/types" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" - "github.com/bearer/bearer/internal/report/output/types" - "github.com/bearer/bearer/internal/util/file" - util "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/gitrepository" + "github.com/bearer/bearer/pkg/commands/process/settings" + saas "github.com/bearer/bearer/pkg/report/output/saas/types" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" + "github.com/bearer/bearer/pkg/report/output/types" + "github.com/bearer/bearer/pkg/util/file" + util "github.com/bearer/bearer/pkg/util/output" ) func GetReport( diff --git a/internal/report/output/saas/sass_test.go b/pkg/report/output/saas/sass_test.go similarity index 89% rename from internal/report/output/saas/sass_test.go rename to pkg/report/output/saas/sass_test.go index 518335945..28ae44f48 100644 --- a/internal/report/output/saas/sass_test.go +++ b/pkg/report/output/saas/sass_test.go @@ -6,12 +6,12 @@ import ( "os" "testing" - "github.com/bearer/bearer/internal/commands/process/gitrepository" - "github.com/bearer/bearer/internal/commands/process/settings" - flagtypes "github.com/bearer/bearer/internal/flag/types" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" - "github.com/bearer/bearer/internal/report/output/types" - util "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/gitrepository" + "github.com/bearer/bearer/pkg/commands/process/settings" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" + "github.com/bearer/bearer/pkg/report/output/types" + util "github.com/bearer/bearer/pkg/util/output" "github.com/bradleyjkemp/cupaloy" ) diff --git a/internal/report/output/saas/testdata/report_fixture.json b/pkg/report/output/saas/testdata/report_fixture.json similarity index 100% rename from internal/report/output/saas/testdata/report_fixture.json rename to pkg/report/output/saas/testdata/report_fixture.json diff --git a/internal/report/output/saas/types/types.go b/pkg/report/output/saas/types/types.go similarity index 91% rename from internal/report/output/saas/types/types.go rename to pkg/report/output/saas/types/types.go index 5923ed497..aeddca41d 100644 --- a/internal/report/output/saas/types/types.go +++ b/pkg/report/output/saas/types/types.go @@ -1,9 +1,9 @@ package types import ( - dataflowtypes "github.com/bearer/bearer/internal/report/output/dataflow/types" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" - ignoretypes "github.com/bearer/bearer/internal/util/ignore/types" + dataflowtypes "github.com/bearer/bearer/pkg/report/output/dataflow/types" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" + ignoretypes "github.com/bearer/bearer/pkg/util/ignore/types" ) type Meta struct { diff --git a/internal/report/output/sarif/.snapshots/TestJuiceShopSarif b/pkg/report/output/sarif/.snapshots/TestJuiceShopSarif similarity index 100% rename from internal/report/output/sarif/.snapshots/TestJuiceShopSarif rename to pkg/report/output/sarif/.snapshots/TestJuiceShopSarif diff --git a/internal/report/output/sarif/sarif.go b/pkg/report/output/sarif/sarif.go similarity index 90% rename from internal/report/output/sarif/sarif.go rename to pkg/report/output/sarif/sarif.go index 10bdba405..50c2f4f52 100644 --- a/internal/report/output/sarif/sarif.go +++ b/pkg/report/output/sarif/sarif.go @@ -1,9 +1,9 @@ package sarif import ( - "github.com/bearer/bearer/internal/commands/process/settings" - sarif "github.com/bearer/bearer/internal/report/output/sarif/types" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" + "github.com/bearer/bearer/pkg/commands/process/settings" + sarif "github.com/bearer/bearer/pkg/report/output/sarif/types" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" ) func ReportSarif(outputDetections map[string][]securitytypes.Finding, rules map[string]*settings.Rule) (sarif.SarifOutput, error) { diff --git a/internal/report/output/sarif/sarif_test.go b/pkg/report/output/sarif/sarif_test.go similarity index 88% rename from internal/report/output/sarif/sarif_test.go rename to pkg/report/output/sarif/sarif_test.go index 8ed4c6800..1ca864ca6 100644 --- a/internal/report/output/sarif/sarif_test.go +++ b/pkg/report/output/sarif/sarif_test.go @@ -8,10 +8,10 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/output/sarif" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" - util "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/report/output/sarif" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" + util "github.com/bearer/bearer/pkg/util/output" ) func TestJuiceShopSarif(t *testing.T) { diff --git a/internal/report/output/sarif/testdata/juice-shop-security-report.json b/pkg/report/output/sarif/testdata/juice-shop-security-report.json similarity index 100% rename from internal/report/output/sarif/testdata/juice-shop-security-report.json rename to pkg/report/output/sarif/testdata/juice-shop-security-report.json diff --git a/internal/report/output/sarif/types/types.go b/pkg/report/output/sarif/types/types.go similarity index 100% rename from internal/report/output/sarif/types/types.go rename to pkg/report/output/sarif/types/types.go diff --git a/internal/report/output/security/.snapshots/TestAddReportData b/pkg/report/output/security/.snapshots/TestAddReportData similarity index 100% rename from internal/report/output/security/.snapshots/TestAddReportData rename to pkg/report/output/security/.snapshots/TestAddReportData diff --git a/internal/report/output/security/.snapshots/TestAddReportDataWithSeverity b/pkg/report/output/security/.snapshots/TestAddReportDataWithSeverity similarity index 100% rename from internal/report/output/security/.snapshots/TestAddReportDataWithSeverity rename to pkg/report/output/security/.snapshots/TestAddReportDataWithSeverity diff --git a/internal/report/output/security/.snapshots/TestBuildReportString b/pkg/report/output/security/.snapshots/TestBuildReportString similarity index 100% rename from internal/report/output/security/.snapshots/TestBuildReportString rename to pkg/report/output/security/.snapshots/TestBuildReportString diff --git a/internal/report/output/security/.snapshots/TestNoRulesBuildReportString b/pkg/report/output/security/.snapshots/TestNoRulesBuildReportString similarity index 100% rename from internal/report/output/security/.snapshots/TestNoRulesBuildReportString rename to pkg/report/output/security/.snapshots/TestNoRulesBuildReportString diff --git a/internal/report/output/security/formatter.go b/pkg/report/output/security/formatter.go similarity index 75% rename from internal/report/output/security/formatter.go rename to pkg/report/output/security/formatter.go index 91f1561cf..7d9e7afa4 100644 --- a/internal/report/output/security/formatter.go +++ b/pkg/report/output/security/formatter.go @@ -7,19 +7,21 @@ import ( "github.com/hhatto/gocloc" "github.com/bearer/bearer/cmd/bearer/build" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/flag" - "github.com/bearer/bearer/internal/report/output/gitlab" - "github.com/bearer/bearer/internal/report/output/html" - "github.com/bearer/bearer/internal/report/output/reviewdog" - "github.com/bearer/bearer/internal/report/output/sarif" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - outputhandler "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/engine" + "github.com/bearer/bearer/pkg/flag" + "github.com/bearer/bearer/pkg/report/output/gitlab" + "github.com/bearer/bearer/pkg/report/output/html" + "github.com/bearer/bearer/pkg/report/output/reviewdog" + "github.com/bearer/bearer/pkg/report/output/sarif" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + outputhandler "github.com/bearer/bearer/pkg/util/output" ) type Formatter struct { ReportData *outputtypes.ReportData Config settings.Config + engine engine.Engine GoclocResult *gocloc.Result StartTime time.Time EndTime time.Time @@ -32,10 +34,18 @@ type JsonV2Output struct { Expected ExpectedDetections `json:"expected_findings,omitempty" yaml:"expected_findings,omitempty"` } -func NewFormatter(reportData *outputtypes.ReportData, config settings.Config, goclocResult *gocloc.Result, startTime time.Time, endTime time.Time) *Formatter { +func NewFormatter( + reportData *outputtypes.ReportData, + config settings.Config, + engine engine.Engine, + goclocResult *gocloc.Result, + startTime time.Time, + endTime time.Time, +) *Formatter { return &Formatter{ ReportData: reportData, Config: config, + engine: engine, GoclocResult: goclocResult, StartTime: startTime, EndTime: endTime, @@ -45,7 +55,7 @@ func NewFormatter(reportData *outputtypes.ReportData, config settings.Config, go func (f Formatter) Format(format string) (output string, err error) { switch format { case flag.FormatEmpty: - output = BuildReportString(f.ReportData, f.Config, f.GoclocResult).String() + output = BuildReportString(f.ReportData, f.Config, f.engine, f.GoclocResult).String() case flag.FormatSarif: sarifContent, sarifErr := sarif.ReportSarif(f.ReportData.FindingsBySeverity, f.Config.Rules) if sarifErr != nil { diff --git a/internal/report/output/security/security.go b/pkg/report/output/security/security.go similarity index 93% rename from internal/report/output/security/security.go rename to pkg/report/output/security/security.go index ddb0359eb..d9eda4ab8 100644 --- a/internal/report/output/security/security.go +++ b/pkg/report/output/security/security.go @@ -15,22 +15,23 @@ import ( "github.com/rodaine/table" "github.com/schollz/progressbar/v3" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/basebranchfindings" - globaltypes "github.com/bearer/bearer/internal/types" - "github.com/bearer/bearer/internal/util/file" - ignoretypes "github.com/bearer/bearer/internal/util/ignore/types" - "github.com/bearer/bearer/internal/util/maputil" - "github.com/bearer/bearer/internal/util/output" - bearerprogressbar "github.com/bearer/bearer/internal/util/progressbar" - "github.com/bearer/bearer/internal/util/rego" - "github.com/bearer/bearer/internal/util/set" - - dataflowtypes "github.com/bearer/bearer/internal/report/output/dataflow/types" - types "github.com/bearer/bearer/internal/report/output/security/types" - stats "github.com/bearer/bearer/internal/report/output/stats" - outputtypes "github.com/bearer/bearer/internal/report/output/types" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/engine" + "github.com/bearer/bearer/pkg/report/basebranchfindings" + globaltypes "github.com/bearer/bearer/pkg/types" + "github.com/bearer/bearer/pkg/util/file" + ignoretypes "github.com/bearer/bearer/pkg/util/ignore/types" + "github.com/bearer/bearer/pkg/util/maputil" + "github.com/bearer/bearer/pkg/util/output" + bearerprogressbar "github.com/bearer/bearer/pkg/util/progressbar" + "github.com/bearer/bearer/pkg/util/rego" + "github.com/bearer/bearer/pkg/util/set" + + dataflowtypes "github.com/bearer/bearer/pkg/report/output/dataflow/types" + types "github.com/bearer/bearer/pkg/report/output/security/types" + stats "github.com/bearer/bearer/pkg/report/output/stats" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" ) var underline = color.New(color.Underline).SprintFunc() @@ -154,7 +155,7 @@ func evaluateRules( var bar *progressbar.ProgressBar if !builtIn { - bar = bearerprogressbar.GetProgressBar(len(rules), config) + bar = bearerprogressbar.GetProgressBar(len(rules), &config) } var fingerprints []string @@ -392,7 +393,12 @@ func getExtract(rawCodeExtract []file.Line) string { return strings.Join(parts, "\n") } -func BuildReportString(reportData *outputtypes.ReportData, config settings.Config, lineOfCodeOutput *gocloc.Result) *strings.Builder { +func BuildReportString( + reportData *outputtypes.ReportData, + config settings.Config, + engine engine.Engine, + lineOfCodeOutput *gocloc.Result, +) *strings.Builder { reportStr := &strings.Builder{} if len(reportData.Files) == 0 { @@ -414,6 +420,7 @@ func BuildReportString(reportData *outputtypes.ReportData, config settings.Confi rulesAvailableCount := writeRuleListToString( reportStr, + engine, config.Rules, config.BuiltInRules, reportData.Dataflow.Dependencies, @@ -492,14 +499,15 @@ func writeStatsToString( func writeRuleListToString( reportStr *strings.Builder, + engine engine.Engine, rules map[string]*settings.Rule, builtInRules map[string]*settings.Rule, reportedDependencies []dataflowtypes.Dependency, languages map[string]*gocloc.Language, config settings.Config, ) int { - ruleCountPerLang, totalRuleCount, defaultRulesUsed := countRules(rules, languages, config, false) - builtInRuleCountPerLang, totalBuiltInRuleCount, builtInRulesUsed := countRules(builtInRules, languages, config, true) + ruleCountPerLang, totalRuleCount, defaultRulesUsed := countRules(engine, rules, languages, config, false) + builtInRuleCountPerLang, totalBuiltInRuleCount, builtInRulesUsed := countRules(engine, builtInRules, languages, config, true) // combine default and built-in rules per lang for _, lang := range maps.Keys(builtInRuleCountPerLang) { @@ -599,6 +607,7 @@ func getLanguagePairs(languages map[string]*gocloc.Language) []*gocloc.Language } func countRules( + engine engine.Engine, rules map[string]*settings.Rule, languages map[string]*gocloc.Language, config settings.Config, @@ -619,13 +628,15 @@ func countRules( var shouldCount bool - if rule.Language() == "secret" { + language := getLanguageDisplayName(engine, rule) + + if language == "secret" { shouldCount = slices.Contains(config.Scan.Scanner, "secrets") } else if slices.Contains(config.Scan.Scanner, "sast") { - if rule.Language() == "JavaScript" { + if language == "JavaScript" { shouldCount = languages["JavaScript"] != nil || languages["TypeScript"] != nil } else { - shouldCount = languages[rule.Language()] != nil + shouldCount = languages[language] != nil } } @@ -637,28 +648,28 @@ func countRules( totalRuleCount += 1 defaultRule := strings.HasPrefix(rule.DocumentationUrl, "https://docs.bearer.com") || builtIn - if ruleCount, ok := ruleCountPerLang[rule.Language()]; ok { + if ruleCount, ok := ruleCountPerLang[language]; ok { if defaultRule { if !defaultRulesUsed { defaultRulesUsed = true } ruleCount.DefaultRuleCount += 1 - ruleCountPerLang[rule.Language()] = ruleCount + ruleCountPerLang[language] = ruleCount } else { ruleCount.CustomRuleCount += 1 - ruleCountPerLang[rule.Language()] = ruleCount + ruleCountPerLang[language] = ruleCount } } else { if defaultRule { if !defaultRulesUsed { defaultRulesUsed = true } - ruleCountPerLang[rule.Language()] = RuleCounter{ + ruleCountPerLang[language] = RuleCounter{ CustomRuleCount: 0, DefaultRuleCount: 1, } } else { - ruleCountPerLang[rule.Language()] = RuleCounter{ + ruleCountPerLang[language] = RuleCounter{ CustomRuleCount: 1, DefaultRuleCount: 0, } @@ -860,3 +871,16 @@ func codeExtract(filename string, Source types.Source, Sink types.Sink) []file.L return code } + +func getLanguageDisplayName(engine engine.Engine, rule *settings.Rule) string { + if rule.Languages == nil { + return "secret" + } + + language := engine.GetLanguageById(rule.Languages[0]) + if language == nil { + return rule.Languages[0] + } + + return language.DisplayName() +} diff --git a/internal/report/output/security/security_test.go b/pkg/report/output/security/security_test.go similarity index 83% rename from internal/report/output/security/security_test.go rename to pkg/report/output/security/security_test.go index 1434a2732..1125e6fb7 100644 --- a/internal/report/output/security/security_test.go +++ b/pkg/report/output/security/security_test.go @@ -7,24 +7,29 @@ import ( "github.com/hhatto/gocloc" "github.com/stretchr/testify/assert" - "github.com/bearer/bearer/internal/commands/process/filelist/files" - "github.com/bearer/bearer/internal/commands/process/settings" - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/git" - "github.com/bearer/bearer/internal/report/basebranchfindings" - "github.com/bearer/bearer/internal/report/schema" - globaltypes "github.com/bearer/bearer/internal/types" - "github.com/bearer/bearer/internal/util/set" - "github.com/bearer/bearer/internal/version_check" - - dataflowtypes "github.com/bearer/bearer/internal/report/output/dataflow/types" - "github.com/bearer/bearer/internal/report/output/security" - "github.com/bearer/bearer/internal/report/output/testhelper" - outputtypes "github.com/bearer/bearer/internal/report/output/types" + "github.com/bearer/bearer/pkg/commands/process/filelist/files" + "github.com/bearer/bearer/pkg/commands/process/settings" + settingsloader "github.com/bearer/bearer/pkg/commands/process/settings/loader" + "github.com/bearer/bearer/pkg/engine" + engineimpl "github.com/bearer/bearer/pkg/engine/implementation" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/git" + "github.com/bearer/bearer/pkg/languages" + "github.com/bearer/bearer/pkg/report/basebranchfindings" + "github.com/bearer/bearer/pkg/report/schema" + globaltypes "github.com/bearer/bearer/pkg/types" + "github.com/bearer/bearer/pkg/util/set" + "github.com/bearer/bearer/pkg/version_check" + + dataflowtypes "github.com/bearer/bearer/pkg/report/output/dataflow/types" + "github.com/bearer/bearer/pkg/report/output/security" + "github.com/bearer/bearer/pkg/report/output/testhelper" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" ) func TestBuildReportString(t *testing.T) { - config, err := generateConfig(flagtypes.ReportOptions{Report: "security"}) + engine := engineimpl.New(languages.Default()) + config, err := generateConfig(engine, flagtypes.ReportOptions{Report: "security"}) // set rule version config.BearerRulesVersion = "TEST" @@ -53,12 +58,13 @@ func TestBuildReportString(t *testing.T) { MaxPathLength: 0, } - stringBuilder := security.BuildReportString(data, config, &dummyGoclocResult) + stringBuilder := security.BuildReportString(data, config, engine, &dummyGoclocResult) cupaloy.SnapshotT(t, stringBuilder.String()) } func TestNoRulesBuildReportString(t *testing.T) { - config, err := generateConfig(flagtypes.ReportOptions{Report: "security"}) + engine := engineimpl.New(languages.Default()) + config, err := generateConfig(engine, flagtypes.ReportOptions{Report: "security"}) // set rule version config.BearerRulesVersion = "TEST" config.Rules = map[string]*settings.Rule{} @@ -82,12 +88,13 @@ func TestNoRulesBuildReportString(t *testing.T) { MaxPathLength: 0, } - stringBuilder := security.BuildReportString(output, config, &dummyGoclocResult) + stringBuilder := security.BuildReportString(output, config, engine, &dummyGoclocResult) cupaloy.SnapshotT(t, stringBuilder.String()) } func TestAddReportData(t *testing.T) { - config, err := generateConfig(flagtypes.ReportOptions{Report: "security"}) + engine := engineimpl.New(languages.Default()) + config, err := generateConfig(engine, flagtypes.ReportOptions{Report: "security"}) config.Rules = map[string]*settings.Rule{ "ruby_lang_ssl_verification": testhelper.RubyLangSSLVerificationRule(), @@ -109,10 +116,11 @@ func TestAddReportData(t *testing.T) { } func TestAddReportDataWithSeverity(t *testing.T) { + engine := engineimpl.New(languages.Default()) severity := set.New[string]() severity.Add(globaltypes.LevelCritical) - config, err := generateConfig(flagtypes.ReportOptions{ + config, err := generateConfig(engine, flagtypes.ReportOptions{ Report: "security", Severity: severity, }) @@ -166,6 +174,7 @@ func TestAddReportDataWithFailOnSeverity(t *testing.T) { }, } { t.Run(test.FailOnSeverity, func(tt *testing.T) { + engine := engineimpl.New(languages.Default()) failOnSeverity := set.New[string]() failOnSeverity.Add(test.FailOnSeverity) @@ -175,7 +184,7 @@ func TestAddReportDataWithFailOnSeverity(t *testing.T) { severity.Add(test.Severity) } - config, err := generateConfig(flagtypes.ReportOptions{ + config, err := generateConfig(engine, flagtypes.ReportOptions{ Report: "security", Severity: severity, FailOnSeverity: failOnSeverity, @@ -201,7 +210,8 @@ func TestAddReportDataWithFailOnSeverity(t *testing.T) { } func TestFingerprintIsStableWithBaseBranchFindings(t *testing.T) { - config, err := generateConfig(flagtypes.ReportOptions{Report: "security"}) + engine := engineimpl.New(languages.Default()) + config, err := generateConfig(engine, flagtypes.ReportOptions{Report: "security"}) if err != nil { t.Fatalf("failed to generate config:%s", err) } @@ -291,7 +301,7 @@ func TestFingerprintIsStableWithBaseBranchFindings(t *testing.T) { assert.Equal(t, fullScanFinding.Fingerprint, diffFinding.Fingerprint) } -func generateConfig(reportOptions flagtypes.ReportOptions) (settings.Config, error) { +func generateConfig(engine engine.Engine, reportOptions flagtypes.ReportOptions) (settings.Config, error) { if reportOptions.Severity == nil { reportOptions.Severity = set.New[string]() reportOptions.Severity.AddAll(globaltypes.Severities) @@ -323,7 +333,8 @@ func generateConfig(reportOptions flagtypes.ReportOptions) (settings.Config, err Message: "", }, } - return settings.FromOptions(opts, meta) + + return settingsloader.FromOptions(opts, meta, engine) } func dummyDataflowData() *outputtypes.ReportData { diff --git a/internal/report/output/security/types/types.go b/pkg/report/output/security/types/types.go similarity index 98% rename from internal/report/output/security/types/types.go rename to pkg/report/output/security/types/types.go index ed73196cf..415a46b8c 100644 --- a/internal/report/output/security/types/types.go +++ b/pkg/report/output/security/types/types.go @@ -7,8 +7,8 @@ import ( "github.com/fatih/color" - "github.com/bearer/bearer/internal/util/file" - ignoretypes "github.com/bearer/bearer/internal/util/ignore/types" + "github.com/bearer/bearer/pkg/util/file" + ignoretypes "github.com/bearer/bearer/pkg/util/ignore/types" ) type ExpectedDetection struct { diff --git a/internal/report/output/stats/formatter.go b/pkg/report/output/stats/formatter.go similarity index 70% rename from internal/report/output/stats/formatter.go rename to pkg/report/output/stats/formatter.go index 777880e1c..1a4830947 100644 --- a/internal/report/output/stats/formatter.go +++ b/pkg/report/output/stats/formatter.go @@ -1,10 +1,10 @@ package stats import ( - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/flag" - outputtypes "github.com/bearer/bearer/internal/report/output/types" - outputhandler "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/flag" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" + outputhandler "github.com/bearer/bearer/pkg/util/output" ) type Formatter struct { diff --git a/internal/report/output/stats/gocloc_detector.go b/pkg/report/output/stats/gocloc_detector.go similarity index 91% rename from internal/report/output/stats/gocloc_detector.go rename to pkg/report/output/stats/gocloc_detector.go index f8283191c..f595c8bcc 100644 --- a/internal/report/output/stats/gocloc_detector.go +++ b/pkg/report/output/stats/gocloc_detector.go @@ -3,8 +3,8 @@ package stats import ( "time" - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/util/output" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/util/output" "github.com/hhatto/gocloc" "github.com/schollz/progressbar/v3" diff --git a/internal/report/output/stats/stats.go b/pkg/report/output/stats/stats.go similarity index 93% rename from internal/report/output/stats/stats.go rename to pkg/report/output/stats/stats.go index edd4ed292..4dce3a10c 100644 --- a/internal/report/output/stats/stats.go +++ b/pkg/report/output/stats/stats.go @@ -6,12 +6,12 @@ import ( "github.com/hhatto/gocloc" - "github.com/bearer/bearer/internal/classification/db" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/util/maputil" + "github.com/bearer/bearer/pkg/classification/db" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/util/maputil" - "github.com/bearer/bearer/internal/report/output/stats/types" - outputtypes "github.com/bearer/bearer/internal/report/output/types" + "github.com/bearer/bearer/pkg/report/output/stats/types" + outputtypes "github.com/bearer/bearer/pkg/report/output/types" ) func AddReportData( diff --git a/internal/report/output/stats/types/types.go b/pkg/report/output/stats/types/types.go similarity index 100% rename from internal/report/output/stats/types/types.go rename to pkg/report/output/stats/types/types.go diff --git a/pkg/report/output/testhelper/testhelper.go b/pkg/report/output/testhelper/testhelper.go new file mode 100644 index 000000000..115d273ee --- /dev/null +++ b/pkg/report/output/testhelper/testhelper.go @@ -0,0 +1,31 @@ +package testhelper + +import ( + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/util/regex" +) + +// new rules are added +func CustomRule() *settings.Rule { + return &settings.Rule{ + Id: "custom_test_rule", + Description: "Its a test!", + CWEIDs: []string{}, + Type: "risk", + Languages: []string{"ruby"}, + Severity: "low", + IsLocal: false, + } +} + +func RubyLangSSLVerificationRule() *settings.Rule { + return &settings.Rule{Id: "ruby_lang_ssl_verification", AssociatedRecipe: "", Type: "risk", Trigger: settings.RuleTrigger{MatchOn: "presence", DataTypesRequired: false, RequiredDetection: (*string)(nil)}, IsLocal: false, Detectors: []string(nil), Processors: []string(nil), Stored: false, AutoEncrytPrefix: "", HasDetailedContext: false, SkipDataTypes: []string(nil), OnlyDataTypes: []string(nil), Severity: "medium", Description: "Missing SSL certificate verification detected.", RemediationMessage: "## Description\n\nApplications processing sensitive data should use valid SSL certificates. This rule checks if SSL verification is enabled.\n\n## Remediations\n\n❌ By default Ruby check for SSL certificate verification but this can be bypassed when setting Open SSL verification mode to `VERIFY_NONE`:\n\n```clojure\nrequire \"net/https\"\nrequire \"uri\"\n\nuri = URI.parse(\"https://ssl-site.com/\")\nhttp = Net::HTTP.new(uri.host, uri.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n```\n\n✅ To ensure that SSL verification always happens, make sure to use the following mode:\n\n```bash\nhttp.verify_mode = OpenSSL::SSL::VERIFY_PEER\n```\n\n## Resources\n- [Ruby OpenSSL module](https://ruby.github.io/openssl/OpenSSL.html)\n", CWEIDs: []string{"295"}, Languages: []string{"ruby"}, Patterns: []settings.RulePattern{settings.RulePattern{Pattern: "Net::HTTP.start(verify_mode: OpenSSL::SSL::VERIFY_NONE)$<...>\n", Focus: "", Filters: []settings.PatternFilter(nil)}, settings.RulePattern{Pattern: "Net::HTTP.start($<...>{ verify_mode: OpenSSL::SSL::VERIFY_NONE })$<...>\n", Focus: "", Filters: []settings.PatternFilter(nil)}, settings.RulePattern{Pattern: "$<_>.verify_mode = OpenSSL::SSL::VERIFY_NONE\n", Focus: "", Filters: []settings.PatternFilter(nil)}}, SanitizerRuleID: "", DocumentationUrl: "https://docs.bearer.com/reference/rules/ruby_lang_ssl_verification", IsAuxilary: false, DependencyCheck: false, Dependency: (*settings.Dependency)(nil), Metavars: map[string]settings.MetaVar(nil), ParamParenting: false, DetectPresence: false, OmitParent: false} +} + +func RubyRailsLoggerRule() *settings.Rule { + return &settings.Rule{Id: "ruby_rails_logger", AssociatedRecipe: "", Type: "risk", Trigger: settings.RuleTrigger{MatchOn: "presence", DataTypesRequired: false, RequiredDetection: (*string)(nil)}, IsLocal: true, Detectors: []string(nil), Processors: []string(nil), Stored: false, AutoEncrytPrefix: "", HasDetailedContext: false, SkipDataTypes: []string{"Unique Identifier"}, OnlyDataTypes: []string(nil), Severity: "critical", Description: "Sensitive data sent to Rails loggers detected.", RemediationMessage: "## Description\nLeaking sensitive data to loggers is a common cause of data leaks and can lead to data breaches. This rule looks for instances of sensitive data sent to rails loggers.\n\n## Remediations\n❌ Avoid using sensitive data in logger messages:\n\n```ruby\nRails.logger.info('User is: #{user.email}')\n```\n\n✅ If you need to identify a user, ensure to use their unique identifier instead of their personal identifiable information:\n\n```ruby\nRails.logger.info('User is: #{user.uuid}')\n```\n\n## Resources\n- [OWASP logging cheat sheet](https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html)\n", CWEIDs: []string{"209", "532"}, Languages: []string{"ruby"}, Patterns: []settings.RulePattern{settings.RulePattern{Pattern: "Rails.logger.$($)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}, settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "METHOD", Detection: "", Scope: "", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string{"info", "warn", "error", "fatal", "unknown"}, LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}}, SanitizerRuleID: "", DocumentationUrl: "https://docs.bearer.com/reference/rules/ruby_rails_logger", IsAuxilary: false, DependencyCheck: false, Dependency: (*settings.Dependency)(nil), Metavars: map[string]settings.MetaVar(nil), ParamParenting: false, DetectPresence: false, OmitParent: false} +} + +func RubyThirdPartiesSentryRule() *settings.Rule { + return &settings.Rule{Id: "ruby_third_parties_sentry", AssociatedRecipe: "Sentry", Type: "risk", Trigger: settings.RuleTrigger{MatchOn: "presence", DataTypesRequired: false, RequiredDetection: (*string)(nil)}, IsLocal: true, Detectors: []string(nil), Processors: []string(nil), Stored: false, AutoEncrytPrefix: "", HasDetailedContext: false, SkipDataTypes: []string{"Unique Identifier"}, OnlyDataTypes: []string(nil), Severity: "Critical", Description: "Sensitive data sent to Sentry detected.", RemediationMessage: "## Description\nLeaking sensitive data to third-party loggers is a common cause of data leaks and can lead to data breaches. This rule looks for instances of sensitive data sent to Sentry.\n\n## Remediations\n\nWhen logging errors or events, ensure all sensitive data is removed.\n\n## Resources\n- [Sentry Docs](https://docs.sentry.io/)\n", CWEIDs: []string{"201"}, Languages: []string{"ruby"}, Patterns: []settings.RulePattern{settings.RulePattern{Pattern: "Sentry::Breadcrumb.new($<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.capture_message($<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.init do |$|\n $.before_breadcrumb = lambda do |$, $<_:identifier>|\n $$.message = $\n end\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.set_context($<_>, $<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_context($<_>, $<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_context($<_>, $<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_extra($<_>, $)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_extra($<_>, $)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.set_extras($<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_extras($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_extras($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_tag($<_>, $)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_tag($<_>, $)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.set_tags($<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_tags($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_tags($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.set_user($<...>$$<...>)\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.configure_scope do |$|\n $$.set_user($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}, settings.RulePattern{Pattern: "Sentry.with_scope do |$|\n $$.set_user($<...>$$<...>)\nend\n", Focus: "", Filters: []settings.PatternFilter{settings.PatternFilter{Not: (*settings.PatternFilter)(nil), Either: []settings.PatternFilter(nil), Variable: "DATA_TYPE", Detection: "datatype", Scope: "result", Filters: []settings.PatternFilter(nil), Contains: (*bool)(nil), Regex: (*regex.SerializableRegexp)(nil), Values: []string(nil), LengthLessThan: (*int)(nil), LessThan: (*int)(nil), LessThanOrEqual: (*int)(nil), GreaterThan: (*int)(nil), GreaterThanOrEqual: (*int)(nil), StringRegex: (*regex.SerializableRegexp)(nil), FilenameRegex: (*regex.SerializableRegexp)(nil)}}}}, SanitizerRuleID: "", DocumentationUrl: "https://docs.bearer.com/reference/rules/ruby_third_parties_sentry", IsAuxilary: false, DependencyCheck: false, Dependency: (*settings.Dependency)(nil), Metavars: map[string]settings.MetaVar(nil), ParamParenting: false, DetectPresence: false, OmitParent: false} +} diff --git a/internal/report/output/types/types.go b/pkg/report/output/types/types.go similarity index 79% rename from internal/report/output/types/types.go rename to pkg/report/output/types/types.go index 18c6d4651..094a34c00 100644 --- a/internal/report/output/types/types.go +++ b/pkg/report/output/types/types.go @@ -1,11 +1,11 @@ package types import ( - dataflowtypes "github.com/bearer/bearer/internal/report/output/dataflow/types" - privacytypes "github.com/bearer/bearer/internal/report/output/privacy/types" - saastypes "github.com/bearer/bearer/internal/report/output/saas/types" - securitytypes "github.com/bearer/bearer/internal/report/output/security/types" - statstypes "github.com/bearer/bearer/internal/report/output/stats/types" + dataflowtypes "github.com/bearer/bearer/pkg/report/output/dataflow/types" + privacytypes "github.com/bearer/bearer/pkg/report/output/privacy/types" + saastypes "github.com/bearer/bearer/pkg/report/output/saas/types" + securitytypes "github.com/bearer/bearer/pkg/report/output/security/types" + statstypes "github.com/bearer/bearer/pkg/report/output/stats/types" ) type ReportData struct { diff --git a/internal/report/report.go b/pkg/report/report.go similarity index 53% rename from internal/report/report.go rename to pkg/report/report.go index 2a12789ae..ee08d715d 100644 --- a/internal/report/report.go +++ b/pkg/report/report.go @@ -1,16 +1,16 @@ package report import ( - "github.com/bearer/bearer/internal/report/dependencies" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks" - "github.com/bearer/bearer/internal/report/interfaces" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/report/schema/datatype" + "github.com/bearer/bearer/pkg/report/dependencies" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks" + "github.com/bearer/bearer/pkg/report/interfaces" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/report/schema/datatype" - "github.com/bearer/bearer/internal/report/secret" - "github.com/bearer/bearer/internal/report/source" + "github.com/bearer/bearer/pkg/report/secret" + "github.com/bearer/bearer/pkg/report/source" ) type Report interface { diff --git a/internal/report/schema/datatype/datatype.go b/pkg/report/schema/datatype/datatype.go similarity index 94% rename from internal/report/schema/datatype/datatype.go rename to pkg/report/schema/datatype/datatype.go index 80bf51f18..ebd111774 100644 --- a/internal/report/schema/datatype/datatype.go +++ b/pkg/report/schema/datatype/datatype.go @@ -4,15 +4,15 @@ import ( "sort" "strings" - classificationschema "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/util/classify" - "github.com/bearer/bearer/internal/util/normalize_key" - "github.com/bearer/bearer/internal/util/pluralize" + classificationschema "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/util/classify" + "github.com/bearer/bearer/pkg/util/normalize_key" + "github.com/bearer/bearer/pkg/util/pluralize" ) type ReportDataType interface { diff --git a/internal/report/schema/schema.go b/pkg/report/schema/schema.go similarity index 91% rename from internal/report/schema/schema.go rename to pkg/report/schema/schema.go index e4d2b43c5..9d99d14d8 100644 --- a/internal/report/schema/schema.go +++ b/pkg/report/schema/schema.go @@ -1,10 +1,10 @@ package schema import ( - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/source" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/source" ) const ( diff --git a/pkg/report/schema/schemahelper/schemahelper.go b/pkg/report/schema/schemahelper/schemahelper.go new file mode 100644 index 000000000..c3a7ebd21 --- /dev/null +++ b/pkg/report/schema/schemahelper/schemahelper.go @@ -0,0 +1,11 @@ +package schemahelper + +import ( + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/report/source" +) + +type Schema struct { + Source source.Source + Value schema.Schema +} diff --git a/internal/report/secret/secret.go b/pkg/report/secret/secret.go similarity index 100% rename from internal/report/secret/secret.go rename to pkg/report/secret/secret.go diff --git a/internal/report/source/source.go b/pkg/report/source/source.go similarity index 97% rename from internal/report/source/source.go rename to pkg/report/source/source.go index 80c461f69..9e2c39ff0 100644 --- a/internal/report/source/source.go +++ b/pkg/report/source/source.go @@ -1,7 +1,7 @@ package source import ( - "github.com/bearer/bearer/internal/util/file" + "github.com/bearer/bearer/pkg/util/file" ) // Source represents a part of a source file that is referenced in the scan report. diff --git a/internal/report/values/values.go b/pkg/report/values/values.go similarity index 98% rename from internal/report/values/values.go rename to pkg/report/values/values.go index 0f14665ab..1e95edc5c 100644 --- a/internal/report/values/values.go +++ b/pkg/report/values/values.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/bearer/bearer/internal/report/variables" + "github.com/bearer/bearer/pkg/report/variables" "github.com/rs/zerolog/log" ) diff --git a/internal/report/variables/variables.go b/pkg/report/variables/variables.go similarity index 100% rename from internal/report/variables/variables.go rename to pkg/report/variables/variables.go diff --git a/internal/report/writer/detectors.go b/pkg/report/writer/detectors.go similarity index 89% rename from internal/report/writer/detectors.go rename to pkg/report/writer/detectors.go index 95196e425..9f72b2326 100644 --- a/internal/report/writer/detectors.go +++ b/pkg/report/writer/detectors.go @@ -5,24 +5,24 @@ import ( "io" "log" - classification "github.com/bearer/bearer/internal/classification" - classificationschema "github.com/bearer/bearer/internal/classification/schema" + classification "github.com/bearer/bearer/pkg/classification" + classificationschema "github.com/bearer/bearer/pkg/classification/schema" zerolog "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/parser" - "github.com/bearer/bearer/internal/parser/nodeid" + "github.com/bearer/bearer/pkg/parser" + "github.com/bearer/bearer/pkg/parser/nodeid" - "github.com/bearer/bearer/internal/report/dependencies" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/frameworks" - "github.com/bearer/bearer/internal/report/interfaces" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/report/schema/datatype" - "github.com/bearer/bearer/internal/report/secret" - "github.com/bearer/bearer/internal/report/source" + "github.com/bearer/bearer/pkg/report/dependencies" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/frameworks" + "github.com/bearer/bearer/pkg/report/interfaces" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/report/schema/datatype" + "github.com/bearer/bearer/pkg/report/secret" + "github.com/bearer/bearer/pkg/report/source" - "github.com/bearer/bearer/internal/util/jsonlines" + "github.com/bearer/bearer/pkg/util/jsonlines" ) type StoredSchema struct { diff --git a/internal/scanner/ast/.snapshots/TestDisabledRules b/pkg/scanner/ast/.snapshots/TestDisabledRules similarity index 100% rename from internal/scanner/ast/.snapshots/TestDisabledRules rename to pkg/scanner/ast/.snapshots/TestDisabledRules diff --git a/internal/scanner/ast/.snapshots/TestExpectedRulesJava b/pkg/scanner/ast/.snapshots/TestExpectedRulesJava similarity index 100% rename from internal/scanner/ast/.snapshots/TestExpectedRulesJava rename to pkg/scanner/ast/.snapshots/TestExpectedRulesJava diff --git a/internal/scanner/ast/.snapshots/TestExpectedRulesRuby b/pkg/scanner/ast/.snapshots/TestExpectedRulesRuby similarity index 100% rename from internal/scanner/ast/.snapshots/TestExpectedRulesRuby rename to pkg/scanner/ast/.snapshots/TestExpectedRulesRuby diff --git a/internal/scanner/ast/ast.go b/pkg/scanner/ast/ast.go similarity index 92% rename from internal/scanner/ast/ast.go rename to pkg/scanner/ast/ast.go index b8128e0cd..56b05d297 100644 --- a/internal/scanner/ast/ast.go +++ b/pkg/scanner/ast/ast.go @@ -9,11 +9,11 @@ import ( "github.com/rs/zerolog/log" sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" ) var ExpectedComment = regexp.MustCompile(`\A[^\w]*bearer:expected\s[\w,]+\z`) @@ -71,7 +71,7 @@ func parseBuilder( return nil, err } - return tree.NewBuilder(contentBytes, sitterTree.RootNode(), ruleCount), nil + return tree.NewBuilder(language.SitterLanguage(), contentBytes, sitterTree.RootNode(), ruleCount), nil } func analyzeNode( diff --git a/internal/scanner/ast/ast_test.go b/pkg/scanner/ast/ast_test.go similarity index 92% rename from internal/scanner/ast/ast_test.go rename to pkg/scanner/ast/ast_test.go index f23ca89e3..55e205fd5 100644 --- a/internal/scanner/ast/ast_test.go +++ b/pkg/scanner/ast/ast_test.go @@ -6,12 +6,12 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/languages/java" - "github.com/bearer/bearer/internal/languages/ruby" - "github.com/bearer/bearer/internal/scanner/ast" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/languages/java" + "github.com/bearer/bearer/pkg/languages/ruby" + "github.com/bearer/bearer/pkg/scanner/ast" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ruleset" ) type ruleInfo struct { diff --git a/internal/scanner/ast/query/query.go b/pkg/scanner/ast/query/query.go similarity index 98% rename from internal/scanner/ast/query/query.go rename to pkg/scanner/ast/query/query.go index b9ffded4c..14f8600c6 100644 --- a/internal/scanner/ast/query/query.go +++ b/pkg/scanner/ast/query/query.go @@ -9,7 +9,7 @@ import ( sitter "github.com/smacker/go-tree-sitter" "gopkg.in/yaml.v3" - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ast/tree" ) type Set struct { diff --git a/internal/scanner/ast/traversalstrategy/builtin.go b/pkg/scanner/ast/traversalstrategy/builtin.go similarity index 95% rename from internal/scanner/ast/traversalstrategy/builtin.go rename to pkg/scanner/ast/traversalstrategy/builtin.go index a7a0eac0d..0a8def07b 100644 --- a/internal/scanner/ast/traversalstrategy/builtin.go +++ b/pkg/scanner/ast/traversalstrategy/builtin.go @@ -1,8 +1,8 @@ package traversalstrategy import ( - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/scanner/ast/tree" ) var ( diff --git a/internal/scanner/ast/traversalstrategy/traversalstrategy.go b/pkg/scanner/ast/traversalstrategy/traversalstrategy.go similarity index 95% rename from internal/scanner/ast/traversalstrategy/traversalstrategy.go rename to pkg/scanner/ast/traversalstrategy/traversalstrategy.go index 55a0d10c4..7723176d8 100644 --- a/internal/scanner/ast/traversalstrategy/traversalstrategy.go +++ b/pkg/scanner/ast/traversalstrategy/traversalstrategy.go @@ -3,8 +3,8 @@ package traversalstrategy import ( "fmt" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/scanner/ast/tree" "github.com/bits-and-blooms/bitset" ) diff --git a/internal/scanner/ast/tree/.snapshots/TestTree b/pkg/scanner/ast/tree/.snapshots/TestTree similarity index 100% rename from internal/scanner/ast/tree/.snapshots/TestTree rename to pkg/scanner/ast/tree/.snapshots/TestTree diff --git a/internal/scanner/ast/tree/builder.go b/pkg/scanner/ast/tree/builder.go similarity index 80% rename from internal/scanner/ast/tree/builder.go rename to pkg/scanner/ast/tree/builder.go index 7e81e6f6f..03a2ddeb4 100644 --- a/internal/scanner/ast/tree/builder.go +++ b/pkg/scanner/ast/tree/builder.go @@ -3,7 +3,7 @@ package tree import ( "slices" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/ruleset" "github.com/bits-and-blooms/bitset" sitter "github.com/smacker/go-tree-sitter" ) @@ -16,20 +16,39 @@ type Builder struct { children, dataflowSources, aliasOf map[int][]int - sitterRootNode *sitter.Node - sitterToNodeID map[*sitter.Node]int - ruleCount int + childrenByField map[int]map[string]int + sitterRootNode *sitter.Node + sitterToNodeID map[*sitter.Node]int + fieldNames []string + ruleCount int } -func NewBuilder(contentBytes []byte, sitterRootNode *sitter.Node, ruleCount int) *Builder { +func NewBuilder( + sitterLanguage *sitter.Language, + contentBytes []byte, + sitterRootNode *sitter.Node, + ruleCount int, +) *Builder { + var fieldNames []string + for i := 1; ; i++ { + name := sitterLanguage.FieldName(i) + if name == "" { + break + } + + fieldNames = append(fieldNames, name) + } + builder := &Builder{ contentBytes: contentBytes, nodes: make([]Node, 0, 1000), children: make(map[int][]int), dataflowSources: make(map[int][]int), aliasOf: make(map[int][]int), + childrenByField: make(map[int]map[string]int), sitterRootNode: sitterRootNode, sitterToNodeID: make(map[*sitter.Node]int), + fieldNames: fieldNames, ruleCount: ruleCount, } @@ -157,6 +176,7 @@ func (builder *Builder) QueryResult(queryID int, sitterNode *sitter.Node, result func (builder *Builder) Build() *Tree { builder.buildChildren() + builder.buildChildrenByField() builder.buildDataflowSources() builder.buildAliasOf() @@ -189,9 +209,10 @@ func (builder *Builder) addNode(sitterNode *sitter.Node) int { } builder.nodes = append(builder.nodes, Node{ - sitterNode: sitterNode, - ID: id, - TypeID: builder.internType(sitterType), + sitterNode: sitterNode, + childrenByField: make(map[string]*Node), + ID: id, + TypeID: builder.internType(sitterType), ContentStart: Position{ Byte: int(sitterNode.StartByte()), Line: int(startPoint.Row) + 1, @@ -204,23 +225,42 @@ func (builder *Builder) addNode(sitterNode *sitter.Node) int { }, }) - builder.children[id] = builder.addChildren(id, sitterNode) + builder.children[id], builder.childrenByField[id] = builder.addChildren(id, sitterNode) return id } -func (builder *Builder) addChildren(parentID int, sitterNode *sitter.Node) []int { +func (builder *Builder) addChildren(parentID int, sitterNode *sitter.Node) ([]int, map[string]int) { + sitterParent := builder.nodes[parentID].sitterNode + childCount := int(sitterNode.ChildCount()) if childCount == 0 { - return nil + return nil, make(map[string]int) } children := make([]int, childCount) + childrenByField := make(map[string]int) + for i := 0; i < childCount; i++ { - children[i] = builder.addNode(sitterNode.Child(i)) + sitterChild := sitterNode.Child(i) + childID := builder.addNode(sitterChild) + children[i] = childID + + var fieldName string + for _, candidateName := range builder.fieldNames { + if candidate := sitterParent.ChildByFieldName(candidateName); candidate != nil && sitterChild.Equal(candidate) { + fieldName = candidateName + break + } + } + + if fieldName != "" { + builder.nodes[childID].fieldName = fieldName + childrenByField[fieldName] = childID + } } - return children + return children, childrenByField } func (builder *Builder) buildChildren() { @@ -229,6 +269,16 @@ func (builder *Builder) buildChildren() { }) } +func (builder *Builder) buildChildrenByField() { + for id := range builder.nodes { + node := &builder.nodes[id] + + for name, childID := range builder.childrenByField[id] { + node.childrenByField[name] = &builder.nodes[childID] + } + } +} + func (builder *Builder) buildDataflowSources() { builder.buildAdjacencyList(builder.dataflowSources, func(node *Node, dataflowSources []*Node) { node.dataflowSources = dataflowSources diff --git a/internal/scanner/ast/tree/tree.go b/pkg/scanner/ast/tree/tree.go similarity index 97% rename from internal/scanner/ast/tree/tree.go rename to pkg/scanner/ast/tree/tree.go index 2612a03bb..0a75f831b 100644 --- a/internal/scanner/ast/tree/tree.go +++ b/pkg/scanner/ast/tree/tree.go @@ -24,12 +24,14 @@ type Node struct { tree *Tree ID, TypeID int + fieldName string ContentStart, ContentEnd Position parent *Node children, dataflowSources, aliasOf []*Node + childrenByField map[string]*Node expectedRules []string disabledRuleIndices *bitset.BitSet // FIXME: remove the need for this @@ -77,6 +79,10 @@ func (node *Node) Type() string { return node.tree.types[node.TypeID] } +func (node *Node) FieldName() string { + return node.fieldName +} + func (node *Node) IsNamed() bool { // FIXME: don't use the sitter node return node.sitterNode.IsNamed() @@ -126,8 +132,7 @@ func (node *Node) NamedChildren() []*Node { } func (node *Node) ChildByFieldName(name string) *Node { - // FIXME: don't use the sitter node - return node.tree.sitterToNode[node.sitterNode.ChildByFieldName(name)] + return node.childrenByField[name] } func (node *Node) DataflowSources() []*Node { diff --git a/internal/scanner/ast/tree/tree_test.go b/pkg/scanner/ast/tree/tree_test.go similarity index 82% rename from internal/scanner/ast/tree/tree_test.go rename to pkg/scanner/ast/tree/tree_test.go index 23583e148..8ee555c8e 100644 --- a/internal/scanner/ast/tree/tree_test.go +++ b/pkg/scanner/ast/tree/tree_test.go @@ -8,7 +8,7 @@ import ( sitter "github.com/smacker/go-tree-sitter" "github.com/smacker/go-tree-sitter/ruby" - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ast/tree" ) func parseTree(t *testing.T, content string) *tree.Tree { @@ -20,7 +20,7 @@ func parseTree(t *testing.T, content string) *tree.Tree { t.Fatalf("failed to parse input: %s", err) } - return tree.NewBuilder(contentBytes, sitterRootNode, 0).Build() + return tree.NewBuilder(sitterLanguage, contentBytes, sitterRootNode, 0).Build() } func TestTree(t *testing.T) { diff --git a/internal/scanner/cache/cache.go b/pkg/scanner/cache/cache.go similarity index 91% rename from internal/scanner/cache/cache.go rename to pkg/scanner/cache/cache.go index d4111d9ad..a10d5e259 100644 --- a/internal/scanner/cache/cache.go +++ b/pkg/scanner/cache/cache.go @@ -3,10 +3,10 @@ package cache import ( "github.com/rs/zerolog/log" - treepkg "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectorset" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/util/set" + treepkg "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/detectorset" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/util/set" ) const ( diff --git a/internal/scanner/detectors/.snapshots/TestDatatypeDetector-datatype b/pkg/scanner/detectors/.snapshots/TestDatatypeDetector-datatype similarity index 100% rename from internal/scanner/detectors/.snapshots/TestDatatypeDetector-datatype rename to pkg/scanner/detectors/.snapshots/TestDatatypeDetector-datatype diff --git a/internal/scanner/detectors/.snapshots/TestDatatypeDetectorInvalidDetection-datatype b/pkg/scanner/detectors/.snapshots/TestDatatypeDetectorInvalidDetection-datatype similarity index 100% rename from internal/scanner/detectors/.snapshots/TestDatatypeDetectorInvalidDetection-datatype rename to pkg/scanner/detectors/.snapshots/TestDatatypeDetectorInvalidDetection-datatype diff --git a/internal/scanner/detectors/.snapshots/TestInsecureUrlDetector-insecure_url b/pkg/scanner/detectors/.snapshots/TestInsecureUrlDetector-insecure_url similarity index 100% rename from internal/scanner/detectors/.snapshots/TestInsecureUrlDetector-insecure_url rename to pkg/scanner/detectors/.snapshots/TestInsecureUrlDetector-insecure_url diff --git a/internal/scanner/detectors/common/object.go b/pkg/scanner/detectors/common/object.go similarity index 89% rename from internal/scanner/detectors/common/object.go rename to pkg/scanner/detectors/common/object.go index a15991268..742b6fc4e 100644 --- a/internal/scanner/detectors/common/object.go +++ b/pkg/scanner/detectors/common/object.go @@ -1,11 +1,11 @@ package common import ( - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) type Object struct { diff --git a/internal/scanner/detectors/common/string.go b/pkg/scanner/detectors/common/string.go similarity index 91% rename from internal/scanner/detectors/common/string.go rename to pkg/scanner/detectors/common/string.go index 420a2b02c..1d9541a3c 100644 --- a/internal/scanner/detectors/common/string.go +++ b/pkg/scanner/detectors/common/string.go @@ -1,11 +1,11 @@ package common import ( - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectors/types" ) const NonLiteralValue = "\uFFFD" // unicode Replacement character diff --git a/internal/scanner/detectors/customrule/customrule.go b/pkg/scanner/detectors/customrule/customrule.go similarity index 79% rename from internal/scanner/detectors/customrule/customrule.go rename to pkg/scanner/detectors/customrule/customrule.go index 39e061647..206d3ec90 100644 --- a/internal/scanner/detectors/customrule/customrule.go +++ b/pkg/scanner/detectors/customrule/customrule.go @@ -5,16 +5,16 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/variableshape" - - "github.com/bearer/bearer/internal/scanner/detectors/customrule/filters" - "github.com/bearer/bearer/internal/scanner/detectors/customrule/patternquery" - "github.com/bearer/bearer/internal/scanner/detectors/customrule/types" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/variableshape" + + "github.com/bearer/bearer/pkg/scanner/detectors/customrule/filters" + "github.com/bearer/bearer/pkg/scanner/detectors/customrule/patternquery" + "github.com/bearer/bearer/pkg/scanner/detectors/customrule/types" ) type Pattern struct { diff --git a/internal/scanner/detectors/customrule/filter.go b/pkg/scanner/detectors/customrule/filter.go similarity index 95% rename from internal/scanner/detectors/customrule/filter.go rename to pkg/scanner/detectors/customrule/filter.go index e740b662b..a15b399de 100644 --- a/internal/scanner/detectors/customrule/filter.go +++ b/pkg/scanner/detectors/customrule/filter.go @@ -6,11 +6,11 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/detectors/customrule/filters" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/variableshape" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/detectors/customrule/filters" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/variableshape" ) func translateFiltersTop( diff --git a/internal/scanner/detectors/customrule/filters/filters.go b/pkg/scanner/detectors/customrule/filters/filters.go similarity index 96% rename from internal/scanner/detectors/customrule/filters/filters.go rename to pkg/scanner/detectors/customrule/filters/filters.go index c5248b6e7..b4840afc1 100644 --- a/internal/scanner/detectors/customrule/filters/filters.go +++ b/pkg/scanner/detectors/customrule/filters/filters.go @@ -7,14 +7,14 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/customrule/types" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/variableshape" - "github.com/bearer/bearer/internal/util/entropy" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/customrule/types" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/variableshape" + "github.com/bearer/bearer/pkg/util/entropy" ) type Result struct { diff --git a/internal/scanner/detectors/customrule/filters/filters_suite_test.go b/pkg/scanner/detectors/customrule/filters/filters_suite_test.go similarity index 100% rename from internal/scanner/detectors/customrule/filters/filters_suite_test.go rename to pkg/scanner/detectors/customrule/filters/filters_suite_test.go diff --git a/internal/scanner/detectors/customrule/filters/filters_test.go b/pkg/scanner/detectors/customrule/filters/filters_test.go similarity index 97% rename from internal/scanner/detectors/customrule/filters/filters_test.go rename to pkg/scanner/detectors/customrule/filters/filters_test.go index 85987004f..b9ace75cf 100644 --- a/internal/scanner/detectors/customrule/filters/filters_test.go +++ b/pkg/scanner/detectors/customrule/filters/filters_test.go @@ -8,16 +8,16 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/bearer/bearer/internal/languages/ruby" - "github.com/bearer/bearer/internal/scanner/ast" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/customrule/filters" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/variableshape" - "github.com/bearer/bearer/internal/util/pointers" + "github.com/bearer/bearer/pkg/languages/ruby" + "github.com/bearer/bearer/pkg/scanner/ast" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/customrule/filters" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/variableshape" + "github.com/bearer/bearer/pkg/util/pointers" ) type MockFilter struct { diff --git a/internal/scanner/detectors/customrule/patternquery/builder/builder.go b/pkg/scanner/detectors/customrule/patternquery/builder/builder.go similarity index 96% rename from internal/scanner/detectors/customrule/patternquery/builder/builder.go rename to pkg/scanner/detectors/customrule/patternquery/builder/builder.go index a107ba1d5..54dd96766 100644 --- a/internal/scanner/detectors/customrule/patternquery/builder/builder.go +++ b/pkg/scanner/detectors/customrule/patternquery/builder/builder.go @@ -10,12 +10,12 @@ import ( "github.com/rs/zerolog/log" sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/parser/nodeid" - "github.com/bearer/bearer/internal/scanner/ast" - "github.com/bearer/bearer/internal/scanner/ast/tree" - asttree "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/customrule/patternquery/builder/bytereplacer" - "github.com/bearer/bearer/internal/scanner/language" + "github.com/bearer/bearer/pkg/parser/nodeid" + "github.com/bearer/bearer/pkg/scanner/ast" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + asttree "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/detectors/customrule/patternquery/builder/bytereplacer" + "github.com/bearer/bearer/pkg/scanner/language" ) type InputParams struct { diff --git a/internal/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer.go b/pkg/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer.go similarity index 100% rename from internal/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer.go rename to pkg/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer.go diff --git a/internal/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_suite_test.go b/pkg/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_suite_test.go similarity index 100% rename from internal/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_suite_test.go rename to pkg/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_suite_test.go diff --git a/internal/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_test.go b/pkg/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_test.go similarity index 97% rename from internal/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_test.go rename to pkg/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_test.go index a5bf9190c..10f153c1d 100644 --- a/internal/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_test.go +++ b/pkg/scanner/detectors/customrule/patternquery/builder/bytereplacer/bytereplacer_test.go @@ -4,7 +4,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/bearer/bearer/internal/scanner/detectors/customrule/patternquery/builder/bytereplacer" + "github.com/bearer/bearer/pkg/scanner/detectors/customrule/patternquery/builder/bytereplacer" ) var _ = Describe("Replacer", func() { diff --git a/internal/scanner/detectors/customrule/patternquery/builder/input.go b/pkg/scanner/detectors/customrule/patternquery/builder/input.go similarity index 95% rename from internal/scanner/detectors/customrule/patternquery/builder/input.go rename to pkg/scanner/detectors/customrule/patternquery/builder/input.go index b54ce6eb3..4584dc8fb 100644 --- a/internal/scanner/detectors/customrule/patternquery/builder/input.go +++ b/pkg/scanner/detectors/customrule/patternquery/builder/input.go @@ -4,8 +4,8 @@ import ( "errors" "fmt" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/util/set" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/util/set" ) func processInput(patternLanguage language.Pattern, input string) ([]byte, *InputParams, error) { diff --git a/internal/scanner/detectors/customrule/patternquery/patternquery.go b/pkg/scanner/detectors/customrule/patternquery/patternquery.go similarity index 94% rename from internal/scanner/detectors/customrule/patternquery/patternquery.go rename to pkg/scanner/detectors/customrule/patternquery/patternquery.go index 826d7a9d3..05f8a6779 100644 --- a/internal/scanner/detectors/customrule/patternquery/patternquery.go +++ b/pkg/scanner/detectors/customrule/patternquery/patternquery.go @@ -7,12 +7,12 @@ import ( "github.com/rs/zerolog/log" "gopkg.in/yaml.v3" - astquery "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/scanner/variableshape" + astquery "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/scanner/variableshape" - "github.com/bearer/bearer/internal/scanner/detectors/customrule/patternquery/builder" + "github.com/bearer/bearer/pkg/scanner/detectors/customrule/patternquery/builder" ) type Query interface { diff --git a/internal/scanner/detectors/customrule/types/types.go b/pkg/scanner/detectors/customrule/types/types.go similarity index 50% rename from internal/scanner/detectors/customrule/types/types.go rename to pkg/scanner/detectors/customrule/types/types.go index 237a5eaf3..3c6f4e03b 100644 --- a/internal/scanner/detectors/customrule/types/types.go +++ b/pkg/scanner/detectors/customrule/types/types.go @@ -1,8 +1,8 @@ package types import ( - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/variableshape" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/variableshape" ) type Data struct { diff --git a/internal/scanner/detectors/datatype/datatype.go b/pkg/scanner/detectors/datatype/datatype.go similarity index 89% rename from internal/scanner/detectors/datatype/datatype.go rename to pkg/scanner/detectors/datatype/datatype.go index 8d914b1dc..e76022cef 100644 --- a/internal/scanner/detectors/datatype/datatype.go +++ b/pkg/scanner/detectors/datatype/datatype.go @@ -1,15 +1,15 @@ package datatype import ( - classificationschema "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/util/classify" + classificationschema "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/util/classify" ) type Data struct { diff --git a/internal/scanner/detectors/detectors_test.go b/pkg/scanner/detectors/detectors_test.go similarity index 82% rename from internal/scanner/detectors/detectors_test.go rename to pkg/scanner/detectors/detectors_test.go index 80ce51b92..00e287a01 100644 --- a/internal/scanner/detectors/detectors_test.go +++ b/pkg/scanner/detectors/detectors_test.go @@ -3,8 +3,8 @@ package detectors_test import ( "testing" - "github.com/bearer/bearer/internal/languages/ruby" - "github.com/bearer/bearer/internal/scanner/detectors/testhelper" + "github.com/bearer/bearer/pkg/languages/ruby" + "github.com/bearer/bearer/pkg/scanner/detectors/testhelper" ) func TestDatatypeDetector(t *testing.T) { diff --git a/internal/scanner/detectors/insecureurl/insecureurl.go b/pkg/scanner/detectors/insecureurl/insecureurl.go similarity index 73% rename from internal/scanner/detectors/insecureurl/insecureurl.go rename to pkg/scanner/detectors/insecureurl/insecureurl.go index 74fabba03..cf988f691 100644 --- a/internal/scanner/detectors/insecureurl/insecureurl.go +++ b/pkg/scanner/detectors/insecureurl/insecureurl.go @@ -3,12 +3,12 @@ package insecureurl import ( "regexp" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ruleset" ) type insecureURLDetector struct { diff --git a/internal/scanner/detectors/stringliteral/stringliteral.go b/pkg/scanner/detectors/stringliteral/stringliteral.go similarity index 68% rename from internal/scanner/detectors/stringliteral/stringliteral.go rename to pkg/scanner/detectors/stringliteral/stringliteral.go index fd8a66b78..3faa07155 100644 --- a/internal/scanner/detectors/stringliteral/stringliteral.go +++ b/pkg/scanner/detectors/stringliteral/stringliteral.go @@ -1,12 +1,12 @@ package stringliteral import ( - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/common" - "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/detectors/common" + "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/ruleset" ) type stringLiteralDetector struct { diff --git a/internal/scanner/detectors/testdata/datatype.rb b/pkg/scanner/detectors/testdata/datatype.rb similarity index 100% rename from internal/scanner/detectors/testdata/datatype.rb rename to pkg/scanner/detectors/testdata/datatype.rb diff --git a/internal/scanner/detectors/testdata/insecureurl.rb b/pkg/scanner/detectors/testdata/insecureurl.rb similarity index 100% rename from internal/scanner/detectors/testdata/insecureurl.rb rename to pkg/scanner/detectors/testdata/insecureurl.rb diff --git a/internal/scanner/detectors/testdata/invalid_datatype.java b/pkg/scanner/detectors/testdata/invalid_datatype.java similarity index 100% rename from internal/scanner/detectors/testdata/invalid_datatype.java rename to pkg/scanner/detectors/testdata/invalid_datatype.java diff --git a/internal/scanner/detectors/testhelper/testhelper.go b/pkg/scanner/detectors/testhelper/testhelper.go similarity index 79% rename from internal/scanner/detectors/testhelper/testhelper.go rename to pkg/scanner/detectors/testhelper/testhelper.go index 0286998e5..34b0d0101 100644 --- a/internal/scanner/detectors/testhelper/testhelper.go +++ b/pkg/scanner/detectors/testhelper/testhelper.go @@ -9,18 +9,18 @@ import ( "github.com/rs/zerolog" "gopkg.in/yaml.v3" - "github.com/bearer/bearer/internal/classification" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/flag" - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/scanner/ast" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/detectorset" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/scanner/rulescanner" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/variableshape" + "github.com/bearer/bearer/pkg/classification" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/flag" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/scanner/ast" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/detectorset" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/scanner/rulescanner" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/variableshape" ) type result struct { diff --git a/internal/scanner/detectors/types/types.go b/pkg/scanner/detectors/types/types.go similarity index 77% rename from internal/scanner/detectors/types/types.go rename to pkg/scanner/detectors/types/types.go index 65109762d..fe8fe890c 100644 --- a/internal/scanner/detectors/types/types.go +++ b/pkg/scanner/detectors/types/types.go @@ -1,9 +1,9 @@ package types import ( - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ruleset" ) type Detection struct { diff --git a/internal/scanner/detectorset/detectorset.go b/pkg/scanner/detectorset/detectorset.go similarity index 85% rename from internal/scanner/detectorset/detectorset.go rename to pkg/scanner/detectorset/detectorset.go index 17b44501b..2589586b7 100644 --- a/internal/scanner/detectorset/detectorset.go +++ b/pkg/scanner/detectorset/detectorset.go @@ -5,15 +5,15 @@ import ( "slices" "strings" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/detectors/customrule" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/variableshape" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/detectors/customrule" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/variableshape" ) const () diff --git a/internal/scanner/language/language.go b/pkg/scanner/language/language.go similarity index 64% rename from internal/scanner/language/language.go rename to pkg/scanner/language/language.go index 3992eae98..96284210d 100644 --- a/internal/scanner/language/language.go +++ b/pkg/scanner/language/language.go @@ -3,14 +3,15 @@ package language import ( sitter "github.com/smacker/go-tree-sitter" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/tree" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" ) type Language interface { ID() string + DisplayName() string EnryLanguages() []string NewBuiltInDetectors(schemaClassifier *schema.Classifier, querySet *query.Set) []detectortypes.Detector SitterLanguage() *sitter.Language diff --git a/internal/scanner/language/pattern.go b/pkg/scanner/language/pattern.go similarity index 98% rename from internal/scanner/language/pattern.go rename to pkg/scanner/language/pattern.go index e7440ddf9..78d84557b 100644 --- a/internal/scanner/language/pattern.go +++ b/pkg/scanner/language/pattern.go @@ -1,7 +1,7 @@ package language import ( - "github.com/bearer/bearer/internal/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/ast/tree" ) type PatternVariable struct { diff --git a/internal/scanner/language/patternbase.go b/pkg/scanner/language/patternbase.go similarity index 92% rename from internal/scanner/language/patternbase.go rename to pkg/scanner/language/patternbase.go index 23e1064d4..2080b7baf 100644 --- a/internal/scanner/language/patternbase.go +++ b/pkg/scanner/language/patternbase.go @@ -1,6 +1,6 @@ package language -import "github.com/bearer/bearer/internal/scanner/ast/tree" +import "github.com/bearer/bearer/pkg/scanner/ast/tree" type PatternBase struct{} diff --git a/internal/scanner/language/scope.go b/pkg/scanner/language/scope.go similarity index 100% rename from internal/scanner/language/scope.go rename to pkg/scanner/language/scope.go diff --git a/internal/scanner/languagescanner/languagescanner.go b/pkg/scanner/languagescanner/languagescanner.go similarity index 80% rename from internal/scanner/languagescanner/languagescanner.go rename to pkg/scanner/languagescanner/languagescanner.go index 0b5fbf1a2..4d2b8fe39 100644 --- a/internal/scanner/languagescanner/languagescanner.go +++ b/pkg/scanner/languagescanner/languagescanner.go @@ -8,22 +8,22 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/scanner/ast" - "github.com/bearer/bearer/internal/scanner/ast/query" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/variableshape" - "github.com/bearer/bearer/internal/util/file" - - "github.com/bearer/bearer/internal/scanner/cache" - "github.com/bearer/bearer/internal/scanner/detectorset" - "github.com/bearer/bearer/internal/scanner/rulescanner" - "github.com/bearer/bearer/internal/scanner/stats" + "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/scanner/ast" + "github.com/bearer/bearer/pkg/scanner/ast/query" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/variableshape" + "github.com/bearer/bearer/pkg/util/file" + + "github.com/bearer/bearer/pkg/scanner/cache" + "github.com/bearer/bearer/pkg/scanner/detectorset" + "github.com/bearer/bearer/pkg/scanner/rulescanner" + "github.com/bearer/bearer/pkg/scanner/stats" ) type Scanner struct { diff --git a/internal/scanner/rulescanner/rulescanner.go b/pkg/scanner/rulescanner/rulescanner.go similarity index 88% rename from internal/scanner/rulescanner/rulescanner.go rename to pkg/scanner/rulescanner/rulescanner.go index 1df49dd54..d88a9a9e1 100644 --- a/internal/scanner/rulescanner/rulescanner.go +++ b/pkg/scanner/rulescanner/rulescanner.go @@ -7,13 +7,13 @@ import ( "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/scanner/ast/traversalstrategy" - "github.com/bearer/bearer/internal/scanner/ast/tree" - "github.com/bearer/bearer/internal/scanner/cache" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/detectorset" - "github.com/bearer/bearer/internal/scanner/ruleset" - "github.com/bearer/bearer/internal/scanner/stats" + "github.com/bearer/bearer/pkg/scanner/ast/traversalstrategy" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + "github.com/bearer/bearer/pkg/scanner/cache" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/detectorset" + "github.com/bearer/bearer/pkg/scanner/ruleset" + "github.com/bearer/bearer/pkg/scanner/stats" ) type Scanner struct { diff --git a/internal/scanner/ruleset/builtin.go b/pkg/scanner/ruleset/builtin.go similarity index 100% rename from internal/scanner/ruleset/builtin.go rename to pkg/scanner/ruleset/builtin.go diff --git a/internal/scanner/ruleset/ruleset.go b/pkg/scanner/ruleset/ruleset.go similarity index 95% rename from internal/scanner/ruleset/ruleset.go rename to pkg/scanner/ruleset/ruleset.go index abf36ce2b..ce8abdff5 100644 --- a/internal/scanner/ruleset/ruleset.go +++ b/pkg/scanner/ruleset/ruleset.go @@ -6,9 +6,9 @@ import ( "golang.org/x/exp/maps" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/report/customdetectors" - "github.com/bearer/bearer/internal/util/set" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/report/customdetectors" + "github.com/bearer/bearer/pkg/util/set" ) type RuleType int diff --git a/internal/scanner/scanner.go b/pkg/scanner/scanner.go similarity index 78% rename from internal/scanner/scanner.go rename to pkg/scanner/scanner.go index 21421ac4e..c418a8fab 100644 --- a/internal/scanner/scanner.go +++ b/pkg/scanner/scanner.go @@ -5,28 +5,28 @@ import ( "fmt" "strings" - schemaclassifier "github.com/bearer/bearer/internal/classification/schema" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/languages/golang" - "github.com/bearer/bearer/internal/languages/java" - "github.com/bearer/bearer/internal/languages/javascript" - "github.com/bearer/bearer/internal/languages/php" - "github.com/bearer/bearer/internal/languages/python" - "github.com/bearer/bearer/internal/languages/ruby" - "github.com/bearer/bearer/internal/report" - reportdetections "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - reportschema "github.com/bearer/bearer/internal/report/schema" - "github.com/bearer/bearer/internal/report/source" - customruletypes "github.com/bearer/bearer/internal/scanner/detectors/customrule/types" - "github.com/bearer/bearer/internal/scanner/detectors/datatype" - detectortypes "github.com/bearer/bearer/internal/scanner/detectors/types" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/util/file" - "github.com/bearer/bearer/internal/util/pluralize" - - "github.com/bearer/bearer/internal/scanner/languagescanner" - "github.com/bearer/bearer/internal/scanner/stats" + schemaclassifier "github.com/bearer/bearer/pkg/classification/schema" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/languages/golang" + "github.com/bearer/bearer/pkg/languages/java" + "github.com/bearer/bearer/pkg/languages/javascript" + "github.com/bearer/bearer/pkg/languages/php" + "github.com/bearer/bearer/pkg/languages/python" + "github.com/bearer/bearer/pkg/languages/ruby" + "github.com/bearer/bearer/pkg/report" + reportdetections "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + reportschema "github.com/bearer/bearer/pkg/report/schema" + "github.com/bearer/bearer/pkg/report/source" + customruletypes "github.com/bearer/bearer/pkg/scanner/detectors/customrule/types" + "github.com/bearer/bearer/pkg/scanner/detectors/datatype" + detectortypes "github.com/bearer/bearer/pkg/scanner/detectors/types" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/util/file" + "github.com/bearer/bearer/pkg/util/pluralize" + + "github.com/bearer/bearer/pkg/scanner/languagescanner" + "github.com/bearer/bearer/pkg/scanner/stats" ) type Scanner struct { diff --git a/internal/scanner/stats/stats.go b/pkg/scanner/stats/stats.go similarity index 100% rename from internal/scanner/stats/stats.go rename to pkg/scanner/stats/stats.go diff --git a/internal/scanner/variableshape/variableshape.go b/pkg/scanner/variableshape/variableshape.go similarity index 91% rename from internal/scanner/variableshape/variableshape.go rename to pkg/scanner/variableshape/variableshape.go index d47cfba6f..af4d983ab 100644 --- a/internal/scanner/variableshape/variableshape.go +++ b/pkg/scanner/variableshape/variableshape.go @@ -3,11 +3,11 @@ package variableshape import ( "fmt" - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/scanner/ast/tree" - patternquerybuilder "github.com/bearer/bearer/internal/scanner/detectors/customrule/patternquery/builder" - "github.com/bearer/bearer/internal/scanner/language" - "github.com/bearer/bearer/internal/scanner/ruleset" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/scanner/ast/tree" + patternquerybuilder "github.com/bearer/bearer/pkg/scanner/detectors/customrule/patternquery/builder" + "github.com/bearer/bearer/pkg/scanner/language" + "github.com/bearer/bearer/pkg/scanner/ruleset" ) type Values []*tree.Node diff --git a/internal/types/artifact.go b/pkg/types/artifact.go similarity index 100% rename from internal/types/artifact.go rename to pkg/types/artifact.go diff --git a/internal/types/report.go b/pkg/types/report.go similarity index 100% rename from internal/types/report.go rename to pkg/types/report.go diff --git a/internal/types/severity.go b/pkg/types/severity.go similarity index 100% rename from internal/types/severity.go rename to pkg/types/severity.go diff --git a/internal/types/target.go b/pkg/types/target.go similarity index 100% rename from internal/types/target.go rename to pkg/types/target.go diff --git a/internal/types/trigger.go b/pkg/types/trigger.go similarity index 100% rename from internal/types/trigger.go rename to pkg/types/trigger.go diff --git a/internal/util/cache/utils.go b/pkg/util/cache/utils.go similarity index 100% rename from internal/util/cache/utils.go rename to pkg/util/cache/utils.go diff --git a/internal/util/classify/classify.go b/pkg/util/classify/classify.go similarity index 94% rename from internal/util/classify/classify.go rename to pkg/util/classify/classify.go index f85bd76dd..9069396db 100644 --- a/internal/util/classify/classify.go +++ b/pkg/util/classify/classify.go @@ -3,7 +3,7 @@ package classify import ( "regexp" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/report/detectors" ) type ValidationState string diff --git a/internal/util/classify/classify_schema.go b/pkg/util/classify/classify_schema.go similarity index 95% rename from internal/util/classify/classify_schema.go rename to pkg/util/classify/classify_schema.go index 2460b93ca..1bd9242e0 100644 --- a/internal/util/classify/classify_schema.go +++ b/pkg/util/classify/classify_schema.go @@ -3,7 +3,7 @@ package classify import ( "fmt" - "github.com/bearer/bearer/internal/report/detectors" + "github.com/bearer/bearer/pkg/report/detectors" ) var objectStopWords = map[string]struct{}{ diff --git a/internal/util/classify/classify_schema_test.go b/pkg/util/classify/classify_schema_test.go similarity index 95% rename from internal/util/classify/classify_schema_test.go rename to pkg/util/classify/classify_schema_test.go index 6546a9fc8..0588491a5 100644 --- a/internal/util/classify/classify_schema_test.go +++ b/pkg/util/classify/classify_schema_test.go @@ -3,8 +3,8 @@ package classify_test import ( "testing" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/util/classify" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/util/classify" "github.com/stretchr/testify/assert" ) diff --git a/internal/util/classify/classify_test.go b/pkg/util/classify/classify_test.go similarity index 92% rename from internal/util/classify/classify_test.go rename to pkg/util/classify/classify_test.go index 1a1b96eee..da8a37716 100644 --- a/internal/util/classify/classify_test.go +++ b/pkg/util/classify/classify_test.go @@ -3,8 +3,8 @@ package classify_test import ( "testing" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/util/classify" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/util/classify" "github.com/stretchr/testify/assert" ) diff --git a/internal/util/components/components.go b/pkg/util/components/components.go similarity index 73% rename from internal/util/components/components.go rename to pkg/util/components/components.go index 5aa77ed0f..985f2711e 100644 --- a/internal/util/components/components.go +++ b/pkg/util/components/components.go @@ -3,8 +3,8 @@ package components import ( "regexp" - "github.com/bearer/bearer/internal/util/normalize_key" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/util/normalize_key" + "github.com/bearer/bearer/pkg/util/regex" ) var keyPatterns = []*regexp.Regexp{ diff --git a/internal/util/entropy/.snapshots/TestShannon b/pkg/util/entropy/.snapshots/TestShannon similarity index 100% rename from internal/util/entropy/.snapshots/TestShannon rename to pkg/util/entropy/.snapshots/TestShannon diff --git a/internal/util/entropy/entropy.go b/pkg/util/entropy/entropy.go similarity index 100% rename from internal/util/entropy/entropy.go rename to pkg/util/entropy/entropy.go diff --git a/internal/util/entropy/entropy_test.go b/pkg/util/entropy/entropy_test.go similarity index 88% rename from internal/util/entropy/entropy_test.go rename to pkg/util/entropy/entropy_test.go index 542497046..244a4b0e5 100644 --- a/internal/util/entropy/entropy_test.go +++ b/pkg/util/entropy/entropy_test.go @@ -6,7 +6,7 @@ import ( "github.com/bradleyjkemp/cupaloy" - "github.com/bearer/bearer/internal/util/entropy" + "github.com/bearer/bearer/pkg/util/entropy" ) func TestShannon(t *testing.T) { diff --git a/internal/util/file/file.go b/pkg/util/file/file.go similarity index 98% rename from internal/util/file/file.go rename to pkg/util/file/file.go index 547781234..d76385aba 100644 --- a/internal/util/file/file.go +++ b/pkg/util/file/file.go @@ -13,8 +13,8 @@ import ( "github.com/go-enry/go-enry/v2" "github.com/rs/zerolog/log" - "github.com/bearer/bearer/internal/util/linescanner" - "github.com/bearer/bearer/internal/util/regex" + "github.com/bearer/bearer/pkg/util/linescanner" + "github.com/bearer/bearer/pkg/util/regex" ignore "github.com/sabhiram/go-gitignore" ) diff --git a/internal/util/ignore/ignore.go b/pkg/util/ignore/ignore.go similarity index 97% rename from internal/util/ignore/ignore.go rename to pkg/util/ignore/ignore.go index 73cfa4c44..5fa903097 100644 --- a/internal/util/ignore/ignore.go +++ b/pkg/util/ignore/ignore.go @@ -11,8 +11,8 @@ import ( "github.com/fatih/color" - types "github.com/bearer/bearer/internal/util/ignore/types" - pointer "github.com/bearer/bearer/internal/util/pointers" + types "github.com/bearer/bearer/pkg/util/ignore/types" + pointer "github.com/bearer/bearer/pkg/util/pointers" ) const DefaultIgnoreFilepath = "bearer.ignore" diff --git a/internal/util/ignore/ignore_test.go b/pkg/util/ignore/ignore_test.go similarity index 96% rename from internal/util/ignore/ignore_test.go rename to pkg/util/ignore/ignore_test.go index 21645ba29..a279ffae1 100644 --- a/internal/util/ignore/ignore_test.go +++ b/pkg/util/ignore/ignore_test.go @@ -7,8 +7,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/bearer/bearer/internal/util/ignore" - types "github.com/bearer/bearer/internal/util/ignore/types" + "github.com/bearer/bearer/pkg/util/ignore" + types "github.com/bearer/bearer/pkg/util/ignore/types" ) func TestGetIgnoredFingerprints(t *testing.T) { diff --git a/internal/util/ignore/types/types.go b/pkg/util/ignore/types/types.go similarity index 100% rename from internal/util/ignore/types/types.go rename to pkg/util/ignore/types/types.go diff --git a/internal/util/jsonlines/jsonlines.go b/pkg/util/jsonlines/jsonlines.go similarity index 97% rename from internal/util/jsonlines/jsonlines.go rename to pkg/util/jsonlines/jsonlines.go index 1545a418d..da5c45965 100644 --- a/internal/util/jsonlines/jsonlines.go +++ b/pkg/util/jsonlines/jsonlines.go @@ -6,7 +6,7 @@ import ( "io" "reflect" - "github.com/bearer/bearer/internal/util/linescanner" + "github.com/bearer/bearer/pkg/util/linescanner" ) const maxTokenSizeBytes int = 5 * 1024 * 1024 diff --git a/internal/util/jsonlines/jsonlines_test.go b/pkg/util/jsonlines/jsonlines_test.go similarity index 95% rename from internal/util/jsonlines/jsonlines_test.go rename to pkg/util/jsonlines/jsonlines_test.go index b416f2e72..1b525dd4b 100644 --- a/internal/util/jsonlines/jsonlines_test.go +++ b/pkg/util/jsonlines/jsonlines_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/bearer/bearer/internal/util/jsonlines" + "github.com/bearer/bearer/pkg/util/jsonlines" "github.com/mitchellh/mapstructure" "github.com/stretchr/testify/assert" ) diff --git a/internal/util/linescanner/linescanner.go b/pkg/util/linescanner/linescanner.go similarity index 100% rename from internal/util/linescanner/linescanner.go rename to pkg/util/linescanner/linescanner.go diff --git a/internal/util/maputil/maputil.go b/pkg/util/maputil/maputil.go similarity index 100% rename from internal/util/maputil/maputil.go rename to pkg/util/maputil/maputil.go diff --git a/internal/util/normalize_key/normalize_key.go b/pkg/util/normalize_key/normalize_key.go similarity index 100% rename from internal/util/normalize_key/normalize_key.go rename to pkg/util/normalize_key/normalize_key.go diff --git a/internal/util/normalize_key/normalize_key_test.go b/pkg/util/normalize_key/normalize_key_test.go similarity index 90% rename from internal/util/normalize_key/normalize_key_test.go rename to pkg/util/normalize_key/normalize_key_test.go index 01deacbbd..7c26a684a 100644 --- a/internal/util/normalize_key/normalize_key_test.go +++ b/pkg/util/normalize_key/normalize_key_test.go @@ -3,7 +3,7 @@ package normalize_key_test import ( "testing" - "github.com/bearer/bearer/internal/util/normalize_key" + "github.com/bearer/bearer/pkg/util/normalize_key" "github.com/stretchr/testify/assert" ) diff --git a/internal/util/output/output.go b/pkg/util/output/output.go similarity index 98% rename from internal/util/output/output.go rename to pkg/util/output/output.go index 1620eeda8..c55260a53 100644 --- a/internal/util/output/output.go +++ b/pkg/util/output/output.go @@ -7,7 +7,7 @@ import ( "os" "time" - "github.com/bearer/bearer/internal/flag" + "github.com/bearer/bearer/pkg/flag" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/spf13/cobra" diff --git a/internal/util/pluralize/pluralize.go b/pkg/util/pluralize/pluralize.go similarity index 100% rename from internal/util/pluralize/pluralize.go rename to pkg/util/pluralize/pluralize.go diff --git a/internal/util/pointers/pointers.go b/pkg/util/pointers/pointers.go similarity index 100% rename from internal/util/pointers/pointers.go rename to pkg/util/pointers/pointers.go diff --git a/internal/util/progressbar/progressbar.go b/pkg/util/progressbar/progressbar.go similarity index 79% rename from internal/util/progressbar/progressbar.go rename to pkg/util/progressbar/progressbar.go index 99cfb6853..d7ee5e065 100644 --- a/internal/util/progressbar/progressbar.go +++ b/pkg/util/progressbar/progressbar.go @@ -1,12 +1,12 @@ package progressbar import ( - "github.com/bearer/bearer/internal/commands/process/settings" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/commands/process/settings" + "github.com/bearer/bearer/pkg/util/output" "github.com/schollz/progressbar/v3" ) -func GetProgressBar(filesLength int, config settings.Config) *progressbar.ProgressBar { +func GetProgressBar(filesLength int, config *settings.Config) *progressbar.ProgressBar { hideProgress := config.Scan.HideProgressBar || config.Scan.Quiet || config.Debug return progressbar.NewOptions(filesLength, progressbar.OptionSetVisibility(!hideProgress), diff --git a/internal/util/regex/regex.go b/pkg/util/regex/regex.go similarity index 72% rename from internal/util/regex/regex.go rename to pkg/util/regex/regex.go index 8bccdd497..4539f2176 100644 --- a/internal/util/regex/regex.go +++ b/pkg/util/regex/regex.go @@ -5,6 +5,29 @@ import ( "strings" ) +type SerializableRegexp struct { + *regexp.Regexp +} + +func (r *SerializableRegexp) UnmarshalText(b []byte) error { + pattern, err := regexp.Compile(string(b)) + if err != nil { + return err + } + + r.Regexp = pattern + + return nil +} + +func (r *SerializableRegexp) MarshalText() ([]byte, error) { + if r.Regexp != nil { + return []byte(r.Regexp.String()), nil + } + + return nil, nil +} + // AnyMatch returns true if any of the regexes match the given string func AnyMatch(exprs []*regexp.Regexp, str string) bool { for _, expr := range exprs { diff --git a/internal/util/rego/rego.go b/pkg/util/rego/rego.go similarity index 100% rename from internal/util/rego/rego.go rename to pkg/util/rego/rego.go diff --git a/internal/util/set/set.go b/pkg/util/set/set.go similarity index 100% rename from internal/util/set/set.go rename to pkg/util/set/set.go diff --git a/internal/util/slices/slices.go b/pkg/util/slices/slices.go similarity index 100% rename from internal/util/slices/slices.go rename to pkg/util/slices/slices.go diff --git a/internal/util/slices/slices_suite_test.go b/pkg/util/slices/slices_suite_test.go similarity index 100% rename from internal/util/slices/slices_suite_test.go rename to pkg/util/slices/slices_suite_test.go diff --git a/internal/util/slices/slices_test.go b/pkg/util/slices/slices_test.go similarity index 92% rename from internal/util/slices/slices_test.go rename to pkg/util/slices/slices_test.go index e996ac345..897767a2a 100644 --- a/internal/util/slices/slices_test.go +++ b/pkg/util/slices/slices_test.go @@ -6,7 +6,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - sliceutil "github.com/bearer/bearer/internal/util/slices" + sliceutil "github.com/bearer/bearer/pkg/util/slices" ) var _ = Describe("Except", func() { diff --git a/internal/util/stringutil/stringutil.go b/pkg/util/stringutil/stringutil.go similarity index 100% rename from internal/util/stringutil/stringutil.go rename to pkg/util/stringutil/stringutil.go diff --git a/internal/util/tmpfile/tmpfile.go b/pkg/util/tmpfile/tmpfile.go similarity index 87% rename from internal/util/tmpfile/tmpfile.go rename to pkg/util/tmpfile/tmpfile.go index e4ffb8356..89ef528be 100644 --- a/internal/util/tmpfile/tmpfile.go +++ b/pkg/util/tmpfile/tmpfile.go @@ -5,7 +5,7 @@ import ( "fmt" "os" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/util/output" ) var ErrCreateFailed = errors.New("failed to create file") diff --git a/internal/util/url/domain_resolver.go b/pkg/util/url/domain_resolver.go similarity index 100% rename from internal/util/url/domain_resolver.go rename to pkg/util/url/domain_resolver.go diff --git a/internal/util/url/domain_resolver_test.go b/pkg/util/url/domain_resolver_test.go similarity index 98% rename from internal/util/url/domain_resolver_test.go rename to pkg/util/url/domain_resolver_test.go index af6d08498..ac9cfa71b 100644 --- a/internal/util/url/domain_resolver_test.go +++ b/pkg/util/url/domain_resolver_test.go @@ -6,7 +6,7 @@ import ( "net" "testing" - "github.com/bearer/bearer/internal/util/url" + "github.com/bearer/bearer/pkg/util/url" "github.com/stretchr/testify/assert" ) diff --git a/internal/util/url/url.go b/pkg/util/url/url.go similarity index 99% rename from internal/util/url/url.go rename to pkg/util/url/url.go index a93c2ce1b..1cbc52669 100644 --- a/internal/util/url/url.go +++ b/pkg/util/url/url.go @@ -8,8 +8,8 @@ import ( "regexp" "strings" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/util/classify" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/util/classify" "github.com/weppos/publicsuffix-go/publicsuffix" ) diff --git a/internal/util/url/url_test.go b/pkg/util/url/url_test.go similarity index 98% rename from internal/util/url/url_test.go rename to pkg/util/url/url_test.go index 2a04d3eee..f5d82f819 100644 --- a/internal/util/url/url_test.go +++ b/pkg/util/url/url_test.go @@ -6,11 +6,11 @@ import ( "net" "testing" - "github.com/bearer/bearer/internal/report/detections" - "github.com/bearer/bearer/internal/report/detectors" - "github.com/bearer/bearer/internal/report/source" - "github.com/bearer/bearer/internal/util/classify" - "github.com/bearer/bearer/internal/util/url" + "github.com/bearer/bearer/pkg/report/detections" + "github.com/bearer/bearer/pkg/report/detectors" + "github.com/bearer/bearer/pkg/report/source" + "github.com/bearer/bearer/pkg/util/classify" + "github.com/bearer/bearer/pkg/util/url" "github.com/stretchr/testify/assert" ) diff --git a/internal/version_check/bearer_version.go b/pkg/version_check/bearer_version.go similarity index 91% rename from internal/version_check/bearer_version.go rename to pkg/version_check/bearer_version.go index 3bdff69bb..a6dc22497 100644 --- a/internal/version_check/bearer_version.go +++ b/pkg/version_check/bearer_version.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/viper" "github.com/bearer/bearer/api" - "github.com/bearer/bearer/internal/flag" + "github.com/bearer/bearer/pkg/flag" ) func GetBearerVersionMeta(languages []string) (*VersionMeta, error) { diff --git a/internal/version_check/github_version.go b/pkg/version_check/github_version.go similarity index 100% rename from internal/version_check/github_version.go rename to pkg/version_check/github_version.go diff --git a/internal/version_check/version_check.go b/pkg/version_check/version_check.go similarity index 93% rename from internal/version_check/version_check.go rename to pkg/version_check/version_check.go index 4a4f831ea..f420becb0 100644 --- a/internal/version_check/version_check.go +++ b/pkg/version_check/version_check.go @@ -7,9 +7,9 @@ import ( "github.com/spf13/viper" "github.com/bearer/bearer/cmd/bearer/build" - "github.com/bearer/bearer/internal/flag" - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/util/output" + "github.com/bearer/bearer/pkg/flag" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/util/output" ) type VersionMeta struct { diff --git a/scripts/gen-doc-yaml.go b/scripts/gen-doc-yaml.go index ea611fe14..17e4c5632 100644 --- a/scripts/gen-doc-yaml.go +++ b/scripts/gen-doc-yaml.go @@ -10,10 +10,10 @@ import ( "strings" "github.com/bearer/bearer/cmd/bearer/build" - "github.com/bearer/bearer/internal/commands" - "github.com/bearer/bearer/internal/flag" - flagtypes "github.com/bearer/bearer/internal/flag/types" - "github.com/bearer/bearer/internal/util/set" + "github.com/bearer/bearer/pkg/commands" + "github.com/bearer/bearer/pkg/flag" + flagtypes "github.com/bearer/bearer/pkg/flag/types" + "github.com/bearer/bearer/pkg/util/set" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" @@ -74,7 +74,7 @@ func main() { os.Exit(1) } - cmd := commands.NewApp(build.Version, build.CommitSHA) + cmd := commands.NewApp(build.Version, build.CommitSHA, nil) err := writeDocs( cmd, dir,