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

BC-8019 Switch to asymmetric signing of JWT #5294

Merged
merged 45 commits into from
Nov 5, 2024
Merged

Conversation

dyedwiper
Copy link
Contributor

@dyedwiper dyedwiper commented Oct 15, 2024

Description

Links to Tickets or other pull requests

Changes

Datasecurity

Deployment

New Repos, NPM pakages or vendor scripts

Approval for review

  • DEV: If api was changed - generate-client:server was executed in vue frontend and changes were tested and put in a PR with the same branch name.
  • QA: In addition to review, the code has been manually tested (if manual testing is possible)
  • All points were discussed with the ticket creator, support-team or product owner. The code upholds all quality guidelines from the PR-template.

Notice: Please remove the WIP label if the PR is ready to review, otherwise nobody will review it.

@@ -1,6 +1,7 @@
{
"$schema": "./default.schema.json",
"AUTHENTICATION": "secrets",
"JWT_PRIVATE_KEY": "-----BEGIN RSA PRIVATE KEY-----\nMIIJKAIBAAKCAgEA0/oW2sIZWvVt0AEgQ8PS80/udJzfWXu6t2QWjUcQA2THGvDS\nXXMH6YMMY2czyBgf6L7hHV/9p1Trfpe7YgxYhOoGsxhXG1keAYQ4+mdveaUAa3ui\nACdEodsB0OFjVUdgOHCyUIXFfhSsp2p2tmZeFi/bE2v/05kYO+ExgQuzUDbB8bCr\n1sc7gMS/2dC2iE/BVw/I0F14oZkZn0fshojg4qoaLbLVKB7Iw53IXF2878zXp81J\ndnnvHdwVbGWqoII6sHZFQs8ob5S/WGMl4QnBHN98x0KmORUFyTv5kK4cdcC8LJ1H\npoVWNC6js84iF9yFRhYXY2RHqh7BwaZZ4XZym/MetTdQTBDaSvhXe0A3WdahNG+D\nGriehd6doWk98Adb49InaodH64ZRkurxiX61GEtzjMRq9EfGS5R/IfcWyPQbiir6\nymKXfOUtywRjcm3FZzmT7j3c0UHzQVEH0NBfTMj+QKz5NILNP230j0DcjNImDbHH\ncVH1quSb6e0WXjKANT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MjmiL+I\nVP4vmHYkM/+W0BipyuiLfPgtjoLmdTJB7Ilo4ebHURbMz3UR0rxU46t7r9+3LsoX\n6YYjkCEnlHar+9sVHVubnCjUkmQEaBjPj/NR8YYfcLlubnSluoc6j6qYH1pjc0Ma\n3TrSWoD3qSYg3Qi9QkcKP/+XDRf/n7RBAoIBAEdAxaD/vUW7DwGPIAbziMtkx03R\nCc7Tdp+v8XURUu5HrAxXdGK1J8ufgevFhJ6jXre/25BV9RVGAUzAK95xEkZh/ulB\nuFtxUN2CRh92EWGiC8FYtMkJEFnkjAxBjucFOWkRHjzJMF7+PuNeQSb4TEiGMEZg\nt1VWdHgL+FpNuZsKzuZ9jwfALj27LAkkJLjpH9DXDo6e7aJlCqbe8ili1gLo80FZ\np65W4wIRQSChoMcOHgZCbOBebUSW0zXLvccXoq+BGlt+qLM830Y0UFolbckHrF1O\nCTSPG6IaRisx3D2hNNrZIcyZaIwZeHhvj7fib/5hMRerXzSTH1QMXPc2bH4=\n-----END RSA PRIVATE KEY-----\n",

Check failure

Code scanning / SonarCloud

Cryptographic private keys should not be disclosed

<!--SONAR_ISSUE_KEY:AZKQxJ7SupxRpfg6Pozk-->Make sure this private key gets revoked, changed, and removed from the code. <p>See more on <a href="https://sonarcloud.io/project/issues?id=hpi-schul-cloud_schulcloud-server&issues=AZKQxJ7SupxRpfg6Pozk&open=AZKQxJ7SupxRpfg6Pozk&pullRequest=5294">SonarCloud</a></p>
@@ -1,6 +1,7 @@
{
"$schema": "./default.schema.json",
"AUTHENTICATION": "secrets",
"JWT_PRIVATE_KEY": "-----BEGIN RSA PRIVATE KEY-----\nMIIJKAIBAAKCAgEA0/oW2sIZWvVt0AEgQ8PS80/udJzfWXu6t2QWjUcQA2THGvDS\nXXMH6YMMY2czyBgf6L7hHV/9p1Trfpe7YgxYhOoGsxhXG1keAYQ4+mdveaUAa3ui\nACdEodsB0OFjVUdgOHCyUIXFfhSsp2p2tmZeFi/bE2v/05kYO+ExgQuzUDbB8bCr\n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EmGVm\n/1CfCtIP5IdppmypJ1KoILBr6pLZpFW9NhHzBumANFEbyCqavMQ6Owt5TwiI8ITK\ncAyJ8AHXsmutXbjQjPcozKmYjexrgHLc3zOvaHTNYnff6Zic9DZvUOEaMJ8Gd0T/\nTIUoFwKCAQBaiA+hHc4hjbxIOvBKMf6lVZm8jvDu8OhLcwCaFMza10pLDjnvdzWp\n1ftt1DP1oYKX4Xq38U/zSJxyiUZWAD1S3oBG3qA026VgTWlD2mCc0p8HyhqFTBdg\nSfCCUnB69pQrDrsZfBZX+8o/NGmaHE+jiy3jqk1i3RzHoThqOzUPsmEaBMjmiL+I\nVP4vmHYkM/+W0BipyuiLfPgtjoLmdTJB7Ilo4ebHURbMz3UR0rxU46t7r9+3LsoX\n6YYjkCEnlHar+9sVHVubnCjUkmQEaBjPj/NR8YYfcLlubnSluoc6j6qYH1pjc0Ma\n3TrSWoD3qSYg3Qi9QkcKP/+XDRf/n7RBAoIBAEdAxaD/vUW7DwGPIAbziMtkx03R\nCc7Tdp+v8XURUu5HrAxXdGK1J8ufgevFhJ6jXre/25BV9RVGAUzAK95xEkZh/ulB\nuFtxUN2CRh92EWGiC8FYtMkJEFnkjAxBjucFOWkRHjzJMF7+PuNeQSb4TEiGMEZg\nt1VWdHgL+FpNuZsKzuZ9jwfALj27LAkkJLjpH9DXDo6e7aJlCqbe8ili1gLo80FZ\np65W4wIRQSChoMcOHgZCbOBebUSW0zXLvccXoq+BGlt+qLM830Y0UFolbckHrF1O\nCTSPG6IaRisx3D2hNNrZIcyZaIwZeHhvj7fib/5hMRerXzSTH1QMXPc2bH4=\n-----END RSA PRIVATE KEY-----\n",

Check failure

Code scanning / SonarCloud

Cryptographic private keys should not be disclosed

<!--SONAR_ISSUE_KEY:AZKQxJ6PupxRpfg6Pozj-->Make sure this private key gets revoked, changed, and removed from the code. <p>See more on <a href="https://sonarcloud.io/project/issues?id=hpi-schul-cloud_schulcloud-server&issues=AZKQxJ6PupxRpfg6Pozj&open=AZKQxJ6PupxRpfg6Pozj&pullRequest=5294">SonarCloud</a></p>
@dyedwiper dyedwiper requested a review from bischofmax October 25, 2024 08:53
Copy link

sonarqubecloud bot commented Nov 4, 2024

@dyedwiper dyedwiper merged commit 2016509 into main Nov 5, 2024
77 checks passed
@dyedwiper dyedwiper deleted the BC-8019-asymmetric-jwt branch November 5, 2024 13:53
Metauriel pushed a commit that referenced this pull request Nov 6, 2024
* Switch to asymmetric signing

* Adjust configs

* Fix tests

* Make secret combination of private and public key in feathers

* Add tests

* Update typ of JWT

* Update authConfig in tests

* Handle new lines in keys

* Clean up strategy tests

* Use JwtModuleOptionsFactory

* Use factory method instead of class

* Remove authConfig

* Remove unnecessary props in AuthGuardConfig

* Add AuthGuardConfig to files-storage

* Change setting of options in authn service

* Add authn test modules

* Fix authn service test

* Change iss and aud of JWT

* Fix reading of config for other apps

* Add JWT_SIGNING_ALGORITHM as env var

* Add check of algorithm in JWT validation

* Add check of issuer and audience in JWT validation

* Remove unnecessary consts

* Skip broken test

* Add SC_Domain to preview-generator-configmap

* Add values to top-level configs where forgotten

* Add factory for strategy options to satisfy SonarCloud

* Use getOrThrow to read values from ConfigService

* Define defaultMikroOrmOptions in for AdminApiServerModule separately to fix dependency problem

* Add JWT_PUBLIC_KEY to configmap of admin-api-server

* Add JWT_PUBLIC_KEY to configmap of preview-generator

---------

Co-authored-by: Max Bischof <[email protected]>
Metauriel added a commit that referenced this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants