Skip to content

Commit c09d73c

Browse files
kptdobeCopilot
andauthored
chore(auth): drop ACL denial logs, compact IMS fallback log (#351)
Remove the per-check "doesn't/does not have permission" logs from hasPermission. Listing filters logged one line per hidden item (~160K lines/48h, each with the user's email); request-level denials already surface as 403 in the zone logs. Permission logic is unchanged. Log the IMS offline-verification fallback as a warning with the error code and message instead of the full error object. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e492bd8 commit c09d73c

1 file changed

Lines changed: 3 additions & 14 deletions

File tree

‎src/utils/auth.js‎

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export async function getUsers(req, env) {
138138
}
139139
} catch (e) {
140140
// eslint-disable-next-line no-console
141-
console.log('IMS token offline verification failed', e);
141+
console.warn('IMS token offline verification failed:', e.code || e.name, e.message);
142142
return { email: 'anonymous' };
143143
}
144144

@@ -539,21 +539,10 @@ export function hasPermission(daCtx, path, action, keywordPath = false) {
539539

540540
// is it the path from the context? then return the cached value
541541
if (k === p) {
542-
const perm = daCtx.aclCtx.actionSet.has(action);
543-
if (!perm) {
544-
// eslint-disable-next-line no-console
545-
console.log(`User ${daCtx.users.map((u) => u.email)} doesn't have permission to ${action} ${path}`);
546-
}
547-
return perm;
542+
return daCtx.aclCtx.actionSet.has(action);
548543
}
549544

550545
// The path is a sub-path which can happen during bulk operations
551-
552-
const permission = daCtx.users
546+
return daCtx.users
553547
.every((u) => getUserActions(daCtx.aclCtx.pathLookup, u, p).actions.has(action));
554-
if (!permission && !isKeyword) {
555-
// eslint-disable-next-line no-console
556-
console.warn(`User ${daCtx.users.map((u) => u.email)} does not have permission to ${action} ${path}`);
557-
}
558-
return permission;
559548
}

0 commit comments

Comments
 (0)