Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5851 Fix AttributeError on t.i.ssl.Certificate repr #11930

Merged
merged 11 commits into from May 3, 2024

Conversation

rvandam
Copy link
Contributor

@rvandam rvandam commented Aug 25, 2023

Scope and purpose

Fixes #5851

@adiroiban
Copy link
Member

Many thanks, Rob for the fix.

For a PR to be merged the changes need to have a release note fragment and the changes to include the tests.

More info about the release notes here
https://docs.twisted.org/en/latest/development/dev-process.html#release-notes-management

Let us know if you need help with the release notes or writing the tests.

Regards

@graingert
Copy link
Member

@rvandam I'm keen to get this merged do you need help writing a test for this change?

@rvandam
Copy link
Contributor Author

rvandam commented Sep 9, 2023 via email

@graingert graingert changed the title #5851 Fix AttributeError on repr #5851 Fix AttributeError on t.i.ssl.Certificate repr Sep 11, 2023
c = sslverify.Certificate.loadPEM(ubuntuOneGoDaddyPem)
self.assertEqual(
repr(c),
"<Certificate Subject=b'Go Daddy Secure Certification Authority' Issuer=>",
Copy link
Member

Choose a reason for hiding this comment

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

might be better to omit the Issuer= entirely here?

Copy link
Member

Choose a reason for hiding this comment

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

I think this is ok. no need to spend too much time with the repr part. this is only to help with the debugging.

@graingert
Copy link
Member

@adiroiban I've added a test case to this PR

Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

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

Thanks for the update.

Not sure what to say about ubuntu one cert.

It's good to have a certificate from real world, but for testing, I would prefer a certificate that is more focused on the scope of that particular test.

I would argue that a barebone certificate is better here.

I left a few comments inline.

Thanks for the update.

src/twisted/newsfragments/5851.bugfix Outdated Show resolved Hide resolved
c = sslverify.Certificate.loadPEM(ubuntuOneGoDaddyPem)
self.assertEqual(
repr(c),
"<Certificate Subject=b'Go Daddy Secure Certification Authority' Issuer=>",
Copy link
Member

Choose a reason for hiding this comment

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

I think this is ok. no need to spend too much time with the repr part. this is only to help with the debugging.

src/twisted/test/test_sslverify.py Outdated Show resolved Hide resolved
src/twisted/test/test_sslverify.py Outdated Show resolved Hide resolved
Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

I am not happy with using the Ubuntu One cert here... but I think this is good enough.

@adiroiban
Copy link
Member

I have enabled auto-merge

@adiroiban adiroiban merged commit d6aff14 into twisted:trunk May 3, 2024
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

t.i.ssl.Certificate __repr__ assumes certificate will have a common name.
5 participants