Repository navigation
Make Test Suite Self-Contained Without AWS Credentials or External Secrets #213
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Test-only RSA keypair for JWT encode/decode in specs. | ||
| # Not used in any deployed environment. | ||
| # rubocop:disable Layout/LineLength -- PEM blocks | ||
| ENV["JWT_PRIVATE_KEY"] = <<~PEM | ||
| -----BEGIN PRIVATE KEY----- | ||
| MIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQC9GgZ7N3VRwhNX | ||
| zDYJugGV50CyabTx/aZYe0JIL5j1ZFJEwG7fhRz03EQAkD6897mhgpHM2MsmPtYx | ||
| AybxC7Qs9q7eKCbX/z9CVRNJF4ayQoGDJdiaVAhInmtBwl3zU0p4Di+Nms/zJQFL | ||
| rOikzy/m5lS5gnXN4B6k/6V/A9YGH+nFmTuegwk0+MkSyrVvODG47nUvo8TCn4NP | ||
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ElEVmPrhgitifBbCM4iOduA6toQwKBgQCeFAms | ||
| Qbdpl4gcUcbjUwvOYkAic0a/h6tY1wPI6pxf/d8pVe1xAPb2hSLbgC4mETTStlE0 | ||
| cFsEzJp0nUHFglcLOWZw12kzpsjnZ5m4BKnqLdQFDpKCnDDuZQEmBPUn250EMMfT | ||
| bvtMVJ9AZxhjtPUGRR12ZryH2Spplx0HuDikQQKBgDI8VJlgH2oGWD4Ojr3ooR9Z | ||
| gvAYEZ8jol9Ja4pQcPUVmmNc1CtvNHrQRLH3MdinNUOnKPbujjn9j+fJ+IMgfw+s | ||
| KHh/Pn1+8SUTD+RTTjakQFYTzryMrIpRy0GdksHGU+oTThrGjigBo4jpF0YJXv+9 | ||
| KvQnQF4urs6knvgIZuW0 | ||
| -----END PRIVATE KEY----- | ||
| PEM | ||
|
|
||
| ENV["JWT_PUBLIC_KEY"] = <<~PEM | ||
| -----BEGIN PUBLIC KEY----- | ||
| MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvRoGezd1UcITV8w2CboB | ||
| ledAsmm08f2mWHtCSC+Y9WRSRMBu34Uc9NxEAJA+vPe5oYKRzNjLJj7WMQMm8Qu0 | ||
| LPau3igm1/8/QlUTSReGskKBgyXYmlQISJ5rQcJd81NKeA4vjZrP8yUBS6zopM8v | ||
| 5uZUuYJ1zeAepP+lfwPWBh/pxZk7noMJNPjJEsq1bzgxuO51L6PEwp+DT8h0oNhs | ||
| GDvJieTPbE7VTVhidAZ/AV4zIC0w9I9t3HXDzuN8Q+9Eu3SPuZfr32hdI056AnYp | ||
| siDw/35SaVZcJs442wtpDldknoYn3zR3CQ7wdT0k8yPacZ9wHxmAVuvGvUVuMYq9 | ||
| iwIDAQAB | ||
| -----END PUBLIC KEY----- | ||
| PEM | ||
| # rubocop:enable Layout/LineLength | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should ever embed in our public repositories private/public key pairs, even if this is only ever used for the tests, it exposes a key that while currently won't be used in production, things can change and we could accidentally expose details we don't expect to.
Using github secrets is a better alternative because it's never then exposed. An alternative to this might instead be to just generate a key pair dynamically in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I don't 100% agree when these keys are kept in specs and not reused elsewhere, I think it is also fine to generate the pair dynamically. I don't think they should have to be kept in the environment whether that is provided in the github secrets or elsewhere.
I'll work on generating them dynamically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we have gone through iterations on this idea before in other projects
datacite/lupo@c5c3c61
Lupo currently uses fixtures for keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look at this @richardhallett . I've updated the helper so that it generates the public private pair once per Rspec process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of lines printed when the specs run; JWT decode ERROR lines that are the expected empty/abc token cases