Skip to content

Commit

Permalink
Added test to show imeta mod bypass is patched
Browse files Browse the repository at this point in the history
  • Loading branch information
FifthPotato committed Feb 19, 2024
1 parent e9c23fe commit 7afcd4f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packaging/test_rule_engine_plugin_metadata_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,28 @@ def test_plugin_cannot_be_bypassed_with_addw__issue_40(self):
# Clean up.
self.rods.assert_icommand(['imeta', 'rm', '-C', root_coll, self.metadata_guard_attribute_name(), json_config])

def test_plugin_cannot_be_bypassed_via_imeta_mod__issue_58(self):
config = IrodsConfig()

# Set JSON configuration for the root collection.
root_coll = os.path.join('/', self.admin.zone_name)
json_config = json.dumps({
'prefixes': ['irods::'],
'admin_only': True
})
self.rods.assert_icommand(['imeta', 'set', '-C', root_coll, self.metadata_guard_attribute_name(), json_config])

try:
with lib.file_backed_up(config.server_config_path):
self.enable_rule_engine_plugin(config)

self.user.assert_icommand(['imeta', 'add', '-C', self.user.session_collection, 'unprotected::issue58', 'v'])
self.user.assert_icommand(['imeta', 'mod', '-C', self.user.session_collection, 'unprotected::tomato', 'v', 'n:irods::tomato'], 'STDERR', ['CAT_INSUFFICIENT_PRIVILEGE_LEVEL'])

finally:
# Clean up.
self.rods.assert_icommand(['imeta', 'rm', '-C', root_coll, self.metadata_guard_attribute_name(), json_config])

#
# Utility Functions
#
Expand Down

0 comments on commit 7afcd4f

Please sign in to comment.