Skip to content

permission: reuse cached env strings - #64912

Open
agape1225 wants to merge 1 commit into
nodejs:mainfrom
agape1225:permission-use-cached-strings
Open

permission: reuse cached env strings#64912
agape1225 wants to merge 1 commit into
nodejs:mainfrom
agape1225:permission-use-cached-strings

Conversation

@agape1225

Copy link
Copy Markdown
Contributor

This PR replaces FIXED_ONE_BYTE_STRING(isolate, "...") literals in
src/permission/permission.cc with the Environment-cached
permission_string()/resource_string() accessors already used
elsewhere in the same file. Follow-up to #59891, which didn't cover
this file.

Permission::is_scope_granted() and Permission::Drop() built the
"permission" and "resource" diagnostics message keys with
FIXED_ONE_BYTE_STRING(isolate, ...) on every publish, even though
Environment already caches these exact strings via
env->permission_string() and env->resource_string()
(src/env_properties.h). One call site in the same file already used
the cached accessor; these two did not, and Environment is already
in scope at both sites.

Assisted-by: Claude Sonnet 5
Signed-off-by: agape1225 <49804691+agape1225@users.noreply.github.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Aug 1, 2026
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.27%. Comparing base (b9dacd4) to head (615612e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64912      +/-   ##
==========================================
- Coverage   90.29%   90.27%   -0.03%     
==========================================
  Files         760      760              
  Lines      247061   247061              
  Branches    46585    46587       +2     
==========================================
- Hits       223092   223035      -57     
- Misses      15451    15496      +45     
- Partials     8518     8530      +12     
Files with missing lines Coverage Δ
src/permission/permission.cc 82.32% <100.00%> (ø)

... and 38 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

leah-1ee added a commit to leah-1ee/node that referenced this pull request Aug 5, 2026
Follow-up to nodejs#59891, covering files it missed.
Overlapping locations (node_ffi.cc, crypto_util.cc) were already
handled by nodejs#64760.

Refs: nodejs#59891
Refs: nodejs#64760
Refs: nodejs#64912

Signed-off-by: leah-1ee <selee3196@gmail.com>
leah-1ee added a commit to leah-1ee/node that referenced this pull request Aug 5, 2026
Follow-up to nodejs#59891, covering files it missed.
Overlapping locations (node_ffi.cc, crypto_util.cc) were already
handled by nodejs#64760.

Refs: nodejs#59891
Refs: nodejs#64760
Refs: nodejs#64912

Signed-off-by: leah-1ee <selee3196@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants