diff --git a/packages/secret-scan/src/denylist.ts b/packages/secret-scan/src/denylist.ts index 0b0c530e..128ee04e 100644 --- a/packages/secret-scan/src/denylist.ts +++ b/packages/secret-scan/src/denylist.ts @@ -42,7 +42,18 @@ import { easypost, facebook, flutterwave, - frameio + frameio, + gitlab, + grafana, + harness, + hashicorp, + heroku, + hubspot, + huggingface, + infracost, + intra42, + // kubernetes, + linear, lob, planetscale, postman, prefect, pulumi } from '@/rules' const denylist: SecretConfig = { @@ -137,7 +148,39 @@ const denylist: SecretConfig = { flutterwave: flutterwave(), - frameio: frameio() + frameio: frameio(), + + gitlab: gitlab(), + + grafana: grafana(), + + harness: harness(), + + hashicorp: hashicorp(), + + heroku: heroku(), + + hubspot: hubspot(), + + huggingface: huggingface(), + + infracost: infracost(), + + intra42: intra42(), + + //kubernetes: kubernetes(), + + linear: linear(), + + lob: lob(), + + planetscale: planetscale(), + + postman: postman(), + + prefect: prefect(), + + pulumi: pulumi() } export default denylist diff --git a/packages/secret-scan/src/rules/gitlab.ts b/packages/secret-scan/src/rules/gitlab.ts index e69de29b..00e159c3 100644 --- a/packages/secret-scan/src/rules/gitlab.ts +++ b/packages/secret-scan/src/rules/gitlab.ts @@ -0,0 +1,47 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function gitlab(): RegExp[] { + return [ + /glpat-[0-9a-zA-Z\-_]{20}/, // GitLab Personal Access Token regex + /glptt-[0-9a-f]{40}/, // GitLab Pipeline Trigger Token regex + /GR1348941[0-9a-zA-Z\-_]{20}/ // GitLab Runner Registration Token regex + ] +} + +const testcase: TestCase[] = [ + { + input: 'glpat-a7rhywlOQc22s2wu6ksw', + expected: true + }, + { + input: 'glptt-6a2ebf582d778fbabc413dfa97e0dfd6b4ce5c2e', + expected: true + }, + { + input: 'GR1348941PQrAlrwIUScCvc8l6dWY', + expected: true + }, + { + input: 'const = GITLAB_PERSONAL_ACCESS_TOKEN', + expected: false + }, + { + input: 'const = GITLAB_PIPELINE_TRIGGER_TOKEN', + expected: false + }, + { + input: 'const = GITLAB_RUNNER_REGISTRATION_TOKEN', + expected: false + }, + { + input: 'GITLAB', + expected: false + }, + { + input: 'GIT', + expected: false + } +] + +gitlab.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/grafana.ts b/packages/secret-scan/src/rules/grafana.ts index e69de29b..faea1144 100644 --- a/packages/secret-scan/src/rules/grafana.ts +++ b/packages/secret-scan/src/rules/grafana.ts @@ -0,0 +1,83 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function grafana(): RegExp[] { + return [ + /eyJrIjoi[A-Za-z0-9]{70,400}={0,2}/, // Grafana API Key regex + /glc_[A-Za-z0-9+/]{32,400}={0,2}/, // Grafana Cloud API Token regex + /glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8}/ // Grafana Service Account Token regex + ] +} + +const testcase: TestCase[] = [ + { + input: 'eyJrIjoiLC58NHoAWV9QQ4Hpinsjz28MsjlfclKhSP6J6ecvqe7mHV67gknZlPfS92wlJSaGVwKI8ZOxmosmWlylfjEQwsDL9M31sNtgLyJZgXMKr3YXFUvwXrxrUmrmA3SGEDQeqrwuQKIRglOx94NHGe7wve0xbOf3Mkysv6u8LUB9H2ZJJhtPorLByR2rUMaZaauZvyNm6dkz4iYgxNk2ROP6PIA1E6N6TGwHa44pebzqMSDMPSlVAWrNaK2xjco3Ez7qtXpJl7tayylHAONDcWiM9vQDUELUA8uZtQsHNZP4DEoPMKHeaChAMlAVzDvzaM8fkGta9CJeqfrwb4qJ2Y6uwsXk8e8XMsSWPsxXFyOe7NUVMPNFzy8C344xiv3YcvV1E==', + expected: true + }, + { + input: 'eyJrIjoiIvuuuE2MzK2VJR23kHp3Q90IJSdnW9f1WIoyculWhTLBXrykooBhgIYm6IJgCndcSWDIaXJks7bkCdP3ywa7AfVpQP9rmJOq5VK57mas1KcdXD7Z1bdvhSo0mdzW91epWEcnlnLQpbtVLlDvxqnak9WETmFH==', + expected: true + }, + { + input: 'eyJrIjoi6QlsUNL4JJHbBXlyJS3SiRDPUzUfhT1B2w6px62kuQK05cTohhVE4TR2H9dOGNF5B6plJAECmpGfWca7gbA7LpFGRRVG', + expected: true + }, + { + input: 'glc_kB8ZcmLO+X1zpBZ7ljeXs8x8QjAPWLAQfIMv9r+4iOeAnQXnecZLzdPkutte3w0u737mBAFf+v3CitNm0fzUOEFd26tuVsncFpEkxRq/kjcYEhBWLYtIStMLcYyo7XhyLFW8IM7Bf4tGI9g5n9jfjtZnWqfKWEEhaHfE0ra', + expected: true + }, + { + input: 'glc_Hb574KjK4N0Z81xqlZGJy0IZCvBmDPT7cPPVqdH9plY1GbHRVl8Nm8coHWlRrh97YJTUyaNSF1Ec3r36sOHyks9C31FIX5vEpAvRx5ZReGdPV4DVP9Y33gzhMgqhHA4HEUi+hnFPClhPlXMBMhZJLUAzFvP0AoOMxrkXnCMJSwfPC4/9/djzC16zX9MuYFWf==', + expected: true + }, + { + input: 'glc_zSP9RW2kk4DZpq/gXYZwiKmLudxJqUNfXjtC8BvJLiMS32766GkZNOq2XIvPs8ZfFAh3yMUYTs/N4UT2d7q63uqq7=', + expected: true + }, + { + input: 'glsa_phY2htSd5uTt3jmPvK8XBLuq1hwk8K7J_BbB124A7', + expected: true + }, + { + input: 'glsa_8LVjQdfLZyFiylzBXDmwAhkwkHODsRNJ_B6BfAf1c', + expected: true + }, + { + input: 'glsa_OBtXDlTAprnRnhZPLHXPyFeY9lbXc4dW_Eb1A4125', + expected: true + }, + { + input: 'glsa_OBtXDlTAprnRnhZPLHXPyFeY9lbXc4dW_', + expected: false + }, + { + input: 'glc_zSP9RW2kq/gXYZwiKmLudxJqU66GkZN', + expected: false + }, + { + input: 'eyJrIjoi6QlsUNL4JJHbBXlyJS3SiRDPUzUfhT1B2w6px62kuQK05cTohhVE4TR2H9dO', + expected: false + }, + { + input: 'GRAFANA', + expected: false + }, + { + input: 'const = GRAFANA_API_KEY', + expected: false + }, + { + input: 'GRAFANA_API_KEY', + expected: false + }, + { + input: 'GRAFANA_CLOUD_API_TOKEN', + expected: false + }, + { + input: 'GRAFANA_SERVICE_ACCOUNT_TOKEN', + expected: false + } +] + +grafana.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/harness.ts b/packages/secret-scan/src/rules/harness.ts index e69de29b..7a53cd51 100644 --- a/packages/secret-scan/src/rules/harness.ts +++ b/packages/secret-scan/src/rules/harness.ts @@ -0,0 +1,50 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function harness(): RegExp[] { + return [ + // Harness Personal Access (starts with `pat`) & Service Account (starts with `sat`) Token regex + /(?:pat|sat)\.[a-zA-Z0-9]{22}\.[a-zA-Z0-9]{24}\.[a-zA-Z0-9]{20}/, + ] +} + +const testcase: TestCase[] = [ + { + input: 'sat.tbD3t0UTVxnDsJjXtA7yFg.Ses0cii322QyNVAWsGCAtbPG.cL64ShIGlxlB55eB2YSw', + expected: true + }, + { + input: 'sat.D5rQDqdpmAy8RCFrGOjBXu.8YSoWK1thmC6eTbWDLSg4SiK.OnKZVW9IytuKh9HFhhKG', + expected: true + }, + { + input: 'pat.GRDSyUuWR5EA2jwP2LDXEv.WqO2w3p1vb8QBvif7r0ilHTS.8T9HF4wdkNw1SxJTcoB3', + expected: true + }, + { + input: 'pat.t9KDTZ3Z4y1LZx2lwLTx5Y.VHA8Fd6wMD8Lc5yZ1aruadYC.v56fG64UhjmwgkoY5ugl\n', + expected: true + }, + { + input: 'const = HARNESS_PERSONAL_ACCESS_TOKEN', + expected: false + }, + { + input: 'const = HARNESS_SERVICE_ACCOUNT_TOKEN', + expected: false + }, + { + input: 'HARNESS', + expected: false + }, + { + input: 'pat.', + expected: false + }, + { + input: 'sat.', + expected: false + } +] + +harness.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/hashicorp.ts b/packages/secret-scan/src/rules/hashicorp.ts index e69de29b..ac88f0eb 100644 --- a/packages/secret-scan/src/rules/hashicorp.ts +++ b/packages/secret-scan/src/rules/hashicorp.ts @@ -0,0 +1,26 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function hashicorp(): RegExp[] { + return [ + // Hashicorp Terraform APi Token Regex + /[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}/i + ] +} + +const testcase: TestCase[] = [ + { + input: '9mc0jh5dvgc1cx.atlasv1.y4u=-3=j=5nbf2bg0tkg1019e_9r6ghkmugdfl05hp2qzdd8=8d=wmtfya99o', + expected: true + }, + { + input: 't4eyvzkop56q4o.atlasv1.idknou9rz9ul3y2lepjhk=c6dvpdioedep=cwkrzk4m8i5v8fpb-kixusz-xo7loooj1', + expected: true + }, + { + input: 'TERRAFORM', + expected: false + } +] + +hashicorp.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/heroku.ts b/packages/secret-scan/src/rules/heroku.ts index e69de29b..8c07d5a9 100644 --- a/packages/secret-scan/src/rules/heroku.ts +++ b/packages/secret-scan/src/rules/heroku.ts @@ -0,0 +1,38 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function heroku(): RegExp[] { + return [ + // Heroku API Key regex ( UUID like pattern ) + /\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b/ + ] +} + +const testcase: TestCase[] = [ + { + input: 'E3D24DAc-7c5D-Aacd-fafF-3cc0c70e2ccc', + expected: true + }, + { + input: 'AAD43dca-DBFc-4aEc-c86c-D57D57CAefb2', + expected: true + }, + { + input: 'FdA859B1-7D9a-f3e0-fAC3-E4ae6FbEEfBA', + expected: true + }, + { + input: 'AADdca-DBFc-4aEc-c86c-D57D57CAefb2', + expected: false + }, + { + input: 'AAD43dca-DBFc-4aEc-c86c-D7CAefb2', + expected: false + }, + { + input: 'AAD43dca-Dc-Ec-cc-D57D57CAefb2', + expected: false + } +] + +heroku.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/hubspot.ts b/packages/secret-scan/src/rules/hubspot.ts index e69de29b..9452d030 100644 --- a/packages/secret-scan/src/rules/hubspot.ts +++ b/packages/secret-scan/src/rules/hubspot.ts @@ -0,0 +1,38 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function hubspot(): RegExp[] { + return [ + // Hubspot API Key regex + /\b[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\b/ + ] +} + +const testcase: TestCase[] = [ + { + input: '6CA76A92-AC2A-8798-B0DD-DC55F0FD2718', + expected: true + }, + { + input: '17EEDBBE-B310-B60F-D37F-5902082CA2F2', + expected: true + }, + { + input: 'F74407A5-64B8-1C17-C90D-A3613B216A0B', + expected: true + }, + { + input: '17EEDBBE-B310-B60F-D37F-5902082CA', + expected: false + }, + { + input: '17EEE-B310-B60F-D37F-5902082CA2F2', + expected: false + }, + { + input: '17EEDBBE-B0-B0F-D-5902082CA2F2', + expected: false + } +] + +hubspot.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/huggingface.ts b/packages/secret-scan/src/rules/huggingface.ts index e69de29b..4bd00c91 100644 --- a/packages/secret-scan/src/rules/huggingface.ts +++ b/packages/secret-scan/src/rules/huggingface.ts @@ -0,0 +1,41 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function huggingface(): RegExp[] { + return [ + // Huggingface Access Token regex + /(?:^|[\\'"` + "`" + ` >=:])(hf_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <])/, + + // Huggingface Organization Access Token Regex + /(?:^|[\\'"` + "`" + ` >=:\(,)])(api_org_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <\),])/ + ] +} + +const testcase: TestCase[] = [ + { + input: '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', + expected: true + }, + { + input: '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', + expected: true + }, + { + input: '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', + expected: true + }, + { + input: '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', + expected: true + }, + { + input: 'api_org_', + expected: false + }, + { + input: 'hf_', + expected: false + } +] + +huggingface.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/index.ts b/packages/secret-scan/src/rules/index.ts index 0bf4638a..d946d6e0 100644 --- a/packages/secret-scan/src/rules/index.ts +++ b/packages/secret-scan/src/rules/index.ts @@ -43,7 +43,23 @@ import dynatrace from './dynatrace' import easypost from './easypost' import facebook from "./facebook"; import flutterwave from './flutterwave' -import frameio from "@/rules/frameio"; +import frameio from "./frameio" +import gitlab from './gitlab' +import grafana from './grafana' +import harness from './harness' +import hashicorp from './hashicorp' +import heroku from './heroku' +import hubspot from './hubspot' +import huggingface from './huggingface' +import infracost from './infracost' +import intra42 from './intra42' +//import kubernetes from './kubernetes' +import linear from './linear' +import lob from './lob' +import planetscale from './planetscale' +import postman from './postman' +import prefect from './prefect' +import pulumi from './pulumi' export { private_key, @@ -91,5 +107,21 @@ export { easypost, facebook, flutterwave, - frameio + frameio, + gitlab, + grafana, + harness, + hashicorp, + heroku, + hubspot, + huggingface, + infracost, + intra42, + //kubernetes, + linear, + lob, + planetscale, + postman, + prefect, + pulumi } diff --git a/packages/secret-scan/src/rules/infracost.ts b/packages/secret-scan/src/rules/infracost.ts index e69de29b..6a64824f 100644 --- a/packages/secret-scan/src/rules/infracost.ts +++ b/packages/secret-scan/src/rules/infracost.ts @@ -0,0 +1,30 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function infracost(): RegExp[] { + return [ + // Infracost API Key regex + /ico-[a-zA-Z0-9]{32}/ + ] +} + +const testcase: TestCase[] = [ + { + input: 'ico-xgKpukMuYNOpYRwdW9VFW1lUcBdgNoiu', + expected: true + }, + { + input: 'ico-nG06pZj4mJAMiBlX0jHsnMgfGFtJlhyu', + expected: true + }, + { + input: 'ico-nG06pZj4mJAMewtiueye', + expected: false + }, + { + input: 'ico-', + expected: false + } +] + +infracost.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/intra42.ts b/packages/secret-scan/src/rules/intra42.ts index e69de29b..ef97a7d4 100644 --- a/packages/secret-scan/src/rules/intra42.ts +++ b/packages/secret-scan/src/rules/intra42.ts @@ -0,0 +1,38 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function intra42(): RegExp[] { + return [ + // Intra42 Client Secret regex + /s-s4t2(?:ud|af)-[a-f0-9]{64}/ + ] +} + +const testcase: TestCase[] = [ + { + input: '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', + expected: true + }, + { + input: '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', + expected: true + }, + { + input: 's-s4t2ud-03c69e8cad5ba22c8a947038931a391e4849eba9866dc065ea02d3', + expected: false + }, + { + input: 's-s4td-03c69e8cad5ba22c8a9470639238931a391e4849eba9866dc065ea02d353ef01wejht72934', + expected: false + }, + { + input: 's-s4t2ud-', + expected: false + }, + { + input: 's-s4t2af-', + expected: false + } +] + +intra42.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/linear.ts b/packages/secret-scan/src/rules/linear.ts index e69de29b..b4e468c5 100644 --- a/packages/secret-scan/src/rules/linear.ts +++ b/packages/secret-scan/src/rules/linear.ts @@ -0,0 +1,30 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function linear(): RegExp[] { + return [ + // Linear API Key regex + /lin_api_[a-z0-9]{40}/i + ] +} + +const testcase: TestCase[] = [ + { + input: 'lin_api_pfwfydji40fvlknog3166f9hvlvqfr1d8odknvr3', + expected: true + }, + { + input: 'lin_api_efzosrmg5ziv9z9v3iq75s8pdyb80qxztk58trza', + expected: true + }, + { + input: 'lin_api_s53gd3ky47rsnqpidr1jj1bjsgpdhr30', + expected: false + }, + { + input: 'lin_api_', + expected: false + } +] + +linear.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/lob.ts b/packages/secret-scan/src/rules/lob.ts new file mode 100644 index 00000000..aa1b440a --- /dev/null +++ b/packages/secret-scan/src/rules/lob.ts @@ -0,0 +1,38 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function lob(): RegExp[] { + return [ + // Lob API (1. Publishable, 2. Normal) Key regex + /(test|live)(_|_pub_)[a-f0-9]{31}/i + ] +} + +const testcase: TestCase[] = [ + { + input: 'test_pub_ba8b57a94ac56f4920c74e2be50dc02', + expected: true + }, + { + input: 'live_ca949625109cf9648c17925b854d1e1', + expected: true + }, + { + input: 'test_9b3c24b9cafee0072d56ddd496adb82', + expected: true + }, + { + input: 'live_pub_c4a7332fc4c74ab259a5d96ab1e7397', + expected: true + }, + { + input: 'live_', + expected: false + }, + { + input: '_pub_', + expected: false + } +] + +lob.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/planetscale.ts b/packages/secret-scan/src/rules/planetscale.ts new file mode 100644 index 00000000..ae4c6689 --- /dev/null +++ b/packages/secret-scan/src/rules/planetscale.ts @@ -0,0 +1,44 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function planetscale(): RegExp[] { + return [ + // Planetscale Password regex + /pscale_pw_[a-z0-9=\-_\.]{32,64}/i, + + // Planetscale API Token Regex + /pscale_tkn_[a-z0-9=\-_\.]{32,64}/i, + + // Planetscale OAuth Token Regex + /pscale_oauth_[a-z0-9=\-_\.]{32,64}/i + ] +} + +const testcase: TestCase[] = [ + { + input: 'pscale_pw_ajpcyf4c=r6lb-io9o2.7-epuvojus8f4horjaq9f3895.6l', + expected: true + }, + { + input: 'pscale_pw_9c5mf807yeygid-jzx24q-2x_u94451-.4qt76m8p7imt0', + expected: true + }, + { + input: 'pscale_tkn_lpy9d_khrord04559x6bdzyrgj38nb_4koqkic', + expected: true + }, + { + input: 'pscale_tkn_zhrzrex23933m5_a3p-vf.vz55ylj3urc4olnter_twvgzujtu._hn3q8l2htdw', + expected: true + }, + { + input: 'pscale_oauth_k-5wwis--9jp1othxh8rrlkqgiv3acoorg0sklcjo', + expected: true + }, + { + input: 'pscale_oauth_dxo=v081vsv10emho_5uj-8xj8=5.upl369nvhwdql8u3x_17mzm', + expected: true + } +] + +planetscale.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/postman.ts b/packages/secret-scan/src/rules/postman.ts new file mode 100644 index 00000000..04ba195e --- /dev/null +++ b/packages/secret-scan/src/rules/postman.ts @@ -0,0 +1,30 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function postman(): RegExp[] { + return [ + // Postman API Key regex + /PMAK-[a-f0-9]{24}-[a-f0-9]{34}/i + ] +} + +const testcase: TestCase[] = [ + { + input: 'PMAK-9b918da2e43ee95b919224d1-e04a135eda41453c240886e79109bf6af3', + expected: true + }, + { + input: 'PMAK-74b0ae4e463c8e190074daca-7cb16c6676b256ebd8b42ee55624ce4528', + expected: true + }, + { + input: 'PMAK-', + expected: false + }, + { + input: 'POSTMAN', + expected: false + } +] + +postman.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/prefect.ts b/packages/secret-scan/src/rules/prefect.ts new file mode 100644 index 00000000..ee001373 --- /dev/null +++ b/packages/secret-scan/src/rules/prefect.ts @@ -0,0 +1,30 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function prefect(): RegExp[] { + return [ + // Prefect API Token regex + /pnu_[a-z0-9]{36}/ + ] +} + +const testcase: TestCase[] = [ + { + input: 'pnu_uv8cueiemumn0xos0s2e3u2xrt8e61temlan', + expected: true + }, + { + input: 'pnu_2be7m5lzmyv47mwsgd1y3ochncyn9a6lltq1', + expected: true + }, + { + input: 'pnu_', + expected: false + }, + { + input: 'PREFECT', + expected: false + } +] + +prefect.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/rules/pulumi.ts b/packages/secret-scan/src/rules/pulumi.ts new file mode 100644 index 00000000..8be45925 --- /dev/null +++ b/packages/secret-scan/src/rules/pulumi.ts @@ -0,0 +1,30 @@ +// keyshade-ignore-all +import type { TestCase }from '@/types' + +export default function pulumi(): RegExp[] { + return [ + // Pulumi API Key regex + /pul-[a-f0-9]{40}/ + ] +} + +const testcase: TestCase[] = [ + { + input: 'pul-1a07270f686b1c66e1e854e540077aaeea752a6f', + expected: true + }, + { + input: 'pul-3779cd2eb66d752be9b15f03ade833da9652f6fe', + expected: true + }, + { + input: 'pul-', + expected: false + }, + { + input: 'PULUMI', + expected: false + } +] + +pulumi.testcases = testcase \ No newline at end of file diff --git a/packages/secret-scan/src/test/secret.test.ts b/packages/secret-scan/src/test/secret.test.ts index a637f72d..5b6cc92e 100644 --- a/packages/secret-scan/src/test/secret.test.ts +++ b/packages/secret-scan/src/test/secret.test.ts @@ -46,7 +46,23 @@ import { easypost, facebook, flutterwave, - + frameio, + gitlab, + grafana, + harness, + hashicorp, + heroku, + hubspot, + huggingface, + infracost, + intra42, + //kubernetes, + linear, + lob, + planetscale, + postman, + prefect, + pulumi } from '@/rules' import type { TestCase } from '@/types' import secretDetector from '@/index' @@ -219,4 +235,55 @@ describe('Detect Secrets from string', () => { it(testcaseTitleTemplate('Flutterwave Key'), () => { testSecret(flutterwave.testcases) }); + it(testcaseTitleTemplate('Frameio Key'), () => { + testSecret(frameio.testcases) + }); + it(testcaseTitleTemplate('Gitlab Key'), () => { + testSecret(gitlab.testcases) + }); + it(testcaseTitleTemplate('Grafana Key'), () => { + testSecret(grafana.testcases) + }); + it(testcaseTitleTemplate('Harness Key'), () => { + testSecret(harness.testcases) + }); + it(testcaseTitleTemplate('Hashicorp Key'), () => { + testSecret(hashicorp.testcases) + }); + it(testcaseTitleTemplate('Heroku Key'), () => { + testSecret(heroku.testcases) + }); + it(testcaseTitleTemplate('Hubspot Key'), () => { + testSecret(hubspot.testcases) + }); + it(testcaseTitleTemplate('Huggingface Key'), () => { + testSecret(huggingface.testcases) + }); + it(testcaseTitleTemplate('Infracost Key'), () => { + testSecret(infracost.testcases) + }); + it(testcaseTitleTemplate('Intra42 Key'), () => { + testSecret(intra42.testcases) + }); + // it(testcaseTitleTemplate('Kubernetes Key'), () => { + // testSecret(kubernetes.testcases) + // }); + it(testcaseTitleTemplate('Linear Key'), () => { + testSecret(linear.testcases) + }); + it(testcaseTitleTemplate('Lob Key'), () => { + testSecret(lob.testcases) + }); + it(testcaseTitleTemplate('Planetscale Key'), () => { + testSecret(planetscale.testcases) + }); + it(testcaseTitleTemplate('Postman Key'), () => { + testSecret(postman.testcases) + }); + it(testcaseTitleTemplate('Prefect Key'), () => { + testSecret(prefect.testcases) + }); + it(testcaseTitleTemplate('Pulumi Key'), () => { + testSecret(pulumi.testcases) + }); })