compromising-position 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +250 -0
- package/bin/compromising-position +29 -0
- package/dist/checks/hibp-email.d.ts +7 -0
- package/dist/checks/hibp-email.d.ts.map +1 -0
- package/dist/checks/hibp-email.js +99 -0
- package/dist/checks/hibp-email.js.map +1 -0
- package/dist/checks/hibp-password.d.ts +13 -0
- package/dist/checks/hibp-password.d.ts.map +1 -0
- package/dist/checks/hibp-password.js +119 -0
- package/dist/checks/hibp-password.js.map +1 -0
- package/dist/checks/local-check.d.ts +9 -0
- package/dist/checks/local-check.d.ts.map +1 -0
- package/dist/checks/local-check.js +36 -0
- package/dist/checks/local-check.js.map +1 -0
- package/dist/checks/plugin.d.ts +29 -0
- package/dist/checks/plugin.d.ts.map +1 -0
- package/dist/checks/plugin.js +2 -0
- package/dist/checks/plugin.js.map +1 -0
- package/dist/checks/plugins/common-secrets-plugin.d.ts +3 -0
- package/dist/checks/plugins/common-secrets-plugin.d.ts.map +1 -0
- package/dist/checks/plugins/common-secrets-plugin.js +130 -0
- package/dist/checks/plugins/common-secrets-plugin.js.map +1 -0
- package/dist/checks/plugins/dehashed-plugin.d.ts +3 -0
- package/dist/checks/plugins/dehashed-plugin.d.ts.map +1 -0
- package/dist/checks/plugins/dehashed-plugin.js +86 -0
- package/dist/checks/plugins/dehashed-plugin.js.map +1 -0
- package/dist/checks/plugins/emailrep-plugin.d.ts +3 -0
- package/dist/checks/plugins/emailrep-plugin.d.ts.map +1 -0
- package/dist/checks/plugins/emailrep-plugin.js +95 -0
- package/dist/checks/plugins/emailrep-plugin.js.map +1 -0
- package/dist/checks/plugins/gitguardian-hsl-plugin.d.ts +3 -0
- package/dist/checks/plugins/gitguardian-hsl-plugin.d.ts.map +1 -0
- package/dist/checks/plugins/gitguardian-hsl-plugin.js +75 -0
- package/dist/checks/plugins/gitguardian-hsl-plugin.js.map +1 -0
- package/dist/checks/plugins/hibp-email-plugin.d.ts +3 -0
- package/dist/checks/plugins/hibp-email-plugin.d.ts.map +1 -0
- package/dist/checks/plugins/hibp-email-plugin.js +73 -0
- package/dist/checks/plugins/hibp-email-plugin.js.map +1 -0
- package/dist/checks/plugins/hibp-password-plugin.d.ts +3 -0
- package/dist/checks/plugins/hibp-password-plugin.d.ts.map +1 -0
- package/dist/checks/plugins/hibp-password-plugin.js +39 -0
- package/dist/checks/plugins/hibp-password-plugin.js.map +1 -0
- package/dist/checks/plugins/intelx-plugin.d.ts +3 -0
- package/dist/checks/plugins/intelx-plugin.d.ts.map +1 -0
- package/dist/checks/plugins/intelx-plugin.js +113 -0
- package/dist/checks/plugins/intelx-plugin.js.map +1 -0
- package/dist/checks/plugins/leakcheck-plugin.d.ts +3 -0
- package/dist/checks/plugins/leakcheck-plugin.d.ts.map +1 -0
- package/dist/checks/plugins/leakcheck-plugin.js +82 -0
- package/dist/checks/plugins/leakcheck-plugin.js.map +1 -0
- package/dist/checks/plugins/local-analysis-plugin.d.ts +3 -0
- package/dist/checks/plugins/local-analysis-plugin.d.ts.map +1 -0
- package/dist/checks/plugins/local-analysis-plugin.js +36 -0
- package/dist/checks/plugins/local-analysis-plugin.js.map +1 -0
- package/dist/checks/registry.d.ts +24 -0
- package/dist/checks/registry.d.ts.map +1 -0
- package/dist/checks/registry.js +53 -0
- package/dist/checks/registry.js.map +1 -0
- package/dist/config/config.d.ts +10 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +56 -0
- package/dist/config/config.js.map +1 -0
- package/dist/core/entropy.d.ts +23 -0
- package/dist/core/entropy.d.ts.map +1 -0
- package/dist/core/entropy.js +180 -0
- package/dist/core/entropy.js.map +1 -0
- package/dist/core/fingerprint.d.ts +7 -0
- package/dist/core/fingerprint.d.ts.map +1 -0
- package/dist/core/fingerprint.js +10 -0
- package/dist/core/fingerprint.js.map +1 -0
- package/dist/core/key-identifier.d.ts +9 -0
- package/dist/core/key-identifier.d.ts.map +1 -0
- package/dist/core/key-identifier.js +310 -0
- package/dist/core/key-identifier.js.map +1 -0
- package/dist/core/sanitize.d.ts +7 -0
- package/dist/core/sanitize.d.ts.map +1 -0
- package/dist/core/sanitize.js +15 -0
- package/dist/core/sanitize.js.map +1 -0
- package/dist/core/secure-buffer.d.ts +61 -0
- package/dist/core/secure-buffer.d.ts.map +1 -0
- package/dist/core/secure-buffer.js +122 -0
- package/dist/core/secure-buffer.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +472 -0
- package/dist/index.js.map +1 -0
- package/dist/input/batch-parser.d.ts +21 -0
- package/dist/input/batch-parser.d.ts.map +1 -0
- package/dist/input/batch-parser.js +65 -0
- package/dist/input/batch-parser.js.map +1 -0
- package/dist/input/secure-prompt.d.ts +11 -0
- package/dist/input/secure-prompt.d.ts.map +1 -0
- package/dist/input/secure-prompt.js +105 -0
- package/dist/input/secure-prompt.js.map +1 -0
- package/dist/output/audit-log.d.ts +11 -0
- package/dist/output/audit-log.d.ts.map +1 -0
- package/dist/output/audit-log.js +50 -0
- package/dist/output/audit-log.js.map +1 -0
- package/dist/output/csv.d.ts +6 -0
- package/dist/output/csv.d.ts.map +1 -0
- package/dist/output/csv.js +28 -0
- package/dist/output/csv.js.map +1 -0
- package/dist/output/formatter.d.ts +12 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +154 -0
- package/dist/output/formatter.js.map +1 -0
- package/dist/output/sarif.d.ts +6 -0
- package/dist/output/sarif.d.ts.map +1 -0
- package/dist/output/sarif.js +52 -0
- package/dist/output/sarif.js.map +1 -0
- package/dist/types/index.d.ts +141 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +45 -0
- package/dist/types/index.js.map +1 -0
- package/dist/verification/anthropic-verifier.d.ts +3 -0
- package/dist/verification/anthropic-verifier.d.ts.map +1 -0
- package/dist/verification/anthropic-verifier.js +56 -0
- package/dist/verification/anthropic-verifier.js.map +1 -0
- package/dist/verification/aws-verifier.d.ts +14 -0
- package/dist/verification/aws-verifier.d.ts.map +1 -0
- package/dist/verification/aws-verifier.js +30 -0
- package/dist/verification/aws-verifier.js.map +1 -0
- package/dist/verification/github-verifier.d.ts +4 -0
- package/dist/verification/github-verifier.d.ts.map +1 -0
- package/dist/verification/github-verifier.js +62 -0
- package/dist/verification/github-verifier.js.map +1 -0
- package/dist/verification/openai-verifier.d.ts +4 -0
- package/dist/verification/openai-verifier.d.ts.map +1 -0
- package/dist/verification/openai-verifier.js +59 -0
- package/dist/verification/openai-verifier.js.map +1 -0
- package/dist/verification/slack-verifier.d.ts +4 -0
- package/dist/verification/slack-verifier.d.ts.map +1 -0
- package/dist/verification/slack-verifier.js +67 -0
- package/dist/verification/slack-verifier.js.map +1 -0
- package/dist/verification/verifier-registry.d.ts +13 -0
- package/dist/verification/verifier-registry.d.ts.map +1 -0
- package/dist/verification/verifier-registry.js +19 -0
- package/dist/verification/verifier-registry.js.map +1 -0
- package/dist/verification/verifier.d.ts +24 -0
- package/dist/verification/verifier.d.ts.map +1 -0
- package/dist/verification/verifier.js +2 -0
- package/dist/verification/verifier.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export var KeyProvider;
|
|
2
|
+
(function (KeyProvider) {
|
|
3
|
+
KeyProvider["OpenAI"] = "OpenAI";
|
|
4
|
+
KeyProvider["OpenAIService"] = "OpenAI Service Account";
|
|
5
|
+
KeyProvider["Anthropic"] = "Anthropic";
|
|
6
|
+
KeyProvider["AWS"] = "AWS";
|
|
7
|
+
KeyProvider["GitHubPAT"] = "GitHub PAT";
|
|
8
|
+
KeyProvider["GitHubFineGrained"] = "GitHub Fine-Grained";
|
|
9
|
+
KeyProvider["StripeLive"] = "Stripe Live";
|
|
10
|
+
KeyProvider["StripeTest"] = "Stripe Test";
|
|
11
|
+
KeyProvider["GoogleAPI"] = "Google API";
|
|
12
|
+
KeyProvider["SlackBot"] = "Slack Bot";
|
|
13
|
+
KeyProvider["SlackUser"] = "Slack User";
|
|
14
|
+
KeyProvider["SendGrid"] = "SendGrid";
|
|
15
|
+
KeyProvider["Twilio"] = "Twilio";
|
|
16
|
+
KeyProvider["Mailgun"] = "Mailgun";
|
|
17
|
+
KeyProvider["DiscordBot"] = "Discord Bot";
|
|
18
|
+
KeyProvider["TelegramBot"] = "Telegram Bot";
|
|
19
|
+
// Phase 1 additions
|
|
20
|
+
KeyProvider["GitLabPAT"] = "GitLab PAT";
|
|
21
|
+
KeyProvider["GitLabPipeline"] = "GitLab Pipeline";
|
|
22
|
+
KeyProvider["NpmToken"] = "npm Token";
|
|
23
|
+
KeyProvider["PyPIToken"] = "PyPI Token";
|
|
24
|
+
KeyProvider["ShopifyPrivate"] = "Shopify Private";
|
|
25
|
+
KeyProvider["ShopifyAccess"] = "Shopify Access";
|
|
26
|
+
KeyProvider["DigitalOceanPAT"] = "DigitalOcean PAT";
|
|
27
|
+
KeyProvider["DigitalOceanOAuth"] = "DigitalOcean OAuth";
|
|
28
|
+
KeyProvider["Supabase"] = "Supabase";
|
|
29
|
+
KeyProvider["HashiCorpVault"] = "HashiCorp Vault";
|
|
30
|
+
KeyProvider["TerraformCloud"] = "Terraform Cloud";
|
|
31
|
+
KeyProvider["PlanetScale"] = "PlanetScale";
|
|
32
|
+
KeyProvider["Postman"] = "Postman";
|
|
33
|
+
KeyProvider["GrafanaService"] = "Grafana Service";
|
|
34
|
+
KeyProvider["Linear"] = "Linear";
|
|
35
|
+
KeyProvider["Netlify"] = "Netlify";
|
|
36
|
+
KeyProvider["DopplerServiceToken"] = "Doppler Service Token";
|
|
37
|
+
KeyProvider["DopplerServiceAccount"] = "Doppler Service Account";
|
|
38
|
+
KeyProvider["Buildkite"] = "Buildkite";
|
|
39
|
+
KeyProvider["Atlassian"] = "Atlassian";
|
|
40
|
+
KeyProvider["Figma"] = "Figma";
|
|
41
|
+
KeyProvider["CircleCI"] = "CircleCI";
|
|
42
|
+
KeyProvider["Notion"] = "Notion";
|
|
43
|
+
KeyProvider["Unknown"] = "Unknown";
|
|
44
|
+
})(KeyProvider || (KeyProvider = {}));
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,WA0CX;AA1CD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,uDAAwC,CAAA;IACxC,sCAAuB,CAAA;IACvB,0BAAW,CAAA;IACX,uCAAwB,CAAA;IACxB,wDAAyC,CAAA;IACzC,yCAA0B,CAAA;IAC1B,yCAA0B,CAAA;IAC1B,uCAAwB,CAAA;IACxB,qCAAsB,CAAA;IACtB,uCAAwB,CAAA;IACxB,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;IACnB,yCAA0B,CAAA;IAC1B,2CAA4B,CAAA;IAC5B,oBAAoB;IACpB,uCAAwB,CAAA;IACxB,iDAAkC,CAAA;IAClC,qCAAsB,CAAA;IACtB,uCAAwB,CAAA;IACxB,iDAAkC,CAAA;IAClC,+CAAgC,CAAA;IAChC,mDAAoC,CAAA;IACpC,uDAAwC,CAAA;IACxC,oCAAqB,CAAA;IACrB,iDAAkC,CAAA;IAClC,iDAAkC,CAAA;IAClC,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,iDAAkC,CAAA;IAClC,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;IACnB,4DAA6C,CAAA;IAC7C,gEAAiD,CAAA;IACjD,sCAAuB,CAAA;IACvB,sCAAuB,CAAA;IACvB,8BAAe,CAAA;IACf,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;AACrB,CAAC,EA1CW,WAAW,KAAX,WAAW,QA0CtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic-verifier.d.ts","sourceRoot":"","sources":["../../src/verification/anthropic-verifier.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,eAAO,MAAM,iBAAiB,EAAE,WAuD/B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { sanitizeForTerminal } from "../core/sanitize.js";
|
|
2
|
+
import { KeyProvider } from "../types/index.js";
|
|
3
|
+
export const anthropicVerifier = {
|
|
4
|
+
provider: KeyProvider.Anthropic,
|
|
5
|
+
endpoint: "https://api.anthropic.com/v1/models",
|
|
6
|
+
description: "Lists available models (read-only)",
|
|
7
|
+
async verify(secret) {
|
|
8
|
+
const key = secret.unsafeGetString();
|
|
9
|
+
try {
|
|
10
|
+
const response = await fetch("https://api.anthropic.com/v1/models", {
|
|
11
|
+
method: "GET",
|
|
12
|
+
headers: {
|
|
13
|
+
"x-api-key": key,
|
|
14
|
+
"anthropic-version": "2023-06-01",
|
|
15
|
+
"User-Agent": "compromising-position/1.0.0",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
if (response.status === 200) {
|
|
19
|
+
return {
|
|
20
|
+
provider: KeyProvider.Anthropic,
|
|
21
|
+
active: true,
|
|
22
|
+
details: "Key is active — authenticated to Anthropic API",
|
|
23
|
+
error: null,
|
|
24
|
+
endpoint: "https://api.anthropic.com/v1/models",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (response.status === 401) {
|
|
28
|
+
return {
|
|
29
|
+
provider: KeyProvider.Anthropic,
|
|
30
|
+
active: false,
|
|
31
|
+
details: "Key is invalid or revoked",
|
|
32
|
+
error: null,
|
|
33
|
+
endpoint: "https://api.anthropic.com/v1/models",
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
provider: KeyProvider.Anthropic,
|
|
38
|
+
active: false,
|
|
39
|
+
details: `Unexpected status: ${response.status}`,
|
|
40
|
+
error: `Anthropic API returned ${response.status}: ${sanitizeForTerminal(response.statusText)}`,
|
|
41
|
+
endpoint: "https://api.anthropic.com/v1/models",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
46
|
+
return {
|
|
47
|
+
provider: KeyProvider.Anthropic,
|
|
48
|
+
active: false,
|
|
49
|
+
details: "Verification failed",
|
|
50
|
+
error: `Network error: ${sanitizeForTerminal(message)}`,
|
|
51
|
+
endpoint: "https://api.anthropic.com/v1/models",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=anthropic-verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic-verifier.js","sourceRoot":"","sources":["../../src/verification/anthropic-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAGzE,MAAM,CAAC,MAAM,iBAAiB,GAAgB;IAC5C,QAAQ,EAAE,WAAW,CAAC,SAAS;IAC/B,QAAQ,EAAE,qCAAqC;IAC/C,WAAW,EAAE,oCAAoC;IAEjD,KAAK,CAAC,MAAM,CAAC,MAAoB;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;QACrC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,qCAAqC,EAAE;gBAClE,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,WAAW,EAAE,GAAG;oBAChB,mBAAmB,EAAE,YAAY;oBACjC,YAAY,EAAE,6BAA6B;iBAC5C;aACF,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,OAAO;oBACL,QAAQ,EAAE,WAAW,CAAC,SAAS;oBAC/B,MAAM,EAAE,IAAI;oBACZ,OAAO,EAAE,gDAAgD;oBACzD,KAAK,EAAE,IAAI;oBACX,QAAQ,EAAE,qCAAqC;iBAChD,CAAC;YACJ,CAAC;YAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,OAAO;oBACL,QAAQ,EAAE,WAAW,CAAC,SAAS;oBAC/B,MAAM,EAAE,KAAK;oBACb,OAAO,EAAE,2BAA2B;oBACpC,KAAK,EAAE,IAAI;oBACX,QAAQ,EAAE,qCAAqC;iBAChD,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,QAAQ,EAAE,WAAW,CAAC,SAAS;gBAC/B,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,sBAAsB,QAAQ,CAAC,MAAM,EAAE;gBAChD,KAAK,EAAE,0BAA0B,QAAQ,CAAC,MAAM,KAAK,mBAAmB,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;gBAC/F,QAAQ,EAAE,qCAAqC;aAChD,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO;gBACL,QAAQ,EAAE,WAAW,CAAC,SAAS;gBAC/B,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,qBAAqB;gBAC9B,KAAK,EAAE,kBAAkB,mBAAmB,CAAC,OAAO,CAAC,EAAE;gBACvD,QAAQ,EAAE,qCAAqC;aAChD,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { KeyVerifier } from "./verifier.js";
|
|
2
|
+
/**
|
|
3
|
+
* AWS verifier for Access Key IDs.
|
|
4
|
+
*
|
|
5
|
+
* Note: AWS Access Key verification requires both the Access Key ID
|
|
6
|
+
* and the Secret Access Key. Since we only have the Access Key ID,
|
|
7
|
+
* we can only check the format. Full verification would require the
|
|
8
|
+
* secret key as well, which the user would need to provide separately.
|
|
9
|
+
*
|
|
10
|
+
* For now, this verifier reports that the key *looks like* a valid
|
|
11
|
+
* AWS Access Key ID but cannot verify it without the secret key.
|
|
12
|
+
*/
|
|
13
|
+
export declare const awsVerifier: KeyVerifier;
|
|
14
|
+
//# sourceMappingURL=aws-verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-verifier.d.ts","sourceRoot":"","sources":["../../src/verification/aws-verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,WAkBzB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { KeyProvider } from "../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* AWS verifier for Access Key IDs.
|
|
4
|
+
*
|
|
5
|
+
* Note: AWS Access Key verification requires both the Access Key ID
|
|
6
|
+
* and the Secret Access Key. Since we only have the Access Key ID,
|
|
7
|
+
* we can only check the format. Full verification would require the
|
|
8
|
+
* secret key as well, which the user would need to provide separately.
|
|
9
|
+
*
|
|
10
|
+
* For now, this verifier reports that the key *looks like* a valid
|
|
11
|
+
* AWS Access Key ID but cannot verify it without the secret key.
|
|
12
|
+
*/
|
|
13
|
+
export const awsVerifier = {
|
|
14
|
+
provider: KeyProvider.AWS,
|
|
15
|
+
endpoint: "https://sts.amazonaws.com (GetCallerIdentity)",
|
|
16
|
+
description: "Calls STS GetCallerIdentity to check if key pair is active (read-only). Requires both Access Key ID and Secret Access Key.",
|
|
17
|
+
async verify(secret) {
|
|
18
|
+
// AWS Access Key IDs alone cannot be verified — need the secret key too.
|
|
19
|
+
// We report this limitation clearly.
|
|
20
|
+
return {
|
|
21
|
+
provider: KeyProvider.AWS,
|
|
22
|
+
active: false,
|
|
23
|
+
details: "AWS Access Key ID detected but verification requires the corresponding Secret Access Key. " +
|
|
24
|
+
"Check AWS IAM console to verify key status.",
|
|
25
|
+
error: null,
|
|
26
|
+
endpoint: "https://sts.amazonaws.com",
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=aws-verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-verifier.js","sourceRoot":"","sources":["../../src/verification/aws-verifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAGzE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,QAAQ,EAAE,WAAW,CAAC,GAAG;IACzB,QAAQ,EAAE,+CAA+C;IACzD,WAAW,EAAE,4HAA4H;IAEzI,KAAK,CAAC,MAAM,CAAC,MAAoB;QAC/B,yEAAyE;QACzE,qCAAqC;QACrC,OAAO;YACL,QAAQ,EAAE,WAAW,CAAC,GAAG;YACzB,MAAM,EAAE,KAAK;YACb,OAAO,EACL,4FAA4F;gBAC5F,6CAA6C;YAC/C,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,2BAA2B;SACtC,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-verifier.d.ts","sourceRoot":"","sources":["../../src/verification/github-verifier.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AA+DjD,eAAO,MAAM,iBAAiB,aAA4C,CAAC;AAC3E,eAAO,MAAM,yBAAyB,aAAoD,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { sanitizeForTerminal } from "../core/sanitize.js";
|
|
2
|
+
import { KeyProvider } from "../types/index.js";
|
|
3
|
+
/** Handles both classic PATs (ghp_) and fine-grained tokens (github_pat_). */
|
|
4
|
+
function makeGitHubVerifier(provider) {
|
|
5
|
+
return {
|
|
6
|
+
provider,
|
|
7
|
+
endpoint: "https://api.github.com/user",
|
|
8
|
+
description: "Gets authenticated user info and scopes (read-only)",
|
|
9
|
+
async verify(secret) {
|
|
10
|
+
const key = secret.unsafeGetString();
|
|
11
|
+
try {
|
|
12
|
+
const response = await fetch("https://api.github.com/user", {
|
|
13
|
+
method: "GET",
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${key}`,
|
|
16
|
+
"User-Agent": "compromising-position/1.0.0",
|
|
17
|
+
Accept: "application/vnd.github+json",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
if (response.status === 200) {
|
|
21
|
+
const scopes = response.headers.get("x-oauth-scopes") ?? "none";
|
|
22
|
+
return {
|
|
23
|
+
provider,
|
|
24
|
+
active: true,
|
|
25
|
+
details: `Key is active — scopes: ${sanitizeForTerminal(scopes)}`,
|
|
26
|
+
error: null,
|
|
27
|
+
endpoint: "https://api.github.com/user",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (response.status === 401) {
|
|
31
|
+
return {
|
|
32
|
+
provider,
|
|
33
|
+
active: false,
|
|
34
|
+
details: "Key is invalid or revoked",
|
|
35
|
+
error: null,
|
|
36
|
+
endpoint: "https://api.github.com/user",
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
provider,
|
|
41
|
+
active: false,
|
|
42
|
+
details: `Unexpected status: ${response.status}`,
|
|
43
|
+
error: `GitHub API returned ${response.status}: ${sanitizeForTerminal(response.statusText)}`,
|
|
44
|
+
endpoint: "https://api.github.com/user",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
49
|
+
return {
|
|
50
|
+
provider,
|
|
51
|
+
active: false,
|
|
52
|
+
details: "Verification failed",
|
|
53
|
+
error: `Network error: ${sanitizeForTerminal(message)}`,
|
|
54
|
+
endpoint: "https://api.github.com/user",
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export const githubPatVerifier = makeGitHubVerifier(KeyProvider.GitHubPAT);
|
|
61
|
+
export const githubFineGrainedVerifier = makeGitHubVerifier(KeyProvider.GitHubFineGrained);
|
|
62
|
+
//# sourceMappingURL=github-verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-verifier.js","sourceRoot":"","sources":["../../src/verification/github-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAGzE,8EAA8E;AAC9E,SAAS,kBAAkB,CAAC,QAAqB;IAC/C,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,6BAA6B;QACvC,WAAW,EAAE,qDAAqD;QAElE,KAAK,CAAC,MAAM,CAAC,MAAoB;YAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;YACrC,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,6BAA6B,EAAE;oBAC1D,MAAM,EAAE,KAAK;oBACb,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,GAAG,EAAE;wBAC9B,YAAY,EAAE,6BAA6B;wBAC3C,MAAM,EAAE,6BAA6B;qBACtC;iBACF,CAAC,CAAC;gBAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC5B,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,MAAM,CAAC;oBAChE,OAAO;wBACL,QAAQ;wBACR,MAAM,EAAE,IAAI;wBACZ,OAAO,EAAE,2BAA2B,mBAAmB,CAAC,MAAM,CAAC,EAAE;wBACjE,KAAK,EAAE,IAAI;wBACX,QAAQ,EAAE,6BAA6B;qBACxC,CAAC;gBACJ,CAAC;gBAED,I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,MAAM,qBAAqB,aAAgD,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { sanitizeForTerminal } from "../core/sanitize.js";
|
|
2
|
+
import { KeyProvider } from "../types/index.js";
|
|
3
|
+
function makeOpenAIVerifier(provider) {
|
|
4
|
+
return {
|
|
5
|
+
provider,
|
|
6
|
+
endpoint: "https://api.openai.com/v1/models",
|
|
7
|
+
description: "Lists available models (read-only)",
|
|
8
|
+
async verify(secret) {
|
|
9
|
+
const key = secret.unsafeGetString();
|
|
10
|
+
try {
|
|
11
|
+
const response = await fetch("https://api.openai.com/v1/models", {
|
|
12
|
+
method: "GET",
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: `Bearer ${key}`,
|
|
15
|
+
"User-Agent": "compromising-position/1.0.0",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
if (response.status === 200) {
|
|
19
|
+
return {
|
|
20
|
+
provider,
|
|
21
|
+
active: true,
|
|
22
|
+
details: "Key is active — authenticated to OpenAI API",
|
|
23
|
+
error: null,
|
|
24
|
+
endpoint: "https://api.openai.com/v1/models",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (response.status === 401) {
|
|
28
|
+
return {
|
|
29
|
+
provider,
|
|
30
|
+
active: false,
|
|
31
|
+
details: "Key is invalid or revoked",
|
|
32
|
+
error: null,
|
|
33
|
+
endpoint: "https://api.openai.com/v1/models",
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
provider,
|
|
38
|
+
active: false,
|
|
39
|
+
details: `Unexpected status: ${response.status}`,
|
|
40
|
+
error: `OpenAI API returned ${response.status}: ${sanitizeForTerminal(response.statusText)}`,
|
|
41
|
+
endpoint: "https://api.openai.com/v1/models",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
46
|
+
return {
|
|
47
|
+
provider,
|
|
48
|
+
active: false,
|
|
49
|
+
details: "Verification failed",
|
|
50
|
+
error: `Network error: ${sanitizeForTerminal(message)}`,
|
|
51
|
+
endpoint: "https://api.openai.com/v1/models",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export const openaiVerifier = makeOpenAIVerifier(KeyProvider.OpenAI);
|
|
58
|
+
export const openaiServiceVerifier = makeOpenAIVerifier(KeyProvider.OpenAIService);
|
|
59
|
+
//# sourceMappingURL=openai-verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai-verifier.js","sourceRoot":"","sources":["../../src/verification/openai-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAGzE,SAAS,kBAAkB,CAAC,QAAqB;IAC/C,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,kCAAkC;QAC5C,WAAW,EAAE,oCAAoC;QAEjD,KAAK,CAAC,MAAM,CAAC,MAAoB;YAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;YACrC,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,kCAAkC,EAAE;oBAC/D,MAAM,EAAE,KAAK;oBACb,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,GAAG,EAAE;wBAC9B,YAAY,EAAE,6BAA6B;qBAC5C;iBACF,CAAC,CAAC;gBAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC5B,OAAO;wBACL,QAAQ;wBACR,MAAM,EAAE,IAAI;wBACZ,OAAO,EAAE,6CAA6C;wBACtD,KAAK,EAAE,IAAI;wBACX,QAAQ,EAAE,kCAAkC;qBAC7C,CAAC;gBACJ,CAAC;gBAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;o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67 @@
|
|
|
1
|
+
import { sanitizeForTerminal } from "../core/sanitize.js";
|
|
2
|
+
import { KeyProvider } from "../types/index.js";
|
|
3
|
+
function makeSlackVerifier(provider) {
|
|
4
|
+
return {
|
|
5
|
+
provider,
|
|
6
|
+
endpoint: "https://slack.com/api/auth.test",
|
|
7
|
+
description: "Calls auth.test to check if token is active (read-only)",
|
|
8
|
+
async verify(secret) {
|
|
9
|
+
const key = secret.unsafeGetString();
|
|
10
|
+
try {
|
|
11
|
+
const response = await fetch("https://slack.com/api/auth.test", {
|
|
12
|
+
method: "POST",
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: `Bearer ${key}`,
|
|
15
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
16
|
+
"User-Agent": "compromising-position/1.0.0",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
return {
|
|
21
|
+
provider,
|
|
22
|
+
active: false,
|
|
23
|
+
details: `Unexpected HTTP status: ${response.status}`,
|
|
24
|
+
error: `Slack API returned ${response.status}: ${sanitizeForTerminal(response.statusText)}`,
|
|
25
|
+
endpoint: "https://slack.com/api/auth.test",
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const data = (await response.json());
|
|
29
|
+
if (data.ok) {
|
|
30
|
+
const info = [
|
|
31
|
+
data.team ? `team: ${sanitizeForTerminal(data.team)}` : null,
|
|
32
|
+
data.user ? `user: ${sanitizeForTerminal(data.user)}` : null,
|
|
33
|
+
]
|
|
34
|
+
.filter(Boolean)
|
|
35
|
+
.join(", ");
|
|
36
|
+
return {
|
|
37
|
+
provider,
|
|
38
|
+
active: true,
|
|
39
|
+
details: `Key is active — ${info || "authenticated to Slack"}`,
|
|
40
|
+
error: null,
|
|
41
|
+
endpoint: "https://slack.com/api/auth.test",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
provider,
|
|
46
|
+
active: false,
|
|
47
|
+
details: `Key is invalid: ${sanitizeForTerminal(data.error ?? "unknown error")}`,
|
|
48
|
+
error: null,
|
|
49
|
+
endpoint: "https://slack.com/api/auth.test",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
54
|
+
return {
|
|
55
|
+
provider,
|
|
56
|
+
active: false,
|
|
57
|
+
details: "Verification failed",
|
|
58
|
+
error: `Network error: ${sanitizeForTerminal(message)}`,
|
|
59
|
+
endpoint: "https://slack.com/api/auth.test",
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export const slackBotVerifier = makeSlackVerifier(KeyProvider.SlackBot);
|
|
66
|
+
export const slackUserVerifier = makeSlackVerifier(KeyProvider.SlackUser);
|
|
67
|
+
//# sourceMappingURL=slack-verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack-verifier.js","sourceRoot":"","sources":["../../src/verification/slack-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAGzE,SAAS,iBAAiB,CAAC,QAAqB;IAC9C,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,iCAAiC;QAC3C,WAAW,EAAE,yDAAyD;QAEtE,KAAK,CAAC,MAAM,CAAC,MAAoB;YAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;YACrC,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,iCAAiC,EAAE;oBAC9D,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,GAAG,EAAE;wBAC9B,cAAc,EAAE,mCAAmC;wBACnD,YAAY,EAAE,6BAA6B;qBAC5C;iBACF,CAAC,CAAC;gBAEH,IAAI,CAAC,QA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AG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACjE,OAAO;oBACL,QAAQ;oBACR,MAAM,EAAE,KAAK;oBACb,OAAO,EAAE,qBAAqB;oBAC9B,KAAK,EAAE,kBAAkB,mBAAmB,CAAC,OAAO,CAAC,EAAE;oBACvD,QAAQ,EAAE,iCAAiC;iBAC5C,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { KeyProvider } from "../types/index.js";
|
|
2
|
+
import type { KeyVerifier } from "./verifier.js";
|
|
3
|
+
/**
|
|
4
|
+
* Registry mapping KeyProvider enum values to their verifier implementations.
|
|
5
|
+
*/
|
|
6
|
+
export declare class VerifierRegistry {
|
|
7
|
+
#private;
|
|
8
|
+
register(verifier: KeyVerifier): void;
|
|
9
|
+
get(provider: KeyProvider): KeyVerifier | undefined;
|
|
10
|
+
has(provider: KeyProvider): boolean;
|
|
11
|
+
getAll(): KeyVerifier[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=verifier-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier-registry.d.ts","sourceRoot":"","sources":["../../src/verification/verifier-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;GAEG;AACH,qBAAa,gBAAgB;;IAG3B,QAAQ,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI;IAIrC,GAAG,CAAC,QAAQ,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS;IAInD,GAAG,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO;IAInC,MAAM,IAAI,WAAW,EAAE;CAGxB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry mapping KeyProvider enum values to their verifier implementations.
|
|
3
|
+
*/
|
|
4
|
+
export class VerifierRegistry {
|
|
5
|
+
#verifiers = new Map();
|
|
6
|
+
register(verifier) {
|
|
7
|
+
this.#verifiers.set(verifier.provider, verifier);
|
|
8
|
+
}
|
|
9
|
+
get(provider) {
|
|
10
|
+
return this.#verifiers.get(provider);
|
|
11
|
+
}
|
|
12
|
+
has(provider) {
|
|
13
|
+
return this.#verifiers.has(provider);
|
|
14
|
+
}
|
|
15
|
+
getAll() {
|
|
16
|
+
return Array.from(this.#verifiers.values());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=verifier-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier-registry.js","sourceRoot":"","sources":["../../src/verification/verifier-registry.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAClB,UAAU,GAAG,IAAI,GAAG,EAA4B,CAAC;IAE1D,QAAQ,CAAC,QAAqB;QAC5B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IAED,GAAG,CAAC,QAAqB;QACvB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,GAAG,CAAC,QAAqB;QACvB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SecureBuffer } from "../core/secure-buffer.js";
|
|
2
|
+
import type { KeyProvider, VerificationResult } from "../types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for active key verifiers.
|
|
5
|
+
* Each verifier checks if a key is still active by making a
|
|
6
|
+
* minimal read-only API call to the provider.
|
|
7
|
+
*
|
|
8
|
+
* IMPORTANT: Verifiers must only use read-only endpoints.
|
|
9
|
+
* Never make write operations with user keys.
|
|
10
|
+
*/
|
|
11
|
+
export interface KeyVerifier {
|
|
12
|
+
/** Which provider this verifier handles. */
|
|
13
|
+
readonly provider: KeyProvider;
|
|
14
|
+
/** The endpoint that will be called. Shown to the user for consent. */
|
|
15
|
+
readonly endpoint: string;
|
|
16
|
+
/** Human-readable description of what this verification does. */
|
|
17
|
+
readonly description: string;
|
|
18
|
+
/**
|
|
19
|
+
* Verify if the key is currently active.
|
|
20
|
+
* @param secret - The API key to verify.
|
|
21
|
+
*/
|
|
22
|
+
verify(secret: SecureBuffer): Promise<VerificationResult>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../src/verification/verifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAE/B,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,iEAAiE;IACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../src/verification/verifier.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "compromising-position",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Privacy-preserving credential exposure checker — were your API keys compromised? Find out.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=20.0.0"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"compromising-position": "./bin/compromising-position"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/",
|
|
14
|
+
"bin/",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"start": "node dist/index.js",
|
|
21
|
+
"dev": "tsc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"check": "tsc --noEmit",
|
|
25
|
+
"prepublishOnly": "npm run build && npm test"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"security",
|
|
29
|
+
"credentials",
|
|
30
|
+
"k-anonymity",
|
|
31
|
+
"hibp",
|
|
32
|
+
"privacy",
|
|
33
|
+
"api-keys",
|
|
34
|
+
"breach-detection",
|
|
35
|
+
"credential-exposure",
|
|
36
|
+
"openclaw",
|
|
37
|
+
"secret-scanning",
|
|
38
|
+
"cli"
|
|
39
|
+
],
|
|
40
|
+
"author": "Tommy Yau",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/tommyyau/compromising-position.git"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://github.com/tommyyau/compromising-position",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/tommyyau/compromising-position/issues"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"chalk": "^5.3.0",
|
|
52
|
+
"commander": "^12.1.0",
|
|
53
|
+
"dotenv": "^16.4.5"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/node": "^20.14.0",
|
|
57
|
+
"msw": "^2.3.0",
|
|
58
|
+
"typescript": "^5.5.0",
|
|
59
|
+
"vitest": "^2.0.0"
|
|
60
|
+
}
|
|
61
|
+
}
|