🩻 feat(insights): Scope Insights to Authorized Agents (#15549)
Some checks failed
Docker Dev Images Build / publish (push) Has been cancelled
Sync Helm Chart Tags / Ignore non-main push (push) Has been cancelled
Sync Helm Chart Tags / Sync chart tags (push) Has been cancelled

* feat(insights): add agent-scoped access

* fix(insights): exclude unattributed assistant messages

* fix(sharing): key role insight toggles by principal

* fix(sharing): preserve insight grant snapshot

* fix(permissions): preserve insight bits atomically

* fix(permissions): guard insight audit rollback

* fix(insights): keep admin grant controls accessible

* fix(permissions): reconcile duplicate principal updates

* fix(insights): show automatic admin access

* fix(permissions): harden insights access updates

* fix(insights): simplify authorization and preserve client state
This commit is contained in:
Ravi Kumar L 2026-09-05 02:16:58 +02:00 • committed by GitHub
parent 57c52de33c
commit 000349681e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
68 changed files with 3682 additions and 747 deletions

View file

@ -1,5 +1,10 @@
const { logger } = require('@librechat/data-schemas');
const { PrincipalType, PermissionTypes, Permissions } = require('librechat-data-provider');
const {
PrincipalType,
PermissionTypes,
Permissions,
SystemRoles,
} = require('librechat-data-provider');
const { getRoleByName } = require('~/models');
const VALID_PRINCIPAL_TYPES = new Set([
@ -27,6 +32,10 @@ const checkPeoplePickerAccess = async (req, res, next) => {
});
}
if (user.role === SystemRoles.ADMIN) {
return next();
}
const role = await getRoleByName(user.role);
if (!role || !role.permissions) {
return res.status(403).json({

View file

@ -1,5 +1,10 @@
const { logger } = require('@librechat/data-schemas');
const { PrincipalType, PermissionTypes, Permissions } = require('librechat-data-provider');
const {
PrincipalType,
PermissionTypes,
Permissions,
SystemRoles,
} = require('librechat-data-provider');
const { checkPeoplePickerAccess } = require('./checkPeoplePickerAccess');
const { getRoleByName } = require('~/models');
@ -53,6 +58,16 @@ describe('checkPeoplePickerAccess', () => {
expect(next).not.toHaveBeenCalled();
});
it('allows a literal admin regardless of configured people picker permissions', async () => {
req.user.role = SystemRoles.ADMIN;
await checkPeoplePickerAccess(req, res, next);
expect(next).toHaveBeenCalled();
expect(getRoleByName).not.toHaveBeenCalled();
expect(res.status).not.toHaveBeenCalled();
});
it('should allow access when searching for users with VIEW_USERS permission', async () => {
req.query.type = PrincipalType.USER;
getRoleByName.mockResolvedValue({