Skip to content

[access] test(guards): make 52 weak guard tests assert the decision, with refusal pairs - #7666

Merged
rubenvdlinde merged 13 commits into
mainfrom
cloud/t36-weak-guards
Nov 9, 2026
Merged

rubenvdlinde merged 13 commits into
mainfrom
cloud/t36-weak-guards

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Lane T36, round t1: strengthen provably weak tests on guard code (SIG audit). The tests were written with Claude Code.

What is covered

52 of the 68 weak tests this lane owns, in 13 test files, now assert what the guard decides. Each allow path is paired with a refusal test that flips the deciding input. The pair either already existed (named in a comment in the test) or is added here.

  • FileValidationHandlerTest (12): new assertAccepted() helper. It asserts no exception and that no "blocked" warning was logged. New refusal pairs: extensionless file with a shebang, an mp4 name without an ftyp box, a shebang inside the first 1024 bytes.
  • WebhookServiceTest (3): the SSRF allow paths assert that no RuntimeException was raised. testAssertSafeWebhookUriAllowsPublicHttps used real DNS and errored in a sandbox without it. It now pins OutboundAddressGuard::addressesOf. New pair: a public name with one private record is refused.
  • MaintenanceModeMiddlewareTest (2): asserts null refusal for the console and for an open instance.
  • ObjectServiceStaleSchemaRefTest (2): find() / findAll() assert that the object handler gets exactly the call's own register and schema. New pair: a call that itself names a schema its register lacks is still refused, and the handler is never asked.
  • UnknownMetadataConditionSaveRefusalTest (8): new assertSaveAccepted(), which asserts that no AuthorizationBlockException was raised.
  • SchemaSaveGovernsScopedPropertiesTest (2): new pair: an anonymous save with one scoped property is refused.
  • FlowTriggerValidatorTest (6): a recording trigger double proves the trigger was asked with its config, including after malformed entries.
  • UserTaskPerformersTest (4): a recording resolver proves the holder check asked, or did not ask, the resolver. New pair: several candidates and none held is refused.
  • UserTaskTypedPerformersTest (3): allow paths assert null refusal, plus the typed performer read as position:chair.
  • PropertyReferenceTypeValidatorTest (4): new pair: validateAll reaches the last property.
  • ReferenceLoopCheckTest (2), SchemaMapperConfigurationPathTest (2, plus a new single-path refusal pair), GeometryValidatedOnSaveTest (2).

Only the listed methods were edited. New helpers and tests sit beside them. No production code was changed.

Numbers

php /tmp/t1/t1-tools/weak.php . /tmp/t36-weak.json tests/Unit, then the listed tests still reported:

What ran

vendor/bin/phpunit --no-coverage on each of the 13 files: 12 are fully green. WebhookServiceTest: every AssertSafeWebhookUri test passes. The file still shows 14 failures or errors in other delivery tests. They are the same set as on main, minus the one this PR fixes, and they come from DNS lookups that the sandbox cannot do.

Mutation samples

Each was applied by hand, run, and reverted. None is committed.

  • mutation: lib/Service/File/FileValidationHandler.php:230 embedded-PHP check '=== true' -> '!== null' (always refuse) -> 28 tests failed
  • mutation: lib/Service/File/FileValidationHandler.php:167 refuseDangerousExtension early 'return' -> throw (refuse every extension) -> 16 tests failed
  • mutation: lib/Service/WebhookService.php:307 allowPrivate opt-in '=== true' -> '=== false' -> 37 tests failed
  • mutation: lib/Middleware/MaintenanceModeMiddleware.php:96 '$holds === false' -> '=== true' -> 2 tests failed
  • mutation: lib/Service/ObjectService.php:1556 getForFind passes 'schema: null' instead of the call's schema -> 1 test failed
  • mutation: lib/Service/ObjectService.php:1858 loadFindAllRows passes 'schema: null' -> 1 test failed
  • mutation: lib/Service/Rbac/MetadataConditionFindings.php:124 ignore the stored block ('authorization: $stored' -> null) -> 4 tests failed
  • mutation: lib/Service/Schemas/ScopedPropertyGovernance.php:137 mayAddAtScope '=== true' -> '=== false' -> 4 tests failed
  • mutation: lib/Db/SchemaMapper.php:1071 skip the scope guard for every Schema ('=== false' -> '=== true') -> 3 tests failed
  • mutation: lib/Service/Flow/FlowTriggerValidator.php:279 drop the validateConfig() call -> 4 tests failed
  • mutation: lib/Service/Flow/FlowTriggerValidator.php:252 ask every node, not only triggers -> 1 test failed (testAStepNodeIsNotAsked)
  • mutation: lib/Service/Flow/Nodes/UserTaskPerformers.php:103 holders check '!== []' -> '=== []' -> 4 tests failed
  • mutation: lib/Service/Flow/Nodes/UserTaskPerformers.php:255 registry has(type) '=== true' -> '=== false' -> 3 tests failed (UserTaskTypedPerformersTest)
  • mutation: lib/Service/Integration/PropertyReferenceTypeValidator.php:105 isValidIntegrationId '=== false' -> '=== true' -> 5 tests failed
  • mutation: lib/Service/Integration/PropertyReferenceTypeValidator.php:82 null referenceType no longer short-circuits -> 4 tests failed
  • mutation: lib/Db/SchemaMapper/ReferenceLoopCheck.php:54 resolve action inputs against the schema properties too -> 1 test failed
  • mutation: lib/Db/SchemaMapper/ReferenceLoops.php:106 treat any ancestor pointer as coming back ('$pointer === $start' -> str_starts_with) -> 3 tests failed
  • mutation: lib/Db/SchemaMapper/ConfigurationFields.php:174 isPropertyPath no longer accepts a dotted path (return false) -> 2 tests failed
  • mutation: lib/Service/Geo/GeoJsonGeometryValidator.php:145 '$found !== []' -> '=== []' (invert the verdict) -> 4 tests failed
  • mutation: lib/Service/Geo/GeoJsonGeometryValidator.php:140 stop skipping absent/null values -> 1 test failed

Generated by Claude Code

claude added 13 commits November 9, 2026 07:29
… log nothing

Assisted-by: ClaudeCode:claude-opus-5-5
…e public-host case

Assisted-by: ClaudeCode:claude-opus-5-5
…n instance through

Assisted-by: ClaudeCode:claude-opus-5-5
…e call's own register and schema

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

Assisted-by: ClaudeCode:claude-opus-5-5
…ped schemas save

Assisted-by: ClaudeCode:claude-opus-5-5
…t and refuses nothing else

Assisted-by: ClaudeCode:claude-opus-5-5
… and unresolvable steps

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

Assisted-by: ClaudeCode:claude-opus-5-5
…l and registered ids

Assisted-by: ClaudeCode:claude-opus-5-5
… inputs save

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

Assisted-by: ClaudeCode:claude-opus-5-5
…th guard

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

Copy link
Copy Markdown
Contributor Author

Newman API Test Suite is red, and the failures are not from this PR.

The job's PHPUnit step reports 11 errors and 11 failures, all in files this PR does not touch:

  • JobRunMapperNarrowGoldenTest: MethodCannotBeConfiguredException on fetchAssociative
  • FileVersioningHandlerGoldenTest
  • EndpointsControllerAnswersGoldenTest
  • ProcessingLogServiceGoldenTest
  • SchemaConfigValidatorsGoldenTest
  • TextExtractionJobsGoldenTest
  • A18InterfaceBindingsTest (ObjectRetentionHandler)

The same 22 tests fail identically on the unrelated #7643 (job 129021095087). The Newman runs on #7643 and #7640 are also red. This PR only edits test methods in 13 unit test files, and none of them appears in that list.

No fix for these exists in any branch I can see, so none is ported here. Under the lane rules this PR gets no further commits. I did not re-run the job: the failures are deterministic mock and golden mismatches, so a re-run would fail the same way.


Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 89b785a

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 ❌ 49147/49168 · 22 skipped (worst of 6 legs: PHP 8.3, NC stable32, pgsql; counts from 6 of 8 legs)
Newman ❌ 1625/1628
Playwright ❌ 131/230 · 4 skipped · 259 did not run
Hydra gates ❌

Quality workflow — 2026-11-10 09:57 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