Skip to content

Commit a7a63aa

Browse files
committed
rgw/iam: match_policy() treats MATCH_POLICY_ARN as case-sensitive
now that the ArnLike conditions are the only user of MATCH_POLICY_ARN, change their case-sensitivity to comply with Amazon Resource Name (ARN) condition operators[1] [1] https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_ARN Signed-off-by: Casey Bodley <[email protected]>
1 parent 4cd40c7 commit a7a63aa

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/rgw/rgw_common.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2186,7 +2186,7 @@ int rgw_parse_op_type_list(const string& str, uint32_t *perm)
21862186
bool match_policy(const std::string& pattern, const std::string& input,
21872187
uint32_t flag)
21882188
{
2189-
const uint32_t flag2 = flag & (MATCH_POLICY_ACTION|MATCH_POLICY_ARN) ?
2189+
const uint32_t flag2 = (flag & MATCH_POLICY_ACTION) ?
21902190
MATCH_CASE_INSENSITIVE : 0;
21912191

21922192
std::string_view::size_type last_pos_input = 0, last_pos_pattern = 0;

src/test/rgw/test_rgw_iam_policy.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ TEST(MatchPolicy, ARN)
14681468
{
14691469
constexpr auto flag = MATCH_POLICY_ARN;
14701470
EXPECT_TRUE(match_policy("a:b:c", "a:b:c", flag));
1471-
EXPECT_TRUE(match_policy("a:b:c", "A:B:C", flag)); // case insensitive
1471+
EXPECT_FALSE(match_policy("a:b:c", "A:B:C", flag)); // case sensitive
14721472
EXPECT_TRUE(match_policy("a:*:e", "a:bcd:e", flag));
14731473
EXPECT_FALSE(match_policy("a:*", "a:b:c", flag)); // cannot span segments
14741474
}

0 commit comments

Comments
 (0)