periderm-cli 0.1.37 → 0.1.39
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/dist/report/markdown.js
CHANGED
|
@@ -119,7 +119,8 @@ export function renderMarkdown(r) {
|
|
|
119
119
|
lines.push(`You are reviewing a Periderm CLI scan: Launch Confidence ${r.scores.confidence}/100, Reality ${r.scores.reality}/100, Perceived ${r.scores.perceived}/100 — verdict ${verdictLabel}.`);
|
|
120
120
|
lines.push(`There are ${r.counts.critical} critical, ${r.counts.high} high, ${r.counts.medium} medium, ${r.counts.low} low findings.`);
|
|
121
121
|
lines.push(`Fix them in priority order. For each finding, open the listed file, apply the Exact fix, and keep the change minimal.`);
|
|
122
|
-
|
|
122
|
+
const aiInstructionsPath = process.cwd() + "/.periderm/ai-instructions.md";
|
|
123
|
+
lines.push(`IMPORTANT: Before you begin, read the instructions in \`${aiInstructionsPath}\` for the full iterative process on how to run the scanner, verify fixes, and handle any authentication requirements.`);
|
|
123
124
|
lines.push("```");
|
|
124
125
|
lines.push("");
|
|
125
126
|
// Hidden watermark — only visible in raw .md source
|
package/dist/scanner/checks.js
CHANGED
|
@@ -756,12 +756,48 @@ const formInputNoLabel = (source, file) => {
|
|
|
756
756
|
return out;
|
|
757
757
|
if (isInternalSurface(file))
|
|
758
758
|
return out;
|
|
759
|
-
|
|
759
|
+
// Match opening tag start positions, then extract attrs from the raw source window
|
|
760
|
+
const tagStartRe = /<(input|select|textarea)\b/g;
|
|
760
761
|
let m;
|
|
761
762
|
let reported = 0;
|
|
762
|
-
while ((m =
|
|
763
|
+
while ((m = tagStartRe.exec(source)) && reported < 3) {
|
|
763
764
|
const tag = m[1];
|
|
764
|
-
|
|
765
|
+
// Walk forward char-by-char, skipping over quoted attribute values so we
|
|
766
|
+
// don't confuse the > inside `(e) => ...` with the tag's closing >.
|
|
767
|
+
let i = m.index + m[0].length;
|
|
768
|
+
let inStr = null;
|
|
769
|
+
let closeIdx = -1;
|
|
770
|
+
while (i < source.length && i < m.index + 1200) {
|
|
771
|
+
const ch = source[i];
|
|
772
|
+
if (inStr) {
|
|
773
|
+
if (ch === inStr && source[i - 1] !== '\\')
|
|
774
|
+
inStr = null;
|
|
775
|
+
}
|
|
776
|
+
else if (ch === '"' || ch === "'" || ch === '`') {
|
|
777
|
+
inStr = ch;
|
|
778
|
+
}
|
|
779
|
+
else if (ch === '{') {
|
|
780
|
+
// Skip balanced braces (JSX expression attributes like onChange={...})
|
|
781
|
+
let depth = 1;
|
|
782
|
+
i++;
|
|
783
|
+
while (i < source.length && depth > 0) {
|
|
784
|
+
if (source[i] === '{')
|
|
785
|
+
depth++;
|
|
786
|
+
else if (source[i] === '}')
|
|
787
|
+
depth--;
|
|
788
|
+
i++;
|
|
789
|
+
}
|
|
790
|
+
continue;
|
|
791
|
+
}
|
|
792
|
+
else if (ch === '>') {
|
|
793
|
+
closeIdx = i;
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
i++;
|
|
797
|
+
}
|
|
798
|
+
if (closeIdx < 0)
|
|
799
|
+
continue;
|
|
800
|
+
const attrs = source.slice(m.index, closeIdx + 1);
|
|
765
801
|
if (/type\s*=\s*["'](hidden|submit|button|image|reset)["']/.test(attrs))
|
|
766
802
|
continue;
|
|
767
803
|
if (/aria-label\s*=|aria-labelledby\s*=/.test(attrs))
|
|
@@ -775,16 +811,16 @@ const formInputNoLabel = (source, file) => {
|
|
|
775
811
|
}
|
|
776
812
|
// wrapping <label> ... <input .../> ... </label>
|
|
777
813
|
const before = source.slice(Math.max(0, m.index - 400), m.index);
|
|
778
|
-
const after = source.slice(
|
|
814
|
+
const after = source.slice(closeIdx + 1, closeIdx + 1 + 300);
|
|
779
815
|
if (/<label\b[^>]*>[^<]*$/.test(before) && /^[^<]*<\/label>/.test(after))
|
|
780
816
|
continue;
|
|
781
817
|
out.push(mkFinding({
|
|
782
818
|
id: "input-no-label",
|
|
783
819
|
category: "Accessibility",
|
|
784
|
-
severity: "
|
|
820
|
+
severity: "medium",
|
|
785
821
|
file, line: lineOf(source, m.index),
|
|
786
822
|
message: `<${tag}> has no associated <label> or aria-label.`,
|
|
787
|
-
why: "Screen readers announce the field with no name.
|
|
823
|
+
why: "Screen readers announce the field with no name. Disabled users have no idea what to type. Violates WCAG 2.1 SC 1.3.1 & 3.3.2.",
|
|
788
824
|
fix: "Either wrap the field in a <label>, add htmlFor={id}, or set aria-label=\"...\" on the field itself.",
|
|
789
825
|
aiPrompt: `In ${file} near line ${lineOf(source, m.index)}, the <${tag}> is missing a label. Add a <label htmlFor="..."> or aria-label describing what the user should enter.`,
|
|
790
826
|
}));
|
|
@@ -217,7 +217,7 @@ export async function runRepoChecks(root, _files, ctx) {
|
|
|
217
217
|
// "is this dep actually imported anywhere?" and "is this class used?".
|
|
218
218
|
let importHaystack = "";
|
|
219
219
|
for (const abs of _files) {
|
|
220
|
-
if (!/\.(tsx|jsx|ts|js|mjs|cjs|svelte|vue|astro|mdx
|
|
220
|
+
if (!/\.(tsx|jsx|ts|js|mjs|cjs|svelte|vue|astro|mdx?|css|scss)$/.test(abs))
|
|
221
221
|
continue;
|
|
222
222
|
const chunk = await readMaybe(abs);
|
|
223
223
|
if (chunk)
|
|
@@ -283,7 +283,7 @@ export async function runRepoChecks(root, _files, ctx) {
|
|
|
283
283
|
continue;
|
|
284
284
|
// Sub-path imports still start with the package name
|
|
285
285
|
const escaped = dep.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
286
|
-
const re = new RegExp(`(?:from\\s+["']|require\\(["']|import\\(\\s*["'])${escaped}(?:["']|/)`);
|
|
286
|
+
const re = new RegExp(`(?:from\\s+["']|require\\(["']|import\\(\\s*["']|import\\s+["']|@import\\s+["'])${escaped}(?:["']|/)`);
|
|
287
287
|
if (!re.test(importHaystack))
|
|
288
288
|
unused.push(dep);
|
|
289
289
|
}
|
package/package.json
CHANGED