Skip to content

fix: certificate lookup by name leaks names of unreadable signed cert… - #1222

Merged
hsinn0 merged 1 commit into
mainfrom
fix/TNZGOV-15094
Nov 3, 2026
Merged

hsinn0 merged 1 commit into
mainfrom
fix/TNZGOV-15094

Conversation

@hsinn0

@hsinn0 hsinn0 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

…ificates

  • Only include certificates the caller can read in the signs field of GET /certificates?name= when ACLs are enforced.

ai-assisted=yes
TNZGOV-15094

return unfilteredNames
}
val actor = userContextHolder.userContext?.actor
val paths = permissionCheckingService.findAllPathsByActor(actor.toString())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI reviewer found:

userContextHolder.userContext?.actor.toString() turns a missing actor into the literal string null, and we then query findAllPathsByActor("null"). Two problems:

  • With no user context, we look up ACLs for a principal literally named null instead of failing. Anyone with that name would match.
  • checkPermissionsByName uses actor!! and fails fast, so the two paths behave differently for the same missing input.

Suggest resolving the actor once with a null check (?: throw ..., or return an empty list), not stringifying a nullable. filterPermissions (line 279) has the same flaw. Fixing both here would be cheap, or we can track it as a follow-up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. filterNamesByPermissions and both existing filterPermissions functions, in DefaultCertificatesHandler and DefaultCredentialsHandler, now resolve the actor the same way checkPermissionsByName does. HTTP clients see no difference: UserContextInterceptor always sets the user context, or rejects the request, before these handlers run.

…cate list

- Only include certificates the caller can read in the `signs` field of GET /certificates?name= when ACLs are enforced.
- Require an actor when filtering certificates and credentials by permissions, instead of looking up permissions for the string "null".

AI-Tool-Used: Claude
AI-Tool-Use-Level: High
AI-Code-Category: Production
@hsinn0
hsinn0 requested a review from dlinsley November 2, 2026 23:42

@dlinsley dlinsley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fixes and tests!

@github-project-automation github-project-automation Bot moved this from Inbox to Pending Merge | Prioritized in Foundational Infrastructure Working Group Nov 3, 2026
@hsinn0
hsinn0 merged commit 709f750 into main Nov 3, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group Nov 3, 2026
@hsinn0
hsinn0 deleted the fix/TNZGOV-15094 branch November 3, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants