-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CUMULUS-1748: support relative paths in recursion.js #1485
Changes from 41 commits
4842ee5
e0a25b2
76c5806
00357be
38cd57f
fcbd968
e154980
82961d3
39319b6
7304555
3dca8e3
1a4f1cd
384c587
a431c50
b0c822a
a5ed80e
1ec9f67
de8def6
724e2f4
9407390
906f2db
ed92f11
dd91f5a
e051b3e
922ddd4
e6771e3
3ec880b
7596d9c
5846725
c989fe3
0f9f930
68b57e3
e4226d3
015f019
1feb8bd
7e481d4
1e242ab
4f37cc9
22fd08a
4f2c913
da6fdfa
5ed85ab
7da1033
fd51f65
afb9113
2048bb6
249c752
030c0d2
d1cc86a
f725ee2
330a5e9
a2f407f
a545798
85b2cf5
5ac3795
7e9d0ed
f92ab5f
4900319
4a1835d
f524a84
dcc4286
a41a2c9
ca69b9c
795f969
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ while ! docker container inspect ${container_id}\_build_env_1; do | |
done | ||
|
||
## Setup the build env container once it's started | ||
$docker_command "npm install --error --no-progress -g nyc; cd $UNIT_TEST_BUILD_DIR; git fetch --all; git checkout $GIT_SHA; npm install --error --no-progress; npm run bootstrap-no-build-quiet || true; npm run bootstrap-no-build-quiet; chmod 0400 -R $UNIT_TEST_BUILD_DIR/packages/test-data/keys" | ||
$docker_command "npm install --error --no-progress -g nyc; cd $UNIT_TEST_BUILD_DIR; git fetch --all; git checkout $GIT_SHA; npm install --error --no-progress; npm run bootstrap-no-build-quiet || true; npm run bootstrap-no-build-quiet" | ||
|
||
# Wait for the FTP server to be available | ||
while ! $docker_command 'curl --connect-timeout 5 -sS -o /dev/null ftp://testuser:[email protected]/README.md'; do | ||
|
@@ -45,10 +45,11 @@ while ! $docker_command 'curl --connect-timeout 5 -sS -o /dev/null http://127.0 | |
done | ||
echo 'HTTP service is available' | ||
|
||
$docker_command "mkdir /keys;cp $UNIT_TEST_BUILD_DIR/packages/test-data/keys/ssh_client_rsa_key /keys/; chmod -R 400 /keys" | ||
# Wait for the SFTP server to be available | ||
while ! $docker_command "sftp \ | ||
-P 2222\ | ||
-i $UNIT_TEST_BUILD_DIR/packages/test-data/keys/ssh_client_rsa_key\ | ||
-i /keys/ssh_client_rsa_key\ | ||
-o 'ConnectTimeout=5'\ | ||
-o 'StrictHostKeyChecking=no'\ | ||
-o 'UserKnownHostsFile=/dev/null'\ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
|
||
const test = require('ava'); | ||
const JSFtp = require('jsftp'); | ||
|
||
const FtpProviderClient = require('../FtpProviderClient'); | ||
|
||
const executeRawFtpCommand = async (cmd) => { | ||
const jsftp = new JSFtp({ | ||
host: '127.0.0.1', | ||
port: 21, | ||
user: 'testuser', | ||
pass: 'testpass' | ||
}); | ||
return new Promise((resolve, reject) => { | ||
jsftp.raw(cmd, (err, data) => { | ||
if (err) reject(err); | ||
resolve(data); | ||
}); | ||
}); | ||
}; | ||
|
||
test.before(async () => { | ||
// await when fixed | ||
executeRawFtpCommand('chmod 400 -R forbidden/file.txt'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fear that the answer is obvious, but why aren't we There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the only way to allow this file to satisfy both |
||
}); | ||
|
||
test.after.always(async () => { | ||
// await when fixed | ||
executeRawFtpCommand('chmod 644 -R forbidden/file.txt'); | ||
}); | ||
|
||
test.skip('FtpProviderClient throws an error when listing a non-permitted directory', async (t) => { | ||
markdboyd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// TODO: update cumuluss/vsftpd to allow `chmod` to work in the setup for this test. | ||
nemreid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const myFtpProviderClient = new FtpProviderClient({ | ||
host: '127.0.0.1', | ||
username: 'testuser', | ||
password: 'testpass', | ||
useList: true | ||
}); | ||
|
||
await t.throwsAsync(myFtpProviderClient.list('forbidden/file.txt'), | ||
'FTP Code 451: Could not retrieve a file listing for forbidden/file.txt.' | ||
nemreid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
+ ' This may be caused by user permissions disallowing the listing.'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the idea behind making it a root directory (
/keys
) instead of in thetest-data
directory to avoid it being crawled by the FTP discovery tests and having issues due to directory permissions?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is both that and the fact that SFTP requires the key permissions to be
400
.Changing the way we react to running into a directory we can't access seemed out of scope for this PR but would be required for everything not to bomb out on encountering a directory that does not allow reads.