Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: avoid shadowed string in fs_permission #51123

Merged
merged 1 commit into from Jan 3, 2024

Conversation

codebytere
Copy link
Member

Refs #44004

Addresses the following shadowing issue in fs_permission:

../../third_party/electron_node/src/permission/fs_permission.h:34:37: error: declaration shadows a field of 'node::permission::FSPermission::RadixTree::Node' [-Werror,-Wshadow]
   34 |       Node* CreateChild(std::string prefix) {
      |                                     ^
../../third_party/electron_node/src/permission/fs_permission.h:24:19: note: previous declaration is here
   24 |       std::string prefix;
      |                   ^
1 error generated.

Allows Electron to remove a patch.

@nodejs-github-bot
Copy link
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 Dec 11, 2023
@RafaelGSS RafaelGSS added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 11, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 11, 2023
@nodejs-github-bot
Copy link
Collaborator

src/permission/fs_permission.h Show resolved Hide resolved
@codebytere codebytere force-pushed the copy-string-fix branch 2 times, most recently from 7161204 to 7d2c4c1 Compare December 12, 2023 09:59
@codebytere
Copy link
Member Author

Seeing test failures that i didn't see when running Electron's version against Node.js tests - looking into it 🤔

Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

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

@codebytere this should fix your issue:

diff --git a/src/permission/fs_permission.h b/src/permission/fs_permission.h
index 4577a73c37d..642d2dbc6ea 100644
--- a/src/permission/fs_permission.h
+++ b/src/permission/fs_permission.h
@@ -43,7 +43,7 @@ class FSPermission final : public PermissionBase {

         Node* child = children[label];
         if (child == nullptr) {
-          children[label] = new Node(prefix);
+          children[label] = new Node(path_prefix);
           return children[label];
         }

@codebytere
Copy link
Member Author

@RafaelGSS done, thanks!

@codebytere codebytere added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 2, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 2, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@RafaelGSS RafaelGSS added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. permission Issues and PRs related to the Permission Model labels Jan 3, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 3, 2024
@nodejs-github-bot nodejs-github-bot merged commit 088f4cc into nodejs:main Jan 3, 2024
59 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 088f4cc

@codebytere codebytere deleted the copy-string-fix branch January 3, 2024 13:54
targos pushed a commit that referenced this pull request Feb 15, 2024
PR-URL: #51123
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
@marco-ippolito marco-ippolito mentioned this pull request Mar 1, 2024
richardlau pushed a commit that referenced this pull request Mar 25, 2024
PR-URL: #51123
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
richardlau pushed a commit that referenced this pull request Mar 25, 2024
PR-URL: #51123
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
@richardlau richardlau mentioned this pull request Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. permission Issues and PRs related to the Permission Model
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants