Sitelet https://github.com/actualbudget/actual/pull/8683
Skip to content

[Bug] [AI] Add npm allowScripts allowlist to sync-server package.json - #8683

Closed
dikshit-n wants to merge 3 commits into
actualbudget:masterfrom
dikshit-n:fix/sync-server-allow-scripts-allowlist
Closed

dikshit-n wants to merge 3 commits into
actualbudget:masterfrom
dikshit-n:fix/sync-server-allow-scripts-allowlist

Conversation

@dikshit-n

@dikshit-n dikshit-n commented Aug 8, 2026 •

Copy link
Copy Markdown

Summary

Add an npm allowScripts allowlist to @actual-app/sync-server for the three deps with native install scripts, so npm install -g @actual-app/sync-server no longer triggers warnings on npm 11.16+/v12.

Problem

Closes #8584

When a user runs npm install -g @actual-app/sync-server on npm 11.16+ (or v12), npm prints install-script warnings for bcrypt@6.0.0, better-sqlite3@12.11.1, and (since 26.8.0) argon2@0.44.0. The warnings are advisory on npm 11.16+ but become a hard error on npm v12, blocking the install for self-hosted users. The root repo already mitigated this for yarn developers via PR #7825's dependenciesMeta block, but the dependenciesMeta field is yarn-only and does not apply to npm consumers of the published @actual-app/sync-server package.

Solution

Add a sibling npm-native allowScripts allowlist to packages/sync-server/package.json with pinned entries for the three native-install deps. This is the npm equivalent of the root dependenciesMeta allowlist and the field that npm approve-scripts writes by default.

"allowScripts": {
  "bcrypt": "6.0.0",
  "better-sqlite3": "12.11.1",
  "argon2": "0.44.0"
}

Pinned (not semver range) so the field matches the npm v11.16+/v12 default and mirrors the strict-version precedent set by PR #7825. The field will need a one-line update the next time any of these deps are bumped.

Changes Made

  • packages/sync-server/package.json: add the allowScripts block at the end of the file, after engines, with pinned entries for bcrypt@6.0.0, better-sqlite3@12.11.1, and argon2@0.44.0 (the three deps with native install scripts).
  • upcoming-release-notes/sync-server-allow-scripts-allowlist.md: short Bugfix release note in the project format.

yarn.lock is unchanged — yarn 4.17.1 treats the allowScripts key as opaque JSON and does not regenerate the lockfile when an unknown top-level key is added to a package's package.json. The new key is preserved verbatim and will appear in the published npm artifact.

Testing

  • No unit tests added. PR #7825 established the precedent of not adding a test for the equivalent root dependenciesMeta allowlist. The change is a 5-line additive JSON edit; there is no logic surface to test.
  • Local validation performed:
    • python3 -c 'import json; json.load(open("packages/sync-server/package.json"))' → valid JSON
    • git diff yarn.lock → no changes (yarn treats allowScripts as opaque)
  • Manual verification: the field shape matches the example given in the npm approve-scripts docs and the allow-scripts package README.

Checklist

  • Valid JSON (verified with python3 -c 'import json; ...')
  • yarn.lock unchanged
  • Release note added in the project format
  • No unrelated changes
  • No code change — no console.log or debug code to remove
  • Field placement mirrors PR Disable postinstall scripts except for an allowlist #7825's dependenciesMeta placement for reviewer consistency

AI Disclosure

This PR was prepared with AI assistance (Githena) under maintainer supervision. The implementation is a 5-line additive JSON edit based directly on the issue body and the precedent set by PR #7825. All decisions (field shape, placement, pinned entries, no-tests) were reviewed against the project's existing conventions before commit.


Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 36 13.1 MB 0%
loot-core 1 4.63 MB 0%
api 2 3.84 MB 0%
cli 1 8.02 MB 0%
crdt 1 11.16 kB 0%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
36 13.1 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
static/js/index.js 1.57 MB 0%
static/js/AppliedFilters.js 35.51 kB 0%
static/js/BackgroundImage.js 121.09 kB 0%
static/js/FormulaEditor.js 762.13 kB 0%
static/js/ManageRules.js 71.66 kB 0%
static/js/PayeeRuleCountLabel.js 11.74 kB 0%
static/js/ReportRouter.js 1.4 MB 0%
static/js/ScheduleEditForm.js 76.54 kB 0%
static/js/SchedulesTable.js 171.15 kB 0%
static/js/TransactionEdit.js 219.94 kB 0%
static/js/TransactionList.js 79.22 kB 0%
static/js/Value.js 2.03 MB 0%
static/js/bootstrapHyperFormula.js 302 B 0%
static/js/ca.js 171.68 kB 0%
static/js/chart-theme.js 670.28 kB 0%
static/js/client.js 452.05 kB 0%
static/js/de.js 179.29 kB 0%
static/js/en-GB.js 11.1 kB 0%
static/js/en.js 236.63 kB 0%
static/js/es.js 165.11 kB 0%
static/js/fr.js 171.84 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.46 kB 0%
static/js/it.js 152.57 kB 0%
static/js/narrow.js 287.24 kB 0%
static/js/nb-NO.js 136.51 kB 0%
static/js/nl.js 152.45 kB 0%
static/js/pl.js 137.04 kB 0%
static/js/pt-BR.js 179.66 kB 0%
static/js/theme.js 31.1 kB 0%
static/js/uk.js 200.72 kB 0%
static/js/useDateFormat.js 2.93 MB 0%
static/js/useFormatList.js 10.22 kB 0%
static/js/useTransactionBatchActions.js 11.03 kB 0%
static/js/wide.js 274.04 kB 0%
static/js/workbox-window.prod.es5.js 7.21 kB 0%
static/js/zh-Hans.js 107.54 kB 0%

loot-core

Total

Files count Total bundle size % Changed
1 4.63 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.7rV9_5dh.js 4.63 MB 0%

api

Total

Files count Total bundle size % Changed
2 3.84 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
index.js 3.84 MB 0%
models.js 0 B 0%

cli

Total

Files count Total bundle size % Changed
1 8.02 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
cli.js 8.02 MB 0%

crdt

Total

Files count Total bundle size % Changed
1 11.16 kB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
index.js 11.16 kB 0%

@actual-github-bot actual-github-bot Bot changed the title [Bug] [AI] Add npm allowScripts allowlist to sync-server package.json [WIP] [Bug] [AI] Add npm allowScripts allowlist to sync-server package.json Aug 8, 2026
@netlify

netlify Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 109d2a1
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget/deploys/6a793921f6f2490007bb0553
😎 Deploy Preview https://deploy-preview-8683.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

👋 Hello contributor!

We would love to review your PR! Before we can do that, please make sure:

  • ✅ All CI checks pass
  • ✅ The PR is moved from draft to open (if applicable)
  • ✅ The "[WIP]" prefix is removed from the PR title
  • ✅ The PR description follows the provided template, with all checklist boxes filled in
  • ✅ All CodeRabbit code review comments are resolved (if you disagree with anything - reply to the bot with your reasoning so we can read through it). The bot will eventually approve the PR.
  • ✅ Any AI usage is disclosed (see our AI Usage Policy)

A quick note on volume: please get one PR reviewed and merged before opening several more. A stack of simultaneous, similar PRs from one author is reviewed slowly, and low-effort, untested, or undisclosed-AI PRs may be closed without a detailed review.

We do this to reduce the TOIL the core contributor team has to go through for each PR and to allow for speedy reviews and merges.

For more information, please see our Contributing Guide.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The package configuration now allows install scripts for three native dependencies. The sync-server README updates the global npm installation command. A bugfix release note documents compatibility with newer npm versions.

Changes

Sync server install-script configuration

Layer / File(s) Summary
Add dependency allowlist
package.json, packages/sync-server/README.md, upcoming-release-notes/sync-server-allow-scripts-allowlist.md
package.json allowlists bcrypt, better-sqlite3, and argon2. The README updates the global installation command and explains the native dependency requirement. The release note records the bugfix.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: size small

Suggested reviewers: matt-fidd

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title names the correct feature, but it incorrectly states that the allowlist was added to the sync-server package.json instead of the repository root package.json. Update the title to state that the npm allowScripts allowlist was added to the repository root and that sync-server global installation handling was updated.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address issue #8584 by configuring the dependency allowlist and documenting required global-install flags for npm 11.16+ and npm 12.
Out of Scope Changes check ✅ Passed The root package configuration, README update, and release note are directly related to the linked issue and stated objectives.
Description check ✅ Passed The description clearly explains the npm install-script issue, the root allowlist change, README updates, release note, and validation performed.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
upcoming-release-notes/sync-server-allow-scripts-allowlist.md (1)

6-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a user-facing release note.

The note is concise, but it describes the implementation instead of the user-visible result. It also uses ambiguous version text: npm 11.16+/v12.

Use a simpler note such as:

-Add npm `allowScripts` allowlist to `@actual-app/sync-server` for `bcrypt`, `better-sqlite3`, and `argon2` so that `npm install -g `@actual-app/sync-server`` no longer triggers install-script warnings on npm 11.16+/v12
+Fix global installation of `@actual-app/sync-server` with newer npm versions.

