spring-projects / spring-projects/spring-ai

Prevent tools from being added to prompt if current security context doesn't have authority.

Open
#2,385 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tool calling
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Per #2356, I'm trying to prevent @Tool-annotated methods (or even Function beans from being invoked using Spring Security's @PreAuthorize annotation if the current security context doesn't have proper authority.

But what would be even better is if there were some pre-prompt filtering to prevent tools for which authority hasn't been granted from even making it into the prompt and therefore the LLM wouldn't even ask to invoke them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review issue #2356 and the handling of @Tool-annotated methods and Function beans with Spring Security's @PreAuthorize. Determine where tools are assembled into the prompt and define how unauthorized tools should be excluded before prompting, then verify that authorized tools remain available and unauthorized ones are not offered for invocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
authorization, backend, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.