Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

test(dashboard): cover deep search queries containing LIKE metacharacters

Claude9ea63e476413
diff --git a/backend/src/server/routes/v1/dashboard-secret-search-fns.test.ts b/backend/src/server/routes/v1/dashboard-secret-search-fns.test.ts
index 05c1259985..4338d193e0 100644
--- a/backend/src/server/routes/v1/dashboard-secret-search-fns.test.ts
+++ b/backend/src/server/routes/v1/dashboard-secret-search-fns.test.ts
@@ -41,11 +41,27 @@ describe("resolveSecretDeepSearch", () => {
});
});
+ test("searches a slash-containing query with LIKE metacharacters literally", () => {
+ expect(resolveSecretDeepSearch("https://service.ariba/a_b", folderPaths)).toEqual({
+ searchName: "https://service.ariba/a_b",
+ searchPath: ""
+ });
+ expect(resolveSecretDeepSearch("https://service.ariba/100%", folderPaths)).toEqual({
+ searchName: "https://service.ariba/100%",
+ searchPath: ""
+ });
+ });
+
test("scopes to a folder when the derived path exists", () => {
expect(resolveSecretDeepSearch("prod/api", folderPaths)).toEqual({ searchName: "api", searchPath: "/prod" });
expect(resolveSecretDeepSearch("prod/", folderPaths)).toEqual({ searchName: "", searchPath: "/prod" });
});
+ test("scopes to a folder even when the name contains LIKE metacharacters", () => {
+ expect(resolveSecretDeepSearch("prod/a_b", folderPaths)).toEqual({ searchName: "a_b", searchPath: "/prod" });
+ expect(resolveSecretDeepSearch("prod/100%", folderPaths)).toEqual({ searchName: "100%", searchPath: "/prod" });
+ });
+
test("supports multi-segment paths", () => {
expect(resolveSecretDeepSearch("a/b/c", folderPaths)).toEqual({ searchName: "c", searchPath: "/a/b" });
});