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

Handle ACL and readability in reporting/Engine.cpp #36488

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

andy31415
Copy link
Contributor

@andy31415 andy31415 commented Nov 13, 2024

This is part of #36484: move the ACL validation out of DataModel::Provider::ReadAttribute and have this handled by the interaction model reporting engine based on the metadata passed in by the provider.

Copy link

Review changes with  SemanticDiff

Copy link

github-actions bot commented Nov 13, 2024

PR #36488: Size comparison from 45a75ba to 1df0e39

Full report (11 builds for cc13x4_26x4, cc32xx, qpg, stm32, tizen)
platform target config section 45a75ba 1df0e39 change % change
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 837852 838052 200 0.0
RAM 123632 123632 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 823768 823976 208 0.0
RAM 125520 125520 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 770492 770708 216 0.0
RAM 113988 113988 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 754704 754912 208 0.0
RAM 114196 114196 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 627498 627874 376 0.1
RAM 205784 205784 0 0.0
lock CC3235SF_LAUNCHXL FLASH 667242 667634 392 0.1
RAM 205936 205936 0 0.0
qpg lighting-app qpg6105+debug FLASH 662144 662344 200 0.0
RAM 105384 105384 0 0.0
lock-app qpg6105+debug FLASH 620244 620452 208 0.0
RAM 99836 99836 0 0.0
stm32 light STM32WB5MM-DK FLASH 482944 483136 192 0.0
RAM 144848 144848 0 0.0
tizen all-clusters-app arm unknown 4952 4956 4 0.1
FLASH 1721608 1724284 2676 0.2
RAM 90628 90640 12 0.0
chip-tool-ubsan arm unknown 10800 10804 4 0.0
FLASH 17982062 17989926 7864 0.0
RAM 7845176 7849660 4484 0.1

Copy link

github-actions bot commented Nov 13, 2024

PR #36488: Size comparison from 45a75ba to 122a60c

Full report (19 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, nrfconnect, qpg, stm32, tizen)
platform target config section 45a75ba 122a60c change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1349448 1350108 660 0.0
RAM 104080 104080 0 0.0
bl702 lighting-app bl702+eth FLASH 649346 649722 376 0.1
RAM 25313 25313 0 0.0
bl702+wifi FLASH 826926 827046 120 0.0
RAM 14053 14053 0 0.0
bl706+mfd+rpc+littlefs FLASH 1055124 1055244 120 0.0
RAM 23893 23893 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 976486 976862 376 0.0
RAM 16556 16556 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 837852 838052 200 0.0
RAM 123632 123632 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 823768 823976 208 0.0
RAM 125520 125520 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 770492 770708 216 0.0
RAM 113988 113988 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 754704 754912 208 0.0
RAM 114196 114196 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 627498 627874 376 0.1
RAM 205784 205784 0 0.0
lock CC3235SF_LAUNCHXL FLASH 667242 667634 392 0.1
RAM 205936 205936 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 914884 915084 200 0.0
RAM 143289 143289 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 887340 887556 216 0.0
RAM 141476 141476 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 849080 849284 204 0.0
RAM 142197 142197 0 0.0
qpg lighting-app qpg6105+debug FLASH 662144 662344 200 0.0
RAM 105384 105384 0 0.0
lock-app qpg6105+debug FLASH 620244 620452 208 0.0
RAM 99836 99836 0 0.0
stm32 light STM32WB5MM-DK FLASH 482944 483136 192 0.0
RAM 144848 144848 0 0.0
tizen all-clusters-app arm unknown 4952 4956 4 0.1
FLASH 1721608 1724284 2676 0.2
RAM 90628 90640 12 0.0
chip-tool-ubsan arm unknown 10800 10804 4 0.0
FLASH 17982062 17989926 7864 0.0
RAM 7845176 7849660 4484 0.1

Copy link

github-actions bot commented Nov 13, 2024

PR #36488: Size comparison from 45a75ba to 7bab9a7

Full report (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 45a75ba 7bab9a7 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1349448 1350102 654 0.0
RAM 104080 104080 0 0.0
bl702 lighting-app bl702+eth FLASH 649346 649716 370 0.1
RAM 25313 25313 0 0.0
bl702+wifi FLASH 826926 827040 114 0.0
RAM 14053 14053 0 0.0
bl706+mfd+rpc+littlefs FLASH 1055124 1055238 114 0.0
RAM 23893 23893 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 976486 976856 370 0.0
RAM 16556 16556 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 837852 838044 192 0.0
RAM 123632 123632 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 823768 823968 200 0.0
RAM 125520 125520 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 770492 770700 208 0.0
RAM 113988 113988 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 754704 754904 200 0.0
RAM 114196 114196 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 627498 627866 368 0.1
RAM 205784 205784 0 0.0
lock CC3235SF_LAUNCHXL FLASH 667242 667626 384 0.1
RAM 205936 205936 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 679489 679657 168 0.0
RAM 78692 78692 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 699341 699509 168 0.0
RAM 81324 81324 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 699341 699509 168 0.0
RAM 81324 81324 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 656277 656437 160 0.0
RAM 73760 73760 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 616345 616505 160 0.0
RAM 71644 71644 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 635973 636141 168 0.0
RAM 74196 74196 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 635973 636141 168 0.0
RAM 74196 74196 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 635801 635969 168 0.0
RAM 74692 74692 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 655517 655685 168 0.0
RAM 77244 77244 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 655517 655685 168 0.0
RAM 77244 77244 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 611197 611373 176 0.0
RAM 68780 68780 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 631049 631225 176 0.0
RAM 71412 71412 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 631049 631225 176 0.0
RAM 71412 71412 0 0.0
efr32 lock-app BRD4187C FLASH 927596 927796 200 0.0
RAM 160164 160164 0 0.0
BRD4338a FLASH 743712 744064 352 0.0
RAM 233296 233296 0 0.0
window-app BRD4187C FLASH 1018816 1019208 392 0.0
RAM 128264 128264 0 0.0
esp32 all-clusters-app c3devkit DRAM 95336 95336 0 0.0
FLASH 1540014 1540286 272 0.0
IRAM 82542 82542 0 0.0
m5stack DRAM 116264 116264 0 0.0
FLASH 1548894 1549158 264 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4712 4712 0 0.0
FLASH 2699379 2703233 3854 0.1
RAM 129696 129696 0 0.0
all-clusters-app debug unknown 5552 5552 0 0.0
FLASH 5990630 5994390 3760 0.1
RAM 523552 523552 0 0.0
all-clusters-minimal-app debug unknown 5448 5448 0 0.0
FLASH 5328802 5332656 3854 0.1
RAM 242512 242512 0 0.0
bridge-app debug unknown 5432 5432 0 0.0
FLASH 4671244 4675098 3854 0.1
RAM 218432 218432 0 0.0
chip-tool debug unknown 5984 5984 0 0.0
FLASH 12855046 12858900 3854 0.0
RAM 583186 583186 0 0.0
chip-tool-ipv6only arm64 unknown 21336 21352 16 0.1
FLASH 10989696 10992368 2672 0.0
RAM 634088 634104 16 0.0
fabric-admin debug unknown 5808 5808 0 0.0
FLASH 11260541 11264395 3854 0.0
RAM 583538 583538 0 0.0
fabric-bridge-app debug unknown 4688 4688 0 0.0
FLASH 4495514 4499368 3854 0.1
RAM 205408 205408 0 0.0
fabric-sync debug unknown 4896 4896 0 0.0
FLASH 5309861 5313717 3856 0.1
RAM 466536 466536 0 0.0
lighting-app debug+rpc+ui unknown 6096 6096 0 0.0
FLASH 5607169 5611025 3856 0.1
RAM 228600 228600 0 0.0
lock-app debug unknown 5368 5368 0 0.0
FLASH 4720718 4724506 3788 0.1
RAM 204600 204600 0 0.0
ota-provider-app debug unknown 4744 4744 0 0.0
FLASH 4346150 4350004 3854 0.1
RAM 198272 198272 0 0.0
ota-requestor-app debug unknown 4680 4680 0 0.0
FLASH 4484552 4488406 3854 0.1
RAM 202856 202856 0 0.0
shell debug unknown 4240 4240 0 0.0
FLASH 3013837 3017597 3760 0.1
RAM 160344 160344 0 0.0
thermostat-no-ble arm64 unknown 9464 9480 16 0.2
FLASH 4090256 4092736 2480 0.1
RAM 242984 243000 16 0.0
tv-app debug unknown 5664 5664 0 0.0
FLASH 5943813 5947669 3856 0.1
RAM 595984 595984 0 0.0
tv-casting-app debug unknown 5232 5232 0 0.0
FLASH 11061613 11065469 3856 0.0
RAM 693096 693096 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 914884 915072 188 0.0
RAM 143289 143289 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 887340 887548 208 0.0
RAM 141476 141476 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 849080 849272 192 0.0
RAM 142197 142197 0 0.0
nxp contact k32w0+release FLASH 584128 584312 184 0.0
RAM 71048 71048 0 0.0
mcxw71+release FLASH 598664 598864 200 0.0
RAM 63144 63144 0 0.0
light k32w0+release FLASH 611172 611364 192 0.0
RAM 70440 70440 0 0.0
k32w1+release FLASH 684976 685184 208 0.0
RAM 48776 48776 0 0.0
lock mcxw71+release FLASH 748512 748720 208 0.0
RAM 67300 67300 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1642476 1642876 400 0.0
RAM 212064 212064 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1550468 1550844 376 0.0
RAM 208864 208864 0 0.0
light cy8ckit_062s2_43012 FLASH 1466620 1467012 392 0.0
RAM 200848 200848 0 0.0
lock cy8ckit_062s2_43012 FLASH 1464796 1465188 392 0.0
RAM 225208 225208 0 0.0
qpg lighting-app qpg6105+debug FLASH 662144 662328 184 0.0
RAM 105384 105384 0 0.0
lock-app qpg6105+debug FLASH 620244 620436 192 0.0
RAM 99836 99836 0 0.0
stm32 light STM32WB5MM-DK FLASH 482944 483128 184 0.0
RAM 144848 144848 0 0.0
telink bridge-app tlsr9258a FLASH 684686 684938 252 0.0
RAM 91536 91536 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 622694 622946 252 0.0
RAM 50472 50472 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 710624 710876 252 0.0
RAM 73812 73812 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 628992 629244 252 0.0
RAM 145392 145392 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 814880 815132 252 0.0
RAM 100012 100012 0 0.0
tizen all-clusters-app arm unknown 4952 4956 4 0.1
FLASH 1721608 1724268 2660 0.2
RAM 90628 90640 12 0.0
chip-tool-ubsan arm unknown 10800 10804 4 0.0
FLASH 17982062 17989870 7808 0.0
RAM 7845176 7849640 4464 0.1

/// Returns the status of ACL validation.
/// if the status is set, the status is FINAL (i.e. permanent failure OR success due to path expansion logic.)
/// if the status is not set, the processing can continue
std::optional<CHIP_ERROR> ValidateReadACL(DataModel::Provider * dataModel, const Access::SubjectDescriptor & subjectDescriptor,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::optional<CHIP_ERROR> ValidateReadACL(DataModel::Provider * dataModel, const Access::SubjectDescriptor & subjectDescriptor,
std::optional<CHIP_ERROR> ValidateReadAttributeACL(DataModel::Provider * dataModel, const Access::SubjectDescriptor & subjectDescriptor,


std::optional<DataModel::AttributeInfo> info = dataModel->GetAttributeInfo(path);

chip::Access::Privilege requiredPrivilege = chip::Access::Privilege::kView; // default
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all the extra chip:: prefixes?

chip::Access::Privilege requiredPrivilege = chip::Access::Privilege::kView; // default
if (info.has_value() && info->readPrivilege.has_value())
{
// set a default even if we do not know and later report the real error if ACL looks ok
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what this comment is trying to say.

return std::nullopt;
}

// attribute does not exist, however we do not now if this is a unsupported endpoint, cluster or attribute,
Copy link
Contributor

@bzbarsky-apple bzbarsky-apple Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does attribute not exist? All we know is we did an access check and it succeeeded.

This code is not making any sense to me. Stopping here.

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

Successfully merging this pull request may close these issues.

3 participants