-
Notifications
You must be signed in to change notification settings - Fork 24
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
Filter control interface messages using the workload's access rights #22
Comments
A concept for the structure of the access rights is already available in #172 (comment). |
I have reviewed the proposal for access rights and it looks good to me. Maybe you can add a few examples how it would look in the Ankaios manifest in this issue. |
Here is an example of a config with access rights. Please note that after our discussions some things have changed compared to the initial design and I have not reflected everything there are this is still work in progress. We also have to see how the implementation and the mapping to Rust structures can be made and consider if the proposed structure is easy to maintain and work with. apiVersion: v0.1
workloads:
composer:
runtime: podman
agent: agent_A
restartPolicy: NEVER
dependencies:
init_workload: ADD_COND_SUCCEEDED
tags:
- key: owner
value: Ankaios team
controlInterfaceAccess:
allowRules:
- desiredStateRule:
operation: RW_READ
targets:
- filterMask: 'desiredState.workloads'
- desiredStateRule:
operation: RW_READWRITE
matchingAllTags: # optional
- key: group
value: infotainment
targets:
- filterMask: 'desiredState.workloads.*.agent'
targetValues: ['agent_A', 'agent_B', '']
- workloadStatesRule:
operation: RS_READSUBSCRIBE
denyRules:
- desiredStateRule:
operation: RW_WRITE
targets:
- filterMask: 'desiredState.workloads.composer'
runtimeConfig: |
image: docker.io/nginx:latest
commandOptions: ["-p", "8081:80"]
init_workload:
runtime: podman
agent: agent_A
restartPolicy: NEVER
dependencies:
workload_C: ADD_COND_SUCCEEDED
tags:
- key: owner
value: Ankaios team
controlInterfaceAccess:
allowRules:
- workloadStatesRule:
operation: RS_READ
objectMasks: ['instanceName.agentName=agent_A', 'executionState.state=Failed']
runtimeConfig: |
image: docker.io/alpine:latest
commandArgs: [ "echo", "Hello Ankaios"]
radio:
runtime: podman
agent: agent_A
restartPolicy: NEVER
dependencies:
workload_C: ADD_COND_SUCCEEDED
tags:
- key: group
value: infotainment
runtimeConfig: |
image: docker.io/alpine:latest
commandArgs: [ "echo", "Hello Ankaios"]
navi:
runtime: podman
agent: agent_A
restartPolicy: NEVER
dependencies:
workload_C: ADD_COND_SUCCEEDED
tags:
- key: group
value: infotainment
runtimeConfig: |
image: docker.io/alpine:latest
commandArgs: [ "echo", "Hello Ankaios"]
|
The objectMasks will not work this way as we cannot request the read with them when getting the complete state. We need to think of something else here. Maybe in the initial version we can leave that part out and just allow access to the execution state when - workloadStatesRule:
operation: RS_READ is specified as an allow rule. The objectMasks, or something similar can later be used for the subcription only, but the read will be allowed to all states. |
Regarding the implementation of the enums in yaml and the (de)serialization in Rust, we have to use the singleton_map_recursive to get a readable yaml config, otherwise !tags are used per default to specify the enum type (see also here). Example: #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ControlInterfaceAccess {
#[serde(with = "serde_yml::with::singleton_map_recursive")]
pub allow_rules: Vec<AccessRightsRule>,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub enum AccessRightsRule {
DesiredStateRule(DesiredStateRule),
WorkloadStatesRule(WorkloadStatesRule),
} |
Issue-Id: #22 Co-authored-by: Oliver Klapper <oliver.klapper@elektrobit.com>
I am currently fixing uncovered swdds in #56 and since you are already implementing system tests for testing the control interface access rights logic, could you link this swdd |
* optimize mem usage in wl state db + prepare for new wl state structure * Add ControlInterfaceAccess to protobuf internal representation Issue-Id: #22 * Introduce PATH_SEPARATOR constant Issue-Id: #22 * Restructuring the workload states object as a searchable map * Fix indentation * Fix clippy warning Issue-Id: #22 * Remove accidentally installed package from devcontainer Issue-Id: #22 * Add first version of authorizer Issue-Id: #22 * Exchange control interface if access rules are changed Issue-Id: #22 * Add file missed in last commits Issue-Id: #22 * Remove unused imports Issue-Id: #22 * Mark code not used in tests with allow(dead_code) Issue-Id: #22 * Change authorizer to support read and write Issue-Id: #22 * Fix example startup state with control interface access rights * Fix rust example with control interface access rights * Fix python control interface example with control interface access rights * Fix nodejs example with control interface access rights * Fix cpp example with control interface access rights * Make allow and deny rules empty by default * Remove comments Issue-Id: #22 Co-authored-by: Oliver Klapper <oliver.klapper@elektrobit.com> * Fix proto files according to review findings Issue-Id: #22 * Remove unwrap in configuration comparison Issue-Id: #22 * Simplify control interface path comparison Issue-Id: #22 * Update common/src/objects/workload_states_map.rs Co-authored-by: Oliver <42932060+inf17101@users.noreply.github.com> * Add upgrading info * Small fixes * Fix requirements tracing * Add logs explaining why a request was allowed/denied Issue-Id: #22 * Correct handling of empty string as mask/rule Issue-Id: #22 * Fix typo Issue-Id: #22 * Remove denyRules from example * Replace fold with simple for loop Issue-Id: #22 * Fix the filtering og the complete state * Remove double conversion in cli * Construct empty string with default * Refactor filtering of list workloads * Add documentation in ank_base.proto * Simplify api version filter and remove clone * Add swdd and utset and fix linkage * Fix cpp_control_interface examples * Make tags, dependencies and restart policy optional * Remove tags and dependencies allocation in cpp example * Fix control_interface examples (#321) Fixed python, nodejs and rust control_interface examples due to change to ank_base.proto * Remove unneeded use * Fix the filtering of the complete state - Updating the unit tests (#323) * Update utests * Update tests * Fix failing server_state unit tests * Fix warnings in unit tests * Fix PR findings * Fix PR findings --------- Co-authored-by: Kaloyan <krucod3@users.noreply.github.com> * Fix all warnings * Fix a todo in a utest * Fix last set of warnings * Add additional information to upgrading section * Apply suggestions from code review Co-authored-by: Christoph Hamm <130038849+christoph-hamm@users.noreply.github.com> * Fix the rest of the review findings --------- Co-authored-by: Christoph Hamm <130038849+christoph-hamm@users.noreply.github.com> Co-authored-by: Oliver Klapper <oliver.klapper@elektrobit.com> Co-authored-by: Oliver <42932060+inf17101@users.noreply.github.com> Co-authored-by: Tomuta Gabriel <gaby_unalaq@yahoo.com> Co-authored-by: RaresHorju <36081886+HorjuRares@users.noreply.github.com> Co-authored-by: Kaloyan <krucod3@users.noreply.github.com>
* optimize mem usage in wl state db + prepare for new wl state structure * Add ControlInterfaceAccess to protobuf internal representation Issue-Id: #22 * Introduce PATH_SEPARATOR constant Issue-Id: #22 * Restructuring the workload states object as a searchable map * Fix indentation * Fix clippy warning Issue-Id: #22 * Remove accidentally installed package from devcontainer Issue-Id: #22 * Add first version of authorizer Issue-Id: #22 * Exchange control interface if access rules are changed Issue-Id: #22 * Add file missed in last commits Issue-Id: #22 * Remove unused imports Issue-Id: #22 * Mark code not used in tests with allow(dead_code) Issue-Id: #22 * Change authorizer to support read and write Issue-Id: #22 * Fix example startup state with control interface access rights * Fix rust example with control interface access rights * Fix python control interface example with control interface access rights * Fix nodejs example with control interface access rights * Fix cpp example with control interface access rights * Make allow and deny rules empty by default * Remove comments Issue-Id: #22 Co-authored-by: Oliver Klapper <oliver.klapper@elektrobit.com> * Fix proto files according to review findings Issue-Id: #22 * Remove unwrap in configuration comparison Issue-Id: #22 * Simplify control interface path comparison Issue-Id: #22 * Update common/src/objects/workload_states_map.rs Co-authored-by: Oliver <42932060+inf17101@users.noreply.github.com> * Add upgrading info * Small fixes * Fix requirements tracing * Add logs explaining why a request was allowed/denied Issue-Id: #22 * Correct handling of empty string as mask/rule Issue-Id: #22 * Fix typo Issue-Id: #22 * Remove denyRules from example * Create container image for control interface stests Issue-Id: #22 * Add robot keywords for control interface stests Issue-Id: #22 * Fix configuration field name in control_interface_tester Issue-Id: #22 * Add first stest for controler interface authorization Issue-Id: #22 * Add stests for control interface authorization Issue-Id: #22 * Trace SWDD to stest Issue-Id: #22 * Split authorizer.rs Issue-Id: #22 * Add utest for PathPattern implementation on Vec<PathPattern> Issue-Id: #22 * Replace ToString by Display implementation Issue-Id: #22 * Add utests for authorizer::path Issue-Id: #22 * Add utests for authorizer::rule Issue-Id: #22 * Add utests for authorize method Issue-Id: #22 * Test authorizer object creation from configuration Issue-Id: #22 * Removed unnecessary PhantomData field Issue-Id: #22 * Rewrite control interface stests in BDT style Issue-Id: #22 * Update tests/resources/image/src/main.rs * Update tests/stests/control_interface/authorization.robot * Update tests/stests/control_interface/authorization.robot * Update tests/stests/control_interface/authorization.robot * Fix stest errors introduced by merge Issue-Id: #22 * Fix authorization of requests with empty mask Issue-Id: #22 * Fix pipes channel run_task utest * Add and use MockAuthorizer Issue-Id: #22 * Remove unused code Issue-Id: #22 * increment clap version and fix env feature * Fix Control Interface tests and add new * Add documentation for authorization Issue-Id: #22 * Apply suggestions from code review Co-authored-by: Oliver <42932060+inf17101@users.noreply.github.com> * Use prebuild image for control interface stests Issue-Id: #22 --------- Co-authored-by: krucod3 <36224699+krucod3@users.noreply.github.com> Co-authored-by: Oliver Klapper <oliver.klapper@elektrobit.com> Co-authored-by: Oliver <42932060+inf17101@users.noreply.github.com> Co-authored-by: lingnoi <42992756+lingnoi@users.noreply.github.com>
Done. |
* Remove unused keywords from stest resources Issue-Id: #22 * Add Authorizer to structural view of the agent Issue-Id: #22 * Add requirements for authorization Issue-Id: #22 * Add version to control_interface_tester Issue-Id: #22 * Add test coverage for authorization requirements Issue-Id: #22 * Add description of Authorizer to Structural View of agent Issue-Id: #22 * Use Authorizer instead of Authorization as tag in agent SWDD Issue-Id: #22 * Merge image forgotten in last merge Issue-Id: #22 * Include authorizer in requirement for control interface change Issue-Id: #22 * Add correct req id * Fix typo * Fix typo * Fix typo * Fix typo * Fix bullet points * Fix bullet points * Fix typo * Fix typo * Fix typo * Apply suggestions from code review Co-authored-by: Oliver <42932060+inf17101@users.noreply.github.com> --------- Co-authored-by: Oliver Klapper <oliver.klapper@elektrobit.com> Co-authored-by: Oliver <42932060+inf17101@users.noreply.github.com> Co-authored-by: Kaloyan <36224699+krucod3@users.noreply.github.com>
Reported by @krucod3:
Description
Implement the access rights for a Workload by providing the Control Interface instance a channel that leads to the Agent (currently the messages from the Control Interface are directly passed to the Server). The Agent can filter the messages depending on the access rights and forward only authorized messages.
Another possibility would be to embed the filtering in the Control Interface task, but this could make it hard to update the accessRights dynamically.
Goals
Authorization for the Control Interface
Tasks
skip the creation of the control interface if the configuration of the workload does not contain a control interface field.This will be done with an extra issue Control interface shall be created only for configured for it workloads #322The text was updated successfully, but these errors were encountered: