Skip to content

fix: pre-release findings in code, chart and CI - #140

Merged
uniqueg merged 8 commits into
devfrom
fix/pre-release-findings
Oct 21, 2026
Merged

uniqueg merged 8 commits into
devfrom
fix/pre-release-findings

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes the low-severity findings in code, chart and CI from the pre-release review of v0.3.0. One commit per point:

  1. .../permissions/groups without a group: PUT/DELETE /services/{serviceId}/permissions/groups matched {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 the UserId parameter description now says so.
    • Why 404 and not 400: the path names the roles of groups with an empty group. Flask already returns 404 for .../permissions/groups/, and both paths now behave the same. An OpenAPI not: {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, and DELETE already returns it for users without roles.
  2. Kubernetes service links: enableServiceLinks: false in the app and MongoDB pod specs. A Service mongo in the namespace no longer injects MONGO_PORT=tcp://…, which FOCA read as configuration. Neither pod uses these variables.
  3. keep_group_subjects warning in Docker Compose: config.dev.yaml now sets group_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.
  4. Dependabot: the docker entry ignores minor and major updates of elixircloud/foca. FOCA minors are bumped by hand, in the Dockerfile and requirements.txt together. Patch and digest updates continue.
  5. Helm: CI (checks.yaml, Helm job only) and the release workflow install Helm v3.22.1 with azure/setup-helm v5.0.1, pinned by commit SHA. v3.22.1 is the version the runners had in the last dev run (39618479224).
  6. actionlint: added to pre-commit (rhysd/actionlint v1.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-first: the new tests failed before each fix and pass after it.
    • test_group_permissions_without_group covers groups and groups/.
    • test_security_context now asserts enableServiceLinks: false.
    • test_create_app_dev_overlay checks that there is no keep_group_subjects warning with config.dev.yaml.
  • coverage run --source=cloud_registry -m pytest (Python 3.12, Helm 3.18.6 on PATH): 714 passed; coverage 100% (permissions.py 100%).
  • mypy: no issues. ruff check / ruff format --check (0.17.1): clean. ast-grep scan and ast-grep test: clean. helm lint --strict: clean. YAML files parse.
  • actionlint 1.7.12 with shellcheck 0.9.0 on the workflows: 0 errors.
  • pre-commit validate-config: valid. pre-commit run cannot fetch hook repos in my sandbox, so CI runs the full pre-commit suite.
  • CI (run 39636971864): all checks pass, including codecov/patch and codecov/project. The Helm job uses v3.22.1, and pre-commit ran the actionlint hook (Passed).
  • Sourcery: one finding, which is fixed: the DELETE test now stores a role of a user groups first and checks that the role is kept. The test fails without the guard. CI for ddbb2f7 (run 39638586267): all checks pass, including codecov and Sourcery.

Declined review findings

  • Roles already stored for a user groups can 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 issues sub=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

uniqueg and others added 7 commits October 21, 2026 18:19
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>
@sourcery-ai

sourcery-ai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR fixes the pre-release findings by disambiguating the reserved groups permission path, disabling Kubernetes service-link environment injection, correcting the development access-control overlay, and pinning dependency and workflow validation tooling for reproducible CI and releases.

Sequence diagram for rejecting the reserved groups permission path

sequenceDiagram
    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
Loading

File-Level Changes

Change Details Files
Prevent ambiguous permission paths from treating the literal groups segment as a user identifier.
  • Reject userId == groups with a 404 before persistence or owner checks.
  • Document the reserved path value and add coverage for both trailing-slash variants, including no state mutation.
cloud_registry/ga4gh/registry/permissions.py
cloud_registry/api/additions.openapi.yaml
tests/test_access_control.py
Prevent Kubernetes service environment variables from being interpreted as application configuration.
  • Disable service-link injection for both application and MongoDB pods.
  • Assert the rendered pod specifications contain enableServiceLinks: false.
deployment/templates/cloud-registry-deploy.yaml
deployment/templates/mongo-deploy.yaml
tests/test_chart.py
Align development configuration with the intended group-subject behavior and warning semantics.
  • Add an empty group_mapping to the development overlay.
  • Verify the no-admin warning remains while the irrelevant keep_group_subjects warning is suppressed.
config.dev.yaml
tests/test_app.py
Make dependency and workflow tooling versions deterministic while controlling FOCA update flow.
  • Ignore FOCA minor and major Docker updates in Dependabot so Dockerfile and requirements pins are updated together.
  • Install Helm 3.22.1 through SHA-pinned azure/setup-helm in CI and release workflows.
  • Add SHA-pinned actionlint 1.7.12 to pre-commit, including shellcheck integration on runners.
.github/dependabot.yml
.github/workflows/checks.yaml
.github/workflows/release.yaml
.pre-commit-config.yaml

Assessment against linked issues

Issue Objective Addressed Explanation
#133 Reject groups as a user ID on the permissions endpoints, return an error without storing or deleting roles, and cover the behavior with tests. ✅
#133 Prevent unwanted runtime configuration issues by disabling Kubernetes service links in both chart pod specs and silencing the unintended keep_group_subjects warning in Docker Compose. ✅
#133 Improve release and CI tooling by excluding FOCA minor and major Dependabot updates, pinning Helm in CI and the release workflow, and adding actionlint to pre-commit. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d69ed42) to head (ddbb2f7).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review October 21, 2026 16:46

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tests/test_access_control.py Resolved
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>
@uniqueg
uniqueg merged commit 31dd4f2 into dev Oct 21, 2026
11 checks passed
@uniqueg
uniqueg deleted the fix/pre-release-findings branch October 21, 2026 17:05
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.

fix: pre-release findings in code, chart and CI

1 participant