Skip to content

HARMONY-2268: Change audit to ignore dev dependencies as best as we can#861

Merged
chris-durbin merged 4 commits intomainfrom
harmony-2268
Feb 25, 2026
Merged

HARMONY-2268: Change audit to ignore dev dependencies as best as we can#861
chris-durbin merged 4 commits intomainfrom
harmony-2268

Conversation

@chris-durbin
Copy link
Contributor

@chris-durbin chris-durbin commented Feb 24, 2026

Jira Issue ID

HARMONY-2268

Description

New plan for dependency monitoring

  • Use the GitHub Advisory database ID instead of the npm ID which often changes
  • Audit tasks attempt to avoid reporting on dev dependencies
  • If a dev dependency is still reported, do not include an expiration and include a note

Local Test Steps

npm run better-audit

PR Acceptance Checklist

  • Acceptance criteria met
  • Tests added/updated (if needed) and passing
  • Documentation updated (if needed)
  • Harmony in a Box tested (if changes made to microservices or new dependencies added)

Summary by CodeRabbit

  • Chores
    • Added a unified dependency-audit script and updated test/audit workflows to delegate to it (now includes progress reporting).
    • Standardized audit invocations across packages and services.
    • Added npm engine requirement (>=8) for compatibility.
    • Updated security advisory data: removed legacy entries, consolidated records, and replaced some advisory identifiers with updated IDs.

…an. For dev dependencies that can't be ignored because they are pulled in from subdependencies add a note and remove the expiration.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 256d5d3 and 4bbf765.

📒 Files selected for processing (4)
  • services/cron-service/.nsprc
  • services/query-cmr/.nsprc
  • services/service-runner/.nsprc
  • services/work-updater/.nsprc
🚧 Files skipped from review as they are similar to previous changes (1)
  • services/service-runner/.nsprc

📝 Walkthrough

Walkthrough

Root-level audit scripting was reorganized and many package test/better-audit scripts were updated to delegate to a new audit script with a progress flag. Multiple .nsprc advisory files were edited—several cleared to {}, others had numeric keys replaced with GHSA identifiers or consolidated.

Changes

Cohort / File(s) Summary
Root package manifest
package.json
Added audit-deps script; updated root test, better-audit, and better-audit-output to invoke the audit script first and include progress handling.
packages/util
packages/util/.nsprc, packages/util/package.json
Cleared .nsprc to {}; updated test to call npm run better-audit; added -p to better-audit; added engines.npm: ">=8".
Services — .nsprc emptied
services/cron-service/.nsprc, services/query-cmr/.nsprc, services/work-failer/.nsprc, packages/util/.nsprc
Replaced previous advisory contents with empty JSON objects for those paths (removed numeric advisory entries).
Services — advisory key updates
services/service-runner/.nsprc, services/work-scheduler/.nsprc, services/harmony/.nsprc, services/work-updater/.nsprc
Replaced numeric advisory keys with GHSA identifiers or consolidated entries; updated notes and removed some expiry fields while preserving active flags.
Services — package.json script harmonization
services/.../package.json
services/cron-service/package.json, services/harmony/package.json, services/query-cmr/package.json, services/service-runner/package.json, services/work-failer/package.json, services/work-scheduler/package.json, services/work-updater/package.json
Standardized test to run npm run better-audit and added -p to better-audit across affected service manifests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

hacktoberfest-accepted

Suggested reviewers

  • ygliuvt
  • flamingbear
  • indiejames

Poem

🐇
I nibbled keys and hopped the trees,
Cleared old crumbs and chased the breeze,
Audits hum with steady beat,
GHSA signs make tidy sheets,
A rabbit winks — the repo's neat.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and specifically describes the main change: updating audit configuration to ignore dev dependencies using GHSA IDs instead of npm IDs across multiple .nsprc files and package.json scripts.
Description check ✅ Passed The description includes the required Jira Issue ID, clear explanation of the changes, local test steps, and a checklist. All essential sections are present and reasonably complete with actionable information.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch harmony-2268

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Line 8: The current "test" script in package.json uses "npm run audit-deps &&
lerna run test --load-env-files=false" which causes audit failures to
short-circuit and skip tests; modify the script so the audit runs but does not
block tests (e.g., run audit as a separate command that does not return
non‑zero, or use a shell separator/ignore-failure pattern so lerna always runs)
and ensure known/accepted root-level vulnerabilities are listed in .nsprc;
update the "test" script entry and verify behavior of the "audit-deps" task and
.nsprc suppression so CI shows test failures separately from audit results.

In `@services/harmony/.nsprc`:
- Around line 17-20: Update the GHSA entry for GHSA-2g4f-4pwh-qvx6 to match the
dev-dependency convention: remove the "expiry" property and change the "notes"
value to "Dev dependency in packages/util" while leaving "active": true intact;
locate the GHSA-2g4f-4pwh-qvx6 object in the .nsprc and make those edits so it
matches the other services' entries.

