Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cloud-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,12 @@ function openReportModal() {
// hand-edited files ever matter.
export function parseMsProjectXml(xml) {
const tag = (block, name) => {
const m = block.match(new RegExp(`<${name}>([^<]*)</${name}>`));
// `name` is always a hardcoded XML tag literal from the callers below
// (UID, Name, OutlineLevel, Start, Finish, ...), never user input, and the
// capture group `[^<]*` is a single linear character class with no nested
// or ambiguous quantifier, so this pattern cannot backtrack catastrophically
// regardless of `block` — there is no ReDoS surface.
const m = block.match(new RegExp(`<${name}>([^<]*)</${name}>`)); // nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
return m ? m[1].trim() : '';
};
const unescape = (s) => s
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"fuzz": "node --test tests/fuzz/*.mjs"
},
"dependencies": {
"@hono/node-server": "^1.19.14",
"@hono/node-server": "^2.0.12",
"hono": "^4.12.27"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions tests/unit/analytics.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,22 @@ assert.ok(midIdx > 0 && Math.abs(s.planned[midIdx] - 0.5) < 1e-6, 'midpoint ≈
// empty / undated tasks → empty series, no throw
assert.deepEqual(buildScurve({ tasks: [], calcPlannedRatio, calcDuration, buildTimeline }), { timeline: [], planned: [] });

// dated tasks whose total duration is zero → empty series (no 0/0 NaN weight).
// Distinct from the empty-input case above: these tasks DO pass the "has both
// planned dates" filter, so they populate `dated`, but each contributes 0 days
// (end<start via the injected calcDuration), leaving totalDays==0. Guards the
// `dur/totalDays` weight division in the cumulative curve from producing NaN.
const zeroDuration = [
{ id: 'z1', plannedStartDate: '2026-01-11', plannedEndDate: '2026-01-01' }, // end<start → 0d
{ id: 'z2', plannedStartDate: '2026-02-05', plannedEndDate: '2026-02-01' }, // end<start → 0d
];
assert.deepEqual(
buildScurve({ tasks: zeroDuration, calcPlannedRatio, calcDuration, buildTimeline }),
{ timeline: [], planned: [] },
'zero total planned duration → empty series (no divide-by-zero)'
);
// and the returned curve carries no NaN (regression guard on the weight math)
const zeroSeries = buildScurve({ tasks: zeroDuration, calcPlannedRatio, calcDuration, buildTimeline });
assert.ok(zeroSeries.planned.every((v) => Number.isFinite(v)), 'no NaN in planned series');

console.log('✓ analytics (EVM + S-curve) unit tests passed');
Loading