Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Unreleased
==========
* Miscellaneous security improvements #1411
* Follow symlinks when creating preview sites #1447

1.5.2
=====
Expand Down
1 change: 1 addition & 0 deletions cli/lib/archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export async function createArchive(
const output = fs.createWriteStream( archivePath );
const archive = archiver( 'zip', {
zlib: { level: ZIP_COMPRESSION_LEVEL },
followSymlinks: true,
} );

output.on( 'close', () => {
Expand Down
5 changes: 4 additions & 1 deletion cli/lib/tests/archive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ describe( 'Archive Module', () => {
const result = await createArchive( mockSiteFolder, mockArchivePath );

expect( fs.createWriteStream ).toHaveBeenCalledWith( mockArchivePath );
expect( archiver ).toHaveBeenCalledWith( 'zip', { zlib: { level: 9 } } );
expect( archiver ).toHaveBeenCalledWith( 'zip', {
followSymlinks: true,
zlib: { level: 9 },
} );
expect( mockArchiver.pipe ).toHaveBeenCalledWith( mockWriteStream );
expect( path.join ).toHaveBeenCalledWith( mockSiteFolder, 'wp-content' );
expect( mockArchiver.directory ).toHaveBeenCalledWith(
Expand Down
12 changes: 12 additions & 0 deletions patches/@types+archiver+6.0.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/node_modules/@types/archiver/index.d.ts b/node_modules/@types/archiver/index.d.ts
index 00829ac..fab29c9 100644
--- a/node_modules/@types/archiver/index.d.ts
+++ b/node_modules/@types/archiver/index.d.ts
@@ -106,6 +106,7 @@ declare namespace archiver {

interface CoreOptions {
statConcurrency?: number | undefined;
+ followSymlinks?: boolean
}

interface TransformOptions {
22 changes: 22 additions & 0 deletions patches/archiver+6.0.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/node_modules/archiver/lib/core.js b/node_modules/archiver/lib/core.js
index 7c0a74d..c70117b 100644
--- a/node_modules/archiver/lib/core.js
+++ b/node_modules/archiver/lib/core.js
@@ -631,7 +631,8 @@ Archiver.prototype.directory = function(dirpath, destpath, data) {

var globOptions = {
stat: true,
- dot: true
+ dot: true,
+ follow: this.options.followSymlinks
};

function onGlobEnd() {
@@ -922,6 +923,7 @@ module.exports = Archiver;
* @global
* @property {Number} [statConcurrency=4] Sets the number of workers used to
* process the internal fs stat queue.
+ * @property {Boolean} [followSymLinks=false] Sets whether to follow symlinks.
*/

/**
Loading