gitsieve 0.1.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 +362 -0
- package/dist/cli.d.ts +19 -0
- package/dist/cli.js +147 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.js +161 -0
- package/dist/config.js.map +1 -0
- package/dist/controls.d.ts +16 -0
- package/dist/controls.js +161 -0
- package/dist/controls.js.map +1 -0
- package/dist/corpus.d.ts +34 -0
- package/dist/corpus.js +121 -0
- package/dist/corpus.js.map +1 -0
- package/dist/git.d.ts +66 -0
- package/dist/git.js +214 -0
- package/dist/git.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/matcher.d.ts +34 -0
- package/dist/matcher.js +75 -0
- package/dist/matcher.js.map +1 -0
- package/dist/preflight.d.ts +21 -0
- package/dist/preflight.js +52 -0
- package/dist/preflight.js.map +1 -0
- package/dist/report.d.ts +8 -0
- package/dist/report.js +0 -0
- package/dist/report.js.map +1 -0
- package/dist/scan.d.ts +17 -0
- package/dist/scan.js +134 -0
- package/dist/scan.js.map +1 -0
- package/dist/secrets.d.ts +13 -0
- package/dist/secrets.js +48 -0
- package/dist/secrets.js.map +1 -0
- package/dist/types.d.ts +104 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A deliberately short list of high-signal, prefix-anchored credential
|
|
3
|
+
* patterns. This is a secondary check. gitleaks and trufflehog carry hundreds
|
|
4
|
+
* of rules plus live verification, and they are the right tool for depth --
|
|
5
|
+
* see the README. What is here exists so that an obvious key in history is not
|
|
6
|
+
* missed by someone who runs only this tool.
|
|
7
|
+
*/
|
|
8
|
+
export interface SecretPattern {
|
|
9
|
+
id: string;
|
|
10
|
+
description: string;
|
|
11
|
+
regex: RegExp;
|
|
12
|
+
}
|
|
13
|
+
export declare const SECRET_PATTERNS: SecretPattern[];
|
package/dist/secrets.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const SECRET_PATTERNS = [
|
|
2
|
+
{
|
|
3
|
+
id: "aws-access-key-id",
|
|
4
|
+
description: "AWS access key id",
|
|
5
|
+
regex: /\b(?:AKIA|ASIA|AGPA|AIDA|AROA|ANPA|ANVA)[0-9A-Z]{16}\b/g,
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
id: "github-token",
|
|
9
|
+
description: "GitHub personal access / OAuth token",
|
|
10
|
+
regex: /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{36}\b/g,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: "github-fine-grained-token",
|
|
14
|
+
description: "GitHub fine-grained personal access token",
|
|
15
|
+
regex: /\bgithub_pat_[A-Za-z0-9_]{60,}\b/g,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "private-key-block",
|
|
19
|
+
description: "PEM private key block",
|
|
20
|
+
regex: /-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY(?: BLOCK)?-----/g,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "slack-token",
|
|
24
|
+
description: "Slack token",
|
|
25
|
+
regex: /\bxox[abposr]-[A-Za-z0-9-]{10,}\b/g,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "google-api-key",
|
|
29
|
+
description: "Google API key",
|
|
30
|
+
regex: /\bAIza[0-9A-Za-z_-]{35}\b/g,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "stripe-secret-key",
|
|
34
|
+
description: "Stripe secret or restricted key",
|
|
35
|
+
regex: /\b(?:sk|rk)_(?:live|test)_[0-9A-Za-z]{16,}\b/g,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "npm-token",
|
|
39
|
+
description: "npm access token",
|
|
40
|
+
regex: /\bnpm_[A-Za-z0-9]{36}\b/g,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "jwt",
|
|
44
|
+
description: "JSON Web Token",
|
|
45
|
+
regex: /\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g,
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
//# sourceMappingURL=secrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C;QACE,EAAE,EAAE,mBAAmB;QACvB,WAAW,EAAE,mBAAmB;QAChC,KAAK,EAAE,yDAAyD;KACjE;IACD;QACE,EAAE,EAAE,cAAc;QAClB,WAAW,EAAE,sCAAsC;QACnD,KAAK,EAAE,8CAA8C;KACtD;IACD;QACE,EAAE,EAAE,2BAA2B;QAC/B,WAAW,EAAE,2CAA2C;QACxD,KAAK,EAAE,mCAAmC;KAC3C;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,WAAW,EAAE,uBAAuB;QACpC,KAAK,EACH,yEAAyE;KAC5E;IACD;QACE,EAAE,EAAE,aAAa;QACjB,WAAW,EAAE,aAAa;QAC1B,KAAK,EAAE,oCAAoC;KAC5C;IACD;QACE,EAAE,EAAE,gBAAgB;QACpB,WAAW,EAAE,gBAAgB;QAC7B,KAAK,EAAE,4BAA4B;KACpC;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,WAAW,EAAE,iCAAiC;QAC9C,KAAK,EAAE,+CAA+C;KACvD;IACD;QACE,EAAE,EAAE,WAAW;QACf,WAAW,EAAE,kBAAkB;QAC/B,KAAK,EAAE,0BAA0B;KAClC;IACD;QACE,EAAE,EAAE,KAAK;QACT,WAAW,EAAE,gBAAgB;QAC7B,KAAK,EAAE,oEAAoE;KAC5E;CACF,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The five places a private repository leaks organisation-owned vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* The incident this tool was written for leaked through `paths` (a directory
|
|
5
|
+
* named after a product) and `identities` (an employer email address in the
|
|
6
|
+
* author field). A content-only scanner sees neither.
|
|
7
|
+
*/
|
|
8
|
+
export type Channel = "contents" | "paths" | "messages" | "identities" | "refs";
|
|
9
|
+
export declare const CHANNELS: readonly Channel[];
|
|
10
|
+
export declare function isChannel(value: unknown): value is Channel;
|
|
11
|
+
/**
|
|
12
|
+
* A term is a literal string, never a regular expression. Users supply
|
|
13
|
+
* organisation, product and client names; asking them for regex would invite
|
|
14
|
+
* both escaping bugs and terms that quietly match nothing.
|
|
15
|
+
*/
|
|
16
|
+
export interface TermSpec {
|
|
17
|
+
id: string;
|
|
18
|
+
value: string;
|
|
19
|
+
/**
|
|
20
|
+
* "auto" (default) applies ASCII word boundaries only when the term begins
|
|
21
|
+
* and ends with an ASCII word character. Korean, Japanese and Chinese terms
|
|
22
|
+
* therefore match as substrings, because `\b` is defined on [A-Za-z0-9_]
|
|
23
|
+
* and would never fire next to a Hangul syllable.
|
|
24
|
+
*/
|
|
25
|
+
wholeWord?: "auto" | "always" | "never";
|
|
26
|
+
caseSensitive?: boolean;
|
|
27
|
+
/** Restrict this term to some channels. Defaults to all five. */
|
|
28
|
+
channels?: Channel[];
|
|
29
|
+
note?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Suppressions reference a term by id, never by value. A suppression file that
|
|
33
|
+
* repeated the sensitive string would be the leak it was written to prevent.
|
|
34
|
+
*/
|
|
35
|
+
export interface SuppressionSpec {
|
|
36
|
+
termId: string;
|
|
37
|
+
channel?: Channel;
|
|
38
|
+
path?: string;
|
|
39
|
+
pathPrefix?: string;
|
|
40
|
+
reason: string;
|
|
41
|
+
}
|
|
42
|
+
/** A string the operator asserts is present, used to prove the scanner runs. */
|
|
43
|
+
export interface ControlSpec {
|
|
44
|
+
value: string;
|
|
45
|
+
channel: Channel;
|
|
46
|
+
note?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface Config {
|
|
49
|
+
terms: TermSpec[];
|
|
50
|
+
suppress?: SuppressionSpec[];
|
|
51
|
+
controls?: ControlSpec[];
|
|
52
|
+
/** Secret patterns are a secondary check; on by default, cheap to disable. */
|
|
53
|
+
secrets?: boolean;
|
|
54
|
+
/** Blobs larger than this are not read. Their paths are still scanned. */
|
|
55
|
+
maxBlobBytes?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface Finding {
|
|
58
|
+
kind: "term" | "secret";
|
|
59
|
+
id: string;
|
|
60
|
+
channel: Channel;
|
|
61
|
+
location: string;
|
|
62
|
+
path?: string;
|
|
63
|
+
line?: number;
|
|
64
|
+
matches: number;
|
|
65
|
+
/** Redacted unless --show-matches is passed. */
|
|
66
|
+
sample?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface Warning {
|
|
69
|
+
code: string;
|
|
70
|
+
message: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ControlResult {
|
|
73
|
+
value: string;
|
|
74
|
+
channel: Channel;
|
|
75
|
+
derived: boolean;
|
|
76
|
+
matches: number;
|
|
77
|
+
note?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface ScanReport {
|
|
80
|
+
repo: string;
|
|
81
|
+
/**
|
|
82
|
+
* False means: do not read the findings list as an answer. A zero from an
|
|
83
|
+
* untrusted scan is the failure mode this whole tool exists to prevent.
|
|
84
|
+
*/
|
|
85
|
+
trusted: boolean;
|
|
86
|
+
untrustedReasons: string[];
|
|
87
|
+
controls: ControlResult[];
|
|
88
|
+
findings: Finding[];
|
|
89
|
+
suppressed: {
|
|
90
|
+
id: string;
|
|
91
|
+
channel: Channel;
|
|
92
|
+
location: string;
|
|
93
|
+
reason: string;
|
|
94
|
+
}[];
|
|
95
|
+
warnings: Warning[];
|
|
96
|
+
stats: {
|
|
97
|
+
commits: number;
|
|
98
|
+
refs: number;
|
|
99
|
+
paths: number;
|
|
100
|
+
objects: number;
|
|
101
|
+
blobsRead: number;
|
|
102
|
+
bytesScanned: number;
|
|
103
|
+
};
|
|
104
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,QAAQ,GAAuB;IAC1C,UAAU;IACV,OAAO;IACP,UAAU;IACV,YAAY;IACZ,MAAM;CACE,CAAC;AAEX,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,QAA8B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gitsieve",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Audit a private repository's entire git history before you open-source it.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"open-source",
|
|
7
|
+
"audit",
|
|
8
|
+
"git-history",
|
|
9
|
+
"secret-scanning",
|
|
10
|
+
"leak",
|
|
11
|
+
"pre-publish",
|
|
12
|
+
"compliance",
|
|
13
|
+
"cli",
|
|
14
|
+
"security"
|
|
15
|
+
],
|
|
16
|
+
"author": "John Yoon",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/sparkYJO1/gitsieve.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/sparkYJO1/gitsieve#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/sparkYJO1/gitsieve/issues"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"main": "dist/index.js",
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"type": "module",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"bin": {
|
|
39
|
+
"gitsieve": "dist/cli.js"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"README.md",
|
|
44
|
+
"LICENSE"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=20"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc -p tsconfig.json",
|
|
51
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"test:watch": "vitest",
|
|
54
|
+
"selfcheck": "npm run build && node dist/cli.js --repo . --terms gitsieve.selfcheck.json --allow-terms-in-repo",
|
|
55
|
+
"prepublishOnly": "npm run build && npm test"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/node": "^22.10.0",
|
|
60
|
+
"typescript": "^5.7.2",
|
|
61
|
+
"vitest": "^2.1.8"
|
|
62
|
+
}
|
|
63
|
+
}
|