Skip to content

Commit c0e9479

Browse files
committed
apple-codesign: add additional test coverage for shallow bundle signing
So we can see diffs when things change. The next commit should introduce a diff.
1 parent a53c408 commit c0e9479

File tree

1 file changed

+370
-0
lines changed

1 file changed

+370
-0
lines changed

apple-codesign/tests/cmd/sign-bundle-multiple-macho.trycmd

Lines changed: 370 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,4 +426,374 @@ signing Mach-O file Contents/MacOS/lib.dylib
426426
signing Mach-O file Contents/Resources/non-nested-bin
427427
signing main executable Contents/MacOS/MyApp
428428

429+
$ rcodesign print-signature-info MyApp.app.signed-shallow
430+
- path: Contents/Info.plist
431+
file_size: 576
432+
file_sha256: 0a5902dc8e47f490d03889d3593d17bddbf79e6c1f79494e20dd28f9459effa5
433+
entity: other
434+
- path: Contents/MacOS/MyApp
435+
file_size: 22544
436+
file_sha256: ed9b322079f477b956269151b7f05966fe4c2522116e2c23b5ab40f518887fe3
437+
entity:
438+
mach_o:
439+
macho_linkedit_start_offset: 16384 / 0x4000
440+
macho_signature_start_offset: 16400 / 0x4010
441+
macho_signature_end_offset: 17232 / 0x4350
442+
macho_linkedit_end_offset: 22544 / 0x5810
443+
macho_end_offset: 22544 / 0x5810
444+
linkedit_signature_start_offset: 16 / 0x10
445+
linkedit_signature_end_offset: 848 / 0x350
446+
linkedit_bytes_after_signature: 5312 / 0x14c0
447+
signature:
448+
superblob_length: 832 / 0x340
449+
blob_count: 5
450+
blobs:
451+
- slot: CodeDirectory (0)
452+
magic: fade0c02
453+
length: 493
454+
sha1: f342b48c4632318b35759a678a90f606463d44aa
455+
sha256: 776f6ff24cb7986e98b41600c6f34ad9ef197b9d28c84531ae2cbdf7b965ac36
456+
- slot: RequirementSet (2)
457+
magic: fade0c01
458+
length: 12
459+
sha1: 3a75f6db058529148e14dd7ea1b4729cc09ec973
460+
sha256: 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986
461+
- slot: Entitlements (5)
462+
magic: fade7171
463+
length: 231
464+
sha1: 609a70a1468d84bef2be0146d1f0a5ea1c839948
465+
sha256: adea2675562421d85cc35e2c909ae27f33846eeb3b2b7c68017abd1b4b02f624
466+
- slot: DER Entitlements (7)
467+
magic: fade7172
468+
length: 36
469+
sha1: 1018e52606e45993b16da1c621ceec945b9d5226
470+
sha256: 4d9925d24f1357a00429379f31f567cedfaa8101d58442e7864f923bfb708794
471+
- slot: CMS Signature (65536)
472+
magic: fade0b01
473+
length: 8
474+
sha1: 2a7254313aa41796079bb0e9d0f044345f69f98b
475+
sha256: e6c83bc98a10348492c7d4d2378a54572ef29e1a5692ccd02b5e29f4b762d6a0
476+
code_directory:
477+
version: '0x20400'
478+
flags: CodeSignatureFlags(ADHOC)
479+
identifier: com.example.mybundle
480+
digest_type: sha256
481+
platform: 0
482+
signed_entity_size: 16400
483+
executable_segment_flags: ExecutableSegmentFlags(MAIN_BINARY | ALLOW_UNSIGNED)
484+
code_digests_count: 5
485+
slot_digests:
486+
- 'Info (1): 0a5902dc8e47f490d03889d3593d17bddbf79e6c1f79494e20dd28f9459effa5'
487+
- 'RequirementSet (2): 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986'
488+
- 'Resources (3): e9faf2afbb4ab5548d3531c4b40abdfd59a2d6c2b5834e1980993957ba5bec83'
489+
- 'Application (4): 0000000000000000000000000000000000000000000000000000000000000000'
490+
- 'Entitlements (5): adea2675562421d85cc35e2c909ae27f33846eeb3b2b7c68017abd1b4b02f624'
491+
- 'Rep Specific (6): 0000000000000000000000000000000000000000000000000000000000000000'
492+
- 'DER Entitlements (7): 4d9925d24f1357a00429379f31f567cedfaa8101d58442e7864f923bfb708794'
493+
entitlements_plist:
494+
- <?xml version="1.0" encoding="UTF-8"?>
495+
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
496+
- <plist version="1.0">
497+
- <dict>
498+
- ' <key>get-task-allow</key>'
499+
- ' <true/>'
500+
- </dict>
501+
- </plist>
502+
entitlements_der_plist:
503+
- <?xml version="1.0" encoding="UTF-8"?>
504+
- <plist version="1.0">
505+
- ' <dict>'
506+
- ' <key>get-task-allow</key>'
507+
- ' <true />'
508+
- ' </dict>'
509+
- </plist>
510+
cms: null
511+
- path: Contents/MacOS/bin
512+
file_size: 22544
513+
file_sha256: 222272e624fadf178495f7eeabdac248a951a0fb1e49002f494dde7067e456c8
514+
entity:
515+
mach_o:
516+
macho_linkedit_start_offset: 16384 / 0x4000
517+
macho_signature_start_offset: 16400 / 0x4010
518+
macho_signature_end_offset: 16772 / 0x4184
519+
macho_linkedit_end_offset: 22544 / 0x5810
520+
macho_end_offset: 22544 / 0x5810
521+
linkedit_signature_start_offset: 16 / 0x10
522+
linkedit_signature_end_offset: 388 / 0x184
523+
linkedit_bytes_after_signature: 5772 / 0x168c
524+
signature:
525+
superblob_length: 372 / 0x174
526+
blob_count: 3
527+
blobs:
528+
- slot: CodeDirectory (0)
529+
magic: fade0c02
530+
length: 316
531+
sha1: c86136679b8fb8b73c260c3f5143eb4787ba7408
532+
sha256: 319e12d5056d6b83506f2a51858ddfd99a244ed7b1bb261d9f7a1befa55239db
533+
- slot: RequirementSet (2)
534+
magic: fade0c01
535+
length: 12
536+
sha1: 3a75f6db058529148e14dd7ea1b4729cc09ec973
537+
sha256: 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986
538+
- slot: CMS Signature (65536)
539+
magic: fade0b01
540+
length: 8
541+
sha1: 2a7254313aa41796079bb0e9d0f044345f69f98b
542+
sha256: e6c83bc98a10348492c7d4d2378a54572ef29e1a5692ccd02b5e29f4b762d6a0
543+
code_directory:
544+
version: '0x20400'
545+
flags: CodeSignatureFlags(ADHOC)
546+
identifier: bin
547+
digest_type: sha256
548+
platform: 0
549+
signed_entity_size: 16400
550+
executable_segment_flags: ExecutableSegmentFlags(MAIN_BINARY)
551+
code_digests_count: 5
552+
slot_digests:
553+
- 'Info (1): 0000000000000000000000000000000000000000000000000000000000000000'
554+
- 'RequirementSet (2): 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986'
555+
cms: null
556+
- path: Contents/MacOS/lib.dylib
557+
file_size: 22544
558+
file_sha256: f5bf39926f898f9d8b10749c2c2e02d89e6ca1ab85e5210df86a711afc35f1bd
559+
entity:
560+
mach_o:
561+
macho_linkedit_start_offset: 16384 / 0x4000
562+
macho_signature_start_offset: 16400 / 0x4010
563+
macho_signature_end_offset: 16772 / 0x4184
564+
macho_linkedit_end_offset: 22544 / 0x5810
565+
macho_end_offset: 22544 / 0x5810
566+
linkedit_signature_start_offset: 16 / 0x10
567+
linkedit_signature_end_offset: 388 / 0x184
568+
linkedit_bytes_after_signature: 5772 / 0x168c
569+
signature:
570+
superblob_length: 372 / 0x174
571+
blob_count: 3
572+
blobs:
573+
- slot: CodeDirectory (0)
574+
magic: fade0c02
575+
length: 316
576+
sha1: af401622e3c8ad117ef8e8048542a0f6ce3e0d7c
577+
sha256: df488d463c798ba6e7afbb55d1f86959aefc12753467b49d5a984611e11ec8d0
578+
- slot: RequirementSet (2)
579+
magic: fade0c01
580+
length: 12
581+
sha1: 3a75f6db058529148e14dd7ea1b4729cc09ec973
582+
sha256: 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986
583+
- slot: CMS Signature (65536)
584+
magic: fade0b01
585+
length: 8
586+
sha1: 2a7254313aa41796079bb0e9d0f044345f69f98b
587+
sha256: e6c83bc98a10348492c7d4d2378a54572ef29e1a5692ccd02b5e29f4b762d6a0
588+
code_directory:
589+
version: '0x20400'
590+
flags: CodeSignatureFlags(ADHOC)
591+
identifier: lib
592+
digest_type: sha256
593+
platform: 0
594+
signed_entity_size: 16400
595+
executable_segment_flags: ExecutableSegmentFlags(0x0)
596+
code_digests_count: 5
597+
slot_digests:
598+
- 'Info (1): 0000000000000000000000000000000000000000000000000000000000000000'
599+
- 'RequirementSet (2): 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986'
600+
cms: null
601+
- path: Contents/Resources/non-nested-bin
602+
file_size: 22544
603+
file_sha256: 17ee48591c2b454766b3d38e00ba5b342b3695c635c9114aad839117f45e3b38
604+
entity:
605+
mach_o:
606+
macho_linkedit_start_offset: 16384 / 0x4000
607+
macho_signature_start_offset: 16400 / 0x4010
608+
macho_signature_end_offset: 16783 / 0x418f
609+
macho_linkedit_end_offset: 22544 / 0x5810
610+
macho_end_offset: 22544 / 0x5810
611+
linkedit_signature_start_offset: 16 / 0x10
612+
linkedit_signature_end_offset: 399 / 0x18f
613+
linkedit_bytes_after_signature: 5761 / 0x1681
614+
signature:
615+
superblob_length: 383 / 0x17f
616+
blob_count: 3
617+
blobs:
618+
- slot: CodeDirectory (0)
619+
magic: fade0c02
620+
length: 327
621+
sha1: c26826707603fb84e28487b5f936799d4edf6377
622+
sha256: 7b46bdc9c357e9a5ce1b15cd255623667b42772b0f42db78c8b630740caecc86
623+
- slot: RequirementSet (2)
624+
magic: fade0c01
625+
length: 12
626+
sha1: 3a75f6db058529148e14dd7ea1b4729cc09ec973
627+
sha256: 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986
628+
- slot: CMS Signature (65536)
629+
magic: fade0b01
630+
length: 8
631+
sha1: 2a7254313aa41796079bb0e9d0f044345f69f98b
632+
sha256: e6c83bc98a10348492c7d4d2378a54572ef29e1a5692ccd02b5e29f4b762d6a0
633+
code_directory:
634+
version: '0x20400'
635+
flags: CodeSignatureFlags(ADHOC)
636+
identifier: non-nested-bin
637+
digest_type: sha256
638+
platform: 0
639+
signed_entity_size: 16400
640+
executable_segment_flags: ExecutableSegmentFlags(MAIN_BINARY)
641+
code_digests_count: 5
642+
slot_digests:
643+
- 'Info (1): 0000000000000000000000000000000000000000000000000000000000000000'
644+
- 'RequirementSet (2): 987920904eab650e75788c054aa0b0524e6a80bfc71aa32df8d237a61743f986'
645+
cms: null
646+
- path: Contents/_CodeSignature/CodeResources
647+
file_size: 2882
648+
file_sha256: e9faf2afbb4ab5548d3531c4b40abdfd59a2d6c2b5834e1980993957ba5bec83
649+
entity:
650+
bundle_code_signature_file: !ResourcesXml
651+
- <?xml version="1.0" encoding="UTF-8"?>
652+
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
653+
- <plist version="1.0">
654+
- <dict>
655+
- ' <key>files</key>'
656+
- ' <dict>'
657+
- ' <key>Resources/non-nested-bin</key>'
658+
- ' <data>'
659+
- ' apwGEW+W2ghwpHtZD2rJ1FcX9d8='
660+
- ' </data>'
661+
- ' </dict>'
662+
- ' <key>files2</key>'
663+
- ' <dict>'
664+
- ' <key>MacOS/bin</key>'
665+
- ' <dict>'
666+
- ' <key>cdhash</key>'
667+
- ' <data>'
668+
- ' MZ4S1QVta4NQbypRhY3f2ZokTtc='
669+
- ' </data>'
670+
- ' <key>requirement</key>'
671+
- ' <string>cdhash H"319e12d5056d6b83506f2a51858ddfd99a244ed7"</string>'
672+
- ' </dict>'
673+
- ' <key>MacOS/lib.dylib</key>'
674+
- ' <dict>'
675+
- ' <key>cdhash</key>'
676+
- ' <data>'
677+
- ' 30iNRjx5i6bnr7tV0fhpWa78EnU='
678+
- ' </data>'
679+
- ' <key>requirement</key>'
680+
- ' <string>cdhash H"df488d463c798ba6e7afbb55d1f86959aefc1275"</string>'
681+
- ' </dict>'
682+
- ' <key>Resources/non-nested-bin</key>'
683+
- ' <dict>'
684+
- ' <key>hash2</key>'
685+
- ' <data>'
686+
- ' F+5IWRwrRUdms9OOALpbNCs2lcY1yRFKrYORF/ReOzg='
687+
- ' </data>'
688+
- ' </dict>'
689+
- ' </dict>'
690+
- ' <key>rules</key>'
691+
- ' <dict>'
692+
- ' <key>^Resources/</key>'
693+
- ' <true/>'
694+
- ' <key>^Resources/.*/.lproj/</key>'
695+
- ' <dict>'
696+
- ' <key>optional</key>'
697+
- ' <true/>'
698+
- ' <key>weight</key>'
699+
- ' <real>1000</real>'
700+
- ' </dict>'
701+
- ' <key>^Resources/.*/.lproj/locversion.plist$</key>'
702+
- ' <dict>'
703+
- ' <key>omit</key>'
704+
- ' <true/>'
705+
- ' <key>weight</key>'
706+
- ' <real>1100</real>'
707+
- ' </dict>'
708+
- ' <key>^Resources/Base/.lproj/</key>'
709+
- ' <dict>'
710+
- ' <key>weight</key>'
711+
- ' <real>1010</real>'
712+
- ' </dict>'
713+
- ' <key>^version.plist$</key>'
714+
- ' <true/>'
715+
- ' </dict>'
716+
- ' <key>rules2</key>'
717+
- ' <dict>'
718+
- ' <key>.*/.dSYM($|/)</key>'
719+
- ' <dict>'
720+
- ' <key>weight</key>'
721+
- ' <real>11</real>'
722+
- ' </dict>'
723+
- ' <key>^(.*/)?/.DS_Store$</key>'
724+
- ' <dict>'
725+
- ' <key>omit</key>'
726+
- ' <true/>'
727+
- ' <key>weight</key>'
728+
- ' <real>2000</real>'
729+
- ' </dict>'
730+
- ' <key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>'
731+
- ' <dict>'
732+
- ' <key>nested</key>'
733+
- ' <true/>'
734+
- ' <key>weight</key>'
735+
- ' <real>10</real>'
736+
- ' </dict>'
737+
- ' <key>^.*</key>'
738+
- ' <true/>'
739+
- ' <key>^Info/.plist$</key>'
740+
- ' <dict>'
741+
- ' <key>omit</key>'
742+
- ' <true/>'
743+
- ' <key>weight</key>'
744+
- ' <real>20</real>'
745+
- ' </dict>'
746+
- ' <key>^PkgInfo$</key>'
747+
- ' <dict>'
748+
- ' <key>omit</key>'
749+
- ' <true/>'
750+
- ' <key>weight</key>'
751+
- ' <real>20</real>'
752+
- ' </dict>'
753+
- ' <key>^Resources/</key>'
754+
- ' <dict>'
755+
- ' <key>weight</key>'
756+
- ' <real>20</real>'
757+
- ' </dict>'
758+
- ' <key>^Resources/.*/.lproj/</key>'
759+
- ' <dict>'
760+
- ' <key>optional</key>'
761+
- ' <true/>'
762+
- ' <key>weight</key>'
763+
- ' <real>1000</real>'
764+
- ' </dict>'
765+
- ' <key>^Resources/.*/.lproj/locversion.plist$</key>'
766+
- ' <dict>'
767+
- ' <key>omit</key>'
768+
- ' <true/>'
769+
- ' <key>weight</key>'
770+
- ' <real>1100</real>'
771+
- ' </dict>'
772+
- ' <key>^Resources/Base/.lproj/</key>'
773+
- ' <dict>'
774+
- ' <key>weight</key>'
775+
- ' <real>1010</real>'
776+
- ' </dict>'
777+
- ' <key>^[^/]+$</key>'
778+
- ' <dict>'
779+
- ' <key>nested</key>'
780+
- ' <true/>'
781+
- ' <key>weight</key>'
782+
- ' <real>10</real>'
783+
- ' </dict>'
784+
- ' <key>^embedded/.provisionprofile$</key>'
785+
- ' <dict>'
786+
- ' <key>weight</key>'
787+
- ' <real>20</real>'
788+
- ' </dict>'
789+
- ' <key>^version/.plist$</key>'
790+
- ' <dict>'
791+
- ' <key>weight</key>'
792+
- ' <real>20</real>'
793+
- ' </dict>'
794+
- ' </dict>'
795+
- </dict>
796+
- </plist>
797+
- ''
798+
429799
```

0 commit comments

Comments
 (0)