Skip to content

feat: make service-info public, configurable - #69

Merged
uniqueg merged 11 commits into
devfrom
feat/service-info-setting
Nov 6, 2026
Merged

uniqueg merged 11 commits into
devfrom
feat/service-info-setting

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #62, part of elixir-cloud-aai/TESK#216. Stacked on the dependency PR, targets master so that CI runs; only the last commit is new.

  • GET and HEAD /service-info stay public by default, also with the auth profile.
  • TESK_API_SERVICE_INFO_PUBLIC=false (tesk.api.service-info.public) requires a valid token for them. No effect with noauth, where everything is open.
  • auth.md said all endpoints are secured; it now lists the public ones. README configuration table updated.

Verified

  • Test first: ServiceInfoTokenRequiredIT failed on no token (200 instead of 401), then passed.
  • ./mvnw clean verify on JDK 8: 104+ unit and 44 integration tests pass, for both settings with no, a valid and an invalid token, and for noauth.
  • The image with the environment variable answers 401; Smoke test now checks this.
  • Reviewer's probe of path variants on the running jar: nothing opens with false.
  • CI on this PR: all jobs pass.

Declined review findings

  • /service-info/ with a trailing slash needs a token also when public. It fails closed and is as before.
  • Shared base class for the integration tests: the existing ones repeat this setup too.

🤖 Generated with Claude Code

Summary by Sourcery

Make service-info access configurable while preserving public access by default and keeping it unrestricted under noauth.

New Features:

  • Add configurable public access for GET and HEAD /service-info, enabled by default and controllable through TESK_API_SERVICE_INFO_PUBLIC.

Enhancements:

  • Document service-info access behavior and the distinction between authenticated and noauth profiles.

CI:

  • Extend the container smoke test to verify that service-info requires authentication when configured as private.

Documentation:

  • Update the authentication and configuration documentation with public endpoint behavior and the new setting.

Tests:

  • Add coverage for public and token-required service-info access with valid, invalid, and absent tokens across auth and noauth profiles.

uniqueg and others added 3 commits November 5, 2026 05:38
Add ci.yml as in the org's other repositories (PR title, lint, test,
smoke test, image scan, gate). The scan only reports until the
dependency update.

The base image of the Dockerfile no longer exists; build from source on
Temurin 8 instead (not Alpine: TLS handshakes fail there on Java 8).
Add a .dockerignore.

Remove the old workflows, which can't run any more and would publish
over the tag of the last release on every push to master, and Travis.

Closes #59

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move to the last releases of the Spring Boot 2.7 line, and pin the
transitive dependencies the scan flags. spring-security-oauth2 2.5
makes its exception translator generic, which the entry point adapts
to.

What is fixed only in Spring Boot 3 goes to .trivyignore.yaml, each
entry with its reason and expiry date. The scan in CI now fails on
fixable critical and high findings.

Closes #60

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GET /service-info stays public by default, also with the auth profile.
TESK_API_SERVICE_INFO_PUBLIC=false requires a valid token for it. Test
both settings with and without a token, and fix auth.md, which said
that all endpoints are secured.

Part of elixir-cloud-aai/TESK#216, whose chart change follows.

Closes #62

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR introduces a configurable service-info security policy: GET and HEAD remain public by default under auth, can be switched to token-required with TESK_API_SERVICE_INFO_PUBLIC=false, and remain open under noauth. It wires the policy into Spring Security, documents and tests the behavior, and substantially refreshes the Java 8 container/build and CI infrastructure.

Sequence diagram for configurable service-info authentication

sequenceDiagram
    participant Client
    participant SpringSecurity
    participant ServiceInfo
    Client->>SpringSecurity: GET /service-info
    alt noauth profile
        SpringSecurity->>ServiceInfo: Allow request
        ServiceInfo-->>Client: 200 Service info
    else auth profile and serviceInfoPublic=true
        SpringSecurity->>ServiceInfo: Allow request
        ServiceInfo-->>Client: 200 Service info
    else auth profile and serviceInfoPublic=false
        alt valid token
            SpringSecurity->>ServiceInfo: Validate token and allow request
            ServiceInfo-->>Client: 200 Service info
        else missing or invalid token
            SpringSecurity-->>Client: 401 Unauthorized
        end
    end
Loading

Flow diagram for service-info security configuration

flowchart TD
    A[Request GET or HEAD /service-info] --> B{Active profile}
    B -->|noauth| C[Allow request]
    B -->|auth| D{tesk.api.service-info.public}
    D -->|true| C
    D -->|false| E[Require valid token]
    E --> F{Token valid}
    F -->|yes| C
    F -->|no| G[401 Unauthorized]
Loading

File-Level Changes

Change Details Files
Made the service-info endpoint’s authentication behavior configurable while preserving public access by default.
  • Added the tesk.api.service-info.public setting, including environment-variable binding and noauth behavior.
  • Conditionally added /service-info to Spring Security’s permit-list under the auth profile.
  • Added integration and unit coverage for public, token-required, valid-token, invalid-token, HEAD, and noauth scenarios.
