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