@vibecontrols/vibe-plugin-security-runtime 2026.528.7 → 2026.1109.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 CHANGED
@@ -1,13 +1,25 @@
1
- Proprietary License
1
+ MIT License
2
2
 
3
- Copyright (c) 2026 Burdenoff Consultancy Services Pvt. Ltd. All rights reserved.
3
+ Copyright (c) 2026 Burdenoff Consultancy Services Private Limited,
4
+ Algoshred Technologies Private Limited,
5
+ and all its sister companies.
4
6
 
5
- This software and associated documentation files (the "Software") are
6
- proprietary to Burdenoff Consultancy Services Pvt. Ltd. ("Burdenoff").
7
+ Maintainer: Vignesh T.V <https://github.com/tvvignesh>
7
8
 
8
- Permission is NOT granted to any person obtaining a copy of this Software
9
- to use, copy, modify, merge, publish, distribute, sublicense, or sell
10
- copies of the Software outside of authorized internal use at Burdenoff and
11
- its designated customers.
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is furnished
14
+ to do so, subject to the following conditions:
12
15
 
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
package/README.md CHANGED
@@ -37,6 +37,34 @@ config:
37
37
  extraKubeBenchArgs: []
38
38
  ```
39
39
 
40
+ <!-- VIBECONTROLS_OSS_FOOTER_START -->
41
+
42
+ ---
43
+
44
+ ## About VibeControls
45
+
46
+ **VibeControls** is the agentic engineering mission control for AI-native teams. Vibe-plugins extend the VibeControls agent with new providers, tools, sessions, tunnels, storage backends, and security stages.
47
+
48
+ - Website: <https://vibecontrols.com>
49
+ - Documentation: <https://docs.vibecontrols.com>
50
+ - Plugin SDK: <https://github.com/algoshred/vibecontrols-plugin-sdk>
51
+ - All plugins: <https://github.com/algoshred?q=vibe-plugin-&type=all>
52
+
53
+ ## Credits
54
+
55
+ This plugin builds on the following upstream open-source projects. All trademarks and copyrights remain with their respective owners.
56
+
57
+ - **Trivy** — <https://github.com/aquasecurity/trivy>
58
+ - **kube-bench** — <https://github.com/aquasecurity/kube-bench>
59
+
40
60
  ## License
41
61
 
42
- Proprietary — Burdenoff Consultancy Services Pvt. Ltd.
62
+ Released under the [MIT License](./LICENSE).
63
+
64
+ Copyright (c) 2026 Burdenoff Consultancy Services Private Limited, Algoshred Technologies Private Limited, and all its sister companies.
65
+
66
+ Maintainer: **Vignesh T.V** — <https://github.com/tvvignesh>
67
+
68
+ **Note**: this plugin is open source under MIT. The `@vibecontrols/agent` runtime that loads and orchestrates plugins is **closed source** and proprietary to Burdenoff Consultancy Services Pvt. Ltd. If you want a fully self-hostable agent, please open an issue or contact the maintainer.
69
+
70
+ <!-- VIBECONTROLS_OSS_FOOTER_END -->
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ProviderRegistry,TelemetryEmitter,createLifecycleHooks}from"@vibecontrols/plugin-sdk";import{spawn}from"child_process";import{createHash}from"crypto";import{promises as fs}from"fs";import*as os from"os";import*as path from"path";import{resolveToolPath}from"@vibecontrols/vibe-plugin-security/tool-installer";var TRIVY_VERSION="0.70.0",KUBE_BENCH_VERSION="0.7.4",KUBE_BENCH_IMAGE="aquasec/kube-bench:latest",TOOLS_MANIFEST={trivy:{version:"0.70.0",binaryName:"trivy",versionMatcher:"0.70.0".replace(/\./g,"\\."),downloads:{"linux-x64":{url:"https://github.com/aquasecurity/trivy/releases/download/v0.70.0/trivy_0.70.0_Linux-64bit.tar.gz",sha256:"8b4376d5d6befe5c24d503f10ff136d9e0c49f9127a4279fd110b727929a5aa9",binaryWithinArchive:"trivy",archive:"tar.gz"},"linux-arm64":{url:"https://github.com/aquasecurity/trivy/releases/download/v0.70.0/trivy_0.70.0_Linux-ARM64.tar.gz",sha256:"2f6bb988b553a1bbac6bdd1ce890f5e412439564e17522b88a4541b4f364fc8d",binaryWithinArchive:"trivy",archive:"tar.gz"},"darwin-x64":{url:"https://github.com/aquasecurity/trivy/releases/download/v0.70.0/trivy_0.70.0_macOS-64bit.tar.gz",sha256:"52d531452b19e7593da29366007d02a810e1e0080d02f9cf6a1afb46c35aaa93",binaryWithinArchive:"trivy",archive:"tar.gz"},"darwin-arm64":{url:"https://github.com/aquasecurity/trivy/releases/download/v0.70.0/trivy_0.70.0_macOS-ARM64.tar.gz",sha256:"68e543c51dcc96e1c344053a4fde9660cf602c25565d9f09dc17dd41e13b838a",binaryWithinArchive:"trivy",archive:"tar.gz"}}}};var TRIVY_TIMEOUT_MS=600000,KUBE_BENCH_TIMEOUT_MS=600000,TRIVY_SEVERITY_MAP={CRITICAL:"critical",HIGH:"high",MEDIUM:"medium",LOW:"low",UNKNOWN:"info"};class TrivyKubeBenchProvider{name="trivy-kube-bench";stage="runtime.continuous";toolVersion=`trivy@${TRIVY_VERSION}+kube-bench@${KUBE_BENCH_VERSION}`;host;trivyPath;kubeBenchAvailable=!1;active=new Map;async init(host){this.host=host}async ensureToolInstalled(){let dataDir=this.host?.getDataDir?.()??path.join(process.env.HOME??".",".boff/vibecontrols");if(this.trivyPath=await resolveToolPath({dataDir,log:{info:(m)=>this.host?.logger?.info?.("runtime-provider",m),warn:(m)=>this.host?.logger?.warn?.("runtime-provider",m),error:(m)=>this.host?.logger?.error?.("runtime-provider",m)}},"trivy",TOOLS_MANIFEST.trivy),this.kubeBenchAvailable=await this.dockerInfoOk(),this.kubeBenchAvailable)try{await this.dockerPullKubeBench()}catch(err){this.host?.logger?.warn?.("runtime-provider",`kube-bench image pre-pull failed: ${String(err)}`)}else this.host?.logger?.info?.("runtime-provider","docker not available \u2014 kube-bench checks will emit skip findings")}async run(input){let startedAt=Date.now();if(!this.trivyPath)await this.ensureToolInstalled();let cfg=input.config??{},findings=[],evidence=[];input.onProgress?.({pct:5,message:"Starting runtime checks"});let imageRefs=cfg.imageRefs??[];if(imageRefs.length===0)findings.push(makeSkipFinding({ruleId:"trivy.no-images-configured",title:"Trivy image rescan skipped \u2014 no imageRefs configured",category:"vuln",description:"RuntimeConfig.imageRefs is empty; nothing to rescan. Add deployed image references to enable Trivy rescans.",fpInput:`trivy:no-images:${input.runId}`}));else{let severityFilter=cfg.trivySeverityFilter??"HIGH,CRITICAL",total=imageRefs.length;for(let i=0;i<total;i++){let imageRef=imageRefs[i],pct=10+Math.floor((i+1)/total*55);input.onProgress?.({pct,message:`Trivy: scanning ${imageRef}`});let slug=slugify(imageRef),outputPath=path.join(input.workdir,`trivy-${slug}.json`),args=["image","--format","json","--output",outputPath,"--severity",severityFilter,"--quiet",imageRef],trivyResult=await this.spawnAndWait(`${input.runId}::trivy::${slug}`,this.trivyPath,args,{},TRIVY_TIMEOUT_MS);if(trivyResult.code!==0){findings.push(makeSkipFinding({ruleId:"trivy.scan-failed",title:`Trivy scan failed for ${imageRef}`,category:"vuln",description:`Trivy exited ${trivyResult.code}: ${trivyResult.stderr.slice(0,500)}`,severity:"low",fpInput:`trivy:scan-failed:${imageRef}:${trivyResult.code}`}));continue}try{let raw=await fs.readFile(outputPath,"utf-8"),parsed=JSON.parse(raw);for(let result of parsed.Results??[])for(let v of result.Vulnerabilities??[])findings.push(normaliseTrivyVuln(v,imageRef));let stat=await fs.stat(outputPath),sha256=createHash("sha256").update(raw).digest("hex");evidence.push({type:"grype-json",localPath:outputPath,sha256,sizeBytes:stat.size})}catch(err){this.host?.logger?.warn?.("runtime-provider",`failed to parse trivy report for ${imageRef}: ${String(err)}`)}}}if(cfg.runKubeBench===!1)findings.push(makeSkipFinding({ruleId:"kube-bench.skipped",title:"kube-bench skipped \u2014 runKubeBench=false",category:"config",description:"RuntimeConfig.runKubeBench was set to false; skipping cluster CIS check.",fpInput:`kube-bench:disabled:${input.runId}`}));else if(cfg.skipKubeconfigProbe)findings.push(makeSkipFinding({ruleId:"kube-bench.skipped",title:"kube-bench skipped \u2014 skipKubeconfigProbe (test mode)",category:"config",description:"skipKubeconfigProbe=true; no docker spawn performed.",fpInput:`kube-bench:test-skip:${input.runId}`}));else{input.onProgress?.({pct:75,message:"kube-bench: resolving kubeconfig"});let kubeconfigPath=resolveKubeconfigPath(cfg.kubeconfigPath),kubeconfigUsable=kubeconfigPath?await pathReadable(kubeconfigPath):!1;if(!kubeconfigUsable||!this.kubeBenchAvailable){let reason=!kubeconfigUsable?"missing-cluster-access":"docker-unavailable";findings.push(makeSkipFinding({ruleId:"kube-bench.skipped",title:`kube-bench skipped \u2014 ${reason}`,category:"config",description:reason==="missing-cluster-access"?`Kubeconfig not found at ${kubeconfigPath??"<unresolved>"}. Set RuntimeConfig.kubeconfigPath or KUBECONFIG env var.`:"Docker is not available on the host; kube-bench runs as a Docker container.",fpInput:`kube-bench:${reason}:${input.runId}`}))}else{input.onProgress?.({pct:80,message:"kube-bench: running container"});let outputPath=path.join(input.workdir,"kube-bench.json"),dockerArgs=["run","--rm","-v",`${kubeconfigPath}:/root/.kube/config:ro`,KUBE_BENCH_IMAGE,"--json"],kb=await this.spawnAndWait(`${input.runId}::kube-bench`,"docker",dockerArgs,{},KUBE_BENCH_TIMEOUT_MS);if(kb.code!==0&&!kb.stdout)findings.push(makeSkipFinding({ruleId:"kube-bench.scan-failed",title:"kube-bench scan failed",category:"config",description:`docker run exited ${kb.code}: ${kb.stderr.slice(0,500)}`,severity:"low",fpInput:`kube-bench:failed:${input.runId}:${kb.code}`}));else try{await fs.writeFile(outputPath,kb.stdout);let parsed=JSON.parse(kb.stdout);for(let control of parsed.Controls??[])for(let t of control.tests??[])for(let r of t.results??[]){if(r.status!=="FAIL")continue;findings.push(normaliseKubeBenchResult(r))}let stat=await fs.stat(outputPath),sha256=createHash("sha256").update(kb.stdout).digest("hex");evidence.push({type:"opa-decision",localPath:outputPath,sha256,sizeBytes:stat.size})}catch(err){this.host?.logger?.warn?.("runtime-provider",`failed to parse kube-bench output: ${String(err)}`)}}}input.onProgress?.({pct:100,message:"Runtime checks complete"});let summary=summarize(findings);return{runId:input.runId,status:"succeeded",findings,evidence,durationMs:Date.now()-startedAt,summary}}async cancel(runId){for(let[key,child]of this.active.entries()){if(!key.startsWith(runId))continue;try{child.kill("SIGTERM"),setTimeout(()=>{try{child.kill("SIGKILL")}catch{}},5000)}finally{this.active.delete(key)}}}metadata(){return{stage:this.stage,supportedProfiles:["backend","frontend","container","iac"],toolVersion:this.toolVersion,description:"Trivy image rescan (--format json, sha256-pinned binary) + kube-bench CIS check via Docker. Each tool emits a skip-with-reason info finding when its prerequisites are missing."}}async dockerInfoOk(){return new Promise((resolve)=>{let child=spawn("docker",["info"],{stdio:["ignore","ignore","ignore"]});child.on("close",(code)=>resolve(code===0)),child.on("error",()=>resolve(!1))})}async dockerPullKubeBench(){return new Promise((resolve,reject)=>{let child=spawn("docker",["pull",KUBE_BENCH_IMAGE],{stdio:["ignore","pipe","pipe"]}),stderr="";child.stderr.on("data",(b)=>stderr+=b.toString()),child.on("close",(code)=>code===0?resolve():reject(Error(`docker pull exit ${code}: ${stderr}`))),child.on("error",(err)=>reject(err))})}spawnAndWait(key,cmd,args,env,timeoutMs){return new Promise((resolve)=>{let child=spawn(cmd,args,{stdio:["ignore","pipe","pipe"],env:{...process.env,...env}});this.active.set(key,child);let stdout="",stderr="";child.stdout?.on("data",(b)=>stdout+=b.toString()),child.stderr?.on("data",(b)=>stderr+=b.toString());let timer=setTimeout(()=>{try{child.kill("SIGTERM")}catch{}},timeoutMs);child.on("close",(code)=>{clearTimeout(timer),this.active.delete(key),resolve({code,stdout,stderr})}),child.on("error",(err)=>{clearTimeout(timer),this.active.delete(key),resolve({code:-1,stdout,stderr:err.message})})})}}function resolveKubeconfigPath(override){if(override)return override;if(process.env.KUBECONFIG)return process.env.KUBECONFIG;let home=process.env.HOME??os.homedir();return home?path.join(home,".kube","config"):null}async function pathReadable(p){try{return(await fs.stat(p)).isFile()}catch{return!1}}function normaliseTrivyVuln(v,imageRef){let vid=v.VulnerabilityID??"TRIVY-UNKNOWN",severity=TRIVY_SEVERITY_MAP[(v.Severity??"").toUpperCase()]??"info",title=(v.Title??vid).slice(0,200),description=truncate(v.Description??"",500);return{fingerprint:sha256Hex(`trivy:${imageRef}:${vid}`),ruleId:`trivy.${vid}`,title,description,severity,category:"vuln",cve:vid,packageName:v.PkgName,packageVersion:v.InstalledVersion,fixedVersion:v.FixedVersion,remediation:v.FixedVersion?`Upgrade ${v.PkgName} to ${v.FixedVersion} or later.`:void 0,rawProviderRef:`image=${imageRef}`}}function normaliseKubeBenchResult(r){let id=r.test_id??"kb-unknown",severity=r.scored?"high":"low";return{fingerprint:sha256Hex(`kube-bench:${id}`),ruleId:`kube-bench.${id}`,title:r.test_desc??`kube-bench ${id} failed`,description:r.remediation,severity,category:"config",remediation:r.remediation}}function makeSkipFinding(i){return{fingerprint:sha256Hex(i.fpInput),ruleId:i.ruleId,title:i.title,description:i.description,severity:i.severity??"info",category:i.category}}function slugify(s){return s.replace(/[^a-zA-Z0-9.-]+/g,"_").slice(0,80)}function truncate(s,max){if(!s)return s;return s.length>max?`${s.slice(0,max)}\u2026`:s}function sha256Hex(input){return createHash("sha256").update(input).digest("hex")}function summarize(findings){let s={critical:0,high:0,medium:0,low:0,info:0};for(let f of findings)s[f.severity]++;return s}var PLUGIN_NAME="security-runtime",PLUGIN_VERSION="2026.528.6",createPlugin=(_ctx)=>{let provider=new TrivyKubeBenchProvider,telemetry=new TelemetryEmitter(PLUGIN_NAME,PLUGIN_VERSION),lifecycle=createLifecycleHooks({name:PLUGIN_NAME,telemetryEventName:"security.runtime.ready",onInit:async(host)=>{await provider.init(host),new ProviderRegistry(host).registerProvider("security.runtime","trivy-kube-bench",provider),telemetry.emit("security.runtime.registered",{provider:"trivy-kube-bench",toolVersion:provider.toolVersion})}});return{name:PLUGIN_NAME,version:PLUGIN_VERSION,description:"Continuous Trivy image rescan + kube-bench CIS check for the runtime.continuous lifecycle stage. Trivy auto-installs via sha256-pinned binary; kube-bench runs as a Docker container against the configured kubeconfig.",tags:["backend","provider","integration"],capabilities:{storage:"rw",subprocess:!0,audit:!0,telemetry:!0},onServerStart:lifecycle.onServerStart,onServerStop:lifecycle.onServerStop}},src_default=createPlugin;export{src_default as default,createPlugin,TrivyKubeBenchProvider};
2
+ import{ProviderRegistry,TelemetryEmitter,createLifecycleHooks}from"@vibecontrols/plugin-sdk";import{spawn}from"child_process";import{createHash}from"crypto";import{promises as fs}from"fs";import*as os from"os";import*as path from"path";import{resolveToolPath}from"@vibecontrols/vibe-plugin-security/tool-installer";var TRIVY_VERSION="0.70.0",KUBE_BENCH_VERSION="0.7.4",KUBE_BENCH_IMAGE="aquasec/kube-bench:latest",TOOLS_MANIFEST={trivy:{version:"0.70.0",binaryName:"trivy",versionMatcher:"0.70.0".replace(/\./g,"\\."),downloads:{"linux-x64":{url:"https://github.com/aquasecurity/trivy/releases/download/v0.70.0/trivy_0.70.0_Linux-64bit.tar.gz",sha256:"8b4376d5d6befe5c24d503f10ff136d9e0c49f9127a4279fd110b727929a5aa9",binaryWithinArchive:"trivy",archive:"tar.gz"},"linux-arm64":{url:"https://github.com/aquasecurity/trivy/releases/download/v0.70.0/trivy_0.70.0_Linux-ARM64.tar.gz",sha256:"2f6bb988b553a1bbac6bdd1ce890f5e412439564e17522b88a4541b4f364fc8d",binaryWithinArchive:"trivy",archive:"tar.gz"},"darwin-x64":{url:"https://github.com/aquasecurity/trivy/releases/download/v0.70.0/trivy_0.70.0_macOS-64bit.tar.gz",sha256:"52d531452b19e7593da29366007d02a810e1e0080d02f9cf6a1afb46c35aaa93",binaryWithinArchive:"trivy",archive:"tar.gz"},"darwin-arm64":{url:"https://github.com/aquasecurity/trivy/releases/download/v0.70.0/trivy_0.70.0_macOS-ARM64.tar.gz",sha256:"68e543c51dcc96e1c344053a4fde9660cf602c25565d9f09dc17dd41e13b838a",binaryWithinArchive:"trivy",archive:"tar.gz"}}}};var TRIVY_TIMEOUT_MS=600000,KUBE_BENCH_TIMEOUT_MS=600000,TRIVY_SEVERITY_MAP={CRITICAL:"critical",HIGH:"high",MEDIUM:"medium",LOW:"low",UNKNOWN:"info"};class TrivyKubeBenchProvider{name="trivy-kube-bench";stage="runtime.continuous";toolVersion=`trivy@${TRIVY_VERSION}+kube-bench@${KUBE_BENCH_VERSION}`;host;trivyPath;kubeBenchAvailable=!1;active=new Map;async init(host){this.host=host}async ensureToolInstalled(){let dataDir=this.host?.getDataDir?.()??path.join(os.homedir(),".boff/vibecontrols"),trivyManifest=TOOLS_MANIFEST.trivy;if(!trivyManifest)throw Error("runtime-provider: trivy entry missing from TOOLS_MANIFEST");if(this.trivyPath=await resolveToolPath({dataDir,log:{info:(m)=>this.host?.logger?.info?.("runtime-provider",m),warn:(m)=>this.host?.logger?.warn?.("runtime-provider",m),error:(m)=>this.host?.logger?.error?.("runtime-provider",m)}},"trivy",trivyManifest),this.kubeBenchAvailable=await this.dockerInfoOk(),this.kubeBenchAvailable)try{await this.dockerPullKubeBench()}catch(err){this.host?.logger?.warn?.("runtime-provider",`kube-bench image pre-pull failed: ${String(err)}`)}else this.host?.logger?.info?.("runtime-provider","docker not available \u2014 kube-bench checks will emit skip findings")}async run(input){let startedAt=Date.now();if(!this.trivyPath)await this.ensureToolInstalled();let cfg=input.config??{},findings=[],evidence=[];input.onProgress?.({pct:5,message:"Starting runtime checks"});let imageRefs=cfg.imageRefs??[];if(imageRefs.length===0)findings.push(makeSkipFinding({ruleId:"trivy.no-images-configured",title:"Trivy image rescan skipped \u2014 no imageRefs configured",category:"vuln",description:"RuntimeConfig.imageRefs is empty; nothing to rescan. Add deployed image references to enable Trivy rescans.",fpInput:`trivy:no-images:${input.runId}`}));else{let severityFilter=cfg.trivySeverityFilter??"HIGH,CRITICAL",total=imageRefs.length;for(let[i,imageRef]of imageRefs.entries()){let pct=10+Math.floor((i+1)/total*55);input.onProgress?.({pct,message:`Trivy: scanning ${imageRef}`});let slug=slugify(imageRef),outputPath=path.join(input.workdir,`trivy-${slug}.json`),args=["image","--format","json","--output",outputPath,"--severity",severityFilter,"--quiet",imageRef],trivyResult=await this.spawnAndWait(`${input.runId}::trivy::${slug}`,this.trivyPath,args,{},TRIVY_TIMEOUT_MS);if(trivyResult.code!==0){findings.push(makeSkipFinding({ruleId:"trivy.scan-failed",title:`Trivy scan failed for ${imageRef}`,category:"vuln",description:`Trivy exited ${trivyResult.code}: ${trivyResult.stderr.slice(0,500)}`,severity:"low",fpInput:`trivy:scan-failed:${imageRef}:${trivyResult.code}`}));continue}try{let raw=await fs.readFile(outputPath,"utf-8"),parsed=JSON.parse(raw);for(let result of parsed.Results??[])for(let v of result.Vulnerabilities??[])findings.push(normaliseTrivyVuln(v,imageRef));let stat=await fs.stat(outputPath),sha256=createHash("sha256").update(raw).digest("hex");evidence.push({type:"grype-json",localPath:outputPath,sha256,sizeBytes:stat.size})}catch(err){this.host?.logger?.warn?.("runtime-provider",`failed to parse trivy report for ${imageRef}: ${String(err)}`)}}}if(cfg.runKubeBench===!1)findings.push(makeSkipFinding({ruleId:"kube-bench.skipped",title:"kube-bench skipped \u2014 runKubeBench=false",category:"config",description:"RuntimeConfig.runKubeBench was set to false; skipping cluster CIS check.",fpInput:`kube-bench:disabled:${input.runId}`}));else if(cfg.skipKubeconfigProbe)findings.push(makeSkipFinding({ruleId:"kube-bench.skipped",title:"kube-bench skipped \u2014 skipKubeconfigProbe (test mode)",category:"config",description:"skipKubeconfigProbe=true; no docker spawn performed.",fpInput:`kube-bench:test-skip:${input.runId}`}));else{input.onProgress?.({pct:75,message:"kube-bench: resolving kubeconfig"});let kubeconfigPath=resolveKubeconfigPath(cfg.kubeconfigPath),kubeconfigUsable=kubeconfigPath?await pathReadable(kubeconfigPath):!1;if(!kubeconfigUsable||!this.kubeBenchAvailable){let reason=!kubeconfigUsable?"missing-cluster-access":"docker-unavailable";findings.push(makeSkipFinding({ruleId:"kube-bench.skipped",title:`kube-bench skipped \u2014 ${reason}`,category:"config",description:reason==="missing-cluster-access"?`Kubeconfig not found at ${kubeconfigPath??"<unresolved>"}. Set RuntimeConfig.kubeconfigPath or KUBECONFIG env var.`:"Docker is not available on the host; kube-bench runs as a Docker container.",fpInput:`kube-bench:${reason}:${input.runId}`}))}else{input.onProgress?.({pct:80,message:"kube-bench: running container"});let outputPath=path.join(input.workdir,"kube-bench.json"),dockerArgs=["run","--rm","-v",`${kubeconfigPath}:/root/.kube/config:ro`,KUBE_BENCH_IMAGE,"--json"],kb=await this.spawnAndWait(`${input.runId}::kube-bench`,"docker",dockerArgs,{},KUBE_BENCH_TIMEOUT_MS);if(kb.code!==0&&!kb.stdout)findings.push(makeSkipFinding({ruleId:"kube-bench.scan-failed",title:"kube-bench scan failed",category:"config",description:`docker run exited ${kb.code}: ${kb.stderr.slice(0,500)}`,severity:"low",fpInput:`kube-bench:failed:${input.runId}:${kb.code}`}));else try{await fs.writeFile(outputPath,kb.stdout);let parsed=JSON.parse(kb.stdout);for(let control of parsed.Controls??[])for(let t of control.tests??[])for(let r of t.results??[]){if(r.status!=="FAIL")continue;findings.push(normaliseKubeBenchResult(r))}let stat=await fs.stat(outputPath),sha256=createHash("sha256").update(kb.stdout).digest("hex");evidence.push({type:"opa-decision",localPath:outputPath,sha256,sizeBytes:stat.size})}catch(err){this.host?.logger?.warn?.("runtime-provider",`failed to parse kube-bench output: ${String(err)}`)}}}input.onProgress?.({pct:100,message:"Runtime checks complete"});let summary=summarize(findings);return{runId:input.runId,status:"succeeded",findings,evidence,durationMs:Date.now()-startedAt,summary}}async cancel(runId){for(let[key,child]of this.active.entries()){if(!key.startsWith(runId))continue;try{child.kill("SIGTERM"),setTimeout(()=>{try{child.kill("SIGKILL")}catch{}},5000)}finally{this.active.delete(key)}}}metadata(){return{stage:this.stage,supportedProfiles:["backend","frontend","container","iac"],toolVersion:this.toolVersion,description:"Trivy image rescan (--format json, sha256-pinned binary) + kube-bench CIS check via Docker. Each tool emits a skip-with-reason info finding when its prerequisites are missing."}}async dockerInfoOk(){return new Promise((resolve)=>{let child=spawn("docker",["info"],{stdio:["ignore","ignore","ignore"]});child.on("close",(code)=>resolve(code===0)),child.on("error",()=>resolve(!1))})}async dockerPullKubeBench(){return new Promise((resolve,reject)=>{let child=spawn("docker",["pull",KUBE_BENCH_IMAGE],{stdio:["ignore","pipe","pipe"]}),stderr="";child.stderr.on("data",(b)=>stderr+=b.toString()),child.on("close",(code)=>code===0?resolve():reject(Error(`docker pull exit ${code}: ${stderr}`))),child.on("error",(err)=>reject(err))})}spawnAndWait(key,cmd,args,env,timeoutMs){return new Promise((resolve)=>{let child=spawn(cmd,args,{stdio:["ignore","pipe","pipe"],env:{...process.env,...env}});this.active.set(key,child);let stdout="",stderr="";child.stdout?.on("data",(b)=>stdout+=b.toString()),child.stderr?.on("data",(b)=>stderr+=b.toString());let timer=setTimeout(()=>{try{child.kill("SIGTERM")}catch{}},timeoutMs);child.on("close",(code)=>{clearTimeout(timer),this.active.delete(key),resolve({code,stdout,stderr})}),child.on("error",(err)=>{clearTimeout(timer),this.active.delete(key),resolve({code:-1,stdout,stderr:err.message})})})}}function resolveKubeconfigPath(override){if(override)return override;if(process.env.KUBECONFIG)return process.env.KUBECONFIG;let home=os.homedir();return home?path.join(home,".kube","config"):null}async function pathReadable(p){try{return(await fs.stat(p)).isFile()}catch{return!1}}function normaliseTrivyVuln(v,imageRef){let vid=v.VulnerabilityID??"TRIVY-UNKNOWN",severity=TRIVY_SEVERITY_MAP[(v.Severity??"").toUpperCase()]??"info",title=(v.Title??vid).slice(0,200),description=truncate(v.Description??"",500);return{fingerprint:sha256Hex(`trivy:${imageRef}:${vid}`),ruleId:`trivy.${vid}`,title,description,severity,category:"vuln",cve:vid,packageName:v.PkgName,packageVersion:v.InstalledVersion,fixedVersion:v.FixedVersion,remediation:v.FixedVersion?`Upgrade ${v.PkgName} to ${v.FixedVersion} or later.`:void 0,rawProviderRef:`image=${imageRef}`}}function normaliseKubeBenchResult(r){let id=r.test_id??"kb-unknown",severity=r.scored?"high":"low";return{fingerprint:sha256Hex(`kube-bench:${id}`),ruleId:`kube-bench.${id}`,title:r.test_desc??`kube-bench ${id} failed`,description:r.remediation,severity,category:"config",remediation:r.remediation}}function makeSkipFinding(i){return{fingerprint:sha256Hex(i.fpInput),ruleId:i.ruleId,title:i.title,description:i.description,severity:i.severity??"info",category:i.category}}function slugify(s){return s.replace(/[^a-zA-Z0-9.-]+/g,"_").slice(0,80)}function truncate(s,max){if(!s)return s;return s.length>max?`${s.slice(0,max)}\u2026`:s}function sha256Hex(input){return createHash("sha256").update(input).digest("hex")}function summarize(findings){let s={critical:0,high:0,medium:0,low:0,info:0};for(let f of findings)s[f.severity]++;return s}var PLUGIN_NAME="security-runtime",PLUGIN_VERSION="2026.528.6",createPlugin=(_ctx)=>{let provider=new TrivyKubeBenchProvider,telemetry=new TelemetryEmitter(PLUGIN_NAME,PLUGIN_VERSION),lifecycle=createLifecycleHooks({name:PLUGIN_NAME,telemetryEventName:"security.runtime.ready",onInit:async(host)=>{await provider.init(host),new ProviderRegistry(host).registerProvider("security.runtime","trivy-kube-bench",provider),telemetry.emit("security.runtime.registered",{provider:"trivy-kube-bench",toolVersion:provider.toolVersion})}});return{name:PLUGIN_NAME,version:PLUGIN_VERSION,description:"Continuous Trivy image rescan + kube-bench CIS check for the runtime.continuous lifecycle stage. Trivy auto-installs via sha256-pinned binary; kube-bench runs as a Docker container against the configured kubeconfig.",tags:["backend","provider","integration"],capabilities:{storage:"rw",subprocess:!0,audit:!0,telemetry:!0},onServerStart:lifecycle.onServerStart,onServerStop:lifecycle.onServerStop}},src_default=createPlugin;export{TrivyKubeBenchProvider,createPlugin,src_default as default};
package/package.json CHANGED
@@ -1,46 +1,44 @@
1
1
  {
2
2
  "name": "@vibecontrols/vibe-plugin-security-runtime",
3
- "version": "2026.528.7",
3
+ "version": "2026.1109.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "description": "Continuous runtime checks for the runtime.continuous lifecycle stage — Trivy rescan against deployed images + kube-bench against cluster nodes. Skips gracefully when no kubeconfig or registry creds are present. Registers as a security.runtime provider with @vibecontrols/vibe-plugin-security.",
8
8
  "engines": {
9
- "bun": ">=1.3.14"
9
+ "bun": ">=1.4.4"
10
10
  },
11
11
  "author": {
12
12
  "name": "Vignesh T.V",
13
- "email": "vignesh@burdenoff.com",
14
13
  "url": "https://github.com/tvvignesh"
15
14
  },
16
- "license": "SEE LICENSE IN LICENSE",
15
+ "license": "MIT",
17
16
  "scripts": {
18
- "build": "bun build ./src/index.ts --outdir ./dist --target bun --minify-syntax --minify-whitespace --external elysia --external @vibecontrols/vibe-plugin-security --external @vibecontrols/plugin-sdk && tsc --emitDeclarationOnly --declaration --outDir ./dist",
19
- "dev": "tsc --watch",
20
- "lint": "eslint ./src ./tests",
21
- "format": "bunx prettier . --write",
22
- "format:check": "bunx prettier . --check",
23
- "type:check": "tsc --noEmit",
24
- "test": "bun test ./tests",
17
+ "build": "bun build ./src/index.ts --outdir ./dist --target bun --minify-syntax --minify-whitespace --external elysia --external @vibecontrols/vibe-plugin-security --external @vibecontrols/plugin-sdk && tsc -p tsconfig.build.json",
18
+ "dev": "tsc -p tsconfig.build.json --watch",
19
+ "lint": "eslint .",
20
+ "format": "bun fmt",
21
+ "format:check": "bun fmt --check",
22
+ "type:check": "boff gate -- bun check --no-pretty",
23
+ "test": "bun test",
25
24
  "clean": "rimraf dist",
26
25
  "prebuild": "bun run clean",
27
26
  "prepublishOnly": "bun run build",
28
- "sanity": "bun run format:check && bun run lint && bun run type:check && bun run test && bun run build"
27
+ "sanity": "boff sanity",
28
+ "sanity:force": "boff sanity --force",
29
+ "audit": "bun audit --audit-level=high"
29
30
  },
30
31
  "dependencies": {
31
32
  "@vibecontrols/plugin-sdk": "2026.527.1",
32
33
  "@vibecontrols/vibe-plugin-security": "2026.528.1"
33
34
  },
34
35
  "devDependencies": {
35
- "@eslint/js": "^10.0.1",
36
- "@types/node": "^22.0.0",
37
- "bun-types": "^1.3.9",
38
- "eslint": "^9.30.1",
39
- "globals": "^17.3.0",
40
- "prettier": "^3.6.2",
41
- "rimraf": "^6.0.1",
42
- "typescript": "^5.9.3",
43
- "typescript-eslint": "^8.56.0"
36
+ "@burdenoff/toolchain": "2026.1107.14",
37
+ "@types/bun": "^1.4.4",
38
+ "eslint": "^9.39.5",
39
+ "knip": "^6.44.1",
40
+ "rimraf": "^6.1.4",
41
+ "typescript": "6.0.3"
44
42
  },
45
43
  "peerDependencies": {
46
44
  "@vibecontrols/agent": ">=2026.428.0"
@@ -63,10 +61,10 @@
63
61
  ],
64
62
  "repository": {
65
63
  "type": "git",
66
- "url": "git+https://github.com/algoshred/vibe-plugin-security-runtime.git"
64
+ "url": "git+https://github.com/Algoshred/vibe-plugin-security-runtime.git"
67
65
  },
68
66
  "bugs": {
69
- "url": "https://github.com/algoshred/vibe-plugin-security-runtime/issues"
67
+ "url": "https://github.com/Algoshred/vibe-plugin-security-runtime/issues"
70
68
  },
71
69
  "homepage": "https://vibecontrols.com",
72
70
  "publishConfig": {
@@ -78,5 +76,24 @@
78
76
  "!dist/**/*.map",
79
77
  "README.md",
80
78
  "LICENSE"
81
- ]
79
+ ],
80
+ "packageManager": "bun@1.4.4",
81
+ "boff": {
82
+ "type": "plugin",
83
+ "sanity": {
84
+ "steps": [
85
+ "format",
86
+ "lint",
87
+ "typecheck",
88
+ "build",
89
+ "test",
90
+ "knip"
91
+ ]
92
+ }
93
+ },
94
+ "overrides": {
95
+ "brace-expansion": ">=5.0.12",
96
+ "elysia": "^1.4.29",
97
+ "minimatch": ">=3.1.3"
98
+ }
82
99
  }