src/main/java/uk/ac/ebi/tsc/tesk/config/security/ResourceServerConfiguration.java
src/main/resources/application.properties
src/test/java/uk/ac/ebi/tsc/tesk/config/security/ServiceInfoPublicSettingTest.java
src/integration-test/java/uk/ac/ebi/tsc/tesk/ServiceInfoTokenRequiredIT.java
src/integration-test/java/uk/ac/ebi/tsc/tesk/ServiceInfoNoAuthIT.java
src/integration-test/java/uk/ac/ebi/tsc/tesk/AuthIT.java
Updated authentication and deployment documentation to describe the public endpoints and configuration.
  • Documented the default public GET/HEAD service-info behavior and how to require a token.
  • Updated the README configuration table and build/test instructions.
auth.md
README.md
Modernized the build, container image, and CI pipeline around the new behavior.
  • Replaced legacy Travis and split GitHub workflows with a consolidated CI workflow covering tests, smoke checks, title/lint gates, and image scanning.
  • Changed the Dockerfile to build the Java 8 application in a pinned multi-stage image.
  • Added dependency automation, Docker ignore rules, and scoped vulnerability suppressions; upgraded Spring Boot 2.7 dependencies.
Dockerfile
.dockerignore
.github/dependabot.yml
.github/workflows/ci.yml
.github/workflows/docker-build-publish.yml
.github/workflows/maven-check.yml
.github/workflows/maven-publish.yml
.travis.yml
.trivyignore.yaml
pom.xml
Adjusted OAuth error handling to remain type-safe with updated dependency APIs.
  • Parameterized the response exception translator and safely extracted the OAuth exception from the translated response.
src/main/java/uk/ac/ebi/tsc/tesk/config/security/CustomAuthenticationEntryPoint.java

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 Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.94%. Comparing base (c0d197c) to head (4f1c14c).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev      #69      +/-   ##
==========================================
+ Coverage   55.90%   55.94%   +0.04%     
==========================================
  Files          64       64              
  Lines        2150     2152       +2     
  Branches      233      234       +1     
==========================================
+ Hits         1202     1204       +2     
  Misses        807      807              
  Partials      141      141              

☔ 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 November 5, 2026 05:07

@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=".trivyignore.yaml" line_range="54-56" />
<code_context>
+    purls: ["pkg:maven/org.springframework/[email protected]"]
+    statement: Concerns JavaScriptUtils; the app doesn't use it
+    expired_at: 2027-01-31
+  - id: CVE-2026-41842
+    purls: ["pkg:maven/org.springframework/[email protected]"]
+    statement: Denial of service when resolving static resources, of which the app only has the Swagger UI (public, also with the auth profile); no code execution or data access
+    expired_at: 2027-01-31
+  - id: CVE-2026-47884
</code_context>
<issue_to_address>
**Public Swagger requests can deny service**

When an unauthenticated caller sends a crafted static-resource URL to the Swagger UI, the public Swagger resource route reaches Spring MVC 5.3.39’s resource resolver, which the PR identifies as vulnerable to denial of service; resolving the request can disrupt API availability for other callers.

Upgrade to a Spring version containing the fix, or disable or restrict the vulnerable public resource handler.

Also at `src/main/java/uk/ac/ebi/tsc/tesk/config/security/ResourceServerConfiguration.java:43`.
</issue_to_address>

Linked issues

#62 feat: make service-info public, configurable · 3 of 3 met

# Requirement Status Notes
1 Require a token for GET /service-info via a setting that is off by default ✅ Met In the auth profile, tesk.api.service-info.public defaults to true; setting it to false removes the endpoint from the public URL list.
2 Test both settings, with and without a token ✅ Met The tests cover public access without a token and with valid or invalid tokens, token-required access without a token and with valid or invalid tokens, and the noauth profile.
3 Describe the default and setting in auth.md and the README configuration reference ✅ Met Both documents describe the default public behavior and how to require a token.

Sourcery assessment

Approval pending. 1 finding to address first, and the security scan did not finish.

Blocking findings: .trivyignore.yaml:56


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

Comment thread .trivyignore.yaml Resolved
uniqueg and others added 8 commits November 6, 2026 04:56
Align CI with the branching model of the org's other repositories
(`dev` + `main`): run on pull requests and pushes to `dev`; on pushes,
push the image by digest in the environment `dev-images`, scan exactly
that digest, then attest, sign and tag it `dev` and `sha-<commit>`, as
cloud-registry does. Add the weekly scan of `latest` (`scan.yml`), let
Dependabot target `dev`, and fail pushes on Codecov upload errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Publish only on pushes to this repository, or to forks that set
`DOCKERHUB_ORG` (`PUBLISH`, as in proTES and foca): other runs scan a
local build, upload nothing to code scanning and don't fail on Codecov
upload errors, and the gate allows the skipped publishing jobs. Name
the environment and secrets publishing needs in the README, and fix
comments from the review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	.github/workflows/ci.yml
# Conflicts:
#	.github/workflows/ci.yml
#	.trivyignore.yaml
Restore the files of #67 to their state on `dev`, so that this pull
request no longer depends on #67, which waits for a decision.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit a1a3ff4 into dev Nov 6, 2026
23 checks passed
@uniqueg
uniqueg deleted the feat/service-info-setting branch November 6, 2026 04:58
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.

feat: make service-info public, configurable

1 participant