Skip to content

GH-581: Check object permissions before calling the Objecten API - #895

Merged
Klaas-Ritense merged 4 commits into
next-minorfrom
bugfix/581-objecten-api-check-permission-before-fetch
Aug 14, 2026
Merged

GH-581: Check object permissions before calling the Objecten API#895
Klaas-Ritense merged 4 commits into
next-minorfrom
bugfix/581-objecten-api-check-permission-before-fetch

Conversation

@Klaas-Ritense

Copy link
Copy Markdown
Member

https://github.com/generiekzaakafhandelcomponent/atlas-internal/issues/581

A user without permission to view objects was refused only after the object had already been
retrieved from the Objecten API. Because the API's answer came back first, the error such a user
received revealed whether the object existed — a one-bit existence oracle — and every request
that was going to be denied still made a pointless outbound call. The permission check now runs
before anything is requested, in all four read operations. The write operations already checked
first and are unchanged.

Nothing is lost by checking first: the entity passed to the check is a fieldless Object(), so
the check has no dependency on the response.

The four new tests each fail against the unpatched code with
HttpClientErrorException$NotFound — that failure is the leak, which is why the mock enqueues a
404 rather than a success.

Scope

This fixes the concrete defect in issue 581 only. The issue also raises per-object scoping,
which is a permission-model question rather than a bug: Object is deliberately a fieldless
capability marker, so no permission condition can scope it. That is being handled as a roadmap
item and the issue should not be closed as fixed on the back of this PR — a view grant still
means "may read any object in a configured Objecten API".

Worth noting for the reporter: the write paths cited in the issue (createObject, objectPatch,
objectUpdate, deleteObject) already checked permission before the outbound call, so the
write/delete escalation described there does not apply to this defect.

Not verified against a running application: this is a reordering inside the API client with no UI
surface of its own, covered by unit tests that assert no request reaches the mock API when
permission is denied.

Note for the reviewer: this and #580 both add to documentation/release-notes/13.x.x/13.41.0/README.md
and will conflict there on merge. The conflict is additive — keep both entries.

The four read methods on ObjectenApiClient performed the outbound HTTP
call before requirePermission, so a 404/4xx from the Objecten API
propagated out of .retrieve().body() ahead of the permission check. An
unauthorized caller could therefore distinguish "object exists" from
"object does not exist", and denied requests still made a pointless
outbound call.

Move the requirePermission block above buildRestClient in getObject,
getObjectRecord, getObjectsByObjecttypeUrl and
getObjectsByObjecttypeUrlWithSearchParams. Nothing is lost by checking
first: the entity passed is a fieldless Object(), so the check has no
dependency on the response. The four write methods already checked
first and are unchanged.

ObjectenApiClientTest now asserts, for each of the four read methods,
that no request reaches the mock API when permission is denied.
@Klaas-Ritense
Klaas-Ritense requested review from a team as code owners August 12, 2026 07:03
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@Klaas-Ritense, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 118 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5ec10fa9-4762-425a-b3e0-e179fe82fe32

📥 Commits

Reviewing files that changed from the base of the PR and between 7f95d63 and 81c7e1e.

📒 Files selected for processing (3)
  • backend/zgw/objecten-api/src/main/kotlin/com/ritense/objectenapi/client/ObjectenApiClient.kt
  • backend/zgw/objecten-api/src/test/kotlin/com/ritense/objectenapi/client/ObjectenApiClientTest.kt
  • documentation/release-notes/13.x.x/13.42.0/README.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Nightly maintenance run.

- Moved the 'Object permissions are checked before the object is retrieved'
  bugfix note from 13.41.0 to 13.42.0, which is the current release-notes
  folder on next-minor.
…cten-api-check-permission-before-fetch

# Conflicts:
#	documentation/release-notes/13.x.x/13.42.0/README.md
Comment thread documentation/release-notes/13.x.x/13.42.0/README.md
@Klaas-Ritense
Klaas-Ritense merged commit 40d82a6 into next-minor Aug 14, 2026
179 of 180 checks passed
@Klaas-Ritense
Klaas-Ritense deleted the bugfix/581-objecten-api-check-permission-before-fetch branch August 14, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants