-
Notifications
You must be signed in to change notification settings - Fork 249
Feature/sample data auth mini testing #2749
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
base: feature/mini-runtime-release
Are you sure you want to change the base?
Feature/sample data auth mini testing #2749
Conversation
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.
Pull Request Overview
This PR adds support for a new SAMPLE_DATA
authentication mechanism in the mini-testing feature, wiring it through enums, DTOs, codec registration, client parsing, and the execution flow.
- Introduce
SAMPLE_DATA
inAuthMechanismTypes
andHttpResponseParams.Source
- Add
SampleDataAuthParam
class to encapsulate sample-data auth parameters - Update
ClientActor
,DaoInit
, andExecutor
to recognize and handle the new mechanism
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
libs/utils/src/main/java/com/akto/data_actor/ClientActor.java | Added SAMPLE_DATA case to test-role parsing |
libs/dao/src/main/java/com/akto/util/enums/LoginFlowEnums.java | Extended AuthMechanismTypes enum with SAMPLE_DATA |
libs/dao/src/main/java/com/akto/dto/testing/SampleDataAuthParam.java | New DTO for holding sample-data auth parameters |
libs/dao/src/main/java/com/akto/dto/HttpResponseParams.java | Added OPEN_API to response source enum |
libs/dao/src/main/java/com/akto/DaoInit.java | Registered SampleDataAuthParam in Mongo codec registry |
apps/mini-testing/src/main/java/com/akto/test_editor/execution/Executor.java | Extended modifyAuthTokenInRawApi to fetch and apply sample data |
Comments suppressed due to low confidence (3)
libs/dao/src/main/java/com/akto/dto/testing/SampleDataAuthParam.java:37
- The Utils class is not imported, which will cause a compilation error. Please add the appropriate import for Utils.
return Utils.isRequestKeyPresent(this.key, request, where);
libs/dao/src/main/java/com/akto/DaoInit.java:159
- SampleDataAuthParam is not imported; add import com.akto.dto.testing.SampleDataAuthParam to fix compilation.
ClassModel<SampleDataAuthParam> sampleDataAuthParamClassModel = ClassModel.builder(SampleDataAuthParam.class)
apps/mini-testing/src/main/java/com/akto/test_editor/execution/Executor.java:629
- Using Integer.MAX_VALUE may not represent an infinite expiry if the field expects a long; consider using Long.MAX_VALUE or a named constant for a non-expiring cache.
authMechanismForRole.updateCacheExpiryEpoch(Integer.MAX_VALUE);
@@ -2456,6 +2456,8 @@ public TestRoles parseTestRole(Document testRole) { | |||
break; | |||
case "TLS_AUTH": | |||
authParam.put("_t", "com.akto.dto.testing.TLSAuthParam"); |
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.
Add a break statement after the TLS_AUTH case to prevent fall-through into the SAMPLE_DATA case.
authParam.put("_t", "com.akto.dto.testing.TLSAuthParam"); | |
authParam.put("_t", "com.akto.dto.testing.TLSAuthParam"); | |
break; |
Copilot uses AI. Check for mistakes.
// TODO Auto-generated catch block | ||
e.printStackTrace(); |
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.
Avoid using printStackTrace in production code; use loggerMaker to log the error and return an appropriate error response instead of silently continuing.
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
loggerMaker.errorAndAddToDb(e, "SAMPLE_DATA: Error executing code for auth parameter key: " + key + " in test role: " + testRole.getName()); |
Copilot uses AI. Check for mistakes.
No description provided.