Skip to content
This repository was archived by the owner on Oct 14, 2026. It is now read-only.

Commit 168a4a0

Browse files
Ravi VermaCopilot
andcommitted
fix(rebac): require canonical IMS group ids (^[1-9][0-9]{0,18}$)
Align with the mysticat-data-service CHECK tightened in adobe/mysticat-data-service#1125 review: zero-padded spellings of one IMS group must not be accepted as distinct subjects, and ids stay within 19 digits. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 35cbe33 commit 168a4a0

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎packages/spacecat-shared-http-utils/src/auth/auth-info.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default class AuthInfo {
119119
} else if (Number.isInteger(group) && Number.isFinite(group) && group >= 0) {
120120
groupId = String(group);
121121
}
122-
if (groupId && /^[0-9]{1,20}$/.test(groupId) && !seen.has(groupId)) {
122+
if (groupId && /^[1-9][0-9]{0,18}$/.test(groupId) && !seen.has(groupId)) {
123123
seen.add(groupId);
124124
out.push(groupId);
125125
if (out.length >= 100) {

‎packages/spacecat-shared-http-utils/src/auth/readme.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,6 @@ The FACS wrapper evaluates route capabilities from the union of:
158158
`facs_grps` is a string array of IMS group idents that have mappings for the
159159
current org/product. `AuthInfo#getFacsGroups()` sanitizes that claim by accepting
160160
strings or finite non-negative integers, coercing integers to strings, keeping
161-
only decimal idents matching `^[0-9]{1,20}$`, deduplicating, and capping the
161+
only decimal idents matching `^[1-9][0-9]{0,18}$`, deduplicating, and capping the
162162
result at 100 entries. Group subjects are grant-only and additive; there are no
163163
deny records.

‎packages/spacecat-shared-http-utils/test/auth/auth-info.test.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,13 @@ describe('AuthInfo', () => {
252252
-1,
253253
1.2,
254254
Infinity,
255-
'123456789012345678901',
255+
'12345678901234567890',
256+
'0',
256257
'',
257258
null,
258259
],
259260
});
260-
expect(authInfo.getFacsGroups()).to.deep.equal(['945801205', '123', '00123']);
261+
expect(authInfo.getFacsGroups()).to.deep.equal(['945801205', '123']);
261262
});
262263

263264
it('caps sanitized groups at 100', () => {

0 commit comments

Comments
 (0)