Skip to content

Commit

Permalink
Merge pull request #1798 from akto-api-security/hotfix/fix_testing_bu…
Browse files Browse the repository at this point in the history
…g_new

Fixing modifying list in cookie transformer
  • Loading branch information
notshivansh authored Dec 3, 2024
2 parents 30c39a0 + 57ddb2f commit cd25509
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public ContainsPredicate(String value) {
public boolean validate(Object value) {
if (value instanceof ApiInfo.ApiInfoKey) {
ApiInfo.ApiInfoKey infoKey = (ApiInfo.ApiInfoKey) value;
return infoKey.getUrl() != null && infoKey.getUrl().contains(this.value);
return infoKey.getUrl() != null && (infoKey.getUrl().contains(this.value) || infoKey.getUrl().matches(this.value));
} else if (value instanceof String) {
return ((String) value).contains(this.value);
return ((String) value).contains(this.value) || ((String) value).matches(this.value);
}
return false;
}
Expand Down
2 changes: 0 additions & 2 deletions libs/dao/src/main/java/com/akto/util/CookieTransformer.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.akto.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CookieTransformer {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.akto.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -33,7 +33,7 @@ public static Boolean tokenPayloadModifier(OriginalHttpRequest request, String k
CookieTransformer.modifyCookie(cookieList, key, value);
} else {
if (headers.containsKey(k)) {
headers.put(k, Collections.singletonList(value));
headers.put(k, Arrays.asList(value));
}
if (CookieTransformer.isKeyPresentInCookie(cookieList, key)) {
CookieTransformer.modifyCookie(cookieList, key, value);
Expand Down

0 comments on commit cd25509

Please sign in to comment.