Repository navigation
feat: make service-info public, configurable - #69
Conversation
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]>
Reviewer's GuideThe PR introduces a configurable service-info security policy: GET and HEAD remain public by default under Sequence diagram for configurable service-info authenticationsequenceDiagram
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
Flow diagram for service-info security configurationflowchart 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]
File-Level Changes
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 #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. 🚀 New features to boost your workflow:
|
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=".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
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]>
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]>
Summary
Closes #62, part of elixir-cloud-aai/TESK#216. Stacked on the dependency PR, targets
masterso that CI runs; only the last commit is new.GETandHEAD /service-infostay public by default, also with theauthprofile.TESK_API_SERVICE_INFO_PUBLIC=false(tesk.api.service-info.public) requires a valid token for them. No effect withnoauth, where everything is open.auth.mdsaid all endpoints are secured; it now lists the public ones. README configuration table updated.Verified
ServiceInfoTokenRequiredITfailed on no token (200 instead of 401), then passed../mvnw clean verifyon JDK 8: 104+ unit and 44 integration tests pass, for both settings with no, a valid and an invalid token, and fornoauth.Smoke testnow checks this.false.Declined review findings
/service-info/with a trailing slash needs a token also when public. It fails closed and is as before.🤖 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:
Enhancements:
CI:
Documentation:
Tests: