@@ 372-389 (lines=18) @@ | ||
369 | $this->assertWillFailPackageVerification(); |
|
370 | } |
|
371 | ||
372 | public function testWillRejectSignedTagsFromUnknownKey() : void |
|
373 | { |
|
374 | $personalGpgDirectory = $this->makeGpgHomeDirectory(); |
|
375 | $foreignGpgDirectory = $this->makeGpgHomeDirectory(); |
|
376 | $vendorName = 'Mr. Magoo'; |
|
377 | $vendorEmail = '[email protected]'; |
|
378 | $vendorKey = $this->makeKey($foreignGpgDirectory, $vendorEmail, $vendorName); |
|
379 | $vendorDir = $this->makeVendorDirectory(); |
|
380 | $vendor1 = $this->makeDependencyGitRepository($vendorDir, 'vendor1/package1', $vendorEmail, $vendorName); |
|
381 | ||
382 | $this->createDependencySignedTag($vendor1, $foreignGpgDirectory, $vendorKey); |
|
383 | ||
384 | $this->configureCorrectComposerSetup(); |
|
385 | ||
386 | putenv('GNUPGHOME=' . $personalGpgDirectory); |
|
387 | ||
388 | $this->assertWillFailPackageVerification(); |
|
389 | } |
|
390 | ||
391 | public function testWillRejectSignedTagsFromNonHeadCommit() : void |
|
392 | { |
|
@@ 391-411 (lines=21) @@ | ||
388 | $this->assertWillFailPackageVerification(); |
|
389 | } |
|
390 | ||
391 | public function testWillRejectSignedTagsFromNonHeadCommit() : void |
|
392 | { |
|
393 | $gpgHome = $this->makeGpgHomeDirectory(); |
|
394 | $vendorName = 'Mr. Magoo'; |
|
395 | $vendorEmail = '[email protected]'; |
|
396 | $vendorKey = $this->makeKey($gpgHome, $vendorEmail, $vendorName); |
|
397 | $vendorDir = $this->makeVendorDirectory(); |
|
398 | $vendor1 = $this->makeDependencyGitRepository($vendorDir, 'vendor1/package1', $vendorEmail, $vendorName); |
|
399 | ||
400 | $this->createDependencySignedTag($vendor1, $gpgHome, $vendorKey); |
|
401 | ||
402 | (new Process('git commit --allow-empty -m "unsigned commit"', $vendor1)) |
|
403 | ->setTimeout(30) |
|
404 | ->mustRun(); |
|
405 | ||
406 | $this->configureCorrectComposerSetup(); |
|
407 | ||
408 | putenv('GNUPGHOME=' . $gpgHome); |
|
409 | ||
410 | $this->assertWillFailPackageVerification(); |
|
411 | } |
|
412 | ||
413 | public function testWillOnlyConsiderTheHeadCommitForValidation() : void |
|
414 | { |
|
@@ 413-433 (lines=21) @@ | ||
410 | $this->assertWillFailPackageVerification(); |
|
411 | } |
|
412 | ||
413 | public function testWillOnlyConsiderTheHeadCommitForValidation() : void |
|
414 | { |
|
415 | $gpgHome = $this->makeGpgHomeDirectory(); |
|
416 | $vendorName = 'Mr. Magoo'; |
|
417 | $vendorEmail = '[email protected]'; |
|
418 | $vendorKey = $this->makeKey($gpgHome, $vendorEmail, $vendorName); |
|
419 | $vendorDir = $this->makeVendorDirectory(); |
|
420 | $vendor1 = $this->makeDependencyGitRepository($vendorDir, 'vendor1/package1', $vendorEmail, $vendorName); |
|
421 | ||
422 | $this->signDependency($vendor1, $gpgHome, $vendorKey); |
|
423 | ||
424 | (new Process('git commit --allow-empty -m "unsigned commit"', $vendor1)) |
|
425 | ->setTimeout(30) |
|
426 | ->mustRun(); |
|
427 | ||
428 | $this->configureCorrectComposerSetup(); |
|
429 | ||
430 | putenv('GNUPGHOME=' . $gpgHome); |
|
431 | ||
432 | $this->assertWillFailPackageVerification(); |
|
433 | } |
|
434 | ||
435 | public function testWillRejectSignedCommitsFromUnknownKeys() : void |
|
436 | { |
|
@@ 435-453 (lines=19) @@ | ||
432 | $this->assertWillFailPackageVerification(); |
|
433 | } |
|
434 | ||
435 | public function testWillRejectSignedCommitsFromUnknownKeys() : void |
|
436 | { |
|
437 | $personalGpgDirectory = $this->makeGpgHomeDirectory(); |
|
438 | $foreignGpgDirectory = $this->makeGpgHomeDirectory(); |
|
439 | ||
440 | $vendorName = 'Mr. Magoo'; |
|
441 | $vendorEmail = '[email protected]'; |
|
442 | $vendorKey = $this->makeKey($foreignGpgDirectory, $vendorEmail, $vendorName); |
|
443 | $vendorDir = $this->makeVendorDirectory(); |
|
444 | $vendor1 = $this->makeDependencyGitRepository($vendorDir, 'vendor1/package1', $vendorEmail, $vendorName); |
|
445 | ||
446 | $this->signDependency($vendor1, $foreignGpgDirectory, $vendorKey); |
|
447 | ||
448 | $this->configureCorrectComposerSetup(); |
|
449 | ||
450 | putenv('GNUPGHOME=' . $personalGpgDirectory); |
|
451 | ||
452 | $this->assertWillFailPackageVerification(); |
|
453 | } |
|
454 | ||
455 | private function makeVendorDirectory() : string |
|
456 | { |