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

fix: prevent false positive return for guarding dao member store #3121

Merged
merged 5 commits into from
Dec 11, 2024

Conversation

piux2
Copy link
Contributor

@piux2 piux2 commented Nov 14, 2024

If we want to guard the MemStore by checking the active DAO realm, m.daoPkgPath must first be assigned a realm package path; otherwise, the isCallerDAORealm() method may return a false positive, failing to protect the MemStore.

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests

If we want to guard the MemStore by checking the active DAO realm, m.daoPkgPath must first be assigned a realm package path; otherwise, the isCallerDAORealm() method may return a false positive, failing to protect the MemStore.
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Nov 14, 2024
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@Kouteki
Copy link
Contributor

Kouteki commented Nov 17, 2024

Closing the issue: Manfred & Miloš discussed this and agreed that, if daoPkgPath isn't defined, realm guard should not be active.

@Kouteki Kouteki closed this Nov 17, 2024
@piux2
Copy link
Contributor Author

piux2 commented Nov 28, 2024

Closing the issue: Manfred & Miloš discussed this and agreed that, if daoPkgPath isn't defined, realm guard should not be active.

We need more discussion on this. The current implementation could introduce serious bugs, resulting in DAO vulnerabilities.

After this PR, when "if daoPkgPath isn't defined, the realm guard should not be active," developers will need to explicitly remove the isCallerDAORealm() statement to indicate that realm access is not protected.

Here is the reasoning behind this approach:

For developers who write or read the code, the intention behind introducing the isCallerDAORealm() statement in the first place was to guard realm access. This method acts as a guard while abstracting the implementation details. However, the guard relies on a condition that may be defined or updated elsewhere. The current implementation could create ambiguity in the OR logic of the if statement.

This PR addresses the issue:
"If daoPkgPath isn't defined, the realm guard should not be active." However, it could introduce false positive results.

@piux2 piux2 reopened this Nov 28, 2024
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Nov 28, 2024

I'm a bot that assists the Gno Core team in maintaining this repository. My role is to ensure that contributors understand and follow our guidelines, helping to streamline the development process.

The following requirements must be fulfilled before a pull request can be merged.
Some requirement checks are automated and can be verified by the CI, while others need manual verification by a staff member.

These requirements are defined in this configuration file.

Automated Checks

🟢 The pull request head branch must be up-to-date with its base (more info)

Manual Checks

No manual checks match this pull request.

Debug
Automated Checks
The pull request head branch must be up-to-date with its base (more info)

If

🟢 Condition met
└── 🟢 On every pull request

Then

🟢 Requirement satisfied
└── 🟢 Head branch (piux2-patch-2) is up to date with base (master): behind by 0 / ahead by 5

@Kouteki Kouteki added the in focus Core team is prioritizing this work label Dec 1, 2024
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Let's go with this 🙏

Please check the CI

@piux2 piux2 merged commit a85a53d into master Dec 11, 2024
105 checks passed
@piux2 piux2 deleted the piux2-patch-2 branch December 11, 2024 23:19
@Kouteki Kouteki removed the in focus Core team is prioritizing this work label Dec 16, 2024
albttx pushed a commit that referenced this pull request Jan 10, 2025
If we want to guard the MemStore by checking the active DAO realm,
m.daoPkgPath must first be assigned a realm package path; otherwise, the
isCallerDAORealm() method may return a false positive, failing to
protect the MemStore.

<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
</details>

---------

Co-authored-by: Miloš Živković <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Development

Successfully merging this pull request may close these issues.

4 participants