File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ import {
1212 EntraInvitationResponse ,
1313} from "../../common/types/iam.js" ;
1414
15+ function validateGroupId ( groupId : string ) : boolean {
16+ const groupIdPattern = / ^ [ a - z A - Z 0 - 9 - ] + $ / ; // Adjust the pattern as needed
17+ return groupIdPattern . test ( groupId ) ;
18+ }
19+
1520export async function getEntraIdToken (
1621 clientId : string ,
1722 scopes : string [ ] = [ "https://graph.microsoft.com/.default" ] ,
@@ -245,6 +250,12 @@ export async function listGroupMembers(
245250 token : string ,
246251 group : string ,
247252) : Promise < Array < { name : string ; email : string } > > {
253+ if ( ! validateGroupId ( group ) ) {
254+ throw new EntraGroupError ( {
255+ message : "Invalid group ID format" ,
256+ group,
257+ } ) ;
258+ }
248259 try {
249260 const url = `https://graph.microsoft.com/v1.0/groups/${ group } /members` ;
250261 const response = await fetch ( url , {
You can’t perform that action at this time.
0 commit comments