@nibgat/nmcp 0.0.0-stage → 2.0.1
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 +111 -2
- package/dist/auth/vault.d.ts +85 -0
- package/dist/auth/vault.js +256 -0
- package/dist/auth/vault.js.map +1 -0
- package/dist/bin/nmcp.d.ts +2 -0
- package/dist/bin/nmcp.js +198 -0
- package/dist/bin/nmcp.js.map +1 -0
- package/dist/cli/configSnippets.d.ts +11 -0
- package/dist/cli/configSnippets.js +57 -0
- package/dist/cli/configSnippets.js.map +1 -0
- package/dist/config/constants.d.ts +31 -0
- package/dist/config/constants.js +87 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/data/ecosystem.d.ts +187 -0
- package/dist/data/ecosystem.js +955 -0
- package/dist/data/ecosystem.js.map +1 -0
- package/dist/http/client.d.ts +31 -0
- package/dist/http/client.js +179 -0
- package/dist/http/client.js.map +1 -0
- package/dist/http/server.d.ts +17 -0
- package/dist/http/server.js +210 -0
- package/dist/http/server.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +2 -0
- package/dist/prompts/index.js +132 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/index.d.ts +2 -0
- package/dist/resources/index.js +108 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/security/redact.d.ts +2 -0
- package/dist/security/redact.js +183 -0
- package/dist/security/redact.js.map +1 -0
- package/dist/security/validators.d.ts +205 -0
- package/dist/security/validators.js +394 -0
- package/dist/security/validators.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.js +44 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.js +1323 -0
- package/dist/tools/index.js.map +1 -0
- package/package.json +67 -5
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { gitRefSchema, repoFullNameSchema } from "../security/validators.js";
|
|
3
|
+
export const registerPrompts = (server) => {
|
|
4
|
+
server.registerPrompt("release-service", {
|
|
5
|
+
title: "Release NİBGAT Service",
|
|
6
|
+
description: "Step-by-step safe release workflow using ncli and nmcp tools.",
|
|
7
|
+
argsSchema: {
|
|
8
|
+
repo: repoFullNameSchema.describe("Repository in owner/repo format (e.g. nibgat/my-service)."),
|
|
9
|
+
version: gitRefSchema.describe("Release tag/version (e.g. v1.2.0)."),
|
|
10
|
+
notes: z.string().max(4000).optional().describe("Optional release notes summary.")
|
|
11
|
+
}
|
|
12
|
+
}, async ({ repo, version, notes }) => {
|
|
13
|
+
const notesSection = notes
|
|
14
|
+
? `\nIncluded release notes:\n${notes}\n`
|
|
15
|
+
: "\nDraft concise release notes from the recent commit history before publishing.\n";
|
|
16
|
+
return {
|
|
17
|
+
description: `Safe release workflow for ${repo}@${version}`,
|
|
18
|
+
messages: [
|
|
19
|
+
{
|
|
20
|
+
role: "user",
|
|
21
|
+
content: {
|
|
22
|
+
type: "text",
|
|
23
|
+
text: [
|
|
24
|
+
`Prepare and execute a safe release of \`${repo}\` at version \`${version}\` on N - Git (\`https://git.nibgat.space\`).`,
|
|
25
|
+
notesSection,
|
|
26
|
+
"Follow this exact sequence:",
|
|
27
|
+
"1. Call `nibgat_whoami` to verify active authentication and ensure write scope is available.",
|
|
28
|
+
`2. Call \`ngit_repo_get\` and \`ngit_releases_list\` for \`${repo}\` to confirm the default branch and ensure \`${version}\` does not already exist.`,
|
|
29
|
+
"3. Call `ncli_pipeline_validate` on the repository's `.ngit-deploy.json` to confirm zero security or schema errors before triggering deployment.",
|
|
30
|
+
`4. Call \`ngit_deployments_list\` for \`${repo}\` to verify no deployment is currently running or stuck.`,
|
|
31
|
+
`5. Publish the release using \`ngit_release_create\` (or advise the exact \`ncli release create ${repo} --tag ${version}\` command if running in \`--read-only\` mode).`,
|
|
32
|
+
`6. Monitor rollout via \`ngit_deployments_list\` and verify public liveness via \`nibgat_health_check\`.`
|
|
33
|
+
].join("\n")
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
server.registerPrompt("setup-pipeline", {
|
|
40
|
+
title: "Setup N - Git CI/CD Pipeline",
|
|
41
|
+
description: "End-to-end client .ngit-deploy.json and self-hosted runner setup workflow.",
|
|
42
|
+
argsSchema: {
|
|
43
|
+
repo: repoFullNameSchema.describe("Repository in owner/repo format."),
|
|
44
|
+
projectType: z.enum([
|
|
45
|
+
"docker",
|
|
46
|
+
"static"
|
|
47
|
+
]).describe("Pipeline deployment type: 'docker' or 'static'."),
|
|
48
|
+
targetHost: z.string().trim().max(120).optional().describe("Optional target deployment hostname (e.g. app.nibgat.space).")
|
|
49
|
+
}
|
|
50
|
+
}, async ({ repo, projectType, targetHost }) => {
|
|
51
|
+
const hostLine = targetHost ? `Target public host: \`${targetHost}\`.` : "Target public host: confirm with the user if healthcheckUrl is needed.";
|
|
52
|
+
return {
|
|
53
|
+
description: `End-to-end ${projectType} pipeline setup for ${repo}`,
|
|
54
|
+
messages: [
|
|
55
|
+
{
|
|
56
|
+
role: "user",
|
|
57
|
+
content: {
|
|
58
|
+
type: "text",
|
|
59
|
+
text: [
|
|
60
|
+
`Set up a production-ready \`${projectType}\` Release-to-Deploy pipeline for \`${repo}\`.`,
|
|
61
|
+
hostLine,
|
|
62
|
+
"",
|
|
63
|
+
"Execute these steps:",
|
|
64
|
+
"1. Read `nibgat://pipeline/schema` to ensure full compliance with N - Git pipeline security rules.",
|
|
65
|
+
`2. Call \`ngit_repo_get\` and \`ngit_runners_list\` for \`${repo}\` to inspect existing branches and runners.`,
|
|
66
|
+
`3. Call \`ncli_pipeline_generate_config\` for \`${repo}\` with \`type: "${projectType}"\` and validate the resulting manifest using \`ncli_pipeline_validate\`.`,
|
|
67
|
+
"4. Call `ncli_command_guide` with topics `pipeline` and `runner` to provide exact client (`ncli pipeline init`) and server (`ncli runner init` / `ncli runner start --systemd`) commands.",
|
|
68
|
+
"5. Verify `onPush: false` is recommended for production safety and outline how the first release (`v1.0.0`) will build, push/sync, and verify health."
|
|
69
|
+
].join("\n")
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
server.registerPrompt("diagnose-deployment", {
|
|
76
|
+
title: "Diagnose Failed or Stalled Deployment",
|
|
77
|
+
description: "Inspects latest deployment logs, runners, releases, and healthchecks to diagnose CI/CD failures.",
|
|
78
|
+
argsSchema: {
|
|
79
|
+
repo: repoFullNameSchema.describe("Repository in owner/repo format.")
|
|
80
|
+
}
|
|
81
|
+
}, async ({ repo }) => ({
|
|
82
|
+
description: `Deployment diagnostics for ${repo}`,
|
|
83
|
+
messages: [
|
|
84
|
+
{
|
|
85
|
+
role: "user",
|
|
86
|
+
content: {
|
|
87
|
+
type: "text",
|
|
88
|
+
text: [
|
|
89
|
+
`Diagnose the latest CI/CD deployment status for \`${repo}\`.`,
|
|
90
|
+
"",
|
|
91
|
+
"Perform a systematic triage:",
|
|
92
|
+
`1. Call \`ngit_deployments_list\` for \`${repo}\` and examine the latest run's \`status\`, \`stage\`, \`durationMs\`, and \`logs\`.`,
|
|
93
|
+
`2. Call \`ngit_runners_list\` for \`${repo}\` to check whether a runner is active and recently seen.`,
|
|
94
|
+
`3. Call \`ngit_releases_list\` for \`${repo}\` to verify the released tag and commit SHA.`,
|
|
95
|
+
"4. Call `nibgat_health_check` to rule out upstream gateway or N - Git service degradation.",
|
|
96
|
+
"5. If a `.ngit-deploy.json` manifest is available locally, run `ncli_pipeline_validate` to catch schema or security rejections (e.g. unsafe `targetDir` or invalid `buildScript`).",
|
|
97
|
+
"6. Summarize root cause, exact remediation steps, and whether a manual redeploy via `ngit_deployment_trigger` or `ncli deploy trigger` is safe."
|
|
98
|
+
].join("\n")
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}));
|
|
103
|
+
server.registerPrompt("scaffold-ncore-app", {
|
|
104
|
+
title: "Scaffold Compliant NCore UI Kit 2.0 App",
|
|
105
|
+
description: "Guide for creating an application compliant with NİBGAT NCore UI Kit 2.0 standards.",
|
|
106
|
+
argsSchema: {
|
|
107
|
+
appName: z.string().trim().min(2).max(80).describe("Application slug or display name."),
|
|
108
|
+
domain: z.string().trim().min(3).max(120).describe("Public domain for the application (e.g. docs.nibgat.space).")
|
|
109
|
+
}
|
|
110
|
+
}, async ({ appName, domain }) => ({
|
|
111
|
+
description: `NCore UI Kit 2.0 application blueprint for ${appName} (${domain})`,
|
|
112
|
+
messages: [
|
|
113
|
+
{
|
|
114
|
+
role: "user",
|
|
115
|
+
content: {
|
|
116
|
+
type: "text",
|
|
117
|
+
text: [
|
|
118
|
+
`Design and scaffold the NİBGAT frontend application \`${appName}\` targeting \`https://${domain.replace(/^https?:\/\//i, "")}\`.`,
|
|
119
|
+
"",
|
|
120
|
+
"Required standards to follow:",
|
|
121
|
+
"1. Read `nibgat://standards/ncore-ui-kit` and `nibgat://ecosystem/architecture` first.",
|
|
122
|
+
"2. Enforce `initialSelectedGapPropagation=\"spacious\"` across the entire app (compact mode is strictly forbidden).",
|
|
123
|
+
"3. Structure every page/component as `<Name>/index.tsx` + `<Name>/stylesheet.ts` + `<Name>/type.ts`, with sub-sections under `views/<Section>/index.tsx`.",
|
|
124
|
+
"4. Apply 4-space indentation, semicolons, strict multiline imports/props/hooks, longest-to-shortest sorting, `NCoreUIKitTheme.useContext()`, and `NCoreUIKitLocalize.useContext()`.",
|
|
125
|
+
"5. Generate a matching `.ngit-deploy.json` via `ncli_pipeline_generate_config` (`type: \"static\"` or `\"docker\"`) and verify `yarn lint` + `yarn type-check` are part of the release checklist."
|
|
126
|
+
].join("\n")
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}));
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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oBACZ,IAAI,EAAE;wBACF,yDAAyD,OAAO,0BAA0B,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,KAAK;wBAClI,EAAE;wBACF,+BAA+B;wBAC/B,wFAAwF;wBACxF,qHAAqH;wBACrH,2JAA2J;wBAC3J,qLAAqL;wBACrL,mMAAmM;qBACtM,CAAC,IAAI,CAAC,IAAI,CAAC;iBACf;aACJ;SACJ;KACJ,CAAC,CACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { PIPELINE_JSON_SCHEMA, RESOURCE_API_CATALOG, RESOURCE_BUYMENT_CATALOG, RESOURCE_CLI_REFERENCE, RESOURCE_CLOUD_CATALOG, RESOURCE_CLOUD_REGIONS, RESOURCE_ECOSYSTEM_ARCHITECTURE, RESOURCE_NCORE_STANDARDS } from "../data/ecosystem.js";
|
|
2
|
+
export const registerResources = (server) => {
|
|
3
|
+
server.registerResource("ecosystem-architecture", "nibgat://ecosystem/architecture", {
|
|
4
|
+
title: "NİBGAT Core Complex Architecture",
|
|
5
|
+
description: "Complete public Core Complex architecture, domains, auth model, and service boundaries.",
|
|
6
|
+
mimeType: "text/markdown"
|
|
7
|
+
}, async (uri) => ({
|
|
8
|
+
contents: [
|
|
9
|
+
{
|
|
10
|
+
uri: uri.href,
|
|
11
|
+
mimeType: "text/markdown",
|
|
12
|
+
text: RESOURCE_ECOSYSTEM_ARCHITECTURE
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}));
|
|
16
|
+
server.registerResource("cli-reference", "nibgat://cli/reference", {
|
|
17
|
+
title: "ncli Official CLI Reference",
|
|
18
|
+
description: "Full ncli command tree, flags, auth flows, pipeline release workflow, and self-hosted runner setup guide.",
|
|
19
|
+
mimeType: "text/markdown"
|
|
20
|
+
}, async (uri) => ({
|
|
21
|
+
contents: [
|
|
22
|
+
{
|
|
23
|
+
uri: uri.href,
|
|
24
|
+
mimeType: "text/markdown",
|
|
25
|
+
text: RESOURCE_CLI_REFERENCE
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}));
|
|
29
|
+
server.registerResource("pipeline-schema", "nibgat://pipeline/schema", {
|
|
30
|
+
title: "N - Git .ngit-deploy.json Pipeline JSON Schema",
|
|
31
|
+
description: "Complete .ngit-deploy.json JSON Schema, security validation rules, and examples for Docker & Static deployments.",
|
|
32
|
+
mimeType: "application/json"
|
|
33
|
+
}, async (uri) => ({
|
|
34
|
+
contents: [
|
|
35
|
+
{
|
|
36
|
+
uri: uri.href,
|
|
37
|
+
mimeType: "application/json",
|
|
38
|
+
text: JSON.stringify(PIPELINE_JSON_SCHEMA, null, 4)
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}));
|
|
42
|
+
server.registerResource("api-catalog", "nibgat://api/catalog", {
|
|
43
|
+
title: "Core Complex & N - Git Public API Catalog",
|
|
44
|
+
description: "Complete public API endpoint catalog for core.nibgat.space and git.nibgat.space.",
|
|
45
|
+
mimeType: "text/markdown"
|
|
46
|
+
}, async (uri) => ({
|
|
47
|
+
contents: [
|
|
48
|
+
{
|
|
49
|
+
uri: uri.href,
|
|
50
|
+
mimeType: "text/markdown",
|
|
51
|
+
text: RESOURCE_API_CATALOG
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}));
|
|
55
|
+
server.registerResource("ncore-ui-kit-standards", "nibgat://standards/ncore-ui-kit", {
|
|
56
|
+
title: "NCore UI Kit 2.0 & Coding Standards",
|
|
57
|
+
description: "NİBGAT NCore UI Kit 2.0 and frontend engineering standards (spacious-only, folder/index pattern, longest-to-shortest, theme-first, localization).",
|
|
58
|
+
mimeType: "text/markdown"
|
|
59
|
+
}, async (uri) => ({
|
|
60
|
+
contents: [
|
|
61
|
+
{
|
|
62
|
+
uri: uri.href,
|
|
63
|
+
mimeType: "text/markdown",
|
|
64
|
+
text: RESOURCE_NCORE_STANDARDS
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}));
|
|
68
|
+
server.registerResource("buyment-catalog", "nibgat://buyment/catalog", {
|
|
69
|
+
title: "N - Buyment Commerce & Billing Reference",
|
|
70
|
+
description: "Billing modes, TRY prepaid wallet, PayTR & Bank Transfer checkout, and Trendyol e-Faturam automation.",
|
|
71
|
+
mimeType: "text/markdown"
|
|
72
|
+
}, async (uri) => ({
|
|
73
|
+
contents: [
|
|
74
|
+
{
|
|
75
|
+
uri: uri.href,
|
|
76
|
+
mimeType: "text/markdown",
|
|
77
|
+
text: RESOURCE_BUYMENT_CATALOG
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}));
|
|
81
|
+
server.registerResource("cloud-regions", "nibgat://cloud/regions", {
|
|
82
|
+
title: "N - Cloud Global Region Availability",
|
|
83
|
+
description: "7 global N - Cloud locations showing Istanbul (tr-ist-1) active and 6 coming_soon regions.",
|
|
84
|
+
mimeType: "text/markdown"
|
|
85
|
+
}, async (uri) => ({
|
|
86
|
+
contents: [
|
|
87
|
+
{
|
|
88
|
+
uri: uri.href,
|
|
89
|
+
mimeType: "text/markdown",
|
|
90
|
+
text: RESOURCE_CLOUD_REGIONS
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}));
|
|
94
|
+
server.registerResource("cloud-catalog", "nibgat://cloud/catalog", {
|
|
95
|
+
title: "N - Cloud Services & Physical Hardware Portfolio",
|
|
96
|
+
description: "70% cloud services (N - Compute, N - Run, N - Storage, N - Net, N - Vault) and 30% physical hardware (N - Metal, N - Hardware).",
|
|
97
|
+
mimeType: "text/markdown"
|
|
98
|
+
}, async (uri) => ({
|
|
99
|
+
contents: [
|
|
100
|
+
{
|
|
101
|
+
uri: uri.href,
|
|
102
|
+
mimeType: "text/markdown",
|
|
103
|
+
text: RESOURCE_CLOUD_CATALOG
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}));
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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AC7C,WAAW,EAAE,4FAA4F;QACzG,QAAQ,EAAE,eAAe;KAC5B,EACD,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QACZ,QAAQ,EAAE;YACN;gBACI,GAAG,EAAE,GAAG,CAAC,IAAI;gBACb,QAAQ,EAAE,eAAe;gBACzB,IAAI,EAAE,sBAAsB;aAC/B;SACJ;KACJ,CAAC,CACL,CAAC;IAEF,MAAM,CAAC,gBAAgB,CACnB,eAAe,EACf,wBAAwB,EACxB;QACI,KAAK,EAAE,kDAAkD;QACzD,WAAW,EAAE,iIAAiI;QAC9I,QAAQ,EAAE,eAAe;KAC5B,EACD,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QACZ,QAAQ,EAAE;YACN;gBACI,GAAG,EAAE,GAAG,CAAC,IAAI;gBACb,QAAQ,EAAE,eAAe;gBACzB,IAAI,EAAE,sBAAsB;aAC/B;SACJ;KACJ,CAAC,CACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
const SENSITIVE_KEY_EXACT = new Set([
|
|
2
|
+
"authorization",
|
|
3
|
+
"cookie",
|
|
4
|
+
"set-cookie",
|
|
5
|
+
"password",
|
|
6
|
+
"passwd",
|
|
7
|
+
"passphrase",
|
|
8
|
+
"secret",
|
|
9
|
+
"webhooksecret",
|
|
10
|
+
"clientsecret",
|
|
11
|
+
"signingsecret",
|
|
12
|
+
"token",
|
|
13
|
+
"rawtoken",
|
|
14
|
+
"plaintoken",
|
|
15
|
+
"accesstoken",
|
|
16
|
+
"refreshtoken",
|
|
17
|
+
"idtoken",
|
|
18
|
+
"runnertoken",
|
|
19
|
+
"sessiontoken",
|
|
20
|
+
"ssosessiontoken",
|
|
21
|
+
"sessioncookie",
|
|
22
|
+
"ssocookie",
|
|
23
|
+
"nauthsession",
|
|
24
|
+
"ngittoken",
|
|
25
|
+
"nclitoken",
|
|
26
|
+
"pat",
|
|
27
|
+
"apikey",
|
|
28
|
+
"privatekey",
|
|
29
|
+
"tokenhash",
|
|
30
|
+
"apppassword",
|
|
31
|
+
"x-ngit-signature-256",
|
|
32
|
+
"x-api-key"
|
|
33
|
+
]);
|
|
34
|
+
const SENSITIVE_KEY_SUFFIXES = [
|
|
35
|
+
"secret",
|
|
36
|
+
"password",
|
|
37
|
+
"passwd",
|
|
38
|
+
"passphrase",
|
|
39
|
+
"privatekey",
|
|
40
|
+
"accesstoken",
|
|
41
|
+
"refreshtoken",
|
|
42
|
+
"sessiontoken",
|
|
43
|
+
"sessioncookie",
|
|
44
|
+
"tokenhash",
|
|
45
|
+
"apikey",
|
|
46
|
+
"authtoken"
|
|
47
|
+
];
|
|
48
|
+
const SAFE_METADATA_KEYS = new Set([
|
|
49
|
+
"hastoken",
|
|
50
|
+
"hascoretoken",
|
|
51
|
+
"hasgittoken",
|
|
52
|
+
"hassessioncookie",
|
|
53
|
+
"hassecret",
|
|
54
|
+
"tokencount",
|
|
55
|
+
"tokenprefix",
|
|
56
|
+
"authenticated",
|
|
57
|
+
"authvia",
|
|
58
|
+
"scopes",
|
|
59
|
+
"expiresat",
|
|
60
|
+
"lastusedat"
|
|
61
|
+
]);
|
|
62
|
+
const STRING_SECRET_PATTERNS = [
|
|
63
|
+
{
|
|
64
|
+
pattern: /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g,
|
|
65
|
+
replacement: "[PRIVATE_KEY_REDACTED]"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
pattern: /\bngit_pat_[A-Za-z0-9._-]{4,}\b/g,
|
|
69
|
+
replacement: "ngit_pat_[REDACTED]"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
pattern: /\bngit_run_[A-Za-z0-9._-]{4,}\b/g,
|
|
73
|
+
replacement: "ngit_run_[REDACTED]"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
pattern: /\bngit_ci_[A-Za-z0-9._-]{4,}\b/g,
|
|
77
|
+
replacement: "ngit_ci_[REDACTED]"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
pattern: /\bnauth_sso_session=[^;\s"'`<>]+/gi,
|
|
81
|
+
replacement: "nauth_sso_session=[REDACTED]"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
pattern: /\bnauth_sso_sid=[^;\s"'`<>]+/gi,
|
|
85
|
+
replacement: "nauth_sso_sid=[REDACTED]"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
pattern: /\bnauth_did=[^;\s"'`<>]+/gi,
|
|
89
|
+
replacement: "nauth_did=[REDACTED]"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
pattern: /\b(Bearer)\s+[A-Za-z0-9._~+/=-]{6,}/gi,
|
|
93
|
+
replacement: "$1 [REDACTED]"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
pattern: /\b(Basic)\s+[A-Za-z0-9+/=]{6,}/gi,
|
|
97
|
+
replacement: "$1 [REDACTED]"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
pattern: /\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g,
|
|
101
|
+
replacement: "[JWT_REDACTED]"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
pattern: /\b(sha256=)[a-f0-9]{32,128}\b/gi,
|
|
105
|
+
replacement: "$1[REDACTED]"
|
|
106
|
+
}
|
|
107
|
+
];
|
|
108
|
+
const isSensitiveKey = (rawKey) => {
|
|
109
|
+
const normalized = rawKey.trim().toLowerCase().replace(/[\s_-]+/g, "");
|
|
110
|
+
if (!normalized || SAFE_METADATA_KEYS.has(normalized)) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (SENSITIVE_KEY_EXACT.has(rawKey.trim().toLowerCase()) || SENSITIVE_KEY_EXACT.has(normalized)) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
for (const suffix of SENSITIVE_KEY_SUFFIXES) {
|
|
117
|
+
if (normalized.endsWith(suffix)) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return false;
|
|
122
|
+
};
|
|
123
|
+
export const redactString = (input) => {
|
|
124
|
+
let sanitized = input;
|
|
125
|
+
for (const rule of STRING_SECRET_PATTERNS) {
|
|
126
|
+
sanitized = sanitized.replace(rule.pattern, rule.replacement);
|
|
127
|
+
}
|
|
128
|
+
return sanitized;
|
|
129
|
+
};
|
|
130
|
+
const redactValueInternal = (value, seen) => {
|
|
131
|
+
if (typeof value === "string") {
|
|
132
|
+
return redactString(value);
|
|
133
|
+
}
|
|
134
|
+
if (value === null ||
|
|
135
|
+
value === undefined ||
|
|
136
|
+
typeof value === "number" ||
|
|
137
|
+
typeof value === "boolean") {
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
if (value instanceof Date) {
|
|
141
|
+
return value.toISOString();
|
|
142
|
+
}
|
|
143
|
+
if (value instanceof Error) {
|
|
144
|
+
return {
|
|
145
|
+
name: value.name,
|
|
146
|
+
message: redactString(value.message)
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
if (Array.isArray(value)) {
|
|
150
|
+
if (seen.has(value)) {
|
|
151
|
+
return "[CIRCULAR]";
|
|
152
|
+
}
|
|
153
|
+
seen.add(value);
|
|
154
|
+
return value.map((item) => redactValueInternal(item, seen));
|
|
155
|
+
}
|
|
156
|
+
if (typeof value === "object") {
|
|
157
|
+
if (seen.has(value)) {
|
|
158
|
+
return "[CIRCULAR]";
|
|
159
|
+
}
|
|
160
|
+
seen.add(value);
|
|
161
|
+
const record = value;
|
|
162
|
+
const output = {};
|
|
163
|
+
for (const [key, entryValue] of Object.entries(record)) {
|
|
164
|
+
if (isSensitiveKey(key)) {
|
|
165
|
+
if (entryValue === null || entryValue === undefined || entryValue === "") {
|
|
166
|
+
output[key] = null;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
output[key] = "[REDACTED]";
|
|
170
|
+
}
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
output[key] = redactValueInternal(entryValue, seen);
|
|
174
|
+
}
|
|
175
|
+
return output;
|
|
176
|
+
}
|
|
177
|
+
return String(value);
|
|
178
|
+
};
|
|
179
|
+
export const redactSecrets = (input) => {
|
|
180
|
+
const seen = new WeakSet();
|
|
181
|
+
return redactValueInternal(input, seen);
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=redact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/security/redact.ts"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAS;IACxC,eAAe;IACf,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,QAAQ;IACR,eAAe;IACf,cAAc;IACd,eAAe;IACf,OAAO;IACP,UAAU;IACV,YAAY;IACZ,aAAa;IACb,cAAc;IACd,SAAS;IACT,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,eAAe;IACf,WAAW;IACX,cAAc;IACd,WAAW;IACX,WAAW;IACX,KAAK;IACL,QAAQ;IACR,YAAY;IACZ,WAAW;IACX,aAAa;IACb,sBAAsB;IACtB,WAAW;CACd,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG;IAC3B,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;IACf,WAAW;IACX,QAAQ;IACR,WAAW;CACd,CAAC;AAEF,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAS;IACvC,UAAU;IACV,cAAc;IACd,aAAa;IACb,kBAAkB;IAClB,WAAW;IACX,YAAY;IACZ,aAAa;IACb,eAAe;IACf,SAAS;IACT,QAAQ;IACR,WAAW;IACX,YAAY;CACf,CAAC,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1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const slugSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
3
|
+
export declare const gitRefSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>;
|
|
4
|
+
export declare const safeUrlSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
5
|
+
export declare const repoFullNameSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
6
|
+
export declare const hasPathTraversal: (rawPath: string) => boolean;
|
|
7
|
+
export declare const isSafeRelativeRepoPath: (rawPath: string) => boolean;
|
|
8
|
+
export declare const isSafeStaticTargetDir: (rawPath: string) => boolean;
|
|
9
|
+
export declare const dockerPipelineSchema: z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"docker">;
|
|
11
|
+
image: z.ZodEffects<z.ZodString, string, string>;
|
|
12
|
+
dockerfile: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
13
|
+
context: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
14
|
+
subDir: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
15
|
+
target: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
16
|
+
composeService: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
17
|
+
composeProject: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
18
|
+
composeDir: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
19
|
+
composeFiles: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
20
|
+
onPush: z.ZodDefault<z.ZodBoolean>;
|
|
21
|
+
branch: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>>;
|
|
22
|
+
healthcheckUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
23
|
+
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
}, "strict", z.ZodTypeAny, {
|
|
25
|
+
type: "docker";
|
|
26
|
+
image: string;
|
|
27
|
+
dockerfile: string;
|
|
28
|
+
context: string;
|
|
29
|
+
onPush: boolean;
|
|
30
|
+
subDir?: string | undefined;
|
|
31
|
+
target?: string | undefined;
|
|
32
|
+
composeService?: string | undefined;
|
|
33
|
+
composeProject?: string | undefined;
|
|
34
|
+
composeDir?: string | undefined;
|
|
35
|
+
composeFiles?: string[] | undefined;
|
|
36
|
+
branch?: string | undefined;
|
|
37
|
+
healthcheckUrl?: string | undefined;
|
|
38
|
+
timeoutSeconds?: number | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
type: "docker";
|
|
41
|
+
image: string;
|
|
42
|
+
dockerfile?: string | undefined;
|
|
43
|
+
context?: string | undefined;
|
|
44
|
+
subDir?: string | undefined;
|
|
45
|
+
target?: string | undefined;
|
|
46
|
+
composeService?: string | undefined;
|
|
47
|
+
composeProject?: string | undefined;
|
|
48
|
+
composeDir?: string | undefined;
|
|
49
|
+
composeFiles?: string[] | undefined;
|
|
50
|
+
onPush?: boolean | undefined;
|
|
51
|
+
branch?: string | undefined;
|
|
52
|
+
healthcheckUrl?: string | undefined;
|
|
53
|
+
timeoutSeconds?: number | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
export declare const staticPipelineSchema: z.ZodObject<{
|
|
56
|
+
type: z.ZodLiteral<"static">;
|
|
57
|
+
buildScript: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
58
|
+
packageManager: z.ZodDefault<z.ZodEnum<["yarn", "npm", "pnpm"]>>;
|
|
59
|
+
distDir: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
60
|
+
subDir: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
61
|
+
skipInstall: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
skipBuild: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
targetDir: z.ZodEffects<z.ZodString, string, string>;
|
|
64
|
+
onPush: z.ZodDefault<z.ZodBoolean>;
|
|
65
|
+
branch: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>>;
|
|
66
|
+
healthcheckUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
67
|
+
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
}, "strict", z.ZodTypeAny, {
|
|
69
|
+
type: "static";
|
|
70
|
+
onPush: boolean;
|
|
71
|
+
buildScript: string;
|
|
72
|
+
packageManager: "yarn" | "npm" | "pnpm";
|
|
73
|
+
distDir: string;
|
|
74
|
+
targetDir: string;
|
|
75
|
+
subDir?: string | undefined;
|
|
76
|
+
branch?: string | undefined;
|
|
77
|
+
healthcheckUrl?: string | undefined;
|
|
78
|
+
timeoutSeconds?: number | undefined;
|
|
79
|
+
skipInstall?: boolean | undefined;
|
|
80
|
+
skipBuild?: boolean | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
type: "static";
|
|
83
|
+
targetDir: string;
|
|
84
|
+
subDir?: string | undefined;
|
|
85
|
+
onPush?: boolean | undefined;
|
|
86
|
+
branch?: string | undefined;
|
|
87
|
+
healthcheckUrl?: string | undefined;
|
|
88
|
+
timeoutSeconds?: number | undefined;
|
|
89
|
+
buildScript?: string | undefined;
|
|
90
|
+
packageManager?: "yarn" | "npm" | "pnpm" | undefined;
|
|
91
|
+
distDir?: string | undefined;
|
|
92
|
+
skipInstall?: boolean | undefined;
|
|
93
|
+
skipBuild?: boolean | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
export declare const pipelineConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"docker">;
|
|
97
|
+
image: z.ZodEffects<z.ZodString, string, string>;
|
|
98
|
+
dockerfile: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
99
|
+
context: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
100
|
+
subDir: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
101
|
+
target: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
102
|
+
composeService: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
103
|
+
composeProject: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
104
|
+
composeDir: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
105
|
+
composeFiles: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
106
|
+
onPush: z.ZodDefault<z.ZodBoolean>;
|
|
107
|
+
branch: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>>;
|
|
108
|
+
healthcheckUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
109
|
+
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
}, "strict", z.ZodTypeAny, {
|
|
111
|
+
type: "docker";
|
|
112
|
+
image: string;
|
|
113
|
+
dockerfile: string;
|
|
114
|
+
context: string;
|
|
115
|
+
onPush: boolean;
|
|
116
|
+
subDir?: string | undefined;
|
|
117
|
+
target?: string | undefined;
|
|
118
|
+
composeService?: string | undefined;
|
|
119
|
+
composeProject?: string | undefined;
|
|
120
|
+
composeDir?: string | undefined;
|
|
121
|
+
composeFiles?: string[] | undefined;
|
|
122
|
+
branch?: string | undefined;
|
|
123
|
+
healthcheckUrl?: string | undefined;
|
|
124
|
+
timeoutSeconds?: number | undefined;
|
|
125
|
+
}, {
|
|
126
|
+
type: "docker";
|
|
127
|
+
image: string;
|
|
128
|
+
dockerfile?: string | undefined;
|
|
129
|
+
context?: string | undefined;
|
|
130
|
+
subDir?: string | undefined;
|
|
131
|
+
target?: string | undefined;
|
|
132
|
+
composeService?: string | undefined;
|
|
133
|
+
composeProject?: string | undefined;
|
|
134
|
+
composeDir?: string | undefined;
|
|
135
|
+
composeFiles?: string[] | undefined;
|
|
136
|
+
onPush?: boolean | undefined;
|
|
137
|
+
branch?: string | undefined;
|
|
138
|
+
healthcheckUrl?: string | undefined;
|
|
139
|
+
timeoutSeconds?: number | undefined;
|
|
140
|
+
}>, z.ZodObject<{
|
|
141
|
+
type: z.ZodLiteral<"static">;
|
|
142
|
+
buildScript: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
143
|
+
packageManager: z.ZodDefault<z.ZodEnum<["yarn", "npm", "pnpm"]>>;
|
|
144
|
+
distDir: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
145
|
+
subDir: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
146
|
+
skipInstall: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
+
skipBuild: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
+
targetDir: z.ZodEffects<z.ZodString, string, string>;
|
|
149
|
+
onPush: z.ZodDefault<z.ZodBoolean>;
|
|
150
|
+
branch: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>>;
|
|
151
|
+
healthcheckUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
152
|
+
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
153
|
+
}, "strict", z.ZodTypeAny, {
|
|
154
|
+
type: "static";
|
|
155
|
+
onPush: boolean;
|
|
156
|
+
buildScript: string;
|
|
157
|
+
packageManager: "yarn" | "npm" | "pnpm";
|
|
158
|
+
distDir: string;
|
|
159
|
+
targetDir: string;
|
|
160
|
+
subDir?: string | undefined;
|
|
161
|
+
branch?: string | undefined;
|
|
162
|
+
healthcheckUrl?: string | undefined;
|
|
163
|
+
timeoutSeconds?: number | undefined;
|
|
164
|
+
skipInstall?: boolean | undefined;
|
|
165
|
+
skipBuild?: boolean | undefined;
|
|
166
|
+
}, {
|
|
167
|
+
type: "static";
|
|
168
|
+
targetDir: string;
|
|
169
|
+
subDir?: string | undefined;
|
|
170
|
+
onPush?: boolean | undefined;
|
|
171
|
+
branch?: string | undefined;
|
|
172
|
+
healthcheckUrl?: string | undefined;
|
|
173
|
+
timeoutSeconds?: number | undefined;
|
|
174
|
+
buildScript?: string | undefined;
|
|
175
|
+
packageManager?: "yarn" | "npm" | "pnpm" | undefined;
|
|
176
|
+
distDir?: string | undefined;
|
|
177
|
+
skipInstall?: boolean | undefined;
|
|
178
|
+
skipBuild?: boolean | undefined;
|
|
179
|
+
}>]>;
|
|
180
|
+
export type DockerPipelineConfig = z.infer<typeof dockerPipelineSchema>;
|
|
181
|
+
export type StaticPipelineConfig = z.infer<typeof staticPipelineSchema>;
|
|
182
|
+
export type PipelineConfig = z.infer<typeof pipelineConfigSchema>;
|
|
183
|
+
export interface IPipelineDiagnostic {
|
|
184
|
+
severity: "error" | "warning" | "info";
|
|
185
|
+
code: string;
|
|
186
|
+
field: string;
|
|
187
|
+
message: string;
|
|
188
|
+
suggestion?: string;
|
|
189
|
+
}
|
|
190
|
+
export interface IPipelineValidationResult {
|
|
191
|
+
valid: boolean;
|
|
192
|
+
normalizedConfig?: PipelineConfig;
|
|
193
|
+
diagnostics: IPipelineDiagnostic[];
|
|
194
|
+
securityChecks: {
|
|
195
|
+
noPathTraversal: boolean;
|
|
196
|
+
noShellInjection: boolean;
|
|
197
|
+
safeTargetDirectory: boolean;
|
|
198
|
+
schemaCompliant: boolean;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
export declare const validatePipelineConfig: (rawConfig: unknown) => IPipelineValidationResult;
|
|
202
|
+
export declare const loadPipelineConfigFile: (rawFilePath: string) => {
|
|
203
|
+
resolvedPath: string;
|
|
204
|
+
parsed: unknown;
|
|
205
|
+
};
|