Skip to content

Commit 19c6495

Browse files
authored
Fix out-of-bound symlink for gitops tools (#2073)
Summary: Fix out-of-bound symlink for gitops tools I'm working on deploying pixie cloud via gitops. For security reasons argocd block the deployment if an out of bound symlink is detected in the monorepo. ``` Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = repository contains out-of-bounds symlinks. file: src/common/system/testdata/proc/123/fd/1 ``` Changing the dummy symlink to a relative path that don't leave the root fixes the issue. Relevant Issues: N/A Type of change: /kind bug Test Plan: the items below - [x] Use my fork to test if the updated symlink path still block the argocd app deployment. - [x] Related unit test still pass Additional documentation: see the links below - argoproj/argo-cd#12593 (comment) - https://argo-cd.readthedocs.io/en/stable/operator-manual/upgrading/2.4-2.5/#out-of-bounds-symlinks-now-blocked-at-fetch Signed-off-by: GitHub <noreply@github.com>
1 parent 3c9c4bd commit 19c6495

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/common/system/proc_parser_test.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ TEST_F(ProcParserTest, read_pid_metadata_null) {
289289
parser_->GetPIDCmdline(456));
290290
}
291291

292-
// This test does not work because bazel uses symlinks itself,
293-
// which then causes ReadProcPIDFDLink to resolve the wrong link.
294292
TEST_F(ProcParserTest, read_proc_fd_link) {
295293
PX_SET_FOR_SCOPE(FLAGS_proc_path, GetPathToTestDataFile("testdata/proc"));
296294
{
@@ -299,7 +297,7 @@ TEST_F(ProcParserTest, read_proc_fd_link) {
299297
ASSERT_OK(
300298
fs::CreateSymlinkIfNotExists("/dev/null", GetPathToTestDataFile("testdata/proc/123/fd/0")));
301299
ASSERT_OK(
302-
fs::CreateSymlinkIfNotExists("/foobar", GetPathToTestDataFile("testdata/proc/123/fd/1")));
300+
fs::CreateSymlinkIfNotExists("./foobar", GetPathToTestDataFile("testdata/proc/123/fd/1")));
303301
ASSERT_OK(fs::CreateSymlinkIfNotExists("socket:[12345]",
304302
GetPathToTestDataFile("testdata/proc/123/fd/2")));
305303
}
@@ -313,7 +311,7 @@ TEST_F(ProcParserTest, read_proc_fd_link) {
313311

314312
s = parser_->ReadProcPIDFDLink(123, 1, &out);
315313
EXPECT_OK(s);
316-
EXPECT_EQ("/foobar", out);
314+
EXPECT_EQ("./foobar", out);
317315

318316
s = parser_->ReadProcPIDFDLink(123, 2, &out);
319317
EXPECT_OK(s);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/foobar
1+
./foobar

0 commit comments

Comments
 (0)