Skip to content

Commit cddffda

Browse files
authored
Merge pull request #3042 from murgatroid99/rbac_types_change_fix
grpc-js-xds: Update RBAC code to handle Node type change, pin @types/node
2 parents 61208ea + 51e6be5 commit cddffda

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

packages/grpc-js-xds/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@types/gulp": "^4.0.6",
3939
"@types/gulp-mocha": "0.0.32",
4040
"@types/mocha": "^5.2.6",
41-
"@types/node": ">=20.11.20",
41+
"@types/node": "25.5.0",
4242
"@types/yargs": "^15.0.5",
4343
"grpc-health-check": "file:../grpc-health-check",
4444
"gts": "^5.0.1",

packages/grpc-js-xds/src/rbac.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,14 @@ export class AuthenticatedPrincipal implements PrincipalRule {
225225
}
226226
}
227227
}
228-
return this.nameMatcher.apply(info.peerCertificate.subject.CN);
228+
if (info.peerCertificate.subject.CN) {
229+
if (Array.isArray(info.peerCertificate.subject.CN)) {
230+
return info.peerCertificate.subject.CN.some(entry => this.nameMatcher!.apply(entry));
231+
} else {
232+
return this.nameMatcher.apply(info.peerCertificate.subject.CN);
233+
}
234+
}
235+
return false;
229236
}
230237
toString(): string {
231238
return `Authenticated(principal=${this.nameMatcher?.toString() ?? null})`;

0 commit comments

Comments
 (0)