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

Add PTU check for allow_unknown_rpc_passthrough #2187

Merged

Conversation

Jack-Byrne
Copy link
Collaborator

This PR is not ready for review.

Summary

Add tests for app policy field allow_unknown_rpc_passthrough

WIP, more tests being added

CLA

---------------------------------------------------------------------------------------------------
-- Precondition:
-- 1) app1, app2 and app3 are registered on SDL.
-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc SendLocation) are assigned for <app1ID>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc SendLocation) are assigned for <app1ID>
-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc FutureRequest) are assigned for <app1ID>

-- Precondition:
-- 1) app1, app2 and app3 are registered on SDL.
-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc SendLocation) are assigned for <app1ID>
-- 3) AppServiceProvider permissions(with MEDIA AppService permissions to handle rpc SendLocation) are assigned for <app2ID>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- 3) AppServiceProvider permissions(with MEDIA AppService permissions to handle rpc SendLocation) are assigned for <app2ID>
-- 3) AppServiceProvider permissions(with MEDIA AppService permissions to handle rpc FutureRequest) are assigned for <app2ID>

-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc SendLocation) are assigned for <app1ID>
-- 3) AppServiceProvider permissions(with MEDIA AppService permissions to handle rpc SendLocation) are assigned for <app2ID>
-- 4) Base-4 permissions are assigned for <app3ID>
-- 5) pt_entry.allow_unknown_rpc_passthrough = false policy assigned for <app3ID>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- 5) pt_entry.allow_unknown_rpc_passthrough = false policy assigned for <app3ID>
-- 5) allow_unknown_rpc_passthrough = false policy assigned for <app3ID>

-- 3) AppServiceProvider permissions(with MEDIA AppService permissions to handle rpc SendLocation) are assigned for <app2ID>
-- 4) Base-4 permissions are assigned for <app3ID>
-- 5) pt_entry.allow_unknown_rpc_passthrough = false policy assigned for <app3ID>
-- 6) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=SendLocation} in the manifest)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- 6) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=SendLocation} in the manifest)
-- 6) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=FutureRequest} in the manifest)

-- 4) Base-4 permissions are assigned for <app3ID>
-- 5) pt_entry.allow_unknown_rpc_passthrough = false policy assigned for <app3ID>
-- 6) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=SendLocation} in the manifest)
-- 7) app2 sends a PublishAppService (with {serviceType=MEDIA, handledRPC=SendLocation} in the manifest)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- 7) app2 sends a PublishAppService (with {serviceType=MEDIA, handledRPC=SendLocation} in the manifest)
-- 7) app2 sends a PublishAppService (with {serviceType=MEDIA, handledRPC=FutureRequest} in the manifest)

local manifest2 = {
serviceName = config.application2.registerAppInterfaceParams.appName,
serviceType = "MEDIA",
handledRPCs = { 109 },
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
handledRPCs = { 109 },
handledRPCs = { rpcRequest.funcId },

local manifest = {
serviceName = config.application1.registerAppInterfaceParams.appName,
serviceType = "NAVIGATION",
handledRPCs = { 109 },
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
handledRPCs = { 109 },
handledRPCs = { rpcRequest.funcId },

local function PTUfunc(tbl)
--Add permissions for app1
local pt_entry = common.getAppServiceProducerConfig(1)
pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = 109}} }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = 109}} }
pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = rpcRequest.funcId}} }

tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry
--Add permissions for app2
pt_entry = common.getAppServiceProducerConfig(2)
pt_entry.app_services.MEDIA.handled_rpcs = {{function_id = 109}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pt_entry.app_services.MEDIA.handled_rpcs = {{function_id = 109}}
pt_entry.app_services.MEDIA.handled_rpcs = {{function_id = rpcRequest.funcId}}

@@ -0,0 +1,126 @@
---------------------------------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps rename the file to indicate that allow_unknown_rpc_passthrough had been set to false. Maybe something like 009_UnknownRPC_Passthrough_Disallowed

@@ -0,0 +1,126 @@
---------------------------------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I see how it is different, using allow_unknown_rpc_passthrough as false. Still, I might suggest using the latest version of https://github.com/smartdevicelink/sdl_atf_test_scripts/pull/2188/files#diff-aecc1389162e76ba570ab26084cb9d94 as a base for this.

…r_UNSUPPORTED_REQUEST_policy_allow_flag_false.lua

Co-Authored-By: JackLivio <jack@livio.io>
--
-- Expected:
-- 1) Core does not forward the request to any provider application
-- 2) core responds to app3 with { success = false, resultCode = "UNSUPPORTED_REQUEST" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- 2) core responds to app3 with { success = false, resultCode = "UNSUPPORTED_REQUEST" }
-- 2) Core responds to app3 with { success = false, resultCode = "UNSUPPORTED_REQUEST" }

…r_UNSUPPORTED_REQUEST_policy_allow_flag_false.lua

Co-Authored-By: JackLivio <jack@livio.io>
@Jack-Byrne Jack-Byrne merged commit d833852 into release/5.1.0 Apr 11, 2019
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.

3 participants