In `@services/work-scheduler/.nsprc`:
- Around line 2-5: Remove the "expiry" field from the advisory entry keyed by
"GHSA-p8p7-x288-28g6" in the .nsprc file: keep "active": true and the existing
"notes" value ("Will fix in HARMONY-1729") but delete the "expiry" property so
the entry complies with HARMONY-2268 for dev-dependency advisories.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d5de9f and 6aca1a1.

📒 Files selected for processing (18)
  • .nsprc
  • package.json
  • packages/util/.nsprc
  • packages/util/package.json
  • services/cron-service/.nsprc
  • services/cron-service/package.json
  • services/harmony/.nsprc
  • services/harmony/package.json
  • services/query-cmr/.nsprc
  • services/query-cmr/package.json
  • services/service-runner/.nsprc
  • services/service-runner/package.json
  • services/work-failer/.nsprc
  • services/work-failer/package.json
  • services/work-scheduler/.nsprc
  • services/work-scheduler/package.json
  • services/work-updater/.nsprc
  • services/work-updater/package.json

"scripts": {
"test": "better-npm-audit audit -l moderate && lerna run test --load-env-files=false",
"audit-deps": "better-npm-audit audit -l moderate -p",
"test": "npm run audit-deps && lerna run test --load-env-files=false",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Heads-up: audit failure now hard-blocks all tests via &&.

If a new vulnerability surfaces in root-level production dependencies (or a stale .nsprc entry expires), lerna run test will be skipped entirely. This is intentional per the PR's fail-fast goal, but it means CI red won't distinguish "tests failed" from "audit blocked tests". Make sure any known/accepted root-level vulnerabilities are suppressed in .nsprc to avoid spurious CI blocks.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 8, The current "test" script in package.json uses "npm
run audit-deps && lerna run test --load-env-files=false" which causes audit
failures to short-circuit and skip tests; modify the script so the audit runs
but does not block tests (e.g., run audit as a separate command that does not
return non‑zero, or use a shell separator/ignore-failure pattern so lerna always
runs) and ensure known/accepted root-level vulnerabilities are listed in .nsprc;
update the "test" script entry and verify behavior of the "audit-deps" task and
.nsprc suppression so CI shows test failures separately from audit results.

Comment on lines +17 to 20
"GHSA-2g4f-4pwh-qvx6": {
"active": true,
"notes": "Will fix in HARMONY-2261",
"expiry": "2026-06-01"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

rg -n --glob '*.nsprc' 'GHSA-2g4f-4pwh-qvx6' -C 3

Repository: nasa/harmony

Length of output: 1610


Align GHSA-2g4f-4pwh-qvx6 with the dev-dependency policy used across all other services.

This advisory is treated as a dev dependency in services/work-updater, services/service-runner, services/cron-service, and services/query-cmr—all with the note "Dev dependency in packages/util" and no expiry. The harmony service should follow the same pattern. Remove the expiry date and update the note to match the established convention.

✏️ Suggested fix
  "GHSA-2g4f-4pwh-qvx6": {
    "active": true,
-   "notes": "Will fix in HARMONY-2261",
-   "expiry": "2026-06-01"
+   "notes": "Dev dependency in packages/util"
  },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"GHSA-2g4f-4pwh-qvx6": {
"active": true,
"notes": "Will fix in HARMONY-2261",
"expiry": "2026-06-01"
"GHSA-2g4f-4pwh-qvx6": {
"active": true,
"notes": "Dev dependency in packages/util"
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@services/harmony/.nsprc` around lines 17 - 20, Update the GHSA entry for
GHSA-2g4f-4pwh-qvx6 to match the dev-dependency convention: remove the "expiry"
property and change the "notes" value to "Dev dependency in packages/util" while
leaving "active": true intact; locate the GHSA-2g4f-4pwh-qvx6 object in the
.nsprc and make those edits so it matches the other services' entries.

Comment on lines +2 to 5
"GHSA-p8p7-x288-28g6": {
"active": true,
"notes": "Will fix in HARMONY-1729",
"expiry": "2026-06-01"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Examine the .nsprc file to see the full context
cat -n services/work-scheduler/.nsprc

Repository: nasa/harmony

Length of output: 227


🏁 Script executed:

# Search for any PR or commit context about this advisory
git log --oneline -20 -- services/work-scheduler/.nsprc

Repository: nasa/harmony

Length of output: 266


🏁 Script executed:

# Search for documentation or context about dev-dep advisory policy in the PR
git log -p --all -5 -S "dev-dep" -- ".nsprc*" | head -200

Repository: nasa/harmony

Length of output: 38


🏁 Script executed:

# Search for references to GHSA-p8p7-x288-28g6 to identify the affected package
rg "GHSA-p8p7-x288-28g6" --type json --type yaml

Repository: nasa/harmony

Length of output: 38


🏁 Script executed:

# Examine package.json in services/work-scheduler to understand dependencies
cd services/work-scheduler && cat -n package.json | head -100

Repository: nasa/harmony

Length of output: 4640


🏁 Script executed:

# Search for npm audit or security scan output that mentions this advisory
git log --all -p -S "GHSA-p8p7-x288-28g6" | head -200

Repository: nasa/harmony

Length of output: 142


Remove expiry per HARMONY-2268 policy for dev-dependency advisories.

The expiry field conflicts with the policy established in HARMONY-2268: "For dev dependencies that can't be ignored because they are pulled in from subdependencies add a note and remove the expiration." The entry already includes the required note; remove the expiry field.

Suggested change
  "GHSA-p8p7-x288-28g6": {
    "active": true,
    "notes": "Will fix in HARMONY-1729",
-    "expiry": "2026-06-01"
  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"GHSA-p8p7-x288-28g6": {
"active": true,
"notes": "Will fix in HARMONY-1729",
"expiry": "2026-06-01"
"GHSA-p8p7-x288-28g6": {
"active": true,
"notes": "Will fix in HARMONY-1729"
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@services/work-scheduler/.nsprc` around lines 2 - 5, Remove the "expiry" field
from the advisory entry keyed by "GHSA-p8p7-x288-28g6" in the .nsprc file: keep
"active": true and the existing "notes" value ("Will fix in HARMONY-1729") but
delete the "expiry" property so the entry complies with HARMONY-2268 for
dev-dependency advisories.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (2)
services/cron-service/.nsprc (1)

1-1: LGTM — same rationale as services/query-cmr/.nsprc.

The removed entries (1113429, 1113371) were dev-dependency advisories now handled at the audit script level. No prod-dependency advisories remain for this service, so {} is correct.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@services/cron-service/.nsprc` at line 1, The .nsprc file should remain an
empty object {} because the removed advisory entries 1113429 and 1113371 were
dev-dependency advisories handled by the audit script; ensure the .nsprc in this
change contains only {} (no prod advisories), and confirm any dev advisory
handling is delegated to the audit script rather than re-adding those IDs.
services/work-updater/.nsprc (1)

1-1: LGTM — same rationale as services/query-cmr/.nsprc.

Consistent with the other emptied service configs. No further suppressions are required here.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@services/work-updater/.nsprc` at line 1, No changes required—leave the .nsprc
for the work-updater service empty to match the same intentional suppression
pattern used for the query-cmr service; approve and keep the consistent empty
config (no code edits to functions or classes are needed).
🧹 Nitpick comments (1)
services/query-cmr/.nsprc (1)

1-1: LGTM — removal of npm-ID-based dev dependency suppressions is consistent with the PR objective.

Entries 1113429 and 1113371 were dev-dependency advisories; since the audit script now filters dev dependencies upstream, explicit suppressions here are redundant. Keeping {} is valid and maintains the file's presence.

As a minor optional cleanup, these files (and the equivalently-emptied cron-service and work-updater ones) could be deleted rather than left as empty stubs, since better-npm-audit treats a missing .nsprc file identically to an empty {} configuration—both result in no exceptions being loaded.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@services/query-cmr/.nsprc` at line 1, The .nsprc file currently contains only
an empty object ("{}"); as an optional cleanup, remove the empty .nsprc from
query-cmr (and the equivalent empty .nsprc files in cron-service and
work-updater) since better-npm-audit treats a missing .nsprc the same as an
empty one; delete those files, run the audit/CI to confirm no behavior changes,
and commit the removals.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@services/cron-service/.nsprc`:
- Line 1: The .nsprc file should remain an empty object {} because the removed
advisory entries 1113429 and 1113371 were dev-dependency advisories handled by
the audit script; ensure the .nsprc in this change contains only {} (no prod
advisories), and confirm any dev advisory handling is delegated to the audit
script rather than re-adding those IDs.

In `@services/work-updater/.nsprc`:
- Line 1: No changes required—leave the .nsprc for the work-updater service
empty to match the same intentional suppression pattern used for the query-cmr
service; approve and keep the consistent empty config (no code edits to
functions or classes are needed).

---

Nitpick comments:
In `@services/query-cmr/.nsprc`:
- Line 1: The .nsprc file currently contains only an empty object ("{}"); as an
optional cleanup, remove the empty .nsprc from query-cmr (and the equivalent
empty .nsprc files in cron-service and work-updater) since better-npm-audit
treats a missing .nsprc the same as an empty one; delete those files, run the
audit/CI to confirm no behavior changes, and commit the removals.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6aca1a1 and 256d5d3.

📒 Files selected for processing (4)
  • services/cron-service/.nsprc
  • services/query-cmr/.nsprc
  • services/service-runner/.nsprc
  • services/work-updater/.nsprc
🚧 Files skipped from review as they are similar to previous changes (1)
  • services/service-runner/.nsprc

@chris-durbin chris-durbin merged commit 57feefe into main Feb 25, 2026
6 checks passed
@chris-durbin chris-durbin deleted the harmony-2268 branch February 25, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants