Skip to content

[access] test(rbac): cover grant constraints, derived grants, external grants, matrix rows and baseline authorization blocks - #7590

Merged
rubenvdlinde merged 8 commits into
mainfrom
cloud/t03-deletion
Nov 9, 2026
Merged

rubenvdlinde merged 8 commits into
mainfrom
cloud/t03-deletion

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Covers nine RBAC grant-shaping and audit classes from lane T03 (round t1, SIG test coverage). Two of them had no dedicated test before this PR.

What is covered (new test files only; "before" is the CI clover on development 30fbb6d)

  • lib/Service/Rbac/RoleActionMap.php (12/14) → RoleActionMapTest: non-array input; the list and keyed shapes; non-string actions, nameless entries and scalar definitions dropped.
  • lib/Service/ShippedBaseline/AuthorizationBlocks.php (69/74) → tests/Unit/Service/ShippedBaseline/AuthorizationBlocksTest: rootOf (schema block, property block, none); roots across definitions; settle roll-up (local, upstream and both; decided blocks applied upstream with localMoved; same and non-authorization paths dropped); outcome (applied, replacedLocal, conflicts with subtree trees).
  • lib/Service/Organisation/OrganisationLifecycleAuditor.php (41/43) → OrganisationLifecycleAuditorBehaviourTest: an unchanged status or edit writes nothing; a write with no session is attributed to system/System and records only the fields that moved.
  • lib/Service/Rbac/ExternalGrantGuard.php (81/88) → ExternalGrantGuardShapeTest: a null block; skipped pseudo keys, numeric keys and non-lists; only a literal true counts as external; a blank until; principal naming order; lapse holders, and the horizon cut-off.
  • lib/Service/Rbac/MatrixRowsFromApps.php (57/70) → MatrixRowsFromAppsProviderTest: no provider or a blank one passes through untouched; no dispatcher; malformed declared rows; a dotless provider is owned by the app of that name; the per-schema and per-provider cache.
  • lib/Service/Rbac/ExplicitRevealTrailMasker.php (31/38) → ExplicitRevealTrailMaskerShapeTest: an unreadable schema is looked up once and everything is masked; a raw row's JSON is masked and re-encoded; a serialisable entry with no schema; unreadable entries and unaffected schemas pass through unchanged.
  • lib/Service/Rbac/MatrixRowWhere.php (38/40) → MatrixRowWhereTest: readable where sorted and $in unwrapped; each unreadable shape refuses the whole row; organisation-crossing intent; crossing findings.
  • lib/Service/Rbac/GrantConstraints.php (78/85) → GrantConstraintsShapeTest: empty blocks; malformed or empty scopedTo, an area that cannot be named, and a blank or non-string until all fail closed; pseudo keys and scalars pass through; roles whose holders have all lapsed are dropped; non-list holders are kept.
  • lib/Service/Rbac/DerivedGrantResolver.php (62/66) → DerivedGrantResolverTest: no rules; each skip reason; a missing claim or wrong value; equals and oneOf against single and multi-valued claims; groups collected once from grants that still reach the area.

What ran

  • Each new file on its own: 28 tests, 0 failures.
  • Merged with current origin/development before opening.
  • weak.php reports none of these tests.
  • Every date in the tests carries an explicit offset and the clock is fixed, except groupsFor(), which reads the real time internally; its tests use the years 2000 and 2999 so the result cannot change.

After: coverage was not measured. No coverage driver could be installed in this sandbox: there is no pcov or xdebug package, and building one from source was not permitted.

