Add repo-wide audit engine, verified remediation, and release hardening - #43
Open
mesrikanthreddy wants to merge 1 commit into
Open
Add repo-wide audit engine, verified remediation, and release hardening#43mesrikanthreddy wants to merge 1 commit into
mesrikanthreddy wants to merge 1 commit into
Conversation
Repo-wide audit (kshield agent, POST /api/v1/audit) scans every git-tracked file in one pass instead of just the staged diff: a real import/symbol/route graph, graph-aware Broken Access Control detection, typosquat and undeclared- dependency checks, and a batched dependency-registry lookup pass that fixed a real timeout on large repos. Remediation patches now come from ksword, which proposes a fix, applies it in-memory, and re-runs the original check before ever returning the diff — replacing the old engine, which could hand back a patch referencing symbols that didn't exist. Also: the VS Code extension is live on the Marketplace; Windows is now a release target (compile-verified via cross-compilation, not yet run-tested on real Windows); the npm package is renamed to the scoped @ytt-global/kshield since the unscoped name was squatted by an unrelated package; and a new MCP server exposes the scan/audit engine as tools for MCP-aware agents. backend/tests/ is intentionally gitignored and not committed — the engine work above is backed by a 186-test local suite (all passing), but the tests themselves aren't shipped in the public repo. CONTRIBUTING.md's testing section reflects this.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
|
|
||
|
|
||
| def _extract_generic(filename: str, content: str, graph: RepoGraph) -> None: | ||
| roots = {_js_package_root(raw) for raw in _JS_IMPORT_RE.findall(content)} |
| def _replace(m: re.Match) -> str: | ||
| return " " if m.group("comment") is not None else m.group("string") | ||
|
|
||
| return _JS_COMMENT_OR_STRING_RE.sub(_replace, code) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kshield agent <name>,POST /api/v1/audit): scans every git-tracked file in one pass with a real import/symbol/route graph, graph-aware Broken Access Control detection, typosquat + undeclared-dependency checks, and a batched dependency-registry lookup pass that fixes a real timeout on large repos.ksword.py), replacing the old remediation engine — every patch is applied in-memory and re-checked against the same rule that raised the finding before it's ever returned, instead of potentially referencing symbols that don't exist.x86_64-pc-windows-msvc) — compile-verified via local cross-compilation (realPE32+binary produced), but not yet run-tested on an actual Windows machine — treat as best-effort until confirmed.kshield→@ytt-global/kshield— the unscoped name was squatted by an unrelated third-party CLI, sonpx kshield initsilently ran someone else's tool. Installed command is stillkshield.mcp-server/) exposes the scan/audit engine as tools for MCP-aware agents (Claude Code, Claude Desktop).docs/algorithms.mddocuments the actual math behind detection (Shannon entropy thresholds, Levenshtein typosquat matching, signature-based false-positive memory).backend/tests/is intentionally gitignored, not shipped in this repo — the engine work above is backed by a 186-test local suite (all passing), but the tests aren't committed.CONTRIBUTING.mdreflects this.Test plan
POST /api/v1/auditagainst real files — correct graph stats and findingscargo build) — clean, zero warningstsc --noEmit,npm run build) — cleankshield agentrun end-to-end via the compiled CLI against this repo — matches API-level resultsvsce publish/npm publishfor this batch (manual, credential-gated, not part of this PR)