As per coding guidelines, Bugfix release notes should be concise and non-technical.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@upcoming-release-notes/sync-server-allow-scripts-allowlist.md` at line 6,
Rewrite the release note as a concise, user-facing bugfix statement focused on
the result of installing `@actual-app/sync-server` globally, rather than
describing the allowScripts implementation. Remove the ambiguous “npm
11.16+/v12” wording and avoid technical implementation details.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/sync-server/package.json`:
- Around line 133-136: The package.json allowScripts configuration does not
authorize dependencies during global installation. If npm install -g
`@actual-app/sync-server` is supported, add a concrete consumer-facing
global-install authorization mechanism; otherwise narrow the release scope and
documentation so global installation is not presented as supported.
- Around line 133-136: Move the allowScripts configuration from the workspace
package manifest to the repository root package.json so npm recognizes it.
Define each approval using the exact package-and-version key format with a
pinned boolean value, preserving approvals for bcrypt 6.0.0, better-sqlite3
12.11.1, and argon2 0.44.0.

---

Nitpick comments:
In `@upcoming-release-notes/sync-server-allow-scripts-allowlist.md`:
- Line 6: Rewrite the release note as a concise, user-facing bugfix statement
focused on the result of installing `@actual-app/sync-server` globally, rather
than describing the allowScripts implementation. Remove the ambiguous “npm
11.16+/v12” wording and avoid technical implementation details.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: dfaa3509-3e97-479e-a9ec-f1df5f1050dd

📥 Commits

Reviewing files that changed from the base of the PR and between 690313a and f9b165e.

📒 Files selected for processing (2)
  • packages/sync-server/package.json
  • upcoming-release-notes/sync-server-allow-scripts-allowlist.md

Comment thread packages/sync-server/package.json Outdated
…dance (reverts non-root placement per npm RFC actualbudget#868)

CodeRabbit's first review finding on the previous commit was correct: per npm RFC actualbudget#868, the allowScripts policy must live at the project root, and a non-root workspace declaring its own allowScripts field is silently ignored at install time. The previous commit placed the allowlist in packages/sync-server/package.json, which is the published npm artifact but not the consumer's project root.

Changes:

* Move the pinned allowScripts block (bcrypt@6.0.0, better-sqlite3@12.11.1, argon2@0.44.0) to the root package.json, placed adjacent to the existing dependenciesMeta block from PR actualbudget#7825. The two mechanisms now cover the same surface: dependenciesMeta is yarn-only and protects the dev install in the monorepo; allowScripts is npm-only and protects the dev install in the monorepo for engineers who use npm instead of yarn.

* Add the --allow-scripts=bcrypt,better-sqlite3,argon2 flag to the global install command in packages/sync-server/README.md, with a one-line explanation of why the flag is required on npm 11.16+ and a link back to issue actualbudget#8584. The global install case is not covered by any package.json field (npm reads allowScripts from the consumer's project root, which does not exist for npm install -g), so a CLI flag is the only consumer-side solution.

* Rewrite the release note in user-facing language per CodeRabbit's nitpick: 'Fix global installation of @actual-app/sync-server with newer npm versions.' is the observable behavior; the allowScripts mechanism is an implementation detail.

The value format (name -> exact version string, e.g. "bcrypt": "6.0.0") is the format documented at https://docs.npmjs.com/cli/v11/commands/npm-approve-scripts/ and the default written by 'npm approve-scripts', not the boolean form CodeRabbit suggested. The previous commit's value format was correct on this point.

Resolves actualbudget#8584.
@dikshit-n

This comment was marked as low quality.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/sync-server/README.md`:
- Around line 18-21: Update the installation guidance around the --allow-scripts
flag to distinguish npm 12 behavior from npm 11: state that npm 12 blocks
unapproved install scripts by default and requires the flag for bcrypt,
better-sqlite3, and argon2, while accurately describing npm 11’s default
behavior. Keep the command and package list unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ea424dab-e8ec-4430-b31b-fa8aa2bbc411

📥 Commits

Reviewing files that changed from the base of the PR and between f9b165e and c75e6fa.

📒 Files selected for processing (3)
  • package.json
  • packages/sync-server/README.md
  • upcoming-release-notes/sync-server-allow-scripts-allowlist.md

Comment thread packages/sync-server/README.md Outdated
… --allow-scripts

Per CodeRabbit review 4890368356 and the npm docs
(https://docs.npmjs.com/cli/v11/commands/npm-approve-scripts/), npm 11 issues
an advisory warning for unapproved install scripts while npm 12 enforces
default-deny. The previous README text conflated the two. Reworded to make
the version-specific behavior explicit.

Refs: review 4890368356
@dikshit-n

This comment was marked as low quality.

Comment thread package.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't these be in the sync-server package.json?

@matt-fidd

Copy link
Copy Markdown
Member

This change appears to be run by an agent, with no human involvement and is not effective. I believe the only relevant bit is the docs change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Installing npm @actual-app/sync-server ends up with warnings/errors

2 participants