-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Development
: Add documentation for tool tokens
#10276
Conversation
WalkthroughThe changes update the server development guidelines by introducing a new authorization annotation, Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant AuthHandler
Client->>Server: API Request (with/without tool token)
Server->>AuthHandler: Validate tool token & @AllowedTools annotation
AuthHandler-->>Server: Return authorization status
Server-->>Client: Send response (access granted/denied)
Possibly related issues
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
docs/dev/guidelines/server.rst (2)
465-469
: Update to Implicit Pre-Authorization AnnotationsThe addition of the
AllowedTools(ToolTokenType.__)
bullet clearly signals that tool-based requests must be explicitly whitelisted. This is a good enhancement to enforce the Principle of Least Privilege. Please ensure that elsewhere in the project any endpoints that can be accessed by tool tokens are updated accordingly, and consider clarifying in related documentation thatToolTokenType.__
is a placeholder which must be replaced with a concrete token type when implemented.
498-536
: New "Tool-Based Authorization Annotations" SectionThis newly added section comprehensively explains the purpose and usage of the
@AllowedTools
annotation. The section breaks down how tool tokens are handled versus regular requests, provides clear examples (including code blocks demonstrating proper usage), and outlines best practices. A minor suggestion:
- Consider adding a brief note that
ToolTokenType.__
in the earlier section is a placeholder and should be replaced by actual tool types (e.g.,ToolTokenType.SCORPIO
orToolTokenType.VSCODE
).Otherwise, the content is well-organized and aligns with the project's security and documentation standards.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/dev/guidelines/server.rst
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed some small typos, looks good otherwise!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
docs/dev/guidelines/server.rst (2)
519-523
: Documented Best Practices for Tool-Based Authorization
The “Best Practices” block explains that endpoints accepting tool-based requests must be explicitly annotated and encourages adherence to the Principle of Least Privilege. Consider including a brief note advising that any changes to tool token behavior should be mirrored in this documentation to avoid discrepancies over time.
527-530
: “How to Get Tool Tokens” Instructional Block
This step-by-step guide succinctly details how to obtain a Tool Token, including verifying the tool type inToolTokenType.java
and sending a POST request to the authentication endpoint. For added clarity, you might consider including a sample response or outlining potential error scenarios.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/dev/guidelines/server.rst
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
docs/dev/guidelines/server.rst (3)
464-468
: Enhance Implicit Authorization Annotation List
The bullet list under “Implicit pre- and post-authorization annotations” now includes the new “AllowedTools(ToolTokenType.__)
” annotation. The description clearly explains its role in restricting tool-based requests. Ensure that the language here is consistent with later detailed sections and that it aligns with the implementation in ToolTokenType.java.
498-508
: New “Tool-Based Authorization Annotations” Section Added
This section introduces and explains the@AllowedTools
annotation in a clear and accessible way. The header and accompanying description effectively differentiate between requests with and without tool claims. Verify that the inline code formatting (especially for JWT claim examples) renders correctly in the final documentation build.
509-517
: Clear “When to Use It?” Guidelines with Example
The “When to Use It?” block provides a concise explanation along with a practical Java code example, demonstrating how to annotate an endpoint using@AllowedTools(ToolTokenType.SCORPIO)
. Confirm that the example (including the referenced DTO name) reflects the actual structures and naming conventions used in the codebase.
fbd1f5f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docs/dev/guidelines/server.rst (1)
498-537
: Review the new Tool-Based Authorization Annotations section.
The newly added section does an excellent job of explaining the use, behavior, and best practices for the@AllowedTools
annotation, along with concrete examples. To further enhance clarity, verify that the placeholders (e.g.,ToolTokenType.__
) and examples (e.g.,ToolTokenType.SCORPIO
,ToolTokenType.VSCODE
) match what is implemented in the codebase. Additionally, consider adding a reference or link toToolTokenType.java
for quick access.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/dev/guidelines/server.rst
(2 hunks)
🔇 Additional comments (1)
docs/dev/guidelines/server.rst (1)
465-468
: Clarify the new AllowedTools bullet in implicit authorization guidelines.
The new bullet introducingAllowedTools(ToolTokenType.__)
clearly indicates the intent to restrict tool-based requests. However, consider clarifying thatToolTokenType.__
is a placeholder to be replaced by a specific tool type, ensuring that readers do not mistakenly interpret it as a concrete value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added styling to increase consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good👍
Chore
: Add Documentation for Tool TokensGeneral
: Add Documentation for Tool Tokens
General
: Add Documentation for Tool TokensGeneral
: Add Documentation for Tool Tokens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked for style consistency, grammar and typos. Looks good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👌🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great and clear documentation
General
: Add Documentation for Tool TokensDevelopment
: Add documentation for tool tokens
Description
Add Documentation to explain Tool Tokens and Authorization for the Tokens. The @AllowedTools Annotation restricts Tool Tokens from only accessing certain routes
Find under Contributor Guide at
Coding and Design Guidelines
->Server
->REST endpoint best practices for authorization
->Tool-Based Authorization Annotations
or at this https://artemis-platform--10276.org.readthedocs.build/en/10276/dev/guidelines/server.html#tool-based-authorization-annotations
Testserver States
You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.
Review Progress
Documentation Review
Screenshots
Summary by CodeRabbit
Summary by CodeRabbit
@AllowedTools(ToolTokenType.__)
annotation to restrict access for tool-based requests.@coderabbitai pause