@nuvlore/extension-bds 0.1.1 → 0.1.2

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.
Files changed (31) hide show
  1. package/package.json +4 -16
  2. package/vendor/extension-read-only-toolkit/LICENSE +0 -202
  3. package/vendor/extension-read-only-toolkit/README.md +0 -29
  4. package/vendor/extension-read-only-toolkit/package.json +0 -46
  5. package/vendor/extension-read-only-toolkit/src/devops-data-paths.mjs +0 -222
  6. package/vendor/extension-read-only-toolkit/src/devops-diagnostics.mjs +0 -440
  7. package/vendor/extension-read-only-toolkit/src/enterprise-api-read.mjs +0 -180
  8. package/vendor/extension-read-only-toolkit/src/read-only-command-pack.mjs +0 -1
  9. package/vendor/extension-read-only-toolkit/src/read-only-plan.mjs +0 -45
  10. package/vendor/extension-read-only-toolkit/src/read-only-shell-policy.d.mts +0 -26
  11. package/vendor/extension-read-only-toolkit/src/read-only-shell-policy.mjs +0 -170
  12. package/vendor/extension-workday-infra-access/LICENSE +0 -202
  13. package/vendor/extension-workday-infra-access/README.md +0 -3
  14. package/vendor/extension-workday-infra-access/agents/workday-infra-access-readonly.yaml +0 -183
  15. package/vendor/extension-workday-infra-access/package.json +0 -49
  16. package/vendor/extension-workday-infra-access/skills/workday-infra-access/SKILL.md +0 -102
  17. package/vendor/extension-workday-infra-access/skills/workday-infra-access/references/access-boundary-runbook.md +0 -43
  18. package/vendor/extension-workday-infra-access/skills/workday-infra-access/references/access-runbook.md +0 -15
  19. package/vendor/extension-workday-infra-access/skills/workday-infra-access/references/access-scylla-cloud-runbook.md +0 -39
  20. package/vendor/extension-workday-infra-access/skills/workday-infra-access/references/access-spc-argo-runbook.md +0 -99
  21. package/vendor/extension-workday-infra-access/src/workday-access-profiles.mjs +0 -194
  22. package/vendor/extension-workday-infra-access/tools/aws_cust_federated_readonly_command_pack.mjs +0 -234
  23. package/vendor/extension-workday-infra-access/tools/gcp_readonly_command_pack.mjs +0 -167
  24. package/vendor/extension-workday-infra-access/tools/public_cloud_access_status.mjs +0 -48
  25. package/vendor/extension-workday-infra-access/tools/workday_boundary_login.mjs +0 -460
  26. package/vendor/extension-workday-infra-access/tools/workday_private_cloud_sudo_readonly_command.mjs +0 -386
  27. package/vendor/extension-workday-infra-access/tools/workday_public_cloud_environment_map.mjs +0 -189
  28. package/vendor/extension-workday-infra-access/tools/workday_public_cloud_kubernetes_read.mjs +0 -297
  29. package/vendor/extension-workday-infra-access/tools/workday_public_cloud_spc_login.mjs +0 -505
  30. package/vendor/extension-workday-infra-access/tools/workday_spc_argo_readonly_command_pack.mjs +0 -215
  31. package/vendor/extension-workday-infra-access/workflows/public-cloud-readonly-investigation.js +0 -99
@@ -1,102 +0,0 @@
1
- ---
2
- name: workday-infra-access
3
- description: Use when the user needs Workday infrastructure access planning, including DC/Boundary connectivity with LDAP credentials or public-cloud connection planning.
4
- allowed-tools:
5
- - mcp__devops_tool__workday_boundary_login
6
- - mcp__devops_tool__workday_public_cloud_environment_map
7
- - mcp__devops_tool__workday_public_cloud_spc_login
8
- - mcp__devops_tool__workday_private_cloud_sudo_readonly_command
9
- - mcp__devops_tool__workday_spc_argo_readonly_command_pack
10
- - mcp__devops_tool__public_cloud_access_status
11
- - mcp__devops_tool__aws_cust_federated_readonly_command_pack
12
- - mcp__devops_tool__gcp_readonly_command_pack
13
- - mcp__devops_tool__remote_readonly_command
14
- - mcp__devops_tool__remote_log_pattern_summary
15
- ---
16
-
17
- # Workday Infrastructure Access
18
-
19
- Use this skill for Workday DC/Boundary access planning, saved LDAP
20
- credential-backed `bauth init`, explicit-host ordinary SSH checks, SPC + Argo UI
21
- inspection, AWS CUST federated access planning, and GCP read-only access
22
- planning.
23
-
24
- Shared access conventions for DC login, Scylla BDM access, and sudo stdin live
25
- in `workday-access-profiles`; package tools should reuse those profiles instead
26
- of copying Boundary, Keychain, SSH, or BDM command templates.
27
-
28
- Load `references/access-runbook.md` as the router, then load only the matching
29
- access-path reference: `references/access-boundary-runbook.md`,
30
- `references/access-spc-argo-runbook.md`, or
31
- `references/access-scylla-cloud-runbook.md`.
32
-
33
- ## Routing
34
-
35
- - Boundary/DC host access: start with `workday_boundary_login` action `status`.
36
- If login preparation is required, use action `login` only after explicit
37
- human approval with `humanApprovedLocalWrite: true` and a complete structured
38
- `hitlApproval` object.
39
- - Public cloud environment mapping: when the user gives a logical environment
40
- such as CP2, call `workday_public_cloud_environment_map` first to resolve the
41
- concrete SPC cluster and platform-specific follow-up reads.
42
- - Public cloud environment login: after mapping, call
43
- `workday_public_cloud_spc_login`.
44
- For customer SPC clusters, the tool must refresh `sso-cust` with
45
- `sso-cli aws --force --profile sso-cust`, then run SPC with
46
- `AWS_PROFILE=sso-cust` only. Do not pass `AWS_REGION` into `sso-cli aws`,
47
- `spc connect`, or the follow-up kubectl environment unless the operator
48
- explicitly requests a region override.
49
- - Workday SPC + Argo UI inspection after public-cloud login: call `workday_spc_argo_readonly_command_pack`.
50
- - Generic public cloud access planning: call `public_cloud_access_status`.
51
- - AWS CUST federated access: call `aws_cust_federated_readonly_command_pack` first.
52
- - GCP project access: call `gcp_readonly_command_pack` first.
53
- - Private cloud sudo evidence collection: for an explicit private cloud/DC
54
- host, use only `workday_private_cloud_sudo_readonly_command` for commands
55
- that need sudo. The tool itself runs `bauth init` with LDAP PROD, then uses
56
- ordinary `ssh <host>`.
57
- - Non-sudo remote evidence collection: after Boundary login is ready and the
58
- target host is explicit, use only `remote_readonly_command` or
59
- `remote_log_pattern_summary` with ordinary SSH. Private cloud/DC does not use
60
- SPC.
61
-
62
- ## Guardrails
63
-
64
- - Never ask the user to paste LDAP passwords into chat.
65
- - Never print, summarize, or store LDAP passwords, Keychain JSON, tokens,
66
- private keys, kubeconfig, ADC, AWS credential files, or cloud session
67
- material.
68
- - Login preparation can update local auth state; keep it separate from remote
69
- inspection evidence and require explicit approval. Public cloud uses SPC;
70
- private cloud/DC uses Boundary through `bauth init`.
71
- - Both public cloud SPC login and private cloud Boundary login require an
72
- already-active Workday Security Network session first.
73
- - Only `workday_boundary_login`, `workday_public_cloud_spc_login`, and
74
- `workday_private_cloud_sudo_readonly_command` may read the LDAP PROD password
75
- from Keychain. Other tools and agents must not call Keychain directly.
76
- - Do not authenticate, port-forward, mutate Argo/Kubernetes, call cloud APIs, or
77
- run cloud login/config commands from a tool unless the operator is actively
78
- doing that approved local setup in an interactive session.
79
- - Do not invent hostnames. If no host or resolvable target is provided, ask for
80
- the host or state the blocker.
81
- - Treat permission/RBAC/IAM denials as evidence gaps, not proof that a resource,
82
- service, pod, or log is absent.
83
-
84
- ## Evidence Order
85
-
86
- 1. Classify the request as Boundary/DC, SPC/Argo, AWS CUST, GCP, generic public
87
- cloud, or explicit remote read-only inspection.
88
- 2. Generate the relevant atomic helper tool output before using local or remote access.
89
- 3. Verify cloud/session identity and authorization before evidence reads:
90
- for public-cloud SPC, check `AWS_PROFILE=sso-cust aws sts get-caller-identity`
91
- before `kubectl auth whoami` and `kubectl auth can-i`; for other paths use
92
- `aws sts get-caller-identity`,
93
- `gcloud auth list`, or `gcloud config list` as applicable.
94
- 4. Collect only bounded read-only evidence from explicit hosts, namespaces,
95
- projects, accounts, or services.
96
- 5. Report exact status, evidence, blockers, and next read-only checks.
97
-
98
- ## Output
99
-
100
- Return Boundary/SPC/cloud readiness, target checked, identity or authorization
101
- evidence, read-only command result summary, blockers such as missing Keychain
102
- credential or unavailable `bauth`, and the next safe read-only check.
@@ -1,43 +0,0 @@
1
- # Boundary And BDS DC Access Runbook
2
-
3
- Use for private cloud/DC `bauth init`, explicit BDS DC hosts, ordinary SSH,
4
- sudo stdin, root-owned read-only state, and remote command examples. Owner:
5
- `workday-infra-access/SKILL.md`.
6
-
7
- ## Shared Profiles
8
-
9
- - Reuse shared profiles for DC SSH and `SudoEnvironmentProfile` for routing
10
- sudo reads to the dedicated sudo tool.
11
-
12
- ## Boundary Access
13
-
14
- - Check Boundary status with `workday_boundary_login` using `action: "status"`.
15
- - If Boundary is not ready and the user explicitly approves local auth-state
16
- changes, call `workday_boundary_login` with `action: "login"`,
17
- `humanApprovedLocalWrite: true`, and a complete `hitlApproval` object with
18
- `approved`, `approvedBy`, `action`, `target`, `reason`, `expectedImpact`, and
19
- `risk`.
20
- - The tool consumes the saved macOS Keychain LDAP credential in place for
21
- approved `bauth init`; do not ask the user to paste LDAP passwords into chat.
22
- - For BDS customer DC hosts, use the explicit hostname from incident or
23
- environment evidence unchanged. After `bauth init`, connect with ordinary
24
- `ssh <host>`; do not use SPC for private cloud and do not invent `.bnd`
25
- aliases.
26
- - Start remote work as the normal SSH user. Use `sudo` only for root-owned
27
- read-only state such as root kubeconfig, bounded `journalctl`, or service
28
- status.
29
- - When sudo needs a password, use `workday_private_cloud_sudo_readonly_command`.
30
- The tool reads the LDAP PROD password from Keychain, runs `bauth init`, then
31
- passes the same secret only to remote sudo stdin. Agents and command packs
32
- must not call Keychain directly.
33
-
34
- ## Read-Only Command Boundary
35
-
36
- - Read-only examples: `hostname -f`, `date -u`, `whoami`,
37
- `kubectl get/describe/logs`, `hdfs dfs -ls/-du/-cat/-tail`, `yarn logs`,
38
- `getent hosts`, `ip route get`, bounded `curl` connect probes, `journalctl`
39
- reads, and `systemctl status`.
40
- - Mutating examples forbidden in read-only investigations: service restarts,
41
- `kubectl apply/delete/patch/scale/rollout restart`, Airflow `clear`,
42
- `backfill`, `trigger`, `mark_success`, HDFS writes/removals, migration
43
- cancel/retry, and `aws s3 cp` object writes.
@@ -1,15 +0,0 @@
1
- # Workday Infrastructure Access Runbook Router
2
-
3
- This file is only a router for `workday-infra-access/SKILL.md`. Load the
4
- smallest access-path reference that matches the request.
5
-
6
- Both public-cloud SPC and private-cloud Boundary paths require an active Workday
7
- Security Network session before starting environment login.
8
-
9
- - Private cloud/DC `bauth init`, BDS DC ordinary SSH, sudo stdin, and
10
- read-only remote commands:
11
- `access-boundary-runbook.md`.
12
- - Public cloud SPC login, Argo UI, ComponentRelease, Flux HelmRelease,
13
- smoke-test dependency namespace checks: `access-spc-argo-runbook.md`.
14
- - Scylla BDM, AWS CUST, and GCP public-cloud read-only access after SPC login:
15
- `access-scylla-cloud-runbook.md`.
@@ -1,39 +0,0 @@
1
- # Scylla BDM And Public Cloud Access Runbook
2
-
3
- Use for Scylla BDM bucket checks, AWS CUST read-only access, and GCP read-only
4
- access. Owner: `workday-infra-access/SKILL.md`.
5
-
6
- ## Scylla BDM Access
7
-
8
- - Reuse `ScyllaAccessProfile` for BDM `kcsb`, `bucketdetails-config`, and RBAC.
9
- - Connect to the target Scylla environment, read `bucketdetails-config`, then use
10
- BDM `kcsb exec <bdm-pod> -- sh -lc 'hadoop fs ...'` and bounded BDM logs.
11
- - Before claiming SIR, Galahad, OMS, or ORS pods/logs are absent, run namespace
12
- `kubectl auth can-i` checks through the SPC kubeconfig.
13
-
14
- ## AWS CUST
15
-
16
- - Use `aws_cust_federated_readonly_command_pack` first. The operator must complete AWS
17
- federated access using the approved CCOE guide
18
- `AWS - Federated Access to CUST Accounts - User Guide`; tools must not open
19
- browser federation, run `aws configure`, read `~/.aws`, or store cloud session
20
- material.
21
- - Always run `aws sts get-caller-identity` before AWS evidence reads. Verify
22
- account ID, role ARN, region, and profile against incident evidence before
23
- reading service metadata.
24
- - AWS read-only commands are limited to `describe-*`, `list-*`, `get-*`,
25
- `head-*`, `aws s3 ls`, and `aws sts get-caller-identity`.
26
- - Treat `aws s3 cp`, `mv`, `rm`, `sync`, `s3api put-object`,
27
- `s3api delete-object`, `secretsmanager get-secret-value`, and IAM/KMS mutation
28
- as forbidden.
29
-
30
- ## GCP
31
-
32
- - Use `gcp_readonly_command_pack` first. Use an already-approved local `gcloud`
33
- identity only; do not run `gcloud auth login`, `gcloud config set`, read ADC
34
- credentials, or change active project/impersonation from a tool.
35
- - Always verify `gcloud auth list` and `gcloud config list` before GCP evidence
36
- reads.
37
- - GCP read-only commands are limited to project/IAM policy inspection,
38
- list/describe/read operations, and Cloud Storage bucket/object listing.
39
- - A cloud IAM denial is an evidence gap, not proof that the resource is absent.
@@ -1,99 +0,0 @@
1
- # SPC, Argo, And ComponentRelease Access Runbook
2
-
3
- Use for public cloud SPC connection, Argo UI inspection,
4
- ComponentRelease/HelmRelease drift, and smoke-test dependency namespace checks.
5
- Private cloud/DC login uses Boundary through `bauth init` instead. Owner:
6
- `workday-infra-access/SKILL.md`.
7
-
8
- ## SPC And Argo UI
9
-
10
- - Confirm Workday Security Network login/session is active before SPC login.
11
- - If the user gives a logical environment name instead of an SPC cluster, map it
12
- first with `workday_public_cloud_environment_map`. Do not treat logical names
13
- like `CP2` as SPC cluster names.
14
- - Preserve the operator-provided tier and cluster mapping. Current SPC CLI shape
15
- is `spc [-d] connect <tier> <cluster>`; `-d` means developer access for
16
- DEV/ENG, not the tier argument. Examples:
17
- `spc -d connect dev proteusaws00020` and `spc connect cust s0026`.
18
- - Use `workday_public_cloud_spc_login` for the reusable public-cloud login
19
- step. It may update local SPC kubeconfig/session state only after structured
20
- HITL approval.
21
- - The verified public-cloud login sequence is:
22
- 1. Confirm Workday Security Network is active.
23
- 2. Refresh the AWS source credential with
24
- `sso-cli aws --force --profile sso-cust`.
25
- 3. Start SPC with `AWS_PROFILE=sso-cust spc connect cust <cluster>`.
26
- 4. Verify with
27
- `AWS_PROFILE=sso-cust kubectl --kubeconfig=$HOME/.kube/spc-config config current-context`,
28
- `auth whoami`, and `auth can-i get pods -n <namespace>`.
29
- Do not export `AWS_REGION` or `AWS_DEFAULT_REGION` into the `spc connect` or
30
- `kubectl` environment. Do not pass `--region` to `sso-cli aws` unless the
31
- operator explicitly requests it; forcing a region into SPC caused DynamoDB
32
- `ResourceNotFoundException` during live testing.
33
- - Use macOS Keychain service `eldwin`, account `eldwin.workday_prod_ldap` for
34
- public cloud SPC login across tiers. Legacy `wallee` entries are fallback
35
- secret sources only. Some entries are JSON; extract only the top-level
36
- `token` and pass it through `expect`/stdin.
37
- - `spc` requires a TTY password prompt. A plain pipe may fail with
38
- `inappropriate ioctl for device`; use an `expect` wrapper. If `spc` exits
39
- before a password prompt during debugging, a TTY wrapper such as
40
- `/usr/bin/script -q /tmp/spc-<cluster>.out spc connect <tier> <cluster>` can
41
- establish the session without exposing the secret.
42
- - Ensure local `PATH` includes `session-manager-plugin`, `sso-cli`, `kubectl`,
43
- and `spc`; missing PATH entries can make `spc connect` or kubeconfig exec auth
44
- fail even when binaries are installed.
45
- - On this workstation the verified binary locations are:
46
- `/Users/boqiang.liang/bin/sso-cli`,
47
- `/usr/local/bin/spc`,
48
- `/usr/local/bin/kubectl`, and
49
- `/usr/local/bin/session-manager-plugin`. Non-login shells may not include
50
- these paths by default, so tools must set the PATH explicitly.
51
- - `spc list cust --url` is a useful preflight after AWS refresh. SPC cluster
52
- names are values such as `s0026` and `s0109`; names like `wd103perf` can be
53
- AWS profile aliases or legacy kube contexts and are not necessarily valid SPC
54
- cluster names.
55
- - CP2 examples:
56
- - AWS-backed public cloud: refresh AWS with `sso-cli aws --force --profile
57
- sso-cust`, then `AWS_PROFILE=sso-cust spc connect cust s0054`, then use
58
- bounded `kcsb get pod` or explicit `kubectl --kubeconfig=$HOME/.kube/spc-config`
59
- reads.
60
- - GCS-backed public cloud: refresh AWS with `sso-cli aws --force --profile
61
- sso-cust`, then `AWS_PROFILE=sso-cust spc connect cust s0029`, then use
62
- bounded `kcsb get pod`; if approved read-only pod shell access is needed,
63
- `kcsb exec -it bdm-0 -- bash` may be used only for bounded reads such as
64
- `gsutil ls gs://scylla-218441665564-bds-tenant-s0020/data/tenants/`.
65
- - Use `kcsb` or explicit `kubectl` commands so evidence is copyable, bounded,
66
- and auditable.
67
- - Clean up long-running `spc connect` and port-forward processes when done.
68
- - After `spc` is connected, Argo UI can be inspected through
69
- `kubectl --kubeconfig=$HOME/.kube/spc-config -n argocdapp port-forward svc/argocdapp-server 8080:443`
70
- and `https://localhost:8080/`.
71
- - `spc connect` proves connectivity, not Kubernetes authorization. Before any
72
- approved remediation such as `kubectl scale`, `patch`, or `rollout restart`,
73
- verify identity with `kubectl auth whoami` and the target verb with
74
- `kubectl auth can-i ... -n <namespace>`.
75
- - Argo UI inspection is read-only only if you avoid state-changing controls:
76
- `Sync`, `Hard Refresh`, `Delete`, `Rollback`, `Scale`, `Patch`, and `Restart`.
77
- - Prefer CLI reads where possible:
78
- `kubectl --kubeconfig=$HOME/.kube/spc-config get app -n argocdapp ... -o json`,
79
- `kubectl get componentrelease -n <namespace> ...`, and
80
- `kubectl get deploy,statefulset,pods -n <namespace> -o wide`.
81
- - Before claiming a service, pod, or log is absent, check namespace RBAC with
82
- `kubectl --kubeconfig=$HOME/.kube/spc-config auth can-i get pods -n <namespace>`,
83
- plus equivalent service, endpoints, deployment, and logs checks.
84
-
85
- ## ComponentRelease And Smoke-Test Dependencies
86
-
87
- - For BDS/Proteus ComponentRelease investigations, verify all five layers:
88
- scylla `component-config` source of truth, Argo Application sync/health,
89
- ComponentRelease desired/deployed status, Flux HelmRelease desired status and
90
- `spec.driftDetection`, and live Deployment/StatefulSet/pod replicas.
91
- - Treat `HelmRelease.spec.driftDetection` as a Flux Helm Controller setting. If
92
- it is null/disabled and live workloads drift from non-zero desired replicas,
93
- the deeper platform question is whether `isd-component-controller` and the
94
- ComponentRelease CRD/default HelmRelease spec expose or set drift detection.
95
- - When a Bamboo smoke test waits on a dependency selector such as `name=prism`,
96
- inspect that dependency namespace directly. Compare ComponentRelease and
97
- HelmRelease desired state with live deployments, pods selected by the exact
98
- label, and service endpoints; do not assume a successful ComponentRelease
99
- means dependency pods are running.
@@ -1,194 +0,0 @@
1
- export const DEFAULT_DC_BOUNDARY_ADDR = "https://dccust.pam.gowday.com";
2
- export const DEFAULT_BOUNDARY_BINARY_DIR = "/opt/homebrew/bin";
3
- export const DEFAULT_BOUNDARY_PROXY_JUMP_HOST = "proxy-jump.atl.bnd";
4
- export const DEFAULT_WORKDAY_LDAP_KEYCHAIN_SERVICE = "eldwin";
5
- export const DEFAULT_WORKDAY_LDAP_SERVICE_KEY = "workday_prod_ldap";
6
- export const DEFAULT_WORKDAY_LDAP_PROD_SERVICE_KEY = "workday_prod_ldap";
7
- export const DEFAULT_WORKDAY_LDAP_CORP_SERVICE_KEY = "workday_corp_ldap";
8
- export const DEFAULT_WORKDAY_LDAP_KEYCHAIN_ACCOUNT = "eldwin.workday_prod_ldap";
9
- export const DEFAULT_WORKDAY_LDAP_PROD_KEYCHAIN_ACCOUNT = "eldwin.workday_prod_ldap";
10
- export const DEFAULT_WORKDAY_LDAP_CORP_KEYCHAIN_ACCOUNT = "eldwin.workday_corp_ldap";
11
- export const LEGACY_WORKDAY_LDAP_KEYCHAIN_SERVICE = ["wal", "lee"].join("");
12
- export const LEGACY_WORKDAY_LDAP_KEYCHAIN_ACCOUNT = `${LEGACY_WORKDAY_LDAP_KEYCHAIN_SERVICE}.workday_prod_ldap`;
13
- export const LEGACY_WORKDAY_LDAP_PROD_KEYCHAIN_ACCOUNT = `${LEGACY_WORKDAY_LDAP_KEYCHAIN_SERVICE}.workday_prod_ldap`;
14
- export const LEGACY_WORKDAY_LDAP_CORP_KEYCHAIN_ACCOUNT = `${LEGACY_WORKDAY_LDAP_KEYCHAIN_SERVICE}.workday_corp_ldap`;
15
- export const DEFAULT_ADMIN_KUBECONFIG_PATH = "/etc/kubernetes/admin.conf";
16
- export const DEFAULT_SCYLLA_NAMESPACE = "bds";
17
- export const DEFAULT_SCYLLA_BDM_POD = "bdm-0";
18
-
19
- function normalizeText(value) {
20
- return typeof value === "string" ? value.trim() : "";
21
- }
22
-
23
- export function shellQuote(value) {
24
- return `'${String(value).replaceAll("'", "'\\''")}'`;
25
- }
26
-
27
- export function extractTokenFromKeychainSecret(rawSecret = "") {
28
- const text = normalizeText(rawSecret);
29
- if (!text) return "";
30
- try {
31
- const parsed = JSON.parse(text);
32
- return normalizeText(parsed?.token);
33
- } catch {
34
- return text;
35
- }
36
- }
37
-
38
- export function keychainAccountCandidates(account, { canonicalPrefix = "eldwin." } = {}) {
39
- const raw = normalizeText(account);
40
- if (!raw) return [];
41
- const prefixed = raw.startsWith(canonicalPrefix) ? raw : `${canonicalPrefix}${raw}`;
42
- return Array.from(new Set([raw, prefixed]));
43
- }
44
-
45
- export function uniqueCredentialCandidates(candidates = []) {
46
- return candidates
47
- .filter((candidate) => candidate?.service && candidate?.account)
48
- .filter((candidate, index, all) =>
49
- all.findIndex((item) => item.service === candidate.service && item.account === candidate.account) === index
50
- );
51
- }
52
-
53
- export function workdayProdCredentialCandidates() {
54
- return uniqueCredentialCandidates([
55
- { service: DEFAULT_WORKDAY_LDAP_KEYCHAIN_SERVICE, account: DEFAULT_WORKDAY_LDAP_PROD_KEYCHAIN_ACCOUNT },
56
- { service: LEGACY_WORKDAY_LDAP_KEYCHAIN_SERVICE, account: LEGACY_WORKDAY_LDAP_PROD_KEYCHAIN_ACCOUNT }
57
- ]);
58
- }
59
-
60
- export class DcLoginProfile {
61
- constructor(input = {}) {
62
- this.boundaryAddr = input.boundaryAddr ?? DEFAULT_DC_BOUNDARY_ADDR;
63
- this.boundaryBinaryDir = input.boundaryBinaryDir ?? DEFAULT_BOUNDARY_BINARY_DIR;
64
- this.boundaryProxyJumpHost = input.boundaryProxyJumpHost ?? DEFAULT_BOUNDARY_PROXY_JUMP_HOST;
65
- this.useBoundaryBnd = input.useBoundaryBnd ?? false;
66
- }
67
-
68
- boundaryHostFor(host) {
69
- const value = String(host || "");
70
- if (!this.useBoundaryBnd || value.includes("<") || value.endsWith(".bnd")) return value;
71
- return `${value}.bnd`;
72
- }
73
-
74
- environmentPrefix() {
75
- return `BOUNDARY_ADDR=${shellQuote(this.boundaryAddr)} BOUNDARY_SKIP_CACHE_DAEMON=true PATH=${shellQuote(this.boundaryBinaryDir)}:/Users/boqiang.liang/bin:/usr/local/bin:$PATH`;
76
- }
77
-
78
- sshCommandFor(host, remoteCommand, { connectTimeout = 20 } = {}) {
79
- return `${this.environmentPrefix()} ssh -o BatchMode=yes -o ConnectTimeout=${connectTimeout} -- ${this.boundaryHostFor(host)} ${JSON.stringify(remoteCommand)}`;
80
- }
81
-
82
- proxyJumpCommandFor(host, remoteCommand, { connectTimeout = 20 } = {}) {
83
- return `${this.environmentPrefix()} ssh -o BatchMode=yes -o ConnectTimeout=${connectTimeout} -J ${shellQuote(this.boundaryProxyJumpHost)} -- ${host} ${JSON.stringify(remoteCommand)}`;
84
- }
85
-
86
- toJson() {
87
- return {
88
- boundaryAddr: this.boundaryAddr,
89
- boundaryBinaryDir: this.boundaryBinaryDir,
90
- boundaryProxyJumpHost: this.boundaryProxyJumpHost,
91
- useBoundaryBnd: this.useBoundaryBnd
92
- };
93
- }
94
- }
95
-
96
- export class SudoEnvironmentProfile {
97
- constructor(input = {}) {
98
- this.keychainService = input.keychainService ?? DEFAULT_WORKDAY_LDAP_KEYCHAIN_SERVICE;
99
- this.keychainAccount = input.keychainAccount ?? DEFAULT_WORKDAY_LDAP_KEYCHAIN_ACCOUNT;
100
- this.fallbackCredentials = input.fallbackCredentials ?? workdayProdCredentialCandidates().slice(1);
101
- this.kubeconfigPath = input.kubeconfigPath ?? DEFAULT_ADMIN_KUBECONFIG_PATH;
102
- }
103
-
104
- keychainCandidates() {
105
- return uniqueCredentialCandidates([
106
- { service: this.keychainService, account: this.keychainAccount },
107
- ...this.fallbackCredentials
108
- ]);
109
- }
110
-
111
- keychainReadCommand() {
112
- return "Direct PROD password reads are restricted. Use workday_private_cloud_sudo_readonly_command.";
113
- }
114
-
115
- stdinSudoRemoteCommand(command) {
116
- return `IFS= read -r SUDOPASS || exit 11; printf '%s\\n' "$SUDOPASS" | sudo -S -p '' bash -lc ${JSON.stringify(command)}`;
117
- }
118
-
119
- sudoWrapperFor({ dcProfile, host, command }) {
120
- const target = dcProfile.boundaryHostFor(host);
121
- return `mcp__devops_tool__workday_private_cloud_sudo_readonly_command ${JSON.stringify({
122
- action: "run",
123
- host: target,
124
- command,
125
- humanApprovedSudoRead: true,
126
- hitlApproval: {
127
- approved: true,
128
- approvedBy: "<operator>",
129
- action: "Run private-cloud sudo read-only command",
130
- target,
131
- reason: "<why this sudo read is needed>",
132
- expectedImpact: "Read-only sudo command; no remote writes.",
133
- risk: "Privileged read may expose sensitive host state."
134
- }
135
- })}`;
136
- }
137
-
138
- sudoKubectl(command) {
139
- return `sudo -n kubectl --kubeconfig=${this.kubeconfigPath} ${command}`;
140
- }
141
-
142
- verificationCommand({ host, dcProfile = new DcLoginProfile() }) {
143
- return this.sudoWrapperFor({ dcProfile, host, command: "hostname" });
144
- }
145
-
146
- toJson() {
147
- return {
148
- keychainService: this.keychainService,
149
- keychainAccount: this.keychainAccount,
150
- keychainCandidates: this.keychainCandidates(),
151
- kubeconfigPath: this.kubeconfigPath
152
- };
153
- }
154
- }
155
-
156
- export class ScyllaAccessProfile {
157
- constructor(input = {}) {
158
- this.cluster = input.cluster;
159
- this.namespace = input.namespace ?? DEFAULT_SCYLLA_NAMESPACE;
160
- this.bdmPod = input.bdmPod ?? DEFAULT_SCYLLA_BDM_POD;
161
- this.kubeconfigPath = input.kubeconfigPath ?? "$HOME/.kube/spc-config";
162
- this.connectionTool = input.connectionTool ?? "kcsb";
163
- }
164
-
165
- podExec(command, { container } = {}) {
166
- const containerArg = container ? ` -c ${container}` : "";
167
- return `${this.connectionTool} exec ${this.bdmPod}${containerArg} -- sh -lc ${shellQuote(command)}`;
168
- }
169
-
170
- podLogs({ pod = this.bdmPod, container = "bdm", since = "4h", pattern = "" } = {}) {
171
- const grep = pattern ? ` | egrep ${shellQuote(pattern)}` : "";
172
- return `${this.connectionTool} logs ${pod} -c ${container} --since=${since}${grep}`;
173
- }
174
-
175
- bucketConfigCommand() {
176
- return `${this.connectionTool} get cm bucketdetails-config -o yaml`;
177
- }
178
-
179
- rbacBoundaryCommand(namespaces = ["sir", "galahad", "ors", "oms", "argocdapp", "bds"]) {
180
- return `for ns in ${namespaces.map(shellQuote).join(" ")}; do for r in pods services endpoints deployments.apps; do kubectl --kubeconfig=${this.kubeconfigPath} auth can-i get "$r" -n "$ns"; done; done`;
181
- }
182
-
183
- toJson() {
184
- return {
185
- cluster: this.cluster,
186
- namespace: this.namespace,
187
- bdmPod: this.bdmPod,
188
- kubeconfigPath: this.kubeconfigPath,
189
- connectionTool: this.connectionTool,
190
- bucketConfigCommand: this.bucketConfigCommand(),
191
- rbacBoundaryCommand: this.rbacBoundaryCommand()
192
- };
193
- }
194
- }