Skip to content

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

improvement: add scope handling to service token search

Scott Wilson796d6bfc85ac
diff --git a/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/ServiceTokenTable.tsx b/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/ServiceTokenTable.tsx
index de08e99f11..4f364b6b63 100644
--- a/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/ServiceTokenTable.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/ServiceTokenTable.tsx
@@ -94,11 +94,19 @@ export const ServiceTokenTable = ({ handlePopUpOpen }: Props) => {
() =>
data
?.filter((token) => {
- const { name } = token;
+ const { name, scopes } = token;
const searchValue = search.trim().toLowerCase();
- return name.toLowerCase().includes(searchValue);
+ if (name.toLowerCase().includes(searchValue)) {
+ return true;
+ }
+
+ return scopes.some(
+ ({ environment, secretPath }) =>
+ environment.toLowerCase().includes(searchValue) ||
+ secretPath.toLowerCase().includes(searchValue)
+ );
})
.sort((a, b) => {
const [tokenOne, tokenTwo] = orderDirection === OrderByDirection.ASC ? [a, b] : [b, a];
@@ -148,7 +156,7 @@ export const ServiceTokenTable = ({ handlePopUpOpen }: Props) => {
value={search}
onChange={(e) => setSearch(e.target.value)}
leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search service tokens..."
+ placeholder="Search service tokens by name, environment or secret path..."
className="flex-1"
containerClassName="mb-4 mt-2"
/>