Mutation samples (each applied by hand, the tests went red, then reverted; none committed)

  • mutation: lib/Service/Rbac/RoleActionMap.php:83 keyed-shape guard dropped (list entries keyed by int accepted) -> 1 tests failed
  • mutation: lib/Service/ShippedBaseline/AuthorizationBlocks.php:138 decided block keeps its pre-decision state -> 1 tests failed
  • mutation: lib/Service/Organisation/OrganisationLifecycleAuditor.php:122 empty-change guard dropped (no-op edit writes a trail entry) -> 1 tests failed
  • mutation: lib/Service/Rbac/ExternalGrantGuard.php:210 public/inheritFromPublic no longer skipped -> 1 tests failed
  • mutation: lib/Service/Rbac/MatrixRowsFromApps.php:119 per-schema provider cache bypassed -> 1 tests failed
  • mutation: lib/Service/Rbac/ExplicitRevealTrailMasker.php:99 raw row's masked change not re-encoded to JSON -> 1 tests failed
  • mutation: lib/Service/Rbac/MatrixRowWhere.php:67 a where on the matrix field itself no longer refused -> 1 tests failed
  • mutation: lib/Service/Rbac/GrantConstraints.php:373 role whose holders all lapsed kept as an empty list -> 1 tests failed
  • mutation: lib/Service/Rbac/DerivedGrantResolver.php:215 a rule naming no wanted value fires on everything -> 1 tests failed

Left

  • ExternalGrantGuard::principalOf(): the string-entry and non-array branches are dead code (b). The method is only ever called for entries isExternal() has already accepted, and those are always arrays.

Tests written with Claude Code.


Generated by Claude Code

…and system attribution

Assisted-by: ClaudeCode:claude-opus-5-5
…nd lapse holders

Assisted-by: ClaudeCode:claude-opus-5-5
…d per-schema cache

Assisted-by: ClaudeCode:claude-opus-5-5
…allbacks

Assisted-by: ClaudeCode:claude-opus-5-5
…rossing findings

Assisted-by: ClaudeCode:claude-opus-5-5
… lapses

Assisted-by: ClaudeCode:claude-opus-5-5
…nd group collection

Assisted-by: ClaudeCode:claude-opus-5-5
@rubenvdlinde
rubenvdlinde changed the base branch from development to main November 9, 2026 06:53

Copy link
Copy Markdown
Contributor Author

CI note: Newman API Test Suite is red on a56fe28 (job). The failure comes from tests this PR does not touch.

The failing tests are the same set that fails on #7517, #7546 and #7578:

  • JobRunMapperNarrowGoldenTest
  • FileVersioningHandlerGoldenTest
  • A18InterfaceBindingsTest
  • TextExtractionJobsGoldenTest
  • EndpointsControllerAnswersGoldenTest
  • SchemaConfigValidatorsGoldenTest
  • ProcessingLogServiceGoldenTest
  • SearchReferenceResolverGoldenTest

This PR does not add or change any of these tests, and none of its nine new test files appears in the failures. This PR contains no fix for them. I could not re-run the job from this session.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

CI note: quality / Frontend Check (test:l10n) is red on a56fe28 (job). The cause is outside this PR: 14 keys used in src/ are missing from l10n/en.js, the known red state on development recorded in the repository's CLAUDE.md. This PR touches neither src/ nor l10n/.

The rest of the quality matrix runs from the same development base: test:l10n:parity, format, eslint, Frontend Tests (unit), phpcs, psalm, phpmd, phpstan and Hydra Gates. On #7517, #7546 and #7578 every one of those failures traces to existing files under lib/, src/ and l10n/, none to a test file the PR adds. This comment covers those checks for this PR as well. I will comment again only if a check names one of this PR's nine new test files.

Those files are outside this test-only lane, so no fix is ported here. I could not re-run jobs from this session.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit 74a9ab4 into main Nov 9, 2026
37 of 49 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ c2f6881

Check PHP Vue Security License Tests
lint ✅
phpcs ❌
phpmd ❌
psalm ❌
phpstan ❌
phpmetrics ✅
eslint ❌
stylelint ✅
build ✅
check-specs ✅
test-l10n ❌
test-l10n-parity ❌
format ❌
check-schema-l10n ✅
test-coverage-ratchet ✅
composer ✅ ✅ 168/168
npm ✅ ✅ 641/641
app:check-code ⏭️
info.xml ✅
REUSE ✅
lockfile sync ✅
PHPUnit ❌ 49060/49070 · 19 skipped
Newman ❌ 1625/1628
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ❌

Quality workflow — 2026-11-09 17:40 UTC

Download the full PDF report from the workflow artifacts.

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