Skip to content

Add BYPASS_LOCKS faction role permission#1911

Open
Copilot wants to merge 8 commits into
mainfrom
copilot/add-faction-permission-bypass-locks
Open

Add BYPASS_LOCKS faction role permission#1911
Copilot wants to merge 8 commits into
mainfrom
copilot/add-faction-permission-bypass-locks

Conversation

Copilot AI commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

Summary

Adds a BYPASS_LOCKS faction role permission. A faction member whose role is granted this permission can access and unlock locked blocks they don't own/aren't an accessor of.

  • MfFactionPermissions: new BYPASS_LOCKS entry (default false) + bypassLocks accessor.
  • PlayerInteractListener: new hasLockBypassPermission(mfPlayer) helper, used in the locked-block access path and the unlock path (alongside the existing mf.bypass / mf.force.unlock Bukkit permissions).
  • Lang key FactionPermissionBypassLocks in all five locales.

⚠️ Reviewer decision needed — bypass scope

hasLockBypassPermission checks only that the player's own faction role has BYPASS_LOCKS; it does not check who owns the lock. Combined with the listener guard (which already established the player is not the owner/accessor), this is effectively a blanket bypass of any lock — including locks owned by other factions or unaffiliated players — for any role granted the permission. If the intent was narrower (e.g. sharing access to the same faction's locks only), the check needs to compare the lock owner's faction. Please confirm the intended scope before merge. Default is false, so no role has it unless a leader grants it.

Dev-loop grooming

  • Rebased on main (was 226 behind) — no conflicts.
  • Build-verified (./gradlew clean build green in a clean container; CI build + docker-build green on 40cb7534).
  • Filled a localization gap: the branch added the lang key only to en_US; added it to en_GB/de_DE/fr_FR/pt_BR to match the 5-locale convention.

Data-safety statement

No schema migrations; no DPC contract change; no config.yml default change; no plugin.yml change. Lang changes are additive (no key removals).

Known gap

  • No test covers the new bypass logic. A test was intentionally not added pending the scope decision above (so as not to cement possibly-over-broad behavior). Once scope is confirmed, a PlayerInteractListenerTest / MfFactionPermissionTest case should be added.

Groomed by Claude on behalf of Daniel Stephenson.

Copilot AI and others added 4 commits December 11, 2025 07:17
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Copilot AI changed the title [WIP] Add faction permission to bypass locks Add BYPASS_LOCKS faction permission for accessing locked blocks Dec 11, 2025
@dmccoystephenson dmccoystephenson changed the base branch from develop to main April 25, 2026 21:50
BuildTools and others added 2 commits June 6, 2026 17:56
The branch added the key only to en_US; add it to en_GB/de_DE/fr_FR/pt_BR
to match the 5-locale convention for faction permission strings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dmccoystephenson dmccoystephenson marked this pull request as ready for review June 7, 2026 00:07
@dmccoystephenson dmccoystephenson changed the title Add BYPASS_LOCKS faction permission for accessing locked blocks Add BYPASS_LOCKS faction role permission Jun 7, 2026

@dmccoystephenson dmccoystephenson left a comment

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.

Self-review rubric (grooming pass — adversarial, assume FAIL without evidence):

  • Scope: PASS — three source files (permission enum, listener helper, lang) plus the grooming locale additions. No unrelated churn.
  • Tests-new: FAIL (flagged, not auto-fixed) — the new hasLockBypassPermission path has no test. Deliberately deferred pending the scope decision below, so a test doesn't lock in possibly-over-broad behavior. PlayerInteractListenerTest and MfFactionPermissionTest already exist to mirror once scope is settled.
  • Sibling structure: PASS — BYPASS_LOCKS follows the existing wrapSimplePermission(...) pattern and accessor convention.
  • Lang-externalized: PASS — FactionPermissionBypassLocks now present in all 5 locales (was en_US-only; added en_GB/de/fr/pt during grooming, Latin-1 preserved). No keys removed.
  • Docs: PASS (N/A) — no doc enumerates the faction role-permission list (USER_GUIDE/FACTION_FLAGS cover gameplay and flag-management Bukkit perms, not the role-permission enum), so nothing to update.
  • Migrations-additive / DPC-contract / Config-defaults / Plugin.yml: PASS (vacuous) — none touched.
  • Main-thread-safety: PASS — hasLockBypassPermission reads faction/role state on the event thread as the surrounding code already does; the bypass branch dispatches via runTaskAsynchronously as before.
  • CI: PASS — build + docker-build green on 40cb7534; also build-verified in a clean container.

Lead finding (security scope — reviewer decision): the bypass is unscopedhasLockBypassPermission only verifies the acting player's role has BYPASS_LOCKS, not that the lock belongs to their faction. So a role with this permission can open any lock, including other factions'/players' locks. If the feature is meant for same-faction lock sharing, the helper must also check the lock owner's faction. This is the one thing to settle before merge; default false limits exposure until a leader grants it.

Rebased cleanly, build-verified, localization gap fixed, marked ready. Left un-merged pending the scope decision — security-sensitive behavior change.

Self-review by Claude on behalf of Daniel Stephenson.

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.

2 participants