-
Notifications
You must be signed in to change notification settings - Fork 294
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
: Theia integration test
#9759
base: develop
Are you sure you want to change the base?
Conversation
…ia-clone-information-on-redirect
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…into feature/re-key
…ide-theia-clone-information-on-redirect
…ia-clone-information-on-redirect
…ide-theia-clone-information-on-redirect
…ia-clone-information-on-redirect
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: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (4)
src/main/java/de/tum/cit/aet/artemis/core/web/CourseResource.java
(3 hunks)src/main/webapp/app/overview/exercise-details/exercise-details-student-actions.component.html
(0 hunks)src/main/webapp/app/shared/components/code-button/code-button.component.html
(1 hunks)src/main/webapp/app/shared/components/code-button/code-button.component.ts
(6 hunks)
💤 Files with no reviewable changes (1)
- src/main/webapp/app/overview/exercise-details/exercise-details-student-actions.component.html
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/webapp/app/shared/components/code-button/code-button.component.html
🧰 Additional context used
📓 Path-based instructions (2)
src/main/java/de/tum/cit/aet/artemis/core/web/CourseResource.java (1)
Pattern src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
src/main/webapp/app/shared/components/code-button/code-button.component.ts (1)
🔇 Additional comments (4)
src/main/webapp/app/shared/components/code-button/code-button.component.ts (1)
275-276
: Skip review due to existing comment
src/main/java/de/tum/cit/aet/artemis/core/web/CourseResource.java (3)
96-97
: Imports are appropriate and follow guidelines
The added imports are necessary for the usage of the @AllowedTools
annotation and ToolTokenType
enum. They comply with the project's coding standards.
654-654
:
Potential unintended access restriction due to @AllowedTools
annotation
Adding @AllowedTools(ToolTokenType.SCORPIO)
to the getCoursesForDashboard
method may unintentionally restrict access to this endpoint. Previously, all users with at least the role of student could access this method, but now only users with a token of type SCORPIO
will have access.
Please confirm if it is intended to limit access exclusively to tools with the SCORPIO
token. If not, consider adjusting the access control annotations to ensure legitimate users are not blocked.
Run the following script to identify all methods annotated with @AllowedTools
and review their access control:
#!/bin/bash
# Description: List methods with @AllowedTools and their other security annotations to analyze access control.
# Search for methods annotated with @AllowedTools and display surrounding annotations
rg --multiline --heading --field-match-separator "@" '@AllowedTools' -A 5 --glob 'src/main/java/**/*.java'
589-589
:
Potential unintended access restriction due to @AllowedTools
annotation
Adding @AllowedTools(ToolTokenType.SCORPIO)
to the getCourseForDashboard
method may unintentionally restrict access to this endpoint. Previously, all users with at least the role of student could access this method, but now only users with a token of type SCORPIO
will have access.
Please confirm if it is intended to limit access exclusively to tools with the SCORPIO
token. If not, consider adjusting the access control annotations to ensure legitimate users are not blocked.
Run the following script to identify all methods annotated with @AllowedTools
and review their access control:
✅ Verification successful
Access restriction with @AllowedTools(ToolTokenType.SCORPIO)
is intentional and consistent across the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: List methods with @AllowedTools and their other security annotations to analyze access control.
# Search for methods annotated with @AllowedTools and display surrounding annotations
rg --multiline --heading --field-match-separator "@" '@AllowedTools' -A 5 --glob 'src/main/java/**/*.java'
Length of output: 3806
src/main/webapp/app/shared/components/code-button/code-button.component.ts
Show resolved
Hide resolved
…mation-on-redirect' into chore/theia-integration-test
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: 3
🧹 Outside diff range and nitpick comments (1)
src/main/webapp/app/shared/components/code-button/code-button.component.ts (1)
386-389
: Improve popup blocker handlingAdd user feedback when the popup is blocked by the browser.
Apply this diff:
const newWindow = window.open('', '_blank'); if (!newWindow) { + console.error('Popup blocked! Please allow popups for this site to use the online IDE.'); + // Consider showing a user-friendly notification here return; }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
src/main/webapp/app/shared/components/code-button/code-button.component.ts
(6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/shared/components/code-button/code-button.component.ts (1)
🔇 Additional comments (3)
src/main/webapp/app/shared/components/code-button/code-button.component.ts (3)
13-13
: LGTM: Clean import additions and property declarations
The new imports and property declarations are well-organized and follow Angular conventions.
Also applies to: 16-16, 19-20, 70-72, 76-76
87-87
: LGTM: Proper dependency injection
The ProgrammingExerciseService is correctly injected following Angular's dependency injection pattern.
275-276
: Existing security concern is still valid
A previous review has already raised concerns about including credentials in URLs.
src/main/webapp/app/shared/components/code-button/code-button.component.ts
Show resolved
Hide resolved
src/main/webapp/app/shared/components/code-button/code-button.component.ts
Show resolved
Hide resolved
src/main/webapp/app/shared/components/code-button/code-button.component.ts
Outdated
Show resolved
Hide resolved
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: 1
🧹 Outside diff range and nitpick comments (1)
src/main/webapp/app/shared/components/code-button/code-button.component.ts (1)
374-380
: Simplify artemisUrl construction using window.location.originThe current URL construction is verbose and potentially error-prone. Using
window.location.origin
would be more concise and reliable.-let artemisUrl: string = ''; -if (window.location.protocol) { - artemisUrl += window.location.protocol + '//'; -} -if (window.location.host) { - artemisUrl += window.location.host; -} +const artemisUrl: string = window.location.origin;
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
src/main/webapp/app/shared/components/code-button/code-button.component.ts
(6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/shared/components/code-button/code-button.component.ts (1)
🔇 Additional comments (3)
src/main/webapp/app/shared/components/code-button/code-button.component.ts (3)
13-13
: LGTM: Clean import additions and property declarations
The new imports and property declarations are well-organized and follow Angular naming conventions.
Also applies to: 16-16, 19-20, 70-72, 76-76
87-87
: LGTM: Proper dependency injection
The ProgrammingExerciseService is correctly injected following Angular's dependency injection pattern.
353-368
: Consider potential race condition in Theia initialization
The initialization of Theia settings depends on both the profile info and the build config. If the exercise changes after the build config is retrieved but before the settings are applied, it could lead to inconsistent state.
Consider wrapping the initialization in a check:
initTheia(profileInfo: ProfileInfo) {
if (profileInfo.activeProfiles?.includes(PROFILE_THEIA) && this.exercise) {
this.programmingExerciseService.getBuildConfig(this.exercise.id!).subscribe((buildConfig) => {
+ // Verify exercise hasn't changed during async operation
+ if (this.exercise?.id !== buildConfig.exerciseId) {
+ return;
+ }
if (this.exercise) {
this.exercise.buildConfig = buildConfig;
// Rest of the code...
}
});
}
}
src/main/webapp/app/shared/components/code-button/code-button.component.ts
Show resolved
Hide resolved
…ogramming-exercises/provide-theia-clone-information-on-redirect
…mation-on-redirect' into chore/theia-integration-test
@coderabbitai pause |
THIS PR SHOULD NOT BE MERGED AND IS ONLY FOR TESTING PURPOSES
Testserver States
Note
These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.
Summary by CodeRabbit
Release Notes
New Features
AllowedTools
annotation for method-level access control based on tool permissions.ToolTokenType
enumeration to represent different tool types.ToolsInterceptor
to manage access control using JWT tokens.getToolToken
method for generating tool-specific bearer tokens inAccountService
.getBuildConfig
method inProgrammingExerciseService
to retrieve build configurations.Enhancements
authorize
method to return an access token in a more structured format.Tests
CodeButtonComponent
to include scenarios for Theia integration and button visibility.@coderabbitai pause