Skip to content

Conversation

@Corniel
Copy link
Contributor

@Corniel Corniel commented May 16, 2023

To ensures that the public key of an signed assembly does not accidentally changes, having an assertion .HasPublicKey(string) can help. Hence this PR. For completeness/symmetry reasons I also added .BeUnsigned().

IMPORTANT

  • If the PR touches the public API, the changes have been approved in a separate issue with the "api-approved" label.
  • The code complies with the Coding Guidelines for C#.
  • The changes are covered by unit tests which follow the Arrange-Act-Assert syntax and the naming conventions such as is used in these tests.
  • If the PR adds a feature or fixes a bug, please update the release notes with a functional description that explains what the change means to consumers of this library, which are published on the website.
  • If the PR changes the public API the changes needs to be included by running AcceptApiChanges.ps1 or AcceptApiChanges.sh.
  • If the PR affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
    • Please also run ./build.sh --target spellcheck or .\build.ps1 --target spellcheck before pushing and check the good outcome

Relevant issue: #2209

@dennisdoomen
Copy link
Member

Thank you for this proposal. As you can see from the checklist, the idea is that you first create an issue with an API proposal so we can discuss the consequences. But since we know each other let's see if we can take this PR further 🫢

@lg2de
Copy link
Contributor

lg2de commented May 17, 2023

When writing the API proposal, please check whether asserting signature fingerprint only is possible and - maybe - easier to use.

@Corniel
Copy link
Contributor Author

Corniel commented May 17, 2023

Thank you for this proposal. As you can see from the checklist, the idea is that you first create an issue with an API proposal so we can discuss the consequences. But since we know each other let's see if we can take this PR further 🫢

I know. I had the code already, and I was not sure my self yet which API to propose. That's the reason I already started this PR. But if this a desired extension to the API, and if not, what to add (or to add this at all) definitionally should be discussed too.

@jnyrup
Copy link
Member

jnyrup commented May 19, 2023

It looks promising, but let's discuss the API in a GH issue first.
The issue template contains questions that help ensuring we're on the same line and reach the better design.

That people already started commenting on the implementation before the shape was agreed upon proves the need to keep these thing separate.

@Corniel
Copy link
Contributor Author

Corniel commented May 24, 2023

@dennisdoomen :Note that locally my build fails, as it claims that C#11 features are not available, and all warnings are handled as errors. Can someone enlighten me on why that could happen?

@jnyrup
Copy link
Member

jnyrup commented May 24, 2023

Do you have the .NET 7 SDK installed? Our global.json file should specify the minimum required version.

@Corniel
Copy link
Contributor Author

Corniel commented May 25, 2023

Do you have the .NET 7 SDK installed? Our global.json file should specify the minimum required version.

Yes I have. Both for my company and multiple open source projects I work on require that. As mentioned, also the thing that (and that only happens for this solution) all warnings are handled as errors is strange.

@dennisdoomen
Copy link
Member

Yes I have. Both for my company and multiple open source projects I work on require that. As mentioned, also the thing that (and that only happens for this solution) all warnings are handled as errors is strange.

I recommend joining our Slack to have a more efficient discussion. You can use this invite.

@jnyrup jnyrup changed the title Extend AssemblyAssertions with HasPublicKey and BeUnsigned Extend AssemblyAssertions with HavePublicKey and NotHavePublicKey Jun 8, 2023
@Corniel Corniel force-pushed the assembly-public-key branch from f4e80fc to 0ffd9bd Compare July 19, 2023 19:20
@Corniel Corniel marked this pull request as ready for review July 20, 2023 17:20
Copy link
Member

@dennisdoomen dennisdoomen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please assume comments also apply to other places in the PR.
  • Also update the releases.md and the assemblies.md

@Corniel Corniel force-pushed the assembly-public-key branch from b62d741 to a1b928a Compare July 30, 2023 07:43
@dennisdoomen dennisdoomen requested a review from jnyrup July 30, 2023 09:16
@coveralls
Copy link

coveralls commented Jul 30, 2023

Pull Request Test Coverage Report for Build 5705024583

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 29 of 29 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.006%) to 97.217%

Totals Coverage Status
Change from base Build 5672891851: -0.006%
Covered Lines: 12890
Relevant Lines: 13132

💛 - Coveralls

Copy link
Member

@jnyrup jnyrup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Please also add an example to the docs
and update the release notes

@jnyrup jnyrup changed the title Extend AssemblyAssertions with HavePublicKey and NotHavePublicKey Extend AssemblyAssertions with BeSignedWithPublicKey and BeUnsigned Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend AssemblyAssertions with methods to check on assemblies being signed or not

7 participants