@uniqweb/vibe-it-securely 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 <YOUR NAME>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,93 @@
1
- # Temporary Holding Version
1
+ # vibe-it-securely
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A security baseline for JavaScript, TypeScript and Python projects, set up with one command.
4
+
5
+ Built for people who build fast with AI coding tools and are not sure whether the result is safe.
6
+
7
+ > **Honest scope:** this sets up a *baseline* and finds *common, obvious* problems. It reduces risk. It does not make a project secure, and a clean report is not a security audit.
8
+
9
+ ## Quick start
10
+
11
+ ```bash
12
+ npx vibe-it-securely init # generate the baseline files
13
+ npx vibe-it-securely check # find problems, explained in plain language
14
+ ```
15
+
16
+ Requires Node 18+. No dependencies.
17
+
18
+ ## `init`: set up the safeguards
19
+
20
+ Detects your stack (JS, TS, Python, or a mix; npm, pnpm or yarn) and generates:
21
+
22
+ | File | Purpose |
23
+ |---|---|
24
+ | `.pre-commit-config.yaml` | Fast local checks: secret scanning and private-key detection before every commit |
25
+ | `.github/workflows/security.yml` | The same checks in CI, plus dependency audit and static analysis. CI is the real enforcement, because local hooks can be skipped with `--no-verify` |
26
+ | `Dockerfile`, `.dockerignore` | Multi-stage build, non-root user, no secrets copied in (skip with `--no-docker`) |
27
+ | `AGENTS.md` | Security rules for AI coding assistants (copy to `CLAUDE.md` or `.cursorrules` if your tool needs that name) |
28
+ | `.env.example`, `.gitignore`, `.gitleaksignore` | Created only if missing |
29
+
30
+ **It never overwrites your files.** If one already exists, the new version is saved as `<name>.suggested` for you to review and merge.
31
+
32
+ Options: `--dir <path>`, `--dry-run`, `--no-docker`.
33
+
34
+ After `init`: `pip install pre-commit && pre-commit install`.
35
+
36
+ ### Secret scan flagged something fake?
37
+
38
+ The CI secret scan (gitleaks) also looks at your git history, so a fake key in a test file can fail the build. If the value is fake or an example, copy the `Fingerprint:` line from the CI log into `.gitleaksignore` (one per line; `#` starts a comment). Better still, build fake values at runtime in tests so no scanner sees a literal. If the value is real, revoke it and replace it instead.
39
+
40
+ ### What blocks and what only warns
41
+
42
+ To avoid false alarms that make people turn the tool off, only high-confidence problems block CI: committed secrets, private keys, and critical dependency vulnerabilities. Everything else is reported as a warning.
43
+
44
+ ## `check`: find problems
45
+
46
+ ```bash
47
+ vibe-it-securely check [--dir <path>] [--fail-on high|medium|none] [--json] [--online]
48
+ ```
49
+
50
+ Looks for:
51
+
52
+ - **Leaked secrets:** private keys; AWS, GitHub, Slack and AI-provider keys; hardcoded passwords and tokens
53
+ - **`.env` mistakes:** committed to git, or not covered by `.gitignore`
54
+ - **Risky code:** `eval`, SQL built by joining text, raw HTML insertion, wide-open CORS, turned-off HTTPS checks, `shell=True`, `yaml.load`, `pickle`, debug mode left on
55
+ - **Docker problems:** running as root, unpinned images, secrets in `ENV`/`ARG`, `.env` copied into the image
56
+ - **Missing safeguards:** pre-commit hooks, CI, lockfile, AI-assistant rules
57
+ - **Common AI-app mistakes:**
58
+ - Routes that change data (Express-style, Next.js `app/` and `pages/api`) with no sign of a login check. This is a heuristic, so public routes need the ignore comment.
59
+ - Supabase `service_role` keys in code (including inside JWTs), and secrets exposed to the browser through public env variables such as `NEXT_PUBLIC_*`
60
+ - Supabase tables created without row level security, or with it switched off
61
+ - **Invented dependencies** (with `--online`): checks that every package in `package.json` and `requirements.txt` really exists on npm / PyPI. AI tools sometimes make up names, and an attacker can register them. This contacts the public registries, so it is opt-in. Private-registry scopes and network failures are reported as "could not verify", never as findings.
62
+
63
+ Every finding says **where** it is, **why** it matters and **how** to fix it. Secret values are never printed.
64
+
65
+ The exit code is `1` if anything at or above `--fail-on` (default `high`) is found, so it works as a CI gate.
66
+
67
+ ### Silencing false alarms
68
+
69
+ - On one line: add the comment `vibe-it-securely-ignore`
70
+ - For whole files or folders: list them in `.vibe-it-securely-ignore` (one path per line, `#` for comments)
71
+
72
+ ```
73
+ # .vibe-it-securely-ignore
74
+ test/fixtures/
75
+ ```
76
+
77
+ ## Limitations
78
+
79
+ - `check` uses pattern matching, not deep code analysis. It misses things and sometimes flags harmless code. The generated CI workflow adds Semgrep and gitleaks for deeper coverage.
80
+ - The route-auth check looks for auth keywords near the route, so it can miss real gaps and flag public routes.
81
+ - It does not check your dependency versions itself. That is done by `npm audit` / `pip-audit` in the generated CI workflow.
82
+ - Generated Dockerfiles guess your start command. Review the `TODO` comments in them.
83
+ - Review generated files before relying on them. Pin third-party GitHub Actions to commit SHAs for stronger supply-chain safety.
84
+
85
+ ## Development
86
+
87
+ ```bash
88
+ npm test
89
+ ```
90
+
91
+ ## License
92
+
93
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ import path from "node:path";
3
+ import { init } from "../src/init.js";
4
+ import { check } from "../src/check.js";
5
+ import { checkDependencies } from "../src/deps.js";
6
+ import { formatReport, countBySeverity } from "../src/report.js";
7
+
8
+ const args = process.argv.slice(2);
9
+ const cmd = args[0];
10
+ const flag = (name) => args.includes(name);
11
+ const value = (name) => {
12
+ const i = args.indexOf(name);
13
+ return i >= 0 ? args[i + 1] : undefined;
14
+ };
15
+ const dir = path.resolve(value("--dir") || process.cwd());
16
+
17
+ const HELP = `vibe-it-securely - a security baseline for your project
18
+
19
+ Usage:
20
+ vibe-it-securely init [--dir <path>] [--dry-run] [--no-docker]
21
+ vibe-it-securely check [--dir <path>] [--fail-on high|medium|none] [--json] [--online]
22
+
23
+ init Generates pre-commit hooks, CI checks, hardened Docker files and AI-assistant
24
+ rules. Existing files are never overwritten; new versions are saved as
25
+ <name>.suggested for you to review. Use --no-docker for libraries, CLIs
26
+ and scripts that do not ship as a container.
27
+ check Looks for leaked secrets, risky code patterns, Docker problems and missing
28
+ safeguards, and explains each finding in plain language.
29
+ --online also verifies that every dependency name really exists on npm/PyPI
30
+ (AI tools sometimes invent package names). It contacts the public registries.
31
+ Exit code 1 if anything at or above --fail-on is found (default: high).`;
32
+
33
+ if (!cmd || cmd === "--help" || cmd === "-h") {
34
+ console.log(HELP);
35
+ process.exit(0);
36
+ }
37
+
38
+ if (cmd === "init") {
39
+ const dryRun = flag("--dry-run");
40
+ const { stack, results, notes, error } = init({ dir, dryRun, docker: !flag("--no-docker") });
41
+ if (error) {
42
+ console.error(error);
43
+ process.exit(1);
44
+ }
45
+ const langs = [stack.typescript ? "TypeScript" : stack.node ? "JavaScript" : null, stack.python ? "Python" : null].filter(Boolean);
46
+ console.log("Detected: " + langs.join(" + ") + (dryRun ? " (dry run, nothing written)" : ""));
47
+ console.log("");
48
+ const label = {
49
+ created: "created ",
50
+ suggested: "suggested ",
51
+ "skipped-exists": "kept as-is",
52
+ "would-be-created": "would create ",
53
+ "would-be-suggested": "would suggest ",
54
+ };
55
+ for (const r of results) console.log(" " + (label[r.status] || r.status) + " " + r.path);
56
+ if (results.some((r) => r.status === "suggested" || r.status === "would-be-suggested")) {
57
+ console.log("\nFiles marked suggested already existed. Yours were left untouched; review the .suggested copies and merge what you want.");
58
+ }
59
+ if (notes.length) {
60
+ console.log("\nHeads up:");
61
+ for (const n of notes) console.log(" - " + n);
62
+ }
63
+ console.log("\nNext: pip install pre-commit && pre-commit install, then run: vibe-it-securely check");
64
+ console.log("Note: this sets up a security baseline. It reduces common risks; it does not make your project secure on its own.");
65
+ } else if (cmd === "check") {
66
+ const failOn = value("--fail-on") || "high";
67
+ if (!["high", "medium", "none"].includes(failOn)) {
68
+ console.error("--fail-on must be high, medium or none");
69
+ process.exit(1);
70
+ }
71
+ const result = check(dir);
72
+ result.notes = [];
73
+ if (flag("--online")) {
74
+ const dep = await checkDependencies(dir);
75
+ result.findings.push(...dep.findings);
76
+ result.notes.push(`Checked ${dep.checked} dependency names against npm/PyPI.` + (dep.unverified ? ` ${dep.unverified} could not be verified (network problem or private registry).` : ""));
77
+ }
78
+ if (flag("--json")) console.log(JSON.stringify({ findings: result.findings, filesScanned: result.filesScanned, notes: result.notes }, null, 2));
79
+ else console.log(formatReport(result));
80
+ const c = countBySeverity(result.findings);
81
+ const fail = failOn === "high" ? c.high > 0 : failOn === "medium" ? c.high + c.medium > 0 : false;
82
+ process.exit(fail ? 1 : 0);
83
+ } else {
84
+ console.log(HELP);
85
+ process.exit(1);
86
+ }
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@uniqweb/vibe-it-securely",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "A security baseline for JavaScript, TypeScript and Python projects: pre-commit hooks, CI checks, hardened Docker config and AI-assistant rules, plus a plain-language security check.",
5
+ "type": "module",
6
+ "bin": {
7
+ "vibe-it-securely": "bin/cli.js"
8
+ },
9
+ "scripts": {
10
+ "test": "node --test"
11
+ },
12
+ "engines": {
13
+ "node": ">=18"
14
+ },
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/uniqueweb1/vibe-it-securely.git"
19
+ },
20
+ "files": [
21
+ "bin",
22
+ "src",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "keywords": [
27
+ "security",
28
+ "pre-commit",
29
+ "docker",
30
+ "vibe-coding",
31
+ "ai-generated-code",
32
+ "secrets",
33
+ "devsecops",
34
+ "cli"
35
+ ]
36
+ }