Commit Graph
74 Commits
Author SHA1 Message Date
Tim Bruijnzeels 055b817881 Cargo clippy - rust 1.54 2021-08-30 13:13:20 +02:00
Ximon Eighteen 45977aa136 Remove more intercepts and waits that might be blocking the test from progressing. 2021-08-03 10:00:19 +02:00
Ximon Eighteen fa95116bc5 Comment out problematic waiting for now... 2021-08-03 10:00:16 +02:00
Ximon Eighteen a2667c2db3 Ignore all unhandled promise rejections
Newer Cypress fails tests in more situations than Cypress 6.8.0, but we’re not ready to investigate the root cause yet so just retain the previous behaviour for now.
2021-08-03 09:57:47 +02:00
Ximon Eighteen fc5683cefa FIX: Logout intercept should be POST not GET. 2021-08-01 21:48:18 +02:00
Ximon Eighteen ffd6c09460 FIX: syntax error in Cypress intercept() call. 2021-08-01 20:33:16 +02:00
Ximon Eighteen 5c3a463e1b Update intercept calls per Cypress 7 migration guide. 2021-08-01 20:14:45 +02:00
Ximon Eighteen ba0bb12cc7 Upgrade Cypress from 8.0.0 to 8.1.0.
See if any of the fixes help with the hanging UI tests.
2021-08-01 20:14:36 +02:00
Ximon Eighteen ad70e0e05a Attempt to work around the ESOCKETTIMEDOUT test failure in GH Actions. This change solves the issue in an AWS t2.small VM. 2021-07-30 00:38:39 +02:00
Ximon Eighteen cc3419074b FIX: Upgraded Cypress uses an err.message field, not an err.description field. Check the right field to catch the uncaught exception 'Redirected when going from "/onboarding" to "/interstitial" via a navigation guard' caused during the 'can logout' test in the multi_user_config_file test. 2021-07-29 20:43:55 +02:00
Ximon Eighteen fb33669664 Prevent Cypress failing the can logout test due to an uncaught "Redirected when going from "/onboarding" to "/interstitial" via a navigation guard." exception in Lagosta. 2021-07-29 17:20:30 +02:00
Ximon EighteenandGitHub f504d00a84 FIX: Don't assume err.description is non-null as since the ugprade from Cypress 6.8.0 to 8.0.0 sometimes it isn't. 2021-07-29 17:01:51 +02:00
Ximon EighteenandGitHub 4d5c6c5147 Bump Cypress to latest (6,8.0 -> 8.0.0) as advised in https://github.com/cypress-io/cypress/issues/7062 "cy.visit() failed trying to load ESOCKETTIMEDOUT". 2021-07-29 16:21:23 +02:00
Ximon EighteenandGitHub 5f913be94a Fix incorrect conditional Cypress test logic. 2021-07-29 15:02:49 +02:00
Ximon Eighteen cc94c6a658 Silence spurious unused code warnings concerning the OpenID Connect mock. 2021-07-29 11:40:11 +02:00
Ximon Eighteen 842264141f Merge branch 'dev' of github.com:NLnetLabs/krill into dev 2021-07-12 17:03:55 +02:00
Ximon Eighteen e024457a50 Experiment with trying not to wait for a request to the server that will never happen (partial attempt at fixing #603). 2021-07-12 17:03:47 +02:00
Tim BruijnzeelsandGitHub 8be620b606 Update dependencies: rpki-rs, bytes, tokio, hyper, reqwest (#584)
* Update dependencies: rpki-rs, and therefore bytes, tokio, hyper, reqwest
* Rust 1.51 clippy
* Update minimal rust version to 1.47
    socket2 requires improved const fn support.
    exponential compile-time and type_length_limit and async in 1.46.

See PR #586
2021-07-02 10:20:24 +02:00
Tim Bruijnzeels 9458adc821 Cargo fmt before release 0.9.0-rc3 (#528) 2021-05-20 15:56:27 +02:00
Tim BruijnzeelsandGitHub 17b928b7cc Use more descriptive KrillIoError where feasible (#495) 2021-05-04 13:53:03 +02:00
Ximon EighteenandGitHub 13b6f7d1f3 Security tweaks (#382) (#484)
* Encrypt session state using ChaCha20-Poly1305 instead of AES-GCM.
* Replace config file users login use of insecure unsalted SHA2 password hashing with secure scrypt salted password hashing.
* Log the start of the request before determining the actor.
* Allow sufficient time for password hashing delays during login with config file user based tests..
* Synced with Lagosta commit b49f23de.
2021-04-20 00:47:22 +02:00
Tim BruijnzeelsandGitHub b43a6815cf Inconsistent and unacceptable token references (#433) (#483) 2021-04-19 22:23:02 +02:00
8a36517126 Error handling fixes and improvements (#464)
Fixes:
* Just use the token we have if we would ideally refresh before expiration but don't have a refresh token.
* Don't hide useful OpenID Connect error details (such as self-signed cert rejected instead of just request failed). (fixes #427)
* Lagosta fixes from branch issue-379-handle-connection-issues commit 58f5ccc7 (relates to #442).

Functional improvements:
* Return or log less in some error scenarios (#419).
* Upgrade to Oso 0.11.2 to get a MUCH better error report when a ?= query in a .polar file fails, plus the Mutex around Oso is no longer needed.
* Log when OIDC discovery completes successfully.
* Be cautious, just log connection issues to the OpenID Connect provider for now, don't retry discovery.
* Use a lower timeout for the OpenID Connect HTTP client than the normal Krill HTTP client.
* Log more cause chains where available.

Code quality improvements:
* Apply review feddback: unwrap locks and crash out via panic to be consistent with the rest of Krill.
* Factor out the repeated RAII guard handling.
* Split login() out into helper methods.
* Removed TODO comment.

Testing improvements:
* Removed left-behind debug screenshot.
* Add a test to show a bug whereby access is wrongly denied if a token is pending expiration and has no refresh token. 
* Add a test to make sure Krill handles timeout of requests to the OIDC provider correctly. Also adds support for a lower timeout in test mode ala how it's done elsewhere in Krill, and more faithfully replicates the normal Krill HTTP client configuration when configuring the OIDC HTTP client. Also factored the OIDC HTTP client code out as it is getting too large to live in provider.rs.
* Extend the OpenID Connect provider not available test to show that Krill copes with the provider being unavailable and coming back to life again.
* Re-worked the test/mock relationship so that the mock no longer has hard-coded users and username based behaviour activation but rather now the test sets the desired behaviour and is thus easier to understand and more flexible.
* Extended the OpenID Connect mock so that its endpoints can be disabled and enabled during tests, and be disabled before Krill even does initial discovery.
* Use example.com based bad ACR ID token.
* Remove support for the NoResponse mock failure mode as it blocks the tiny http server thread indefinitely also preventing a test using it from exiting, and adds little no perceived benefit over the SlowResponse failure mode (which does at least stop blocking within the expected test run time).
* The mock OpenID Connect provider must be shutdown before the UI test result is asserted, otherwise the test process never terminates.
* Use the expected OpenID Connect provider timeout when in test mode.
* Extend the openid connect test to test the 'hybrid' user attributes case.
* Give the login more time to complete before expiring the access token. (#466).
* Wait for the right backend status BEFORE clicking the ROAs tab. (#465)

Other:
* OpenID Connect log message consistency tweaks.
* Sync with updated correspoinding Lagosta branch commit d2a92fe1 with latest Lagosta master merged in and a yarn build empty catch block fix.
* Sync with commit b9a2f5b3 in the corresponding PR branch in Lagosta to get a testbed REST API client fix.

Co-authored-by: Tim Bruijnzeels <tim@nlnetlabs.nl>
2021-04-13 12:13:18 +02:00
7cb5674033 Stabilize API and CLI (#330 and #360)
* Move child_request API endpoint for conststency. (#330)
* Move get RFC 8183 Publisher Request API endpoints (#330)
* Accept XML and json to add/update parent on same endpoints (#330)
* Simplify the JSON to add a child and remove unused fields. (#330)
* Update path to child_request in openapi spec.
* Update path to publisher request.
* Update api spec and documentation.
* Fix update parent API documentation and call by CLI.
* CLI stability
* Update pubd OpenAPI spec t o match changes made to the Krill API.
* Update the e2e test client code to submit only the id_cert and not the whole RFC8183 request, as required by changes made to the Krill API.

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2021-04-12 17:24:41 +02:00
Ximon EighteenandGitHub f3e8023be5 Support fine grained access per CA (resolves #437) (#443)
- Various changes to support a grey policy in between black and white approach of permitting or denying access to CAs entirely, whereby a user can have a different role in one CA than in another.
- Introduces the NoResourceType for requests not relating to a specific "resource", e.g. CA, such as LOGIN. NoResourceType maps to `nil` in Oso policy language.
- Add support for Permission constants in Polar files. Build the Permission enum using a macro.
- Added CA_ADMIN (for bulk operations) and CA_DELETE permissions.
- Support loading more than one custom auth policy file.
- Checks were missing on some API calls if the user had the necessary permission *on the relevant resources*.
- Rename the team policy as a demo to indicate that it is educational only.
- Split a role-per-ca demo out of the team policy demo.
- Extend the with_ta Cypress test to cover the role-per-ca ca demo policy (as it creates the needed data).
- Don't misrepresent an external policy file in log statements as being internal.
- Better comments describing what the tests are doing.
- Remove unused role parameter in team access demo policy.
- Add disallow() in Oso policies as a way to define deny rules.
2021-03-25 21:35:38 +01:00
23be0b5ef7 Make testbed fully configurable through config section
* Let users configure the AIA to use with TA certificates. Set 'ta_aia' in the config file. (#409)
* Use explicit configuration section for testbed, no longer rely on magic env variables.

Note: this will all be revised again if/when the Publication server and TA vs CA code is fully separated in future.

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2021-03-22 16:53:41 +01:00
Ximon EighteenandGitHub 0f930f37ef Logout enhancements (closes #385, closes #397, fixes #408, closes #425) (#436)
- Formalize support for different logout strategies and add the fallback strategy.
- Generate the logout URL at logout time in preparation for supporting dynamic logout requests (as needed by token revocation).
- Secure the connection to the mock OpenID Connect provider with a self-signed TLS certificate.
- Allow self-signed certificates for HTTPS connections to localhost (same policy as elsewhere in Krill).
- Upgrade openidconnect-rs to latest v2.0.0 alpha to gain contributed support for OAuth 2.0 Token Revocation. (#385 and #397)
- Use reqwest 0.9.x directly instead of via the openidconnect-rs crate (we cannot use the v0.11.x reqwest that comes with the crate as (a) it doesn't permit self-signed certificates, (b) the blocking implementation was changed to be async which causes problems when inside an existing async runtime, and (c) switching the OpenID Connect client code over to be async is non-trivial - see #428).
- Pass the ID token as `id_token_hint` to the OpenID Connect RP-Initiated Logout 1.0 endpoint. (#408)
- Refined logic for the various logout mechanism permutations. (#425).
- Require OpenID Connection RP-Initiated Logout 1.0 and OAuth 2.0 Token Revocation endpoints to be HTTPS per the specs.
- Passes manual testing with Microsoft Azure Active Directory RP-Initiated Logout support and Google Compute Cloud OAuth 2.0 Token Revocation support.
- Added a Google Cloud Platform example to the comments in the default config file.
- Updated and added tests.
- Fixed logout and token revocation in the mock OpenID Connect provider to actually terminate login sessions.
- Handle a race condition in Lagosta where null user data was accessed that was just deleted due to logout.
- Handle errors from the Krill logout endpoint in Lagosta.
2021-03-08 23:39:45 +01:00
Ximon EighteenandGitHub 47830dbf37 Check the OpenID Connect CSRF token (resolves #383). (#424)
Use a user agent cookie with strict security settings to verify the CSRF token. Adds a test to verify that passing the wrong CSRF state value to Krill correctly results in an error.
2021-03-08 12:09:13 +01:00
Ximon EighteenandGitHub e3eb5e6752 Add a CTRL-C handler to Cypress UI tests to prevent the Cypress Docker container being left running if the test is aborted while running. (#431) 2021-03-08 11:27:23 +01:00
Ximon EighteenandGitHub c50050c481 Support use of env vars CYPRESS_INTERACTIVE and CYPRESS_DEBUG to control the Cypress test experience. (#404) (#405) 2021-02-10 23:50:00 +01:00
Jasper den HertogandGitHub 1cba1dba70 authenticate()/try_refresh_token() rfc-6749 style errors (#396)
Improved handling of OpenID Connect error responses when using a refresh token to obtain new tokens.
2021-02-10 10:42:43 +01:00
Ximon EighteenandGitHub bbfe9a824a Testbed mode should be more liberal in handling formatting variations in child and publisher registration XML. (#369) (#403)
Testbed mode should be more liberal in handling formatting variations in child and publisher registration XML. Synced with Lagosta commit d94470db. (#369, #403)
2021-01-29 17:11:30 +01:00
Ximon EighteenandGitHub 424664001d Stabilize the add ROA UI test (#377) (#407)
Wait until CA resources exist before adding a ROA. Synced with Lagosta master branch commit 30215b85. (#377).
2021-01-29 12:10:18 +01:00
Ximon EighteenandGitHub a362ad9dad Tune the ResizeObserver uncaught exception workaround. (#377) (#406)
Update the uncaught exception string match to match on the right error property and text.
2021-01-22 10:55:00 +01:00
Ximon EighteenandGitHub e3cc74ff26 UI test stability improvements (#398)
* Use a less short 'short-lived' token that doesn't expire in the GH Action runner VMs before Krill is able to validate it. (#377)
* Attempt to suppress occasional spurious "ResizeObserver loop limit exceeded" errors using a custom Cypress uncaught exception handler. Unable to reproduce locally or even confirm that the new handler is being invoked. (#377)
2021-01-19 00:56:37 +01:00
Ximon EighteenandGitHub cb94515cbb Skip Add ROA test while investigating #377.
As it is causing test failures for other commits/PRs.
2021-01-15 16:26:07 +01:00
Ximon EighteenandGitHub 8a7a7bcb3e Extend the CI job with code coverage reports by cargo tarpaulin. (#371) (#372)
Trigger a new code coverage report GitHub Actions CI workflow after successful completion of the CI workflow (#371).
Also attempts to stablize the flakey add ROAs UI test (#377).
2021-01-15 15:10:30 +01:00
Ximon Eighteen f2a79eb28f Test error reporting on authn success but authz LOGIN failure. 2021-01-12 21:19:50 +01:00
Ximon Eighteen 36b09d2790 FIX: Correct UI test expected string. 2021-01-12 17:11:52 +01:00
Ximon Eighteen 87cdf7962f FIX: Pass user attributes to Lagosta, not just the role. Synced with Lagosta master branch commit ac2dab37. 2021-01-09 14:55:06 +01:00
Ximon Eighteen 394e325b7c cargo fmt 2021-01-06 14:27:59 +01:00
Ximon Eighteen 8343456b11 FIX: Flakey UI test: AssertionError: Timed out retrying after 4000ms: Expected to find content: '<child_request' within the element: <code.language-xml> but never did. 2021-01-06 14:25:39 +01:00
Ximon Eighteen f19994354e FIX: Incorrect UI subtest title. 2021-01-06 14:08:22 +01:00
Ximon Eighteen db8647b60f FIX: Initial rough implementation: Don't fail Krill startup if the OpenID Connect provider is unavailable. Synced with Lagosta master commit 5f61a5c9. Also includes some minor log / error consistency/cleanup tweaks. 2021-01-06 13:56:39 +01:00
Ximon Eighteen 76eb78f5a5 Add failing a test for verifying that Krill starts up even if the OpenID Connect provider is unavailable. 2021-01-05 12:21:23 +01:00
Ximon Eighteen 9bd8968dd0 Add a test for the case where the OpenID Connect provider responds with a non-spec compliant ID Token. Currently fails because the error message shown to the user could imply that Krill had a problem rather than correctly reporting that this is an OpenID Connect provider issue. 2021-01-05 12:17:25 +01:00
Ximon Eighteen 24e37b88de Enable UI 'Add ROA for CA' UI based test which now passes. 2021-01-05 11:19:52 +01:00
Ximon Eighteen 1a6be4d753 FIX: UI tests time out due to slow route analysis of vast TA resources when TA isn't even needed. 2020-12-31 16:33:54 +01:00
Ximon Eighteen 8bc43d7640 rustfmt on recently modified files. 2020-12-30 15:46:08 +01:00
Ximon Eighteen 5d6fbcd66f UI test tweaks. 2020-12-30 15:46:08 +01:00