aws-greengrass / aws-greengrass-client-device-auth

Apache License 2.0
2 stars 3 forks source link

fix: delete thing from local registry if validation fails #429

Closed MikeDombo closed 8 months ago

MikeDombo commented 8 months ago

Issue #, if available:

Description of changes: getOrCreateThing writes to our config which is necessary to perform the validation, but if validation failed and the thing hasn't been seen before, then we make sure to delete the thing from our config.

Any additional information or context required to review the change:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

github-actions[bot] commented 8 months ago

Code Coverage Report

File Coverage
All files 74% :white_check_mark:
com.aws.greengrass.clientdevices.auth.PermissionEvaluationUtils 90% :white_check_mark:
com.aws.greengrass.clientdevices.auth.CertificateManager 88% :white_check_mark:
com.aws.greengrass.clientdevices.auth.ClientDevicesAuthService 83% :white_check_mark:
com.aws.greengrass.clientdevices.auth.DeviceAuthClient 73% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.ClientCertificateGenerator 95% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.CertificateHelper 74% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.CertificateStore 72% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.CertificateExpiryMonitor 87% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.ServerCertificateGenerator 93% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.CertificateGenerator 70% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.CertificateExpiryMonitor$CertRotationDecider 90% :white_check_mark:
com.aws.greengrass.clientdevices.auth.iot.usecases.VerifyIotCertificate 94% :white_check_mark:
com.aws.greengrass.clientdevices.auth.iot.usecases.VerifyThingAttachedToCertificate 89% :white_check_mark:
com.aws.greengrass.clientdevices.auth.iot.usecases.CreateIoTThingSession 76% :white_check_mark:
com.aws.greengrass.clientdevices.auth.iot.usecases.VerifyCertificateValidityPeriod 88% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.infra.BackgroundCertificateRefresh 80% :white_check_mark:
com.aws.greengrass.clientdevices.auth.iot.infra.ThingRegistry 92% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.usecases.ConfigureManagedCertificateAuthority 85% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.usecases.ConfigureCustomCertificateAuthority 83% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.usecases.RegisterCertificateAuthorityUseCase 65% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.MetricsConfiguration 83% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.GroupManager 94% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.CAConfiguration 96% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.RuntimeConfiguration 83% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.SecurityConfiguration 80% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.GroupDefinition 75% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.ExpressionVisitor 84% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.GroupConfiguration 92% :white_check_mark:
com.aws.greengrass.clientdevices.auth.api.ClientDevicesAuthServiceApi 85% :white_check_mark:
com.aws.greengrass.clientdevices.auth.api.GetCertificateRequestWithGenerator 75% :white_check_mark:
com.aws.greengrass.clientdevices.auth.api.UseCases 71% :white_check_mark:
com.aws.greengrass.clientdevices.auth.session.attribute.WildcardSuffixAttribute 96% :white_check_mark:
com.aws.greengrass.clientdevices.auth.iot.IotAuthClient$Default 56% :white_check_mark:
com.aws.greengrass.clientdevices.auth.iot.Thing 83% :white_check_mark:
com.aws.greengrass.clientdevices.auth.iot.Certificate 74% :white_check_mark:
com.aws.greengrass.clientdevices.auth.iot.GreengrassV2DataClientFactory 18% :x:
com.aws.greengrass.clientdevices.auth.iot.CertificateRegistry 95% :white_check_mark:
com.aws.greengrass.clientdevices.auth.infra.NetworkStateProvider$Default 83% :white_check_mark:
com.aws.greengrass.ipc.IPCUtils 83% :white_check_mark:
com.aws.greengrass.ipc.VerifyClientDeviceIdentityOperationHandler 60% :white_check_mark:
com.aws.greengrass.ipc.GetClientDeviceAuthTokenOperationHandler 83% :white_check_mark:
com.aws.greengrass.ipc.AuthorizeClientDeviceActionOperationHandler 79% :white_check_mark:
com.aws.greengrass.ipc.SubscribeToCertificateUpdatesOperationHandler 81% :white_check_mark:
com.aws.greengrass.clientdevices.auth.session.SessionConfig 92% :white_check_mark:
com.aws.greengrass.clientdevices.auth.session.SessionManager 88% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.handlers.CAConfigurationChangedHandler 93% :white_check_mark:
com.aws.greengrass.clientdevices.auth.certificate.handlers.CertificateRotationHandler 96% :white_check_mark:
com.aws.greengrass.clientdevices.auth.metrics.handlers.SessionCreationEventHandler 88% :white_check_mark:
com.aws.greengrass.clientdevices.auth.metrics.handlers.MetricsConfigurationChangedHandler 70% :white_check_mark:
com.aws.greengrass.clientdevices.auth.metrics.handlers.AuthorizeClientDeviceActionsMetricHandler 88% :white_check_mark:
com.aws.greengrass.clientdevices.auth.metrics.handlers.VerifyClientDeviceIdentityEventHandler 88% :white_check_mark:
com.aws.greengrass.clientdevices.auth.metrics.handlers.CertificateSubscriptionEventHandler 83% :white_check_mark:
com.aws.greengrass.clientdevices.auth.util.ResizableLinkedBlockingQueue 90% :white_check_mark:
com.aws.greengrass.clientdevices.auth.util.ParseIPAddress 90% :white_check_mark:
com.aws.greengrass.clientdevices.auth.connectivity.CISShadowMonitor$SucceedOnceOperation 88% :white_check_mark:
com.aws.greengrass.clientdevices.auth.connectivity.CISShadowMonitor 79% :white_check_mark:
com.aws.greengrass.clientdevices.auth.connectivity.CISShadowMonitor$ProcessCISShadowTask 83% :white_check_mark:
com.aws.greengrass.clientdevices.auth.connectivity.CISShadowMonitor$CISShadowTaskQueue 92% :white_check_mark:
com.aws.greengrass.clientdevices.auth.connectivity.HostAddress 67% :white_check_mark:
com.aws.greengrass.clientdevices.auth.connectivity.CISShadowMonitor$CISShadowTaskExecutor 80% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.parser.TokenMgrError 22% :x:
com.aws.greengrass.clientdevices.auth.configuration.parser.RuleExpressionTokenManager 61% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.parser.ASTStart 33% :x:
com.aws.greengrass.clientdevices.auth.configuration.parser.ASTAnd 67% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.parser.Token 58% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.parser.RuleExpressionDefaultVisitor 0% :x:
com.aws.greengrass.clientdevices.auth.configuration.parser.ASTOr 67% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.parser.SimpleCharStream 28% :x:
com.aws.greengrass.clientdevices.auth.configuration.parser.RuleExpressionTreeConstants 0% :x:
com.aws.greengrass.clientdevices.auth.configuration.parser.JJTRuleExpressionState 67% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.parser.ASTThing 67% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.parser.RuleExpression 63% :white_check_mark:
com.aws.greengrass.clientdevices.auth.configuration.parser.SimpleNode 27% :x:

Minimum allowed coverage is 50%

Generated by :monkey: cobertura-action against 06c901f87fc450716017993c68a88805e52fe6ec

github-actions[bot] commented 8 months ago

Benchmark Results

Benchmark Score
com.aws.greengrass.clientdevices.auth.benchmark.AuthorizationBenchmarks.GIVEN_policy_with_thing_name_variable_WHEN_auth_request_THEN_successful_auth 1283161.87 ops/s
com.aws.greengrass.clientdevices.auth.benchmark.AuthorizationBenchmarks.GIVEN_policy_with_wildcards_WHEN_auth_request_THEN_successful_auth 206871.94 ops/s
com.aws.greengrass.clientdevices.auth.benchmark.AuthorizationBenchmarks.GIVEN_single_group_permission_WHEN_simple_auth_request_THEN_successful_auth 2501011.63 ops/s