fullcourtdefense 2.0.0 → 2.2.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/README.md +233 -53
- package/dist/adapters.d.ts +11 -0
- package/dist/adapters.js +16 -0
- package/dist/anthropic.d.ts +32 -0
- package/dist/anthropic.js +67 -0
- package/dist/argsBounds.d.ts +38 -0
- package/dist/argsBounds.js +84 -0
- package/dist/autoInstrument.d.ts +24 -7
- package/dist/autoInstrument.js +148 -23
- package/dist/circuitBreaker.d.ts +17 -0
- package/dist/circuitBreaker.js +39 -0
- package/dist/cliMoved.d.ts +4 -0
- package/dist/cliMoved.js +20 -0
- package/dist/client.d.ts +185 -1
- package/dist/client.js +1094 -87
- package/dist/errors.d.ts +73 -0
- package/dist/errors.js +110 -0
- package/dist/failMode.d.ts +96 -0
- package/dist/failMode.js +180 -0
- package/dist/identity.d.ts +32 -0
- package/dist/identity.js +120 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +9 -1
- package/dist/lambda.d.ts +101 -0
- package/dist/lambda.js +357 -0
- package/dist/localDecision.d.ts +100 -0
- package/dist/localDecision.js +246 -0
- package/dist/localGate.d.ts +44 -0
- package/dist/localGate.js +114 -0
- package/dist/localSafety.d.ts +48 -0
- package/dist/localSafety.js +220 -0
- package/dist/policy/acorn.js +6365 -0
- package/dist/policy/actionPolicyEngine.d.ts +427 -0
- package/dist/policy/actionPolicyEngine.js +6481 -0
- package/dist/policy/detectionData.d.ts +21 -0
- package/dist/policy/detectionData.js +71 -0
- package/dist/policy/detectorRuntime.d.ts +27 -0
- package/dist/policy/detectorRuntime.js +58 -0
- package/dist/policy/deterministicGuard.d.ts +406 -0
- package/dist/policy/deterministicGuard.js +6651 -0
- package/dist/protect.d.ts +48 -0
- package/dist/protect.js +223 -1
- package/dist/recordQueue.d.ts +53 -0
- package/dist/recordQueue.js +132 -0
- package/dist/recordSpool.d.ts +17 -0
- package/dist/recordSpool.js +137 -0
- package/dist/types.d.ts +167 -2
- package/lambda.js +6 -0
- package/package.json +31 -27
- package/dist/cli/actionPolicyEngine.d.ts +0 -146
- package/dist/cli/actionPolicyEngine.js +0 -754
- package/dist/cli/api.d.ts +0 -116
- package/dist/cli/api.js +0 -65
- package/dist/cli/appDetection.d.ts +0 -8
- package/dist/cli/appDetection.js +0 -107
- package/dist/cli/attack-corpus/context_escape/context-escape-newline.yaml +0 -23
- package/dist/cli/attack-corpus/context_escape/context-escape-unicode.yaml +0 -14
- package/dist/cli/attack-corpus/context_escape/delimiter-json.yaml +0 -14
- package/dist/cli/attack-corpus/context_escape/delimiter-markdown.yaml +0 -22
- package/dist/cli/attack-corpus/context_escape/delimiter-xml.yaml +0 -19
- package/dist/cli/attack-corpus/context_escape/html-injection.yaml +0 -14
- package/dist/cli/attack-corpus/context_escape/javascript-injection.yaml +0 -13
- package/dist/cli/attack-corpus/data_extraction/adv26-adversarial-function-hallucination.yaml +0 -20
- package/dist/cli/attack-corpus/data_extraction/adv26-cot-hijack-debug-trace.yaml +0 -20
- package/dist/cli/attack-corpus/data_extraction/adv26-cot-hijack-verification.yaml +0 -18
- package/dist/cli/attack-corpus/data_extraction/adv26-crossmodal-diff.yaml +0 -22
- package/dist/cli/attack-corpus/data_extraction/adv26-crossmodal-graphql.yaml +0 -34
- package/dist/cli/attack-corpus/data_extraction/adv26-crossmodal-regex.yaml +0 -19
- package/dist/cli/attack-corpus/data_extraction/adv26-crossmodal-sql-prose.yaml +0 -18
- package/dist/cli/attack-corpus/data_extraction/adv26-meta-confidence-calibration.yaml +0 -21
- package/dist/cli/attack-corpus/data_extraction/adv26-meta-instruction-count.yaml +0 -18
- package/dist/cli/attack-corpus/data_extraction/adv26-meta-output-format.yaml +0 -16
- package/dist/cli/attack-corpus/data_extraction/adv26-meta-summarize-yourself.yaml +0 -19
- package/dist/cli/attack-corpus/data_extraction/adv26-semantic-decomp-definition.yaml +0 -15
- package/dist/cli/attack-corpus/data_extraction/adv26-semantic-decomp-fill-blank.yaml +0 -19
- package/dist/cli/attack-corpus/data_extraction/adv26-semantic-decomp-negation.yaml +0 -14
- package/dist/cli/attack-corpus/data_extraction/cloud-provider-discovery.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/config-file-request.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/cve-2025-echoleak.yaml +0 -17
- package/dist/cli/attack-corpus/data_extraction/data-api-key.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/data-architecture.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/data-conversation-history.yaml +0 -10
- package/dist/cli/attack-corpus/data_extraction/data-credit-card.yaml +0 -15
- package/dist/cli/attack-corpus/data_extraction/data-customer-list.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/data-database.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/data-employees.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/data-export.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/data-inference-v1.yaml +0 -10
- package/dist/cli/attack-corpus/data_extraction/data-inference-v2.yaml +0 -10
- package/dist/cli/attack-corpus/data_extraction/data-logs.yaml +0 -10
- package/dist/cli/attack-corpus/data_extraction/data-model-info.yaml +0 -10
- package/dist/cli/attack-corpus/data_extraction/data-password.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/data-ssn.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/data-training.yaml +0 -10
- package/dist/cli/attack-corpus/data_extraction/dependency-enum.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/dialogflow-fulfillment-leak.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/dialogflow-intent-leak.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/error-induced-leak.yaml +0 -17
- package/dist/cli/attack-corpus/data_extraction/error-message-leak.yaml +0 -12
- package/dist/cli/attack-corpus/data_extraction/infra-fingerprint.yaml +0 -16
- package/dist/cli/attack-corpus/data_extraction/make-scenario-leak.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/n8n-execution-data.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/n8n-node-enumeration.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/n8n-workflow-disclosure.yaml +0 -15
- package/dist/cli/attack-corpus/data_extraction/prompt-extraction-v1.yaml +0 -10
- package/dist/cli/attack-corpus/data_extraction/prompt-extraction-v2.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/prompt-extraction-v3.yaml +0 -10
- package/dist/cli/attack-corpus/data_extraction/prompt-leak-completion.yaml +0 -10
- package/dist/cli/attack-corpus/data_extraction/prompt-leak-indirect.yaml +0 -10
- package/dist/cli/attack-corpus/data_extraction/rasa-domain-leak.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/system-prompt-section.yaml +0 -14
- package/dist/cli/attack-corpus/data_extraction/tech-architecture.yaml +0 -16
- package/dist/cli/attack-corpus/data_extraction/tool-api-key-exfil.yaml +0 -15
- package/dist/cli/attack-corpus/data_extraction/tool-email-exfil.yaml +0 -14
- package/dist/cli/attack-corpus/data_extraction/tool-env-extraction.yaml +0 -14
- package/dist/cli/attack-corpus/data_extraction/tool-file-read.yaml +0 -16
- package/dist/cli/attack-corpus/data_extraction/tool-nosql-injection.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/tool-payment-manipulation.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/tool-price-manipulation.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/tool-session-hijack.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/tool-sql-injection.yaml +0 -13
- package/dist/cli/attack-corpus/data_extraction/tool-webhook-hijack.yaml +0 -13
- package/dist/cli/attack-corpus/data_extraction/version-fingerprint.yaml +0 -16
- package/dist/cli/attack-corpus/data_extraction/webhook-secret-extraction.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/webhook-url-enum.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/workflow-instance-id.yaml +0 -11
- package/dist/cli/attack-corpus/data_extraction/workflow-state-leak.yaml +0 -16
- package/dist/cli/attack-corpus/data_extraction/zapier-zap-leak.yaml +0 -11
- package/dist/cli/attack-corpus/encoding_attack/adv26-adversarial-token-confusion.yaml +0 -13
- package/dist/cli/attack-corpus/encoding_attack/base64-decode-request.yaml +0 -14
- package/dist/cli/attack-corpus/encoding_attack/base64-injection-v1.yaml +0 -14
- package/dist/cli/attack-corpus/encoding_attack/flip-attack-v1.yaml +0 -14
- package/dist/cli/attack-corpus/encoding_attack/flip-attack-v2.yaml +0 -14
- package/dist/cli/attack-corpus/encoding_attack/token-smuggling.yaml +0 -10
- package/dist/cli/attack-corpus/encoding_attack/unicode-homoglyph.yaml +0 -15
- package/dist/cli/attack-corpus/encoding_attack/unicode-invisible.yaml +0 -15
- package/dist/cli/attack-corpus/encoding_attack/unicode-rtl.yaml +0 -11
- package/dist/cli/attack-corpus/encoding_bypass/adv26-compound-encoding-chain.yaml +0 -19
- package/dist/cli/attack-corpus/encoding_bypass/adv26-smuggle-acrostic.yaml +0 -26
- package/dist/cli/attack-corpus/encoding_bypass/adv26-smuggle-ascii-art.yaml +0 -25
- package/dist/cli/attack-corpus/encoding_bypass/adv26-smuggle-emoji-cipher.yaml +0 -22
- package/dist/cli/attack-corpus/encoding_bypass/adv26-smuggle-first-word.yaml +0 -15
- package/dist/cli/attack-corpus/encoding_bypass/adv26-smuggle-pig-latin.yaml +0 -15
- package/dist/cli/attack-corpus/encoding_bypass/encoding-base64-v1.yaml +0 -11
- package/dist/cli/attack-corpus/encoding_bypass/encoding-base64-v2.yaml +0 -15
- package/dist/cli/attack-corpus/encoding_bypass/encoding-hex-v1.yaml +0 -11
- package/dist/cli/attack-corpus/encoding_bypass/encoding-leetspeak-v1.yaml +0 -10
- package/dist/cli/attack-corpus/encoding_bypass/encoding-morse-v1.yaml +0 -11
- package/dist/cli/attack-corpus/encoding_bypass/encoding-reverse-v1.yaml +0 -11
- package/dist/cli/attack-corpus/encoding_bypass/encoding-rot13-v1.yaml +0 -11
- package/dist/cli/attack-corpus/encoding_bypass/unicode-tag-injection.yaml +0 -10
- package/dist/cli/attack-corpus/encoding_bypass/zero-width-injection.yaml +0 -10
- package/dist/cli/attack-corpus/exploitation/exploit-command-injection.yaml +0 -12
- package/dist/cli/attack-corpus/exploitation/exploit-path-traversal.yaml +0 -12
- package/dist/cli/attack-corpus/exploitation/exploit-sql-injection.yaml +0 -12
- package/dist/cli/attack-corpus/exploitation/exploit-sql-union.yaml +0 -12
- package/dist/cli/attack-corpus/exploitation/exploit-template-injection.yaml +0 -12
- package/dist/cli/attack-corpus/glitch_token/glitch-davidjl.yaml +0 -10
- package/dist/cli/attack-corpus/glitch_token/glitch-solidgoldmagikarp.yaml +0 -10
- package/dist/cli/attack-corpus/harmful_content/dna-deepfake-guidance.yaml +0 -14
- package/dist/cli/attack-corpus/harmful_content/dna-discrimination.yaml +0 -14
- package/dist/cli/attack-corpus/harmful_content/dna-information-hazard.yaml +0 -14
- package/dist/cli/attack-corpus/harmful_content/dna-malicious-use-phishing.yaml +0 -14
- package/dist/cli/attack-corpus/harmful_content/dna-malware-assistance.yaml +0 -16
- package/dist/cli/attack-corpus/harmful_content/dna-misinformation-health.yaml +0 -17
- package/dist/cli/attack-corpus/jailbreak/adv26-adversarial-few-shot-poison.yaml +0 -27
- package/dist/cli/attack-corpus/jailbreak/adv26-adversarial-prompt-refraction.yaml +0 -19
- package/dist/cli/attack-corpus/jailbreak/adv26-adversarial-response-prefill.yaml +0 -25
- package/dist/cli/attack-corpus/jailbreak/adv26-compound-authority-technical.yaml +0 -24
- package/dist/cli/attack-corpus/jailbreak/adv26-context-error-recovery.yaml +0 -19
- package/dist/cli/attack-corpus/jailbreak/adv26-context-token-budget.yaml +0 -19
- package/dist/cli/attack-corpus/jailbreak/adv26-cot-hijack-proof.yaml +0 -20
- package/dist/cli/attack-corpus/jailbreak/adv26-cot-hijack-reasoning.yaml +0 -19
- package/dist/cli/attack-corpus/jailbreak/adv26-meta-alignment-test.yaml +0 -22
- package/dist/cli/attack-corpus/jailbreak/adv26-persona-memory.yaml +0 -17
- package/dist/cli/attack-corpus/jailbreak/adv26-persona-mirror.yaml +0 -16
- package/dist/cli/attack-corpus/jailbreak/adv26-persona-split.yaml +0 -17
- package/dist/cli/attack-corpus/jailbreak/adv26-persona-timetravel.yaml +0 -15
- package/dist/cli/attack-corpus/jailbreak/dan-anti.yaml +0 -16
- package/dist/cli/attack-corpus/jailbreak/dan-dude.yaml +0 -16
- package/dist/cli/attack-corpus/jailbreak/dan-jailbreak-v1.yaml +0 -21
- package/dist/cli/attack-corpus/jailbreak/dan-jailbreak-v2.yaml +0 -19
- package/dist/cli/attack-corpus/jailbreak/dan-stan.yaml +0 -16
- package/dist/cli/attack-corpus/jailbreak/debug-mode-activation.yaml +0 -20
- package/dist/cli/attack-corpus/jailbreak/iris-self-jailbreak.yaml +0 -23
- package/dist/cli/attack-corpus/jailbreak/logic-trap-moral.yaml +0 -20
- package/dist/cli/attack-corpus/jailbreak/logic-trap-paradox.yaml +0 -17
- package/dist/cli/attack-corpus/jailbreak/policy-puppetry-json.yaml +0 -25
- package/dist/cli/attack-corpus/jailbreak/policy-puppetry-xml.yaml +0 -20
- package/dist/cli/attack-corpus/jailbreak/simulation-mode.yaml +0 -19
- package/dist/cli/attack-corpus/latent_injection/adv26-compound-trojan-doc.yaml +0 -26
- package/dist/cli/attack-corpus/latent_injection/latent-code-comment-injection.yaml +0 -18
- package/dist/cli/attack-corpus/latent_injection/latent-email-injection.yaml +0 -23
- package/dist/cli/attack-corpus/latent_injection/latent-report-injection.yaml +0 -21
- package/dist/cli/attack-corpus/latent_injection/latent-resume-injection.yaml +0 -23
- package/dist/cli/attack-corpus/latent_injection/latent-whois-snippet.yaml +0 -19
- package/dist/cli/attack-corpus/multi-turn/multiturn-context-confusion.yaml +0 -20
- package/dist/cli/attack-corpus/multi-turn/multiturn-emergency.yaml +0 -20
- package/dist/cli/attack-corpus/multi-turn/multiturn-employee-impersonation.yaml +0 -20
- package/dist/cli/attack-corpus/multi-turn/multiturn-example-injection.yaml +0 -20
- package/dist/cli/attack-corpus/multi-turn/multiturn-jailbreak-buildup.yaml +0 -20
- package/dist/cli/attack-corpus/multi-turn/multiturn-memory-manipulation.yaml +0 -20
- package/dist/cli/attack-corpus/multi-turn/multiturn-privilege-escalation.yaml +0 -23
- package/dist/cli/attack-corpus/multi-turn/multiturn-split-request.yaml +0 -20
- package/dist/cli/attack-corpus/multi-turn/multiturn-trust-building.yaml +0 -19
- package/dist/cli/attack-corpus/multilingual/multilingual-mixed.yaml +0 -10
- package/dist/cli/attack-corpus/multilingual/multilingual-spanish.yaml +0 -10
- package/dist/cli/attack-corpus/prompt_injection/adv26-context-fake-history.yaml +0 -16
- package/dist/cli/attack-corpus/prompt_injection/adv26-context-sandwich.yaml +0 -18
- package/dist/cli/attack-corpus/prompt_injection/adv26-context-system-message.yaml +0 -19
- package/dist/cli/attack-corpus/prompt_injection/adv26-crossmodal-yaml.yaml +0 -30
- package/dist/cli/attack-corpus/prompt_injection/adv26-semantic-decomp-stepwise.yaml +0 -16
- package/dist/cli/attack-corpus/prompt_injection/context-json-injection.yaml +0 -15
- package/dist/cli/attack-corpus/prompt_injection/context-markdown-injection.yaml +0 -26
- package/dist/cli/attack-corpus/prompt_injection/context-xml-injection.yaml +0 -19
- package/dist/cli/attack-corpus/prompt_injection/continuation-code.yaml +0 -16
- package/dist/cli/attack-corpus/prompt_injection/continuation-story.yaml +0 -10
- package/dist/cli/attack-corpus/prompt_injection/cve-2025-copilot.yaml +0 -17
- package/dist/cli/attack-corpus/prompt_injection/ignore-instructions-v1.yaml +0 -14
- package/dist/cli/attack-corpus/prompt_injection/ignore-instructions-v2.yaml +0 -16
- package/dist/cli/attack-corpus/prompt_injection/ignore-instructions-v3.yaml +0 -18
- package/dist/cli/attack-corpus/prompt_injection/indirect-file.yaml +0 -10
- package/dist/cli/attack-corpus/prompt_injection/indirect-url.yaml +0 -10
- package/dist/cli/attack-corpus/prompt_injection/instruction-hierarchy.yaml +0 -20
- package/dist/cli/attack-corpus/prompt_injection/multilang-chain.yaml +0 -16
- package/dist/cli/attack-corpus/prompt_injection/multilang-chinese.yaml +0 -10
- package/dist/cli/attack-corpus/prompt_injection/multilang-japanese.yaml +0 -11
- package/dist/cli/attack-corpus/prompt_injection/multilang-mixed.yaml +0 -10
- package/dist/cli/attack-corpus/prompt_injection/multilang-polish.yaml +0 -11
- package/dist/cli/attack-corpus/prompt_injection/multilang-spanish.yaml +0 -14
- package/dist/cli/attack-corpus/prompt_injection/nested-instruction.yaml +0 -22
- package/dist/cli/attack-corpus/prompt_injection/template-injection-v1.yaml +0 -14
- package/dist/cli/attack-corpus/prompt_injection/template-injection-v2.yaml +0 -10
- package/dist/cli/attack-corpus/prompt_injection/tool-file-write.yaml +0 -13
- package/dist/cli/attack-corpus/prompt_injection/tool-function-override.yaml +0 -13
- package/dist/cli/attack-corpus/prompt_injection/tool-log-injection.yaml +0 -13
- package/dist/cli/attack-corpus/prompt_injection/tool-orchestration-abuse.yaml +0 -14
- package/dist/cli/attack-corpus/prompt_injection/tool-session-fixation.yaml +0 -12
- package/dist/cli/attack-corpus/role_manipulation/role-reversal-v1.yaml +0 -20
- package/dist/cli/attack-corpus/role_manipulation/role-reversal-v2.yaml +0 -16
- package/dist/cli/attack-corpus/social_engineering/adv26-compound-compliance-trap.yaml +0 -23
- package/dist/cli/attack-corpus/social_engineering/adv26-compound-emotional-technical.yaml +0 -18
- package/dist/cli/attack-corpus/social_engineering/adv26-cot-hijack-socratic.yaml +0 -19
- package/dist/cli/attack-corpus/social_engineering/adv26-persona-dying.yaml +0 -15
- package/dist/cli/attack-corpus/social_engineering/adv26-reward-consensus.yaml +0 -17
- package/dist/cli/attack-corpus/social_engineering/adv26-reward-gradient.yaml +0 -21
- package/dist/cli/attack-corpus/social_engineering/adv26-reward-helpful-framing.yaml +0 -17
- package/dist/cli/attack-corpus/social_engineering/adv26-reward-praise-prime.yaml +0 -13
- package/dist/cli/attack-corpus/social_engineering/adv26-reward-punishment.yaml +0 -13
- package/dist/cli/attack-corpus/social_engineering/adv26-semantic-decomp-analogy.yaml +0 -16
- package/dist/cli/attack-corpus/social_engineering/emotional-authority.yaml +0 -14
- package/dist/cli/attack-corpus/social_engineering/emotional-urgency.yaml +0 -14
- package/dist/cli/attack-corpus/social_engineering/grandma-bedtime-v1.yaml +0 -21
- package/dist/cli/attack-corpus/social_engineering/grandma-bedtime-v2.yaml +0 -17
- package/dist/cli/attack-corpus/social_engineering/grandma-colorful-words.yaml +0 -14
- package/dist/cli/attack-corpus/social_engineering/hypothetical-fiction.yaml +0 -10
- package/dist/cli/attack-corpus/social_engineering/hypothetical-research.yaml +0 -10
- package/dist/cli/attack-corpus/social_engineering/hypothetical-training.yaml +0 -13
- package/dist/cli/attack-corpus/social_engineering/hypothetical-v1.yaml +0 -17
- package/dist/cli/attack-corpus/social_engineering/hypothetical-v2.yaml +0 -14
- package/dist/cli/attack-corpus/social_engineering/hypothetical-v3.yaml +0 -14
- package/dist/cli/attack-corpus/social_engineering/meta-explanation.yaml +0 -14
- package/dist/cli/attack-corpus/social_engineering/phrasing-comparative.yaml +0 -10
- package/dist/cli/attack-corpus/social_engineering/phrasing-educational.yaml +0 -14
- package/dist/cli/attack-corpus/social_engineering/phrasing-future-tense.yaml +0 -10
- package/dist/cli/attack-corpus/social_engineering/phrasing-past-tense.yaml +0 -10
- package/dist/cli/attack-corpus/social_engineering/phrasing-third-person.yaml +0 -10
- package/dist/cli/attack-corpus/social_engineering/privilege-escalation-v1.yaml +0 -14
- package/dist/cli/attack-corpus/social_engineering/privilege-escalation-v2.yaml +0 -14
- package/dist/cli/attack-corpus/social_engineering/recursive-explanation.yaml +0 -15
- package/dist/cli/attack-corpus/social_engineering/smuggle-academic-paper.yaml +0 -10
- package/dist/cli/attack-corpus/social_engineering/smuggle-function-masking.yaml +0 -19
- package/dist/cli/attack-corpus/social_engineering/smuggle-hypothetical-response.yaml +0 -10
- package/dist/cli/attack-corpus/social_engineering/smuggle-roleplay-interviewer.yaml +0 -12
- package/dist/cli/attack-corpus/social_engineering/smuggle-translation-mask.yaml +0 -12
- package/dist/cli/attack-corpus/social_engineering/tool-admin-impersonation.yaml +0 -16
- package/dist/cli/attack-corpus/social_engineering/tool-sudo-mode.yaml +0 -17
- package/dist/cli/attack-corpus/stress_test/context-window-overflow.yaml +0 -17
- package/dist/cli/attack-corpus/stress_test/extreme-payload-50k.yaml +0 -13
- package/dist/cli/attack-corpus/stress_test/large-payload-10k.yaml +0 -12
- package/dist/cli/attack-corpus/stress_test/large-payload-5k.yaml +0 -12
- package/dist/cli/attack-corpus/stress_test/long-prompt-exhaustion.yaml +0 -19
- package/dist/cli/attack-corpus/stress_test/stress-large-payload.yaml +0 -16
- package/dist/cli/attack-corpus/stress_test/stress-repetition.yaml +0 -14
- package/dist/cli/backupManifest.d.ts +0 -7
- package/dist/cli/backupManifest.js +0 -108
- package/dist/cli/commands/agentCi.d.ts +0 -15
- package/dist/cli/commands/agentCi.js +0 -418
- package/dist/cli/commands/approve.d.ts +0 -17
- package/dist/cli/commands/approve.js +0 -40
- package/dist/cli/commands/autoProtect.d.ts +0 -10
- package/dist/cli/commands/autoProtect.js +0 -154
- package/dist/cli/commands/ciProtect.d.ts +0 -44
- package/dist/cli/commands/ciProtect.js +0 -123
- package/dist/cli/commands/clipboardScan.d.ts +0 -2
- package/dist/cli/commands/clipboardScan.js +0 -51
- package/dist/cli/commands/cmdGuard.d.ts +0 -41
- package/dist/cli/commands/cmdGuard.js +0 -411
- package/dist/cli/commands/configure.d.ts +0 -10
- package/dist/cli/commands/configure.js +0 -131
- package/dist/cli/commands/credits.d.ts +0 -6
- package/dist/cli/commands/credits.js +0 -21
- package/dist/cli/commands/daemon.d.ts +0 -120
- package/dist/cli/commands/daemon.js +0 -2449
- package/dist/cli/commands/demoActions.d.ts +0 -117
- package/dist/cli/commands/demoActions.js +0 -450
- package/dist/cli/commands/desktopChatGuard.d.ts +0 -54
- package/dist/cli/commands/desktopChatGuard.js +0 -629
- package/dist/cli/commands/deterministicGuard.d.ts +0 -102
- package/dist/cli/commands/deterministicGuard.js +0 -1281
- package/dist/cli/commands/discover.d.ts +0 -92
- package/dist/cli/commands/discover.js +0 -1125
- package/dist/cli/commands/discoverAgentFiles.d.ts +0 -36
- package/dist/cli/commands/discoverAgentFiles.js +0 -345
- package/dist/cli/commands/discoverBlastRadius.d.ts +0 -36
- package/dist/cli/commands/discoverBlastRadius.js +0 -201
- package/dist/cli/commands/discoverPaths.d.ts +0 -83
- package/dist/cli/commands/discoverPaths.js +0 -537
- package/dist/cli/commands/discoverProxy.d.ts +0 -46
- package/dist/cli/commands/discoverProxy.js +0 -302
- package/dist/cli/commands/discoverSchedule.d.ts +0 -12
- package/dist/cli/commands/discoverSchedule.js +0 -209
- package/dist/cli/commands/discoverSecrets.d.ts +0 -41
- package/dist/cli/commands/discoverSecrets.js +0 -608
- package/dist/cli/commands/doctor.d.ts +0 -11
- package/dist/cli/commands/doctor.js +0 -297
- package/dist/cli/commands/ephemeralStack.d.ts +0 -82
- package/dist/cli/commands/ephemeralStack.js +0 -185
- package/dist/cli/commands/flushSpool.d.ts +0 -13
- package/dist/cli/commands/flushSpool.js +0 -28
- package/dist/cli/commands/hook.d.ts +0 -141
- package/dist/cli/commands/hook.js +0 -1679
- package/dist/cli/commands/init.d.ts +0 -1
- package/dist/cli/commands/init.js +0 -95
- package/dist/cli/commands/installAll.d.ts +0 -22
- package/dist/cli/commands/installAll.js +0 -186
- package/dist/cli/commands/installClaudeHook.d.ts +0 -39
- package/dist/cli/commands/installClaudeHook.js +0 -336
- package/dist/cli/commands/installCursorHook.d.ts +0 -33
- package/dist/cli/commands/installCursorHook.js +0 -380
- package/dist/cli/commands/knownMcpServers.d.ts +0 -8
- package/dist/cli/commands/knownMcpServers.js +0 -113
- package/dist/cli/commands/local-scan.d.ts +0 -44
- package/dist/cli/commands/local-scan.js +0 -3003
- package/dist/cli/commands/login.d.ts +0 -17
- package/dist/cli/commands/login.js +0 -75
- package/dist/cli/commands/mcpGateway.d.ts +0 -119
- package/dist/cli/commands/mcpGateway.js +0 -2987
- package/dist/cli/commands/onboard.d.ts +0 -41
- package/dist/cli/commands/onboard.js +0 -713
- package/dist/cli/commands/onboardingJournal.d.ts +0 -20
- package/dist/cli/commands/onboardingJournal.js +0 -104
- package/dist/cli/commands/posixShellGuard.d.ts +0 -26
- package/dist/cli/commands/posixShellGuard.js +0 -410
- package/dist/cli/commands/protectionRepair.d.ts +0 -14
- package/dist/cli/commands/protectionRepair.js +0 -24
- package/dist/cli/commands/restartNotice.d.ts +0 -2
- package/dist/cli/commands/restartNotice.js +0 -14
- package/dist/cli/commands/scan.d.ts +0 -48
- package/dist/cli/commands/scan.js +0 -134
- package/dist/cli/commands/shellGuard.d.ts +0 -96
- package/dist/cli/commands/shellGuard.js +0 -880
- package/dist/cli/commands/taintLedger.d.ts +0 -108
- package/dist/cli/commands/taintLedger.js +0 -587
- package/dist/cli/commands/uninstallAll.d.ts +0 -67
- package/dist/cli/commands/uninstallAll.js +0 -454
- package/dist/cli/commands/verifyRemoved.d.ts +0 -24
- package/dist/cli/commands/verifyRemoved.js +0 -294
- package/dist/cli/commands/watchdog.d.ts +0 -28
- package/dist/cli/commands/watchdog.js +0 -158
- package/dist/cli/commands/windowsAudit.d.ts +0 -92
- package/dist/cli/commands/windowsAudit.js +0 -479
- package/dist/cli/commands/workloadProtect.d.ts +0 -61
- package/dist/cli/commands/workloadProtect.js +0 -173
- package/dist/cli/config.d.ts +0 -130
- package/dist/cli/config.js +0 -583
- package/dist/cli/credentialStore.d.ts +0 -19
- package/dist/cli/credentialStore.js +0 -136
- package/dist/cli/daemonForensics.d.ts +0 -178
- package/dist/cli/daemonForensics.js +0 -318
- package/dist/cli/describeError.d.ts +0 -17
- package/dist/cli/describeError.js +0 -74
- package/dist/cli/devConfirm.d.ts +0 -78
- package/dist/cli/devConfirm.js +0 -241
- package/dist/cli/discoveryMarker.d.ts +0 -9
- package/dist/cli/discoveryMarker.js +0 -81
- package/dist/cli/distress.d.ts +0 -124
- package/dist/cli/distress.js +0 -245
- package/dist/cli/envDiagnostics.d.ts +0 -53
- package/dist/cli/envDiagnostics.js +0 -114
- package/dist/cli/honeypot.d.ts +0 -45
- package/dist/cli/honeypot.js +0 -190
- package/dist/cli/hookIo.d.ts +0 -43
- package/dist/cli/hookIo.js +0 -189
- package/dist/cli/hookSlim.d.ts +0 -32
- package/dist/cli/hookSlim.js +0 -142
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +0 -1141
- package/dist/cli/integrity.d.ts +0 -23
- package/dist/cli/integrity.js +0 -159
- package/dist/cli/localSafetySnapshot.d.ts +0 -49
- package/dist/cli/localSafetySnapshot.js +0 -254
- package/dist/cli/machineActionVerify.d.ts +0 -58
- package/dist/cli/machineActionVerify.js +0 -160
- package/dist/cli/machineIdentity.d.ts +0 -23
- package/dist/cli/machineIdentity.js +0 -235
- package/dist/cli/machineKeyFile.d.ts +0 -25
- package/dist/cli/machineKeyFile.js +0 -226
- package/dist/cli/notify.d.ts +0 -30
- package/dist/cli/notify.js +0 -139
- package/dist/cli/output.d.ts +0 -11
- package/dist/cli/output.js +0 -292
- package/dist/cli/perfSnapshot.d.ts +0 -113
- package/dist/cli/perfSnapshot.js +0 -274
- package/dist/cli/policyGateHealth.d.ts +0 -45
- package/dist/cli/policyGateHealth.js +0 -135
- package/dist/cli/pollLoop.d.ts +0 -78
- package/dist/cli/pollLoop.js +0 -160
- package/dist/cli/runtimeConfig.d.ts +0 -183
- package/dist/cli/runtimeConfig.js +0 -474
- package/dist/cli/securityAgents.d.ts +0 -26
- package/dist/cli/securityAgents.js +0 -65
- package/dist/cli/selfTest.d.ts +0 -48
- package/dist/cli/selfTest.js +0 -212
- package/dist/cli/selfUpdate.d.ts +0 -101
- package/dist/cli/selfUpdate.js +0 -515
- package/dist/cli/sessionLimits.d.ts +0 -76
- package/dist/cli/sessionLimits.js +0 -330
- package/dist/cli/telemetry.d.ts +0 -134
- package/dist/cli/telemetry.js +0 -433
- package/dist/cli/verdictIpc.d.ts +0 -30
- package/dist/cli/verdictIpc.js +0 -244
- package/dist/cli/verdictIpcClient.d.ts +0 -103
- package/dist/cli/verdictIpcClient.js +0 -251
- package/dist/cli/version.json +0 -3
- package/dist/cli/windowsTaskState.d.ts +0 -40
- package/dist/cli/windowsTaskState.js +0 -43
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.doctorCommand = doctorCommand;
|
|
37
|
-
const os = __importStar(require("os"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const config_1 = require("../config");
|
|
40
|
-
const runtimeConfig_1 = require("../runtimeConfig");
|
|
41
|
-
const perfSnapshot_1 = require("../perfSnapshot");
|
|
42
|
-
const DEFAULT_API_URL = 'https://api.fullcourtdefense.ai';
|
|
43
|
-
function withTimeout(ms) {
|
|
44
|
-
return AbortSignal.timeout(ms);
|
|
45
|
-
}
|
|
46
|
-
function normalizeApiUrl(url) {
|
|
47
|
-
return (url || DEFAULT_API_URL).replace(/\/$/, '');
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Credential health, printed after connectivity passes. Connectivity alone is
|
|
51
|
-
* a false comfort: the 8/12 incident machine had a green ping while the
|
|
52
|
-
* backend rejected its shield key on every call (broken local key store), so
|
|
53
|
-
* every protected action failed closed. Doctor must surface that state.
|
|
54
|
-
*/
|
|
55
|
-
async function checkCredentials(apiUrl, config) {
|
|
56
|
-
const creds = (0, config_1.resolveCliCredentials)(config, { apiUrl });
|
|
57
|
-
if (!creds.shieldId || !creds.shieldKey) {
|
|
58
|
-
console.log('INFO not enrolled on this machine (no saved shield credentials)');
|
|
59
|
-
console.log(' Enroll with: fullcourtdefense onboard --token <fleet-enrollment-token>');
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
const started = Date.now();
|
|
63
|
-
const validation = await (0, runtimeConfig_1.validateShieldCredentials)({ apiUrl, shieldId: creds.shieldId, shieldKey: creds.shieldKey });
|
|
64
|
-
const elapsed = Date.now() - started;
|
|
65
|
-
if (validation.ok) {
|
|
66
|
-
console.log(`PASS machine credentials accepted by the backend (shield ${creds.shieldId}, ${elapsed}ms)`);
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
if (validation.authRejected) {
|
|
70
|
-
console.log(`FAIL backend REJECTS this machine's saved credentials (${validation.detail})`);
|
|
71
|
-
console.log(' Protected actions fail-closed until the machine re-enrolls.');
|
|
72
|
-
console.log(' Fix: fullcourtdefense onboard --token <fleet-enrollment-token>');
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
console.log(`WARN could not verify credentials right now (${validation.detail}); cached enforcement applies`);
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* `doctor --perf` — the customer-runnable lightness proof. Measures the REAL
|
|
80
|
-
* per-event overhead on THIS machine (live caches, live install, live AV/EDR),
|
|
81
|
-
* so before/after comparisons happen on the customer's own hardware instead of
|
|
82
|
-
* our lab. Read-only: no config writes, no enrollment changes, no uploads.
|
|
83
|
-
* Shares its collection code with the `perf_snapshot` remote machine action
|
|
84
|
-
* (perfSnapshot.ts), so the console table matches what customers see locally.
|
|
85
|
-
*/
|
|
86
|
-
async function perfCheck(apiUrl, config) {
|
|
87
|
-
console.log('');
|
|
88
|
-
console.log('FullCourtDefense overhead self-check (read-only, ~10s)');
|
|
89
|
-
console.log('');
|
|
90
|
-
// Resolved enforcement state — numbers are only interpretable per mode.
|
|
91
|
-
const creds = (0, config_1.resolveCliCredentials)(config, { apiUrl }, { skipDpapi: true });
|
|
92
|
-
let mode;
|
|
93
|
-
let source;
|
|
94
|
-
let policyHash;
|
|
95
|
-
if (creds.shieldId) {
|
|
96
|
-
const bundle = await (0, runtimeConfig_1.getRuntimeBundle)({
|
|
97
|
-
apiUrl, shieldId: creds.shieldId, shieldKey: creds.shieldKey,
|
|
98
|
-
developerName: `${os.userInfo().username}@${os.hostname()}`, machineName: os.hostname(),
|
|
99
|
-
hotPath: true,
|
|
100
|
-
});
|
|
101
|
-
mode = bundle.mode;
|
|
102
|
-
source = bundle.source;
|
|
103
|
-
policyHash = bundle.policyHash;
|
|
104
|
-
console.log(`mode: ${bundle.mode} (source: ${bundle.source}${bundle.policyHash ? `, policy ${bundle.policyHash.slice(0, 12)}` : ''})`);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
console.log('mode: not enrolled (local defaults, monitor-first)');
|
|
108
|
-
}
|
|
109
|
-
const snapshot = await (0, perfSnapshot_1.collectPerfSnapshot)({ mode, source, policyHash });
|
|
110
|
-
const hp = snapshot.hotPath;
|
|
111
|
-
console.log(`node spawn floor: ${hp.nodeSpawnFloorMs}ms median — OS+AV cost of any per-event process`);
|
|
112
|
-
console.log(`hook end-to-end: ${hp.hookMedianMs}ms median, ${hp.hookMinMs}-${hp.hookMaxMs}ms range — per IDE event (shell/MCP/file)`);
|
|
113
|
-
if (hp.cmdGuardOverheadMs !== undefined) {
|
|
114
|
-
console.log(`cmd guard overhead: +${hp.cmdGuardOverheadMs}ms median — per cmd.exe START (once per terminal window; every time for "cmd /c" callers such as build scripts and CI)`);
|
|
115
|
-
}
|
|
116
|
-
if (hp.cmdGuardCheckerMs !== undefined) {
|
|
117
|
-
console.log(`cmd guard checker: +${hp.cmdGuardCheckerMs}ms median — additional, only when the typed command is one we intercept`);
|
|
118
|
-
}
|
|
119
|
-
if (snapshot.processes.length > 0) {
|
|
120
|
-
console.log(`resident processes: ${snapshot.processes.length} FullCourtDefense process(es), ${snapshot.totalWorkingSetMB}MB working set total`);
|
|
121
|
-
for (const p of snapshot.processes) {
|
|
122
|
-
console.log(` pid ${p.pid} ${p.workingSetMB}MB, cpu ${p.cpuSec}s — ${p.cmd.slice(0, 100)}`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
const d = snapshot.disk;
|
|
126
|
-
console.log(`disk: hook.log ${d.hookLogKB ?? 0}KB (capped 1MB) | spool ${d.spoolKB ?? 0}KB (backlog ${d.spoolBacklogCount ?? 0}) | daemon.log ${d.daemonLogKB ?? 0}KB (capped 1MB)`);
|
|
127
|
-
console.log('');
|
|
128
|
-
const budgetMs = 300;
|
|
129
|
-
if (hp.hookMedianMs <= budgetMs) {
|
|
130
|
-
console.log(`PASS per-event overhead within budget (${hp.hookMedianMs}ms <= ${budgetMs}ms)`);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
console.log(`WARN per-event overhead above budget (${hp.hookMedianMs}ms > ${budgetMs}ms) — if the node spawn floor is also high, AV/EDR is scanning every process spawn; ask IT about an exclusion for the FullCourtDefense install folder.`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* `doctor --health` — mdatp-health-style status: one line per subsystem with
|
|
138
|
-
* PASS/FAIL and detail. Runs the SAME deep self-test the fleet console
|
|
139
|
-
* triggers remotely (`deep_selftest` machine action), so a customer reading
|
|
140
|
-
* this table and an admin reading the console see identical facts.
|
|
141
|
-
*/
|
|
142
|
-
async function healthCheck(apiUrl, config) {
|
|
143
|
-
const { cliVersion, isWatchdogTaskInstalled } = await Promise.resolve().then(() => __importStar(require('./daemon')));
|
|
144
|
-
const { runDeepSelfTest, summarizeSelfTest } = await Promise.resolve().then(() => __importStar(require('../selfTest')));
|
|
145
|
-
const { getMachineIdentity } = await Promise.resolve().then(() => __importStar(require('../machineIdentity')));
|
|
146
|
-
const version = cliVersion();
|
|
147
|
-
console.log('');
|
|
148
|
-
console.log(`FullCourtDefense health${version ? ` v${version}` : ''} — ${os.hostname()} (${os.platform()} ${os.release()})`);
|
|
149
|
-
const creds = (0, config_1.resolveCliCredentials)(config, { apiUrl });
|
|
150
|
-
if (creds.shieldId) {
|
|
151
|
-
try {
|
|
152
|
-
const bundle = await (0, runtimeConfig_1.getRuntimeBundle)({
|
|
153
|
-
apiUrl, shieldId: creds.shieldId, shieldKey: creds.shieldKey,
|
|
154
|
-
developerName: `${os.userInfo().username}@${os.hostname()}`, machineName: os.hostname(),
|
|
155
|
-
hotPath: true,
|
|
156
|
-
});
|
|
157
|
-
console.log(`enrolled: yes (shield ${creds.shieldId}) | mode: ${bundle.mode} (source: ${bundle.source}${bundle.policyHash ? `, policy ${bundle.policyHash.slice(0, 12)}` : ''})`);
|
|
158
|
-
}
|
|
159
|
-
catch {
|
|
160
|
-
console.log(`enrolled: yes (shield ${creds.shieldId}) | mode: cached (policy fetch unavailable right now)`);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
console.log('enrolled: no (local defaults, monitor-first)');
|
|
165
|
-
}
|
|
166
|
-
console.log('');
|
|
167
|
-
const identity = getMachineIdentity();
|
|
168
|
-
const report = await runDeepSelfTest({
|
|
169
|
-
creds,
|
|
170
|
-
developerName: identity.developerName,
|
|
171
|
-
machineName: identity.hostname,
|
|
172
|
-
machineId: identity.machineId,
|
|
173
|
-
isWatchdogTaskInstalled,
|
|
174
|
-
});
|
|
175
|
-
for (const check of report.checks) {
|
|
176
|
-
const status = check.ok ? 'PASS' : (check.optional ? 'WARN' : 'FAIL');
|
|
177
|
-
console.log(`${status} ${check.label}${check.detail ? ` — ${check.detail}` : ''}`);
|
|
178
|
-
}
|
|
179
|
-
console.log('');
|
|
180
|
-
console.log(summarizeSelfTest(report));
|
|
181
|
-
if (!report.ok) {
|
|
182
|
-
console.log('For AV/EDR tuning guidance run: fullcourtdefense doctor --edr true');
|
|
183
|
-
process.exit(1);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* `doctor --edr` — the narrowest AV/EDR allowlist guidance, printable and
|
|
188
|
-
* pasteable into an IT ticket. Mirrors docs/av-edr-coexistence.md; most
|
|
189
|
-
* fleets need none of it.
|
|
190
|
-
*/
|
|
191
|
-
function edrGuidance(apiUrl) {
|
|
192
|
-
const installRoot = path.resolve(__dirname, '..', '..');
|
|
193
|
-
const nodeExe = path.join(installRoot, 'runtime', 'node.exe');
|
|
194
|
-
const hostname = new URL(normalizeApiUrl(apiUrl)).hostname;
|
|
195
|
-
console.log('');
|
|
196
|
-
console.log('FullCourtDefense — AV/EDR co-existence guidance (for your IT/security team)');
|
|
197
|
-
console.log('');
|
|
198
|
-
console.log('Most fleets need NO exclusions. Add them only if `doctor --perf true` shows');
|
|
199
|
-
console.log('hook latency dominated by process start (EDR scanning every node spawn).');
|
|
200
|
-
console.log('');
|
|
201
|
-
console.log('1. Process exclusion (preferred, narrowest):');
|
|
202
|
-
console.log(` ${nodeExe}`);
|
|
203
|
-
console.log(' Signed binary in an admin-write-only path. Removes the per-spawn scan');
|
|
204
|
-
console.log(' cost, which is the entire hot-path problem.');
|
|
205
|
-
console.log('2. File exclusions for hot state files (high write frequency, never executed):');
|
|
206
|
-
console.log(' %USERPROFILE%\\.fullcourtdefense-spool.jsonl');
|
|
207
|
-
console.log(' %USERPROFILE%\\.fullcourtdefense-hook.log');
|
|
208
|
-
console.log(' %USERPROFILE%\\.fullcourtdefense-runtime.json');
|
|
209
|
-
console.log('3. Folder exclusion (only if 1-2 are unavailable):');
|
|
210
|
-
console.log(` ${installRoot}\\`);
|
|
211
|
-
console.log(' Do NOT exclude %USERPROFILE%\\.fullcourtdefense* wholesale and do NOT');
|
|
212
|
-
console.log(' exclude %ProgramData%\\FullCourtDefense — they are user-writable; keep them scanned.');
|
|
213
|
-
console.log('');
|
|
214
|
-
console.log('Network allowlist (proxy / TLS inspection):');
|
|
215
|
-
console.log(` Allow outbound HTTPS (TCP 443) to: ${hostname}`);
|
|
216
|
-
console.log(' Everything (policy bundle, verdicts, telemetry, update manifest) uses that one hostname.');
|
|
217
|
-
console.log('');
|
|
218
|
-
console.log('AppLocker / WDAC:');
|
|
219
|
-
console.log(' The MSI and installer scripts are Authenticode-signed — prefer a PUBLISHER');
|
|
220
|
-
console.log(' rule over path rules. The bundled runtime\\node.exe carries the official');
|
|
221
|
-
console.log(' Node.js signature. Install/update custom actions are PowerShell-free, so');
|
|
222
|
-
console.log(' PowerShell-blocking policies do not affect install, update, or enforcement.');
|
|
223
|
-
console.log('');
|
|
224
|
-
console.log('Full guide: sdks/cli/docs/av-edr-coexistence.md (in the product repo).');
|
|
225
|
-
}
|
|
226
|
-
async function doctorCommand(args, config) {
|
|
227
|
-
const apiUrl = normalizeApiUrl(args.apiUrl || config.apiUrl);
|
|
228
|
-
if (args.perf === 'true') {
|
|
229
|
-
await perfCheck(apiUrl, config);
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
if (args.health === 'true') {
|
|
233
|
-
await healthCheck(apiUrl, config);
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
if (args.edr === 'true') {
|
|
237
|
-
edrGuidance(apiUrl);
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
const pingUrl = `${apiUrl}/api/health/ping`;
|
|
241
|
-
const rootUrl = `${apiUrl}/`;
|
|
242
|
-
console.log('');
|
|
243
|
-
console.log('FullCourtDefense outbound diagnostic');
|
|
244
|
-
console.log(`Target: ${apiUrl}`);
|
|
245
|
-
console.log('');
|
|
246
|
-
const started = Date.now();
|
|
247
|
-
try {
|
|
248
|
-
const resp = await fetch(pingUrl, {
|
|
249
|
-
method: 'GET',
|
|
250
|
-
signal: withTimeout(10000),
|
|
251
|
-
});
|
|
252
|
-
const elapsed = Date.now() - started;
|
|
253
|
-
const body = await resp.text().catch(() => '');
|
|
254
|
-
if (resp.ok) {
|
|
255
|
-
console.log(`PASS outbound HTTPS open (${resp.status}, ${elapsed}ms)`);
|
|
256
|
-
console.log(`Checked: ${pingUrl}`);
|
|
257
|
-
if (!(await checkCredentials(apiUrl, config))) {
|
|
258
|
-
process.exit(1);
|
|
259
|
-
}
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
console.log(`WARN health ping reachable but returned HTTP ${resp.status} (${elapsed}ms)`);
|
|
263
|
-
if (body)
|
|
264
|
-
console.log(body.slice(0, 300));
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
console.log(`FAIL health ping failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
268
|
-
}
|
|
269
|
-
const fallbackStarted = Date.now();
|
|
270
|
-
try {
|
|
271
|
-
const resp = await fetch(rootUrl, {
|
|
272
|
-
method: 'GET',
|
|
273
|
-
signal: withTimeout(10000),
|
|
274
|
-
});
|
|
275
|
-
const elapsed = Date.now() - fallbackStarted;
|
|
276
|
-
if (resp.ok) {
|
|
277
|
-
console.log(`PASS root API reachable (${resp.status}, ${elapsed}ms)`);
|
|
278
|
-
console.log(`Checked: ${rootUrl}`);
|
|
279
|
-
if (!(await checkCredentials(apiUrl, config))) {
|
|
280
|
-
process.exit(1);
|
|
281
|
-
}
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
console.log(`FAIL root API returned HTTP ${resp.status} (${elapsed}ms)`);
|
|
285
|
-
}
|
|
286
|
-
catch (error) {
|
|
287
|
-
console.log(`FAIL root API failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
288
|
-
}
|
|
289
|
-
const hostname = new URL(apiUrl).hostname;
|
|
290
|
-
console.log('');
|
|
291
|
-
console.log(`FAIL API unreachable — on corporate networks this is almost always a proxy/firewall allowlist, not this machine.`);
|
|
292
|
-
console.log(` Ask IT to allowlist outbound HTTPS (TCP 443) to: ${hostname}`);
|
|
293
|
-
console.log(' While unreachable, the CLI enforces from its locally cached policies with zero added');
|
|
294
|
-
console.log(' latency per action (fast-probe window) — nothing hangs waiting for the network.');
|
|
295
|
-
console.log(' Re-run this command after the allowlist change to confirm.');
|
|
296
|
-
process.exit(1);
|
|
297
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { BotGuardConfig } from '../config';
|
|
2
|
-
export type EphemeralNoun = 'workload' | 'pipeline';
|
|
3
|
-
/**
|
|
4
|
-
* Written by `ci-protect` / `workload-protect` next to the credentials they
|
|
5
|
-
* save. Its presence says "the enrollment on this machine is EPHEMERAL", so a
|
|
6
|
-
* re-run (same container, next job on the same runner) may overwrite it.
|
|
7
|
-
*/
|
|
8
|
-
export declare function ephemeralIdentityMarkerPath(): string;
|
|
9
|
-
export interface EnrolledLaptopCheck {
|
|
10
|
-
configPath?: string;
|
|
11
|
-
markerPath?: string;
|
|
12
|
-
machineKeyPath?: string;
|
|
13
|
-
force?: boolean;
|
|
14
|
-
env?: NodeJS.ProcessEnv;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Refuse to turn an enrolled LAPTOP into a workload/pipeline.
|
|
18
|
-
*
|
|
19
|
-
* Both ephemeral commands save their identity into the SAME files the laptop
|
|
20
|
-
* enrollment uses (`~/.fullcourtdefense.yml`, the credential store, the S4U
|
|
21
|
-
* `machine-key.json`). Run on a developer's already-enrolled machine, they
|
|
22
|
-
* silently replace the human's identity with a container's: the hook then
|
|
23
|
-
* carries a workload key, the daemon 401s, and on a fail-closed machine every
|
|
24
|
-
* IDE action is blocked until someone re-enrolls by hand (2026-09-03).
|
|
25
|
-
*
|
|
26
|
-
* The rule is deterministic: an existing enrollment (config with a shieldId,
|
|
27
|
-
* or a machine key file) WITHOUT the ephemeral marker is a human enrollment —
|
|
28
|
-
* stop, unless `--force true` / FCD_FORCE_EPHEMERAL=1 says the operator knows.
|
|
29
|
-
* A fresh container has none of these files, so the guard never fires there.
|
|
30
|
-
*/
|
|
31
|
-
export declare function assertNotEnrolledLaptop(noun: EphemeralNoun, check?: EnrolledLaptopCheck): void;
|
|
32
|
-
/** Record that the enrollment now on this machine is ephemeral (see assertNotEnrolledLaptop). */
|
|
33
|
-
export declare function writeEphemeralIdentityMarker(noun: EphemeralNoun, machineId: string, markerPath?: string): void;
|
|
34
|
-
/**
|
|
35
|
-
* Shared protection stack for EPHEMERAL identities — CI pipelines
|
|
36
|
-
* (`ci-protect`) and workloads (`workload-protect`). Both enroll a
|
|
37
|
-
* non-human identity with an org API key and then install the exact laptop
|
|
38
|
-
* stack: Claude-format runtime hook + MCP gateway + vendored policy engine.
|
|
39
|
-
* One implementation so the two never drift apart.
|
|
40
|
-
*/
|
|
41
|
-
export type EphemeralLogLevel = 'info' | 'success' | 'warn' | 'error';
|
|
42
|
-
export type EphemeralLogSink = (lines: Array<{
|
|
43
|
-
level: EphemeralLogLevel;
|
|
44
|
-
message: string;
|
|
45
|
-
}>, status?: 'running' | 'succeeded' | 'failed') => Promise<void>;
|
|
46
|
-
/** No-op sink for callers without a live log stream (workloads today). */
|
|
47
|
-
export declare const silentLogSink: EphemeralLogSink;
|
|
48
|
-
export interface EphemeralStackOptions {
|
|
49
|
-
shieldId: string;
|
|
50
|
-
shieldKey?: string;
|
|
51
|
-
apiUrl: string;
|
|
52
|
-
/** 'false' => skip installing the Claude-format runtime hook. */
|
|
53
|
-
hooks?: string;
|
|
54
|
-
/** 'false' => skip wrapping MCP client configs with the gateway. */
|
|
55
|
-
gateway?: string;
|
|
56
|
-
sendLog?: EphemeralLogSink;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Install the runtime hook + MCP gateway for an enrolled ephemeral identity.
|
|
60
|
-
* Each step is best-effort and reported: a missing MCP client on the image is
|
|
61
|
-
* not a failure of the job/workload.
|
|
62
|
-
*/
|
|
63
|
-
export declare function installEphemeralProtectionStack(options: EphemeralStackOptions, config: BotGuardConfig): Promise<void>;
|
|
64
|
-
export interface IdentityEnvExportOptions {
|
|
65
|
-
/** GitHub Actions: path of $GITHUB_ENV — later job steps inherit the identity. */
|
|
66
|
-
githubEnvPath?: string;
|
|
67
|
-
/** Container entrypoints: write `KEY=value` lines to this file to `source` before starting the agent. */
|
|
68
|
-
envFilePath?: string;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Make the ephemeral identity visible to everything that runs AFTER this
|
|
72
|
-
* command — the hooks/gateway attribute every event to the identity record
|
|
73
|
-
* (pipeline / workload), not to disposable hardware.
|
|
74
|
-
*
|
|
75
|
-
* Applies to the current process, then to whichever hand-off channels exist:
|
|
76
|
-
* `$GITHUB_ENV` (later job steps) and/or an env file (container entrypoint
|
|
77
|
-
* `set -a; . /path/workload.env; set +a`). Returns the channels written.
|
|
78
|
-
*/
|
|
79
|
-
export declare function exportIdentityEnv(identityEnv: Record<string, string>, options: IdentityEnvExportOptions): {
|
|
80
|
-
githubEnv: boolean;
|
|
81
|
-
envFile?: string;
|
|
82
|
-
};
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.silentLogSink = void 0;
|
|
37
|
-
exports.ephemeralIdentityMarkerPath = ephemeralIdentityMarkerPath;
|
|
38
|
-
exports.assertNotEnrolledLaptop = assertNotEnrolledLaptop;
|
|
39
|
-
exports.writeEphemeralIdentityMarker = writeEphemeralIdentityMarker;
|
|
40
|
-
exports.installEphemeralProtectionStack = installEphemeralProtectionStack;
|
|
41
|
-
exports.exportIdentityEnv = exportIdentityEnv;
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
43
|
-
const os = __importStar(require("os"));
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
|
-
const config_1 = require("../config");
|
|
46
|
-
const installClaudeHook_1 = require("./installClaudeHook");
|
|
47
|
-
const mcpGateway_1 = require("./mcpGateway");
|
|
48
|
-
/**
|
|
49
|
-
* Written by `ci-protect` / `workload-protect` next to the credentials they
|
|
50
|
-
* save. Its presence says "the enrollment on this machine is EPHEMERAL", so a
|
|
51
|
-
* re-run (same container, next job on the same runner) may overwrite it.
|
|
52
|
-
*/
|
|
53
|
-
function ephemeralIdentityMarkerPath() {
|
|
54
|
-
return path.join(os.homedir(), '.fullcourtdefense', 'ephemeral-identity.json');
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Refuse to turn an enrolled LAPTOP into a workload/pipeline.
|
|
58
|
-
*
|
|
59
|
-
* Both ephemeral commands save their identity into the SAME files the laptop
|
|
60
|
-
* enrollment uses (`~/.fullcourtdefense.yml`, the credential store, the S4U
|
|
61
|
-
* `machine-key.json`). Run on a developer's already-enrolled machine, they
|
|
62
|
-
* silently replace the human's identity with a container's: the hook then
|
|
63
|
-
* carries a workload key, the daemon 401s, and on a fail-closed machine every
|
|
64
|
-
* IDE action is blocked until someone re-enrolls by hand (2026-09-03).
|
|
65
|
-
*
|
|
66
|
-
* The rule is deterministic: an existing enrollment (config with a shieldId,
|
|
67
|
-
* or a machine key file) WITHOUT the ephemeral marker is a human enrollment —
|
|
68
|
-
* stop, unless `--force true` / FCD_FORCE_EPHEMERAL=1 says the operator knows.
|
|
69
|
-
* A fresh container has none of these files, so the guard never fires there.
|
|
70
|
-
*/
|
|
71
|
-
function assertNotEnrolledLaptop(noun, check = {}) {
|
|
72
|
-
const env = check.env || process.env;
|
|
73
|
-
if (check.force || env.FCD_FORCE_EPHEMERAL === '1' || env.FCD_FORCE_EPHEMERAL === 'true')
|
|
74
|
-
return;
|
|
75
|
-
const configPath = check.configPath || (0, config_1.getHomeConfigPath)();
|
|
76
|
-
const markerPath = check.markerPath || ephemeralIdentityMarkerPath();
|
|
77
|
-
const machineKeyPath = check.machineKeyPath || path.join(os.homedir(), '.fullcourtdefense', 'machine-key.json');
|
|
78
|
-
if (fs.existsSync(markerPath))
|
|
79
|
-
return; // previous ephemeral enrollment — ours to replace
|
|
80
|
-
const configHasShield = (() => {
|
|
81
|
-
try {
|
|
82
|
-
return /^\s*shieldId:\s*\S+/m.test(fs.readFileSync(configPath, 'utf8'));
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
})();
|
|
88
|
-
const hasMachineKey = fs.existsSync(machineKeyPath);
|
|
89
|
-
if (!configHasShield && !hasMachineKey)
|
|
90
|
-
return;
|
|
91
|
-
const command = noun === 'workload' ? 'workload-protect' : 'ci-protect';
|
|
92
|
-
throw new Error(`This machine is already enrolled in the fleet as a developer machine (${configHasShield ? configPath : machineKeyPath}). `
|
|
93
|
-
+ `${command} is for containers, jobs and runners — running it here would replace this machine's identity with a ${noun} `
|
|
94
|
-
+ 'identity and break its hooks. Run it inside the container/job instead. '
|
|
95
|
-
+ `If this really is a ${noun} host, pass --force true (or set FCD_FORCE_EPHEMERAL=1).`);
|
|
96
|
-
}
|
|
97
|
-
/** Record that the enrollment now on this machine is ephemeral (see assertNotEnrolledLaptop). */
|
|
98
|
-
function writeEphemeralIdentityMarker(noun, machineId, markerPath = ephemeralIdentityMarkerPath()) {
|
|
99
|
-
try {
|
|
100
|
-
fs.mkdirSync(path.dirname(markerPath), { recursive: true });
|
|
101
|
-
fs.writeFileSync(markerPath, JSON.stringify({ v: 1, kind: noun, machineId, enrolledAt: new Date().toISOString() }, null, 2), { encoding: 'utf8', mode: 0o600 });
|
|
102
|
-
}
|
|
103
|
-
catch { /* read-only filesystem — the next run re-enrolls and is refused only if a laptop config appears */ }
|
|
104
|
-
}
|
|
105
|
-
/** No-op sink for callers without a live log stream (workloads today). */
|
|
106
|
-
const silentLogSink = async () => { };
|
|
107
|
-
exports.silentLogSink = silentLogSink;
|
|
108
|
-
/**
|
|
109
|
-
* Install the runtime hook + MCP gateway for an enrolled ephemeral identity.
|
|
110
|
-
* Each step is best-effort and reported: a missing MCP client on the image is
|
|
111
|
-
* not a failure of the job/workload.
|
|
112
|
-
*/
|
|
113
|
-
async function installEphemeralProtectionStack(options, config) {
|
|
114
|
-
const sendLog = options.sendLog || exports.silentLogSink;
|
|
115
|
-
// The Claude-format hook covers Claude Code, VS Code agent mode, and
|
|
116
|
-
// Copilot CLI — the common agents on runners and in containers.
|
|
117
|
-
if (options.hooks !== 'false') {
|
|
118
|
-
console.log('\n\x1b[1mInstalling runtime hook (Claude Code / VS Code / Copilot CLI)…\x1b[0m');
|
|
119
|
-
const hookArgs = {
|
|
120
|
-
shieldId: options.shieldId,
|
|
121
|
-
shieldKey: options.shieldKey,
|
|
122
|
-
apiUrl: options.apiUrl,
|
|
123
|
-
events: 'tools,prompt',
|
|
124
|
-
};
|
|
125
|
-
try {
|
|
126
|
-
await (0, installClaudeHook_1.installClaudeHookCommand)(hookArgs, config);
|
|
127
|
-
await sendLog([{ level: 'success', message: 'Runtime hook installed (Claude Code / VS Code / Copilot CLI)' }]);
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
131
|
-
console.log(`Hook install skipped: ${reason}`);
|
|
132
|
-
await sendLog([{ level: 'warn', message: `Runtime hook install skipped: ${reason}` }]);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (options.gateway !== 'false') {
|
|
136
|
-
console.log('\n\x1b[1mWrapping MCP client configs with the gateway…\x1b[0m');
|
|
137
|
-
const gatewayArgs = {
|
|
138
|
-
shieldId: options.shieldId,
|
|
139
|
-
shieldKey: options.shieldKey,
|
|
140
|
-
apiUrl: options.apiUrl,
|
|
141
|
-
clients: 'all',
|
|
142
|
-
};
|
|
143
|
-
try {
|
|
144
|
-
await (0, mcpGateway_1.protectAllCommand)(gatewayArgs, config);
|
|
145
|
-
await sendLog([{ level: 'success', message: 'MCP client configs wrapped with the FullCourtDefense gateway' }]);
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
149
|
-
console.log(`MCP gateway wrap skipped: ${reason}`);
|
|
150
|
-
await sendLog([{ level: 'warn', message: `MCP gateway wrap skipped: ${reason}` }]);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Make the ephemeral identity visible to everything that runs AFTER this
|
|
156
|
-
* command — the hooks/gateway attribute every event to the identity record
|
|
157
|
-
* (pipeline / workload), not to disposable hardware.
|
|
158
|
-
*
|
|
159
|
-
* Applies to the current process, then to whichever hand-off channels exist:
|
|
160
|
-
* `$GITHUB_ENV` (later job steps) and/or an env file (container entrypoint
|
|
161
|
-
* `set -a; . /path/workload.env; set +a`). Returns the channels written.
|
|
162
|
-
*/
|
|
163
|
-
function exportIdentityEnv(identityEnv, options) {
|
|
164
|
-
for (const [key, value] of Object.entries(identityEnv))
|
|
165
|
-
process.env[key] = value;
|
|
166
|
-
const lines = Object.entries(identityEnv).map(([key, value]) => `${key}=${value}\n`).join('');
|
|
167
|
-
let githubEnv = false;
|
|
168
|
-
if (options.githubEnvPath) {
|
|
169
|
-
try {
|
|
170
|
-
fs.appendFileSync(options.githubEnvPath, lines);
|
|
171
|
-
githubEnv = true;
|
|
172
|
-
}
|
|
173
|
-
catch { /* non-GitHub runner with a stray env var — identity still set for this process */ }
|
|
174
|
-
}
|
|
175
|
-
let envFile;
|
|
176
|
-
if (options.envFilePath) {
|
|
177
|
-
try {
|
|
178
|
-
fs.mkdirSync(path.dirname(options.envFilePath), { recursive: true });
|
|
179
|
-
fs.writeFileSync(options.envFilePath, lines, { encoding: 'utf8', mode: 0o600 });
|
|
180
|
-
envFile = options.envFilePath;
|
|
181
|
-
}
|
|
182
|
-
catch { /* read-only filesystem — the caller prints the export lines instead */ }
|
|
183
|
-
}
|
|
184
|
-
return { githubEnv, envFile };
|
|
185
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BotGuardConfig } from '../config';
|
|
2
|
-
export interface FlushSpoolArgs {
|
|
3
|
-
apiUrl?: string;
|
|
4
|
-
shieldId?: string;
|
|
5
|
-
shieldKey?: string;
|
|
6
|
-
heartbeat?: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* `fullcourtdefense flush-spool` — drain the local telemetry spool to the backend
|
|
10
|
-
* and send a heartbeat. Normally invoked detached by the hook; can also be run
|
|
11
|
-
* from cron/launchd/Task Scheduler for steady liveness on idle machines.
|
|
12
|
-
*/
|
|
13
|
-
export declare function flushSpoolCommand(args: FlushSpoolArgs, config: BotGuardConfig): Promise<void>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flushSpoolCommand = flushSpoolCommand;
|
|
4
|
-
const config_1 = require("../config");
|
|
5
|
-
const telemetry_1 = require("../telemetry");
|
|
6
|
-
/**
|
|
7
|
-
* `fullcourtdefense flush-spool` — drain the local telemetry spool to the backend
|
|
8
|
-
* and send a heartbeat. Normally invoked detached by the hook; can also be run
|
|
9
|
-
* from cron/launchd/Task Scheduler for steady liveness on idle machines.
|
|
10
|
-
*/
|
|
11
|
-
async function flushSpoolCommand(args, config) {
|
|
12
|
-
const creds = (0, config_1.resolveCliCredentials)(config, {
|
|
13
|
-
shieldId: args.shieldId,
|
|
14
|
-
shieldKey: args.shieldKey,
|
|
15
|
-
apiUrl: args.apiUrl,
|
|
16
|
-
});
|
|
17
|
-
if (!creds.shieldId)
|
|
18
|
-
return; // nothing to attribute to
|
|
19
|
-
const result = await (0, telemetry_1.flushSpool)({
|
|
20
|
-
apiUrl: creds.apiUrl,
|
|
21
|
-
shieldId: creds.shieldId,
|
|
22
|
-
shieldKey: creds.shieldKey,
|
|
23
|
-
heartbeat: args.heartbeat !== 'false',
|
|
24
|
-
});
|
|
25
|
-
if (result) {
|
|
26
|
-
console.log(`Flushed ${result.accepted} event(s)${result.deduped ? `, ${result.deduped} deduped` : ''}.`);
|
|
27
|
-
}
|
|
28
|
-
}
|