Web Content Utils
Properties
A dummy domain used by the AssetLoader for local items. Instead of "file:///", Braze will have the HTML reference this domain for local files. InAppMessageHtmlBaseView.setWebViewContent and InAppMessageWebViewClient.assetLoader should both use this value. Do not use your own value since it is used internally by Braze for HTML In-App messages with a zip file.
Functions
Streams the current zip entry to outputStream while enforcing both the per-entry and cumulative archive size limits. Size accounting is performed against actual decompressed bytes read from the stream rather than ZipEntry.getSize, which is attacker-controlled metadata and therefore untrustworthy for zip bomb defense. Throws IOException if maxUnpackedZipEntrySizeBytes or maxUnpackedZipSizeBytes would be exceeded; the caller converts this into a rejected archive.
Return the Braze html in-app message asset cache directory. This cache directory stores assets for html in-app messages that are not pre-fetched into the files directory.
Takes a remote url pointing to zip file assets and then downloads them into a local directory.
Returns true when entryCount has passed maxUnpackedZipEntryCount. Enforces the SEI CERT IDS04-J TOOMANY guard against archives with an abusive number of entries.
In the original string, replaces all instances of the remote uri (Map.Entry.getKey with the local uri Map.Entry.getValue.
Returns true for zip entries that should be silently ignored during extraction. Currently filters __MACOSX metadata entries that macOS adds to archives. Skipped entries do not count toward maxUnpackedZipEntryCount or the cumulative byte total.
Validates and extracts a single zip entry under unpackDirectory. Throws IllegalStateException from validateChildFileExistsUnderParent if the entry name would resolve outside of unpackDirectory, and IOException from copyZipEntryToOutputStream if the entry or the cumulative archive exceed their size limits. Directory entries are created; file entries are written to disk.
Takes a zip file and unzips it into a destination directory. Creates the destination directory if not already present.
Validates that the provided filename's canonical path exists under the intended directory. Throws IllegalStateException if not.