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

Allow subscriptions if wildcard expansion is empty. #34983

Conversation

andy31415
Copy link
Contributor

@andy31415 andy31415 commented Aug 14, 2024

In #22349 we changed logic to say "if no permissions, reject subscription" to preserve resources.

This is however problematic in case some resources will be available in the future, specifically while reviewing tests for MCORE 1.2: we subscribe to all BridgedInformationCluster::UniqueId but without any bridged devices, the paths are empty and expansion fails.

This PR allows subscriptions to continue if subscription finds no path matches (instead of assuming permission error). note that this is still not fully ok: even if we would have some permission failures, nothing says that in the future some things without permission failures may not appear.

Overall it is unclear if we should actually deny subscriptions when we cannot fully guarantee that they will never match a valid request. This may require some spec review and review if #18485 is actually valid.

Changes

  • Update ParseAttributePaths/EventPaths to use a single "out" parameter since several ones (especially if bools) will be easy to mix up
  • Keep track of a "was list empty" for paths, to allow subscribing for paths that are yet to be created
  • Update unit tests after this change

Copy link

Review changes with SemanticDiff.

Copy link

github-actions bot commented Aug 14, 2024

PR #34983: Size comparison from 927f99a to 3a6010b

Full report (46 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, nrfconnect, nxp, psoc6, qpg, stm32, tizen)
platform target config section 927f99a 3a6010b change % change
bl602 lighting-app bl602 FLASH 1278128 1278198 70 0.0
RAM 95928 95928 0 0.0
bl602+mfd FLASH 1292238 1292308 70 0.0
RAM 96072 96072 0 0.0
bl602+rpc FLASH 1317092 1317162 70 0.0
RAM 104352 104352 0 0.0
bl702 lighting-app bl702 FLASH 943988 944064 76 0.0
RAM 15209 15209 0 0.0
bl702+mfd FLASH 946388 946464 76 0.0
RAM 15353 15353 0 0.0
bl702+rpc FLASH 1039044 1039120 76 0.0
RAM 24221 24221 0 0.0
bl706-eth FLASH 646706 646782 76 0.0
RAM 25305 25305 0 0.0
bl706-wifi FLASH 894312 894388 76 0.0
RAM 14525 14525 0 0.0
bl702l lighting-app bl702l FLASH 960392 960468 76 0.0
RAM 16868 16868 0 0.0
bl702l+mfd FLASH 963270 963346 76 0.0
RAM 17012 17012 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 803140 803212 72 0.0
RAM 117628 117628 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 818984 819048 64 0.0
RAM 125220 125220 0 0.0
lock-mtd LP_EM_CC1354P10_6 FLASH 811324 811388 64 0.0
RAM 119500 119500 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 763496 763560 64 0.0
RAM 113648 113648 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 747996 748068 72 0.0
RAM 113840 113840 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 613106 613178 72 0.0
RAM 205404 205404 0 0.0
lock CC3235SF_LAUNCHXL FLASH 655074 655146 72 0.0
RAM 205620 205620 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 672289 672353 64 0.0
RAM 78348 78348 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 692149 692213 64 0.0
RAM 80980 80980 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 692149 692213 64 0.0
RAM 80980 80980 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 649077 649141 64 0.0
RAM 73416 73416 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 610721 610785 64 0.0
RAM 71340 71340 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 630349 630413 64 0.0
RAM 73892 73892 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 630349 630413 64 0.0
RAM 73892 73892 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 628185 628249 64 0.0
RAM 74356 74356 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 647893 647957 64 0.0
RAM 76908 76908 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 647893 647957 64 0.0
RAM 76908 76908 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 601717 601781 64 0.0
RAM 68388 68388 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 621577 621641 64 0.0
RAM 71020 71020 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 621577 621641 64 0.0
RAM 71020 71020 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 909012 909080 68 0.0
RAM 142255 142255 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 880932 880968 36 0.0
RAM 140394 140394 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 840848 840916 68 0.0
RAM 141074 141074 0 0.0
nxp contact k32w0+release FLASH 577372 577452 80 0.0
RAM 70468 70468 0 0.0
k32w1+release FLASH 592680 592744 64 0.0
RAM 74456 74456 0 0.0
light k32w0+release FLASH 612816 612880 64 0.0
RAM 69940 69940 0 0.0
k32w1+release FLASH 677640 677704 64 0.0
RAM 83232 83232 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1639108 1639188 80 0.0
RAM 210952 210952 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1543892 1543956 64 0.0
RAM 207672 207672 0 0.0
light cy8ckit_062s2_43012 FLASH 1463796 1463860 64 0.0
RAM 200776 200776 0 0.0
lock cy8ckit_062s2_43012 FLASH 1462460 1462524 64 0.0
RAM 225112 225112 0 0.0
qpg lighting-app qpg6105+debug FLASH 655908 655972 64 0.0
RAM 105152 105152 0 0.0
lock-app qpg6105+debug FLASH 613248 613312 64 0.0
RAM 99636 99636 0 0.0
stm32 light STM32WB5MM-DK FLASH 478304 478368 64 0.0
RAM 144764 144764 0 0.0
tizen all-clusters-app arm unknown 4808 4808 0 0.0
FLASH 1700832 1700924 92 0.0
RAM 89348 89348 0 0.0
chip-tool-ubsan arm unknown 10236 10236 0 0.0
FLASH 17307046 17307350 304 0.0
RAM 7560508 7560660 152 0.0

