Repository navigation
fix: pre-release findings in code, chart and CI - #140
Merged
Merged
Conversation
PUT and DELETE /services/{serviceId}/permissions/groups matched the
user permission routes with the user ID "groups": they granted or
revoked a role of a user "groups", and that stray owner then satisfied
the last-owner check. Both now return 404, like the group path with an
empty group (.../permissions/groups/), and store nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kubernetes injects <SERVICE>_PORT and similar variables for each Service in the namespace. FOCA reads MONGO_PORT, so a Service named mongo (e.g., of another release) made the app crash-loop with an invalid MongoDB URI. Neither pod uses these variables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FOCA warned on every Docker Compose start that keep_group_subjects has no effect, as config.dev.yaml set no group_mapping. An empty mapping keeps the behavior (no admins, group claim values as subjects) without the warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dependabot bumped the FOCA base image in the Dockerfile and the foca pin in requirements.txt separately, so a base image with a new FOCA minor would get the old FOCA reinstalled on top. Minor and major updates of the base image are now ignored; FOCA minors are bumped by hand in both files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both workflows used whatever Helm the runner image had. They now install Helm v3.22.1, the version the runners had at the time, with azure/setup-helm (pinned by commit, like the other actions). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
actionlint checks the workflows, and their scripts with shellcheck where it is installed, as on GitHub-hosted runners. It would have caught workflow mistakes such as those in the version logic of #126. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also format the new dev overlay test as ruff does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewer's GuideThe PR fixes the pre-release findings by disambiguating the reserved Sequence diagram for rejecting the reserved groups permission pathsequenceDiagram
participant Client
participant API
participant _check_user_id
participant Permissions
Client->>API: PUT /services/{serviceId}/permissions/groups
API->>_check_user_id: _check_user_id(userId)
_check_user_id-->>API: NotFound
API-->>Client: 404 problem details
Note over API,Permissions: No permission is stored
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #140 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 732 737 +5
=========================================
+ Hits 732 737 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
uniqueg
marked this pull request as ready for review
October 21, 2026 16:46
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_access_control.py" line_range="778" />
<code_context>
+ {"user_id": ALICE, "name": NAMES[ALICE], "role": "owner"}
+ ]
+ assert revoke(client, service_id, ALICE) == 409
+ assert client.delete(url, headers=headers(ALICE)).status_code == 404
+ assert permissions(client, service_id) == [(ALICE, "owner")]
+
</code_context>
<issue_to_address>
**DELETE guard goes untested**
When the DELETE handler lacks its `_check_user_id()` call and no role for user `groups` exists in the test service, `test_group_permissions_without_group` reaches this DELETE with no `groups` role stored: the preceding PUT returned 404 and the permission-list assertion confirms only Alice's role exists. If the DELETE guard is removed, `_delete_roles` still returns 404 for a missing role, so this assertion passes while DELETE can revoke a pre-existing role for user `groups`.
Seed a role for user `groups` before DELETE and assert the request returns 404 without removing that role.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: tests/test_access_control.py:778
The DELETE of .../permissions/groups returned 404 also without the guard, as no role of a user groups existed. Now one is stored first, and must be kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the low-severity findings in code, chart and CI from the pre-release review of v0.3.0. One commit per point:
.../permissions/groupswithout a group:PUT/DELETE /services/{serviceId}/permissions/groupsmatched{userId}=groups, so they granted or revoked a role of a user named "groups", and that stray owner satisfied the last-owner check. Both now return 404 (problem details) and store nothing. The handler rejects the ID, and theUserIdparameter description now says so..../permissions/groups/, and both paths now behave the same. An OpenAPInot: {enum: [groups]}constraint would make Connexion return 400 for one of the two equivalent paths and 404 for the other. 404 is also already documented for both operations, andDELETEalready returns it for users without roles.enableServiceLinks: falsein the app and MongoDB pod specs. A Servicemongoin the namespace no longer injectsMONGO_PORT=tcp://…, which FOCA read as configuration. Neither pod uses these variables.keep_group_subjectswarning in Docker Compose:config.dev.yamlnow setsgroup_mapping: {}. Access control is unchanged: there are no admin groups, group claim values are still used as group subjects, and the intended "no admin" warning stays.elixircloud/foca. FOCA minors are bumped by hand, in theDockerfileandrequirements.txttogether. Patch and digest updates continue.checks.yaml, Helm job only) and the release workflow install Helm v3.22.1 withazure/setup-helmv5.0.1, pinned by commit SHA. v3.22.1 is the version the runners had in the lastdevrun (39618479224).rhysd/actionlintv1.7.12, frozen SHA). On GitHub runners it also runs shellcheck on the workflow scripts.README.md,
deployment/README.md,docs/and the release notes are not touched here; they follow in #134, after the docs move (#132).Closes #133
How it was verified
test_group_permissions_without_groupcoversgroupsandgroups/.test_security_contextnow assertsenableServiceLinks: false.test_create_app_dev_overlaychecks that there is nokeep_group_subjectswarning withconfig.dev.yaml.coverage run --source=cloud_registry -m pytest(Python 3.12, Helm 3.18.6 on PATH): 714 passed; coverage 100% (permissions.py100%).mypy: no issues.ruff check/ruff format --check(0.17.1): clean.ast-grep scanandast-grep test: clean.helm lint --strict: clean. YAML files parse.actionlint1.7.12 with shellcheck 0.9.0 on the workflows: 0 errors.pre-commit validate-config: valid.pre-commit runcannot fetch hook repos in my sandbox, so CI runs the full pre-commit suite.Declined review findings
groupscan no longer be revoked via the API (adversarial reviewer, low). Such a rule could only come from the bug fixed here. The bug exists only since feat: grant roles on services to groups #129 (unreleased), and no identity provider issuessub=groups. Deleting the service, or editing the policy collection, still removes such a rule. Special-casing DELETE would reopen the ambiguous path._check_user_id()is a small helper (quality reviewer, low, optional). It is kept, so that the reason is documented once for both handlers, like the existing_check_other_owners().Open questions
None.
🤖 Generated with Claude Code