@@ -61,7 +61,9 @@ security.stringSha256Sync = function (contents) {
6161
6262security . packageHashSync = function ( jsonData ) {
6363 var sortedArr = security . sortJsonToArr ( jsonData ) ;
64- var manifestData = _ . map ( sortedArr , ( v ) => {
64+ var manifestData = _ . filter ( sortedArr , ( v ) => {
65+ return ! security . isPackageHashIgnored ( v . path ) ;
66+ } ) . map ( ( v ) => {
6567 return v . path + ':' + v . hash ;
6668 } ) ;
6769 log . debug ( 'packageHashSync manifestData:' , manifestData ) ;
@@ -153,18 +155,28 @@ security.isHashIgnored = function (relativePath) {
153155 return true ;
154156 }
155157
156-
157158 const IgnoreMacOSX = '__MACOSX/' ;
158159 const IgnoreDSStore = '.DS_Store' ;
159- const IgnoreCodePushMetadata = '.codepushrelease' ;
160160
161161 return relativePath . startsWith ( IgnoreMacOSX )
162162 || relativePath === IgnoreDSStore
163- || relativePath . endsWith ( IgnoreDSStore )
164- || relativePath === IgnoreCodePushMetadata
165- || relativePath . endsWith ( IgnoreCodePushMetadata ) ;
163+ || relativePath . endsWith ( IgnoreDSStore ) ;
164+ }
165+
166+ security . isPackageHashIgnored = function ( relativePath ) {
167+ if ( ! relativePath ) {
168+ return true ;
169+ }
170+
171+ // .codepushrelease contains code sign JWT
172+ // it should be ignored in package hash but need to be included in package manifest
173+ const IgnoreCodePushMetadata = '.codepushrelease' ;
174+ return relativePath === IgnoreCodePushMetadata
175+ || relativePath . endsWith ( IgnoreCodePushMetadata )
176+ || security . isHashIgnored ( relativePath ) ;
166177}
167178
179+
168180security . calcAllFileSha256 = function ( directoryPath ) {
169181 return new Promise ( ( resolve , reject ) => {
170182 var recursive = require ( "recursive-readdir" ) ;
0 commit comments