@github-actions github-actions bot added the tests label Aug 14, 2024
@@ -462,13 +462,14 @@ Status InteractionModelEngine::OnInvokeCommandRequest(Messaging::ExchangeContext
}

CHIP_ERROR InteractionModelEngine::ParseAttributePaths(const Access::SubjectDescriptor & aSubjectDescriptor,
AttributePathIBs::Parser & aAttributePathListParser,
AttributePathIBs::Parser & aAttributePathListParser, bool & aPathsIsNotEmpty,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Blocker comment to allow time for a careful review on logic on this PR as the underlying assumptions are reasonably deep.

Overall I wonder if we should have the "deny on no ACL" at all throughout ...

Copy link

github-actions bot commented Aug 14, 2024

PR #34983: Size comparison from 927f99a to ae22c25

Full report (19 builds for cc13x4_26x4, cc32xx, nrfconnect, nxp, qpg, stm32, tizen)
platform target config section 927f99a ae22c25 change % change
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 803140 803212 72 0.0
RAM 117628 117628 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 818984 819048 64 0.0
RAM 125220 125220 0 0.0
lock-mtd LP_EM_CC1354P10_6 FLASH 811324 811388 64 0.0
RAM 119500 119500 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 763496 763560 64 0.0
RAM 113648 113648 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 747996 748068 72 0.0
RAM 113840 113840 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 613106 613178 72 0.0
RAM 205404 205404 0 0.0
lock CC3235SF_LAUNCHXL FLASH 655074 655146 72 0.0
RAM 205620 205620 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 909012 909080 68 0.0
RAM 142255 142255 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 880932 880972 40 0.0
RAM 140394 140394 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 840848 840916 68 0.0
RAM 141074 141074 0 0.0
nxp contact k32w0+release FLASH 577372 577452 80 0.0
RAM 70468 70468 0 0.0
k32w1+release FLASH 592680 592744 64 0.0
RAM 74456 74456 0 0.0
light k32w0+release FLASH 612816 612880 64 0.0
RAM 69940 69940 0 0.0
k32w1+release FLASH 677640 677704 64 0.0
RAM 83232 83232 0 0.0
qpg lighting-app qpg6105+debug FLASH 655908 655972 64 0.0
RAM 105152 105152 0 0.0
lock-app qpg6105+debug FLASH 613248 613312 64 0.0
RAM 99636 99636 0 0.0
stm32 light STM32WB5MM-DK FLASH 478304 478368 64 0.0
RAM 144764 144764 0 0.0
tizen all-clusters-app arm unknown 4808 4808 0 0.0
FLASH 1700832 1700924 92 0.0
RAM 89348 89348 0 0.0
chip-tool-ubsan arm unknown 10236 10236 0 0.0
FLASH 17307046 17307350 304 0.0
RAM 7560508 7560660 152 0.0

Copy link

github-actions bot commented Aug 14, 2024

PR #34983: Size comparison from 927f99a to 29d8f4b

Full report (5 builds for cc32xx, stm32, tizen)
platform target config section 927f99a 29d8f4b change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 613106 613138 32 0.0
RAM 205404 205404 0 0.0
lock CC3235SF_LAUNCHXL FLASH 655074 655106 32 0.0
RAM 205620 205620 0 0.0
stm32 light STM32WB5MM-DK FLASH 478304 478312 8 0.0
RAM 144764 144764 0 0.0
tizen all-clusters-app arm unknown 4808 4808 0 0.0
FLASH 1700832 1700904 72 0.0
RAM 89348 89348 0 0.0
chip-tool-ubsan arm unknown 10236 10236 0 0.0
FLASH 17307046 17307838 792 0.0
RAM 7560508 7560836 328 0.0

Copy link

PR #34983: Size comparison from 927f99a to 8fa109f

Full report (7 builds for cc32xx, qpg, stm32, tizen)
platform target config section 927f99a 8fa109f change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 613106 613138 32 0.0
RAM 205404 205404 0 0.0
lock CC3235SF_LAUNCHXL FLASH 655074 655106 32 0.0
RAM 205620 205620 0 0.0
qpg lighting-app qpg6105+debug FLASH 655908 655916 8 0.0
RAM 105152 105152 0 0.0
lock-app qpg6105+debug FLASH 613248 613256 8 0.0
RAM 99636 99636 0 0.0
stm32 light STM32WB5MM-DK FLASH 478304 478312 8 0.0
RAM 144764 144764 0 0.0
tizen all-clusters-app arm unknown 4808 4808 0 0.0
FLASH 1700832 1700904 72 0.0
RAM 89348 89348 0 0.0
chip-tool-ubsan arm unknown 10236 10236 0 0.0
FLASH 17307046 17307838 792 0.0
RAM 7560508 7560836 328 0.0

Copy link
Contributor

@woody-apple woody-apple left a comment

Choose a reason for hiding this comment

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

Approving, but needs review.

Copy link

github-actions bot commented Aug 14, 2024

PR #34983: Size comparison from e1f29bd to 6945873

Full report (84 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section e1f29bd 6945873 change % change
bl602 lighting-app bl602 FLASH 1278128 1278158 30 0.0
RAM 95928 95928 0 0.0
bl602+mfd FLASH 1292238 1292268 30 0.0
RAM 96072 96072 0 0.0
bl602+rpc FLASH 1317092 1317122 30 0.0
RAM 104352 104352 0 0.0
bl702 lighting-app bl702 FLASH 943988 944002 14 0.0
RAM 15209 15209 0 0.0
bl702+mfd FLASH 946388 946402 14 0.0
RAM 15353 15353 0 0.0
bl702+rpc FLASH 1039044 1039058 14 0.0
RAM 24221 24221 0 0.0
bl706-eth FLASH 646706 646720 14 0.0
RAM 25305 25305 0 0.0
bl706-wifi FLASH 894312 894322 10 0.0
RAM 14525 14525 0 0.0
bl702l lighting-app bl702l FLASH 960392 960406 14 0.0
RAM 16868 16868 0 0.0
bl702l+mfd FLASH 963270 963284 14 0.0
RAM 17012 17012 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 803140 803148 8 0.0
RAM 117628 117628 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 818984 818992 8 0.0
RAM 125220 125220 0 0.0
lock-mtd LP_EM_CC1354P10_6 FLASH 811324 811332 8 0.0
RAM 119500 119500 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 763496 763504 8 0.0
RAM 113648 113648 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 747996 748004 8 0.0
RAM 113840 113840 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 613106 613138 32 0.0
RAM 205404 205404 0 0.0
lock CC3235SF_LAUNCHXL FLASH 655074 655106 32 0.0
RAM 205620 205620 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 672289 672297 8 0.0
RAM 78348 78348 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 692149 692157 8 0.0
RAM 80980 80980 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 692149 692157 8 0.0
RAM 80980 80980 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 649077 649085 8 0.0
RAM 73416 73416 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 610721 610729 8 0.0
RAM 71340 71340 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 630349 630357 8 0.0
RAM 73892 73892 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 630349 630357 8 0.0
RAM 73892 73892 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 628185 628193 8 0.0
RAM 74356 74356 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 647893 647901 8 0.0
RAM 76908 76908 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 647893 647901 8 0.0
RAM 76908 76908 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 601717 601725 8 0.0
RAM 68388 68388 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 621577 621585 8 0.0
RAM 71020 71020 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 621577 621585 8 0.0
RAM 71020 71020 0 0.0
efr32 lighting-app BRD4187C FLASH 930312 930304 -8 -0.0
RAM 135144 135144 0 0.0
lock-app BRD4338a FLASH 737468 737492 24 0.0
RAM 207864 207864 0 0.0
window-app BRD4187C FLASH 1015444 1015468 24 0.0
RAM 127084 127084 0 0.0
esp32 all-clusters-app c3devkit DRAM 94176 94176 0 0.0
FLASH 1533510 1533520 10 0.0
IRAM 82538 82538 0 0.0
m5stack DRAM 115104 115104 0 0.0
FLASH 1543238 1543262 24 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4624 4624 0 0.0
FLASH 2754677 2754763 86 0.0
RAM 128408 128408 0 0.0
all-clusters-app debug unknown 5408 5408 0 0.0
FLASH 6036734 6036820 86 0.0
RAM 509704 509704 0 0.0
all-clusters-minimal-app debug unknown 5304 5304 0 0.0
FLASH 5375786 5375872 86 0.0
RAM 240072 240072 0 0.0
bridge-app debug unknown 5288 5288 0 0.0
FLASH 4728474 4728560 86 0.0
RAM 216952 216952 0 0.0
chip-tool debug unknown 5832 5832 0 0.0
FLASH 12488074 12488160 86 0.0
RAM 557202 557202 0 0.0
chip-tool-ipv6only arm64 unknown 20312 20312 0 0.0
FLASH 11163580 11163676 96 0.0
RAM 607272 607272 0 0.0
fabric-admin debug unknown 5672 5672 0 0.0
FLASH 11199311 11199397 86 0.0
RAM 554706 554706 0 0.0
fabric-bridge-app debug unknown 4520 4520 0 0.0
FLASH 4539238 4539324 86 0.0
RAM 203456 203456 0 0.0
lighting-app debug+rpc+ui unknown 5936 5936 0 0.0
FLASH 5663041 5663121 80 0.0
RAM 228008 228008 0 0.0
lock-app debug unknown 5224 5224 0 0.0
FLASH 4783222 4783308 86 0.0
RAM 203736 203736 0 0.0
ota-provider-app debug unknown 4600 4600 0 0.0
FLASH 4423294 4423380 86 0.0
RAM 197720 197720 0 0.0
ota-requestor-app debug unknown 4536 4536 0 0.0
FLASH 4561912 4561998 86 0.0
RAM 202256 202256 0 0.0
shell debug unknown 4176 4176 0 0.0
FLASH 3076221 3076301 80 0.0
RAM 159200 159200 0 0.0
thermostat-no-ble arm64 unknown 9352 9352 0 0.0
FLASH 4363556 4363652 96 0.0
RAM 242416 242416 0 0.0
tv-app debug unknown 5496 5496 0 0.0
FLASH 6006501 6006581 80 0.0
RAM 582968 582968 0 0.0
tv-casting-app debug unknown 5168 5168 0 0.0
FLASH 10691981 10692061 80 0.0
RAM 644280 644280 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 909012 909024 12 0.0
RAM 142255 142255 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 880932 880964 32 0.0
RAM 140394 140394 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 840848 840860 12 0.0
RAM 141074 141074 0 0.0
nxp contact k32w0+release FLASH 577372 577388 16 0.0
RAM 70468 70468 0 0.0
k32w1+release FLASH 592680 592688 8 0.0
RAM 74456 74456 0 0.0
light k32w0+release FLASH 612816 612816 0 0.0
RAM 69940 69940 0 0.0
k32w1+release FLASH 677640 677648 8 0.0
RAM 83232 83232 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1639108 1639140 32 0.0
RAM 210952 210952 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1543892 1543924 32 0.0
RAM 207672 207672 0 0.0
light cy8ckit_062s2_43012 FLASH 1463796 1463828 32 0.0
RAM 200776 200776 0 0.0
lock cy8ckit_062s2_43012 FLASH 1462460 1462492 32 0.0
RAM 225112 225112 0 0.0
qpg lighting-app qpg6105+debug FLASH 655908 655916 8 0.0
RAM 105152 105152 0 0.0
lock-app qpg6105+debug FLASH 613248 613256 8 0.0
RAM 99636 99636 0 0.0
stm32 light STM32WB5MM-DK FLASH 478304 478312 8 0.0
RAM 144764 144764 0 0.0
telink air-quality-sensor-app tlsr9528a_retention FLASH 620118 620128 10 0.0
RAM 50940 50940 0 0.0
all-clusters-app tlsr9118bdk40d FLASH 680630 680640 10 0.0
RAM 149592 149592 0 0.0
all-clusters-minimal-app tlsr9528a FLASH 773898 773908 10 0.0
RAM 110752 110752 0 0.0
bridge-app tlsr9258a FLASH 678806 678816 10 0.0
RAM 91636 91636 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 621714 621724 10 0.0
RAM 50980 50980 0 0.0
light-switch-app-ota-shell-factory-data tlsr9528a FLASH 707596 707606 10 0.0
RAM 74320 74320 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 620640 620650 10 0.0
RAM 145580 145580 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 806726 806736 10 0.0
RAM 99504 99504 0 0.0
lock-app-dfu tlsr9528a FLASH 654586 654596 10 0.0
RAM 67016 67016 0 0.0
ota-requestor-app tlsr9258a FLASH 696822 696832 10 0.0
RAM 91320 91320 0 0.0
pump-app-usb tlsr9518adk80d FLASH 631102 631112 10 0.0
RAM 55760 55760 0 0.0
pump-controller-app tlsr9518adk80d FLASH 608612 608622 10 0.0
RAM 53004 53004 0 0.0
shell tlsr9518adk80d FLASH 466810 466810 0 0.0
RAM 68660 68660 0 0.0
smoke_co_alarm-app tlsr9528a_retention FLASH 628502 628512 10 0.0
RAM 52700 52700 0 0.0
temperature-measurement-app-mars-ota tlsr9518adk80d FLASH 652482 652492 10 0.0
RAM 56640 56640 0 0.0
thermostat tlsr9518adk80d FLASH 633666 633676 10 0.0
RAM 53400 53400 0 0.0
window-covering tlsr9118bdk40d FLASH 522646 522656 10 0.0
RAM 98540 98540 0 0.0
tizen all-clusters-app arm unknown 4808 4808 0 0.0
FLASH 1700832 1700904 72 0.0
RAM 89348 89348 0 0.0
chip-tool-ubsan arm unknown 10236 10236 0 0.0
FLASH 17307046 17307838 792 0.0
RAM 7560508 7560836 328 0.0

@ksperling-apple
Copy link
Contributor

With respect to the potential denial of service (https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/5219), we could require that the client node has access to anything at all on the device (rather than specifically to something matching the wildcard)

@@ -796,7 +798,8 @@ Protocols::InteractionModel::Status InteractionModelEngine::OnReadInitialRequest
return Status::InvalidAction;
}

if (!hasValidAttributePath && !hasValidEventPath)
if (!(attributePathInfo.hasValidPath || eventPathInfo.hasValidPath ||
Copy link
Contributor

Choose a reason for hiding this comment

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

If there are valid paths, then we know the client has some level of access. If all paths are empty, we can instead check if the client has access to anything at all (i.e. there is some ACL entry referencing the client). Or we could check for read access to the Descriptor cluster. Arguably wildcard expansion implicitly requires read access to the descriptor cluster anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is descriptor cluster access sufficient to check? If so we could update to that.

Otherwise generically I can only say "this is a real client, some data could be accessible at some time in the future theoretically" so if that is the case, we should never actually deny this as we do here. But that undoes the original PR that allows auto-rejection.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thinking about this more, maybe wildcard expansion should actually explicitly check for access to the descriptor cluster anyway? It's a little strange that we're allowing information from the Descriptor cluster to be revealed when access to it hasn't necessarily been granted. On the other hand starting to enforce this now might break existing ACLs out there. But if we're treating information from the Descriptor cluster as special in this way maybe we should make this explicit in the spec, e.g. by having read access to the descriptor cluster be implicitly granted on any endpoints the client can access.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's been a while since I waded into the spec (would need @tcarmelveilleux or @bzbarsky-apple's input here), but wildcard expansion is a server-side operation, and doesn't require the client have descriptor access I'd think. It's reasonable I'd think for a client to not have privilege to the descriptor cluster, and upon expansion, the server realize this.

A client could have access to just say, OnOff cluster, and request a wildcard, and correctly, be returned just the OnOff cluster on all matching endpoints.

@ksperling-apple
Copy link
Contributor

Actually looking at the spec again, 8.4.3.2. Incoming Read Request and Subscribe Request Action Processing seems to say that Request Path Expansion happens during processing of the Subscribe Request. Do we need to fix the spec here to even allow / mandate the wildcards to be expanded at reporting time instead of at subscription time?

@andy31415
Copy link
Contributor Author

Actually looking at the spec again, 8.4.3.2. Incoming Read Request and Subscribe Request Action Processing seems to say that Request Path Expansion happens during processing of the Subscribe Request. Do we need to fix the spec here to even allow / mandate the wildcards to be expanded at reporting time instead of at subscription time?

Spec has to specify expansion at reporting time because expansion at subscription time cannot be kept in memory: many generic controllers will do a full wildcard subscribe and asking devices to keep track of every possible attribute and event path seems super painful (events are even dynamic, you do not know their paths in advance). Furthermore, asking controllers to re-subscribe on every new endpoint addition also sounds like going down a wrong path.

@andy31415
Copy link
Contributor Author

Closing for now: apparently this DOES have spec backing:

...
If this action is in response to a Subscribe Request action,
  - If both AttributeRequests and EventRequests are empty
    - a Status Response Action with the INVALID_ACTION Status Code SHALL be sent to the initiator,
...

It is unfortunate in my mind, however changing behavirour has probably more significant sideffects.

@andy31415 andy31415 closed this Aug 15, 2024
@bzbarsky-apple
Copy link
Contributor

@andy31415 Yes, this is explicitly done in the spec so that clients with no access granted at all cannot DoS a device by creating subscriptions and evicting subscriptions from clients that do have access granted.

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.

5 participants