Project

General

Profile

Bug #12616

${const.dollar} in generic method parameter leads to missing report

Added by François ARMAND 7 months ago. Updated 6 months ago.

Status:
Released
Priority:
N/A
Category:
Web - Compliance & node report
Target version:
Severity:
User visibility:
Effort required:
Priority:
0

Description

The following parameter on generic method "command_execution_result" leads to a missing:

[ ${const.dollar}(touch /tmp/constdollar && echo "enabled") = 'enabled' ]

I'm not sure what started it, but at some point, I also got an unexpected which make sense:

[ $(touch /tmp/constdollar && echo "enabled") = 'enabled' ]              Unexpected
[ ${const.dollar}(touch /tmp/constdollar && echo "enabled") = 'enabled' ] Missing

At least that means that we don't escape correctly the expected report in Rudder side or that the agent send the expanded value where it should not.

Associated revisions

Revision 97a9e63d (diff)
Added by François ARMAND 7 months ago

Fixes #12616: ${const.dollar} in generic method parameter leads to missing report

History

#1 Updated by François ARMAND 7 months ago

I'm not sure what/where to correct that. On the one hand, it seems that the agent should send back the actual value. On the other hand, we are already doing a match on Rudder side between the value we saved as "expected" and the actual agent value, with for ex. variable replaced agent side.

Actually, what we really want is a report id, unique at component value level (with added rules to know if the value actually matches, and the mutliplicity of the reports in the case of a list being processed agent side).

So I propose to add a matching rule in Rudder server for `${const.dollar} == $`

#2 Updated by François ARMAND 7 months ago

  • Status changed from New to In progress
  • Assignee set to François ARMAND

#3 Updated by François ARMAND 7 months ago

There is something strange with "\" matching in the corresponding code.

In fact, the problem is not with the escape of ${const.dollar}, but with the incorrect escape of regex chars in the value. So () is interpreted as regex char, and are not used in the matches. We need to correctly escape them.

#4 Updated by François ARMAND 7 months ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from François ARMAND to Vincent MEMBRÉ
  • Pull Request set to https://github.com/Normation/rudder/pull/1930

#5 Updated by François ARMAND 7 months ago

The "\" thing was most likely to avoid having "\x" sequence being interpreted as a regex character classes. It was not sufficient at all to avoid problems, and it is not necessary anymore with correct quotation.

#6 Updated by Normation Quality Assistant 7 months ago

  • Assignee changed from Vincent MEMBRÉ to François ARMAND

#7 Updated by François ARMAND 7 months ago

  • Status changed from Pending technical review to Pending release

#8 Updated by Benoît PECCATTE 6 months ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 4.1.12, 4.2.6 and 4.3.1 which were released today.

Also available in: Atom PDF