Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 8, 2025

Port no-policy ABAC feature to Node-Casbin

Based on investigation, the core functionality is already implemented in Node-Casbin. The check on line 482 of src/coreEnforcer.ts matches the Go implementation.

What's needed:

  • Create examples/abac_not_using_policy_model.conf matching Go Casbin
  • Create examples/abac_rule_effect_policy.csv matching Go Casbin
  • Add test case TestABACNotUsingPolicy to verify the feature works
  • Run tests to validate implementation (all 184 tests pass)
  • Request code review (completed, 1 comment was a misunderstanding of feature intent)
  • Run security check (no vulnerabilities found)
  • Run linter (passes with no issues)
  • Revert yarn.lock changes (as requested by reviewer)

Summary

Successfully ported the no-policy ABAC feature from Go Casbin to Node-Casbin. The core logic was already implemented in the codebase. Added example configuration files and test case to demonstrate the feature. All tests pass and no security issues detected.

Security Summary

No vulnerabilities detected by CodeQL scanner.

Original prompt

This section details on the original issue you should resolve

<issue_title>[feature] Port no-policy ABAC feature to Node-Casbin and Casbin-Editor</issue_title>
<issue_description>Required by: casbin/casbin#918 (comment)</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 8, 2025
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mserico mserico marked this pull request as ready for review December 8, 2025 12:25
@coveralls
Copy link

Pull Request Test Coverage Report for Build 20028035704

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 78.096%

Totals Coverage Status
Change from base Build 20028002150: 0.0%
Covered Lines: 1597
Relevant Lines: 1948

💛 - Coveralls

Copilot AI changed the title [WIP] Port no-policy ABAC feature to Node-Casbin and Casbin-Editor Add no-policy ABAC example and test Dec 8, 2025
Copilot AI requested a review from mserico December 8, 2025 12:37
@mserico
Copy link
Contributor

mserico commented Dec 8, 2025

@copilot don't modify yarn.lock

Copy link
Contributor Author

Copilot AI commented Dec 8, 2025

@copilot don't modify yarn.lock

Reverted yarn.lock changes in commit 6f30525.

@mserico
Copy link
Contributor

mserico commented Dec 8, 2025

@copilot should exactly use the same behavior as Go Casbin, including code and test cases and naming patterns

so the test case should not have policy file at all

Copy link
Contributor Author

Copilot AI commented Dec 8, 2025

@copilot should exactly use the same behavior as Go Casbin, including code and test cases and naming patterns

so the test case should not have policy file at all

The current implementation matches Go Casbin exactly - TestABACNotUsingPolicy in Go loads both the model and policy file (NewEnforcer("examples/abac_not_using_policy_model.conf", "examples/abac_rule_effect_policy.csv")).

Could you clarify what should be different? Should the test load no policy file at all (just the model), or should it demonstrate a different behavior?

@mserico mserico changed the title Add no-policy ABAC example and test feat: add no-policy ABAC example and test Dec 8, 2025
@mserico mserico merged commit 2e90085 into master Dec 8, 2025
12 of 14 checks passed
hsluoyz added a commit that referenced this pull request Dec 8, 2025
github-actions bot pushed a commit that referenced this pull request Dec 8, 2025
# [5.43.0](v5.42.0...v5.43.0) (2025-12-08)

### Features

* add no-policy ABAC example and test ([#523](#523)) ([d982c05](d982c05))
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.

[feature] Port no-policy ABAC feature to Node-Casbin and Casbin-Editor

4 participants