8000 Feature/sample data auth mini testing by ankush-jain-akto · Pull Request #2749 · akto-api-security/akto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Open
wants to merge 3 commits into
base: feature/mini-runtime-release
Choose a base branch
from

Conversation

ankush-jain-akto
Copy link
Contributor

No description provided.

@Copilot Copilot AI review requested due to automatic review settings July 2, 2025 23:21
Copy link
Contributor
@Copilot Copilot AI left a 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 in AuthMechanismTypes and HttpResponseParams.Source
  • Add SampleDataAuthParam class to encapsulate sample-data auth parameters
  • Update ClientActor, DaoInit, and Executor 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");
Copy link
Preview
Copilot AI Jul 2, 2025

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.

Suggested change
authParam.put("_t", "com.akto.dto.testing.TLSAuthParam");
authParam.put("_t", "com.akto.dto.testing.TLSAuthParam");
break;

Copilot uses AI. Check for mistakes.

Comment on lines +623 to +624
// TODO Auto-generated catch block
e.printStackTrace();
Copy link
Preview
Copilot AI Jul 2, 2025

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.

Suggested change
// 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0