File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed 
packages/node-renderer/src/shared Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,15 @@ def validate_license
3636          license  =  load_and_decode_license 
3737          return  false  unless  license 
3838
39-           # Check expiry if present 
40-           if  license [ "exp" ]  && Time . now . to_i  > license [ "exp" ] 
39+           # Check that exp field exists 
40+           unless  license [ "exp" ] 
41+             @validation_error  =  "License is missing required expiration field" 
42+             handle_invalid_license ( development_mode ,  @validation_error ) 
43+             return  development_mode 
44+           end 
45+ 
46+           # Check expiry 
47+           if  Time . now . to_i  > license [ "exp" ] 
4148            @validation_error  =  "License has expired" 
4249            handle_invalid_license ( development_mode ,  @validation_error ) 
4350            return  development_mode 
@@ -63,6 +70,9 @@ def load_and_decode_license
6370          license_string , 
6471          public_key , 
6572          true , 
73+           # NOTE: Never remove the 'algorithm' parameter from JWT.decode to prevent algorithm bypassing vulnerabilities. 
74+           # Ensure to hardcode the expected algorithm. 
75+           # See: https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/ 
6676          algorithm : "RS256" 
6777        ) . first 
6878      end 
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { PUBLIC_KEY } from './licensePublicKey';
66interface  LicenseData  { 
77  sub ?: string ; 
88  iat ?: number ; 
9-   exp ? : number ; 
9+   exp : number ;   // Required: expiration timestamp 
1010  [ key : string ] : any ; 
1111} 
1212
@@ -60,8 +60,15 @@ class LicenseValidator {
6060        return  false ; 
6161      } 
6262
63-       // Check expiry if present 
64-       if  ( license . exp  &&  Date . now ( )  /  1000  >  license . exp )  { 
63+       // Check that exp field exists 
64+       if  ( ! license . exp )  { 
65+         this . validationError  =  'License is missing required expiration field' ; 
66+         this . handleInvalidLicense ( isDevelopment ,  this . validationError ) ; 
67+         return  isDevelopment ; 
68+       } 
69+ 
70+       // Check expiry 
71+       if  ( Date . now ( )  /  1000  >  license . exp )  { 
6572        this . validationError  =  'License has expired' ; 
6673        this . handleInvalidLicense ( isDevelopment ,  this . validationError ) ; 
6774        return  isDevelopment ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments