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

Clean up fabric filtered read #14430

Closed
mlepage-google opened this issue Jan 27, 2022 · 1 comment
Closed

Clean up fabric filtered read #14430

mlepage-google opened this issue Jan 27, 2022 · 1 comment
Assignees
Labels

Comments

@mlepage-google
Copy link
Contributor

mlepage-google commented Jan 27, 2022

See PR #13881 and particularly this conversation:
#13881 (comment)

Essentially, if not using the generated cluster types for encode, they won't fabric filter if a MatchesFabricIndex method isn't provided. They also won't fail to compile or otherwise warn, so this is highly dangerous.

There is discussion in that conversation about various ways to address this. It should be addressed at the DM/IM level as appropriate, and then whatever changes need to happen to access control cluster (for whatever new mechanism is used for fabric filtered read) will have to happen.

@erjiaqing
Copy link
Contributor

erjiaqing commented Feb 10, 2022

I guess this is resolved,

IsFabricScoped now requires "kIsFabricScoped" attribute always exists when encoding structs.

It says

 * Using IsFabricScoped<X>::value without a basic type or cluster object with kIsFabricScoped will cause a compile error.  This is
 * an intended behavior to make users explicitly decide whether their cluster object is fabric-scoped or not.

template <typename X>
class IsFabricScoped
{
private:
template <typename X0, decltype(std::decay_t<X0>::kIsFabricScoped) = true>
static constexpr bool IsFabricScopedClusterObject()
{
return std::decay_t<X0>::kIsFabricScoped;
}
template <typename X0, std::enable_if_t<IsBasicType<std::decay_t<X0>>::value, bool> = true>
static constexpr bool IsFabricScopedClusterObject()
{
return false;
}
public:
static constexpr bool value = IsFabricScopedClusterObject<X>();
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants