Skip to content

Commit 3118879

Browse files
committed
fixup! tests: Add blackbox tests for setuid/gid/sticky bit
1 parent 6e47b51 commit 3118879

File tree

1 file changed

+115
-1
lines changed

1 file changed

+115
-1
lines changed

tests/positive/files/file.go

+115-1
Original file line numberDiff line numberDiff line change
@@ -380,22 +380,79 @@ func ApplyCustomFilePermissions() types.Test {
380380
out := types.GetBaseDisk()
381381
config := `{
382382
"ignition": { "version": "$version" },
383+
"passwd": {
384+
"users": [
385+
{
386+
"name": "auser",
387+
"uid": 1001,
388+
"shouldExist": false
389+
}
390+
],
391+
"groups": [
392+
{
393+
"name": "auser",
394+
"gid": 1001,
395+
"shouldExist": false
396+
}
397+
]
398+
},
383399
"storage": {
384400
"files": [
385401
{
386402
"path": "/foo/setuidsetgid",
387403
"contents": { "source": "data:,hello%20world%0A" },
388404
"mode": 3565
405+
},
406+
{
407+
"path": "/foo/auser/setuidsetgid",
408+
"contents": { "source": "data:,hello%20world%0A" },
409+
"mode": 3565,
410+
"user": { "id": 1001 },
411+
"group": { "id": 1001 }
412+
}, {
413+
"path": "/foo/root/setuidsetgid",
414+
"contents": { "source": "data:,hello%20world%0A" },
415+
"mode": 3565,
416+
"user": { "id": 0 },
417+
"group": { "id": 0 }
389418
},
390419
{
391420
"path": "/foo/setuid",
392421
"contents": { "source": "data:,hello%20world%0A" },
393422
"mode": 2541
423+
},
424+
{
425+
"path": "/foo/auser/setuid",
426+
"contents": { "source": "data:,hello%20world%0A" },
427+
"mode": 2541,
428+
"user": { "id": 1001 },
429+
"group": { "id": 1001 }
430+
},
431+
{
432+
"path": "/foo/root/setuid",
433+
"contents": { "source": "data:,hello%20world%0A" },
434+
"mode": 2541,
435+
"user": { "id": 0 },
436+
"group": { "id": 0 }
394437
},
395438
{
396439
"path": "/foo/setgid",
397440
"contents": { "source": "data:,hello%20world%0A" },
398441
"mode": 1517
442+
},
443+
{
444+
"path": "/foo/auser/setgid",
445+
"contents": { "source": "data:,hello%20world%0A" },
446+
"mode": 1517,
447+
"user": { "id": 1001 },
448+
"group": { "id": 1001 }
449+
},
450+
{
451+
"path": "/foo/root/setgid",
452+
"contents": { "source": "data:,hello%20world%0A" },
453+
"mode": 1517,
454+
"user": { "id": 0 },
455+
"group": { "id": 0 }
399456
}
400457
]
401458
}
@@ -409,6 +466,25 @@ func ApplyCustomFilePermissions() types.Test {
409466
Contents: "hello world\n",
410467
Mode: 06755,
411468
},
469+
{
470+
Node: types.Node{
471+
Directory: "foo/auser",
472+
Name: "setuidsetgid",
473+
User: 1001,
474+
Group: 1001,
475+
},
476+
Contents: "hello world\n",
477+
Mode: 06755,
478+
}, {
479+
Node: types.Node{
480+
Directory: "foo/root",
481+
Name: "setuidsetgid",
482+
User: 0,
483+
Group: 0,
484+
},
485+
Contents: "hello world\n",
486+
Mode: 06755,
487+
},
412488
{
413489
Node: types.Node{
414490
Directory: "foo",
@@ -417,6 +493,25 @@ func ApplyCustomFilePermissions() types.Test {
417493
Contents: "hello world\n",
418494
Mode: 04755,
419495
},
496+
{
497+
Node: types.Node{
498+
Directory: "foo/auser",
499+
Name: "setuid",
500+
User: 1001,
501+
Group: 1001,
502+
},
503+
Contents: "hello world\n",
504+
Mode: 04755,
505+
}, {
506+
Node: types.Node{
507+
Directory: "foo/root",
508+
Name: "setuid",
509+
User: 0,
510+
Group: 0,
511+
},
512+
Contents: "hello world\n",
513+
Mode: 04755,
514+
},
420515
{
421516
Node: types.Node{
422517
Directory: "foo",
@@ -425,8 +520,27 @@ func ApplyCustomFilePermissions() types.Test {
425520
Contents: "hello world\n",
426521
Mode: 02755,
427522
},
523+
{
524+
Node: types.Node{
525+
Directory: "foo/auser",
526+
Name: "setgid",
527+
User: 1001,
528+
Group: 1001,
529+
},
530+
Contents: "hello world\n",
531+
Mode: 02755,
532+
}, {
533+
Node: types.Node{
534+
Directory: "foo/root",
535+
Name: "setgid",
536+
User: 0,
537+
Group: 0,
538+
},
539+
Contents: "hello world\n",
540+
Mode: 02755,
541+
},
428542
})
429-
configMinVersion := "3.4.0"
543+
configMinVersion := "3.6.0-experimental"
430544

431545
return types.Test{
432546
Name: name,

0 commit comments

Comments
 (0)