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

CONJSE-1785: Remain with weak privileges in case of policy conflicts #2907

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Nothing should go in this section, please add to the latest unreleased version
(and update the corresponding date), or add a new version.

## [1.0.5-cloud] - 2023-08-16
### Security
- Previously, attempting to add and remove a privilege in the same policy load
resulted in only the positive privilege (grant, permit) taking effect. Now we
fail safe and the negative privilege statement (revoke, deny) is the final
outcome
[CONJSE-1785](https://ca-il-jira.il.cyber-ark.com:8443/browse/CONJSE-1785)

## [1.0.4-cloud] - 2023-08-10
### Fixed
- Support plural syntax for revoke and deny
### Security
- Support plural syntax for revoke and deny
[CONJSE-1783](https://ca-il-jira.il.cyber-ark.com:8443/browse/CONJSE-1783)

### Added
Expand Down
4 changes: 2 additions & 2 deletions app/models/loader/orchestrate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ def setup_db_for_new_policy
@extensions.call(:before_load_policy, policy_version: @policy_version)
end

perform_deletion

create_schema

load_records
Expand All @@ -129,6 +127,8 @@ def store_policy_in_db

drop_schema

perform_deletion

store_passwords

store_public_keys
Expand Down
45 changes: 45 additions & 0 deletions cucumber/policy/features/deletion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ Feature: Deleting objects and relationships.
body:
- !delete
record: !variable db-password
"""
And I load a policy:
"""
- !policy
id: test
body:
- !variable db-password
"""
Then variable "test/db-password" exists
Expand Down Expand Up @@ -264,3 +270,42 @@ Feature: Deleting objects and relationships.
Then the role list includes host "host-01"
And the role list includes host "host-02"
And the role list includes host "host-03"

@smoke
Scenario: Delete statements prevail on conflicting policy statements
If a policy contains both adding and deleting statements (delete, deny, revoke),
then we want to ensure that we fail safe and the delete statement is the final outcome.
Given I update the policy with:
"""
- !variable db/password
- !host host-01
- !permit
resource: !variable db/password
privileges: [ execute ]
role: !host host-01
- !deny
resource: !variable db/password
privileges: [ execute ]
role: !host host-01
"""
When I list the roles permitted to execute variable "db/password"
Then the role list does not include host "host-01"
Given I update the policy with:
"""
- !group hosts
- !grant
role: !host host-01
member: !group hosts
- !revoke
role: !host host-01
member: !group hosts
"""
When I show the group "hosts"
Then host "host-01" is not a role member
Given I update the policy with:
"""
- !variable to_be_deleted
- !delete
record: !variable to_be_deleted
"""
Then variable "to_be_deleted" does not exist