Skip to content

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

fix: ensure secret path validation in service token modal

Victor Santos99f5acd6797c
diff --git a/backend/src/lib/casl/index.ts b/backend/src/lib/casl/index.ts
index 1d40b58799..02e7a98e33 100644
--- a/backend/src/lib/casl/index.ts
+++ b/backend/src/lib/casl/index.ts
@@ -15,7 +15,7 @@ const $glob: FieldInstruction<string> = {
const glob: JsInterpreter<FieldCondition<string>> = (node, object, context) => {
const secretPath = context.get(object, node.field) as string;
const permissionSecretGlobPath = node.value;
- if (permissionSecretGlobPath === "") return false;
+ if (permissionSecretGlobPath.trim() === "") return false;
return picomatch.isMatch(secretPath, permissionSecretGlobPath, { strictSlashes: false });
};
diff --git a/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx b/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx
index f6ce0bb777..d4596d72ea 100644
--- a/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx
@@ -210,7 +210,7 @@ const ServiceTokenForm = () => {
onClick={() =>
append({
environment: currentProject?.environments?.[0]?.slug || "",
- secretPath: ""
+ secretPath: "/"
})
}
leftIcon={<FontAwesomeIcon icon={faPlus} />}