Project

General

Profile

Actions

Bug #26138

closed

Undefined variables can lead to unwanted policy overrides

Bug #26138: Undefined variables can lead to unwanted policy overrides

Added by Félix DALLIDET over 1 year ago. Updated 7 months ago.

Status:
Released
Priority:
N/A
Category:
rudderc
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
Checked
Regression:
No

Description

The techniques generated by rudderc do not force the methods to be executed in a specific cfengine "pass".
In cases where a method call uses an undefined variable, cfengine will "loop" several times on the bundle and try each time to execute the method call.
If some policy mode override were defined, the push/pop logic will only be applied on the first "pass", meaning that if a variable is defined after its first usage in a technique,
the cfengine code will execute the method 2 times, but the policy mode override will only be applied to the first occurence.

id: testing_the_audit_bug
name: Testing the audit bug
version: '1.0'
category: ncf_techniques
items:
  - id: b68fe09a-469f-439a-97ca-4e5f72f13a0b
    name: ''
    method: file_content
    params:
      path: /tmp/fda_test
      lines: ${fda.var}
      enforce: 'true'
    policy_mode_override: audit
  - id: 4e2a7f80-aa34-4928-a929-5a1c96c49efb
    name: ''
    method: variable_string
    params:
      prefix: fda
      name: var
      value: plouf

Will produce:

A| non-compliant testing_the_audit_bug     File content              /tmp/fda_test      Insert content into /tmp/fda_test was not correct
E| compliant     testing_the_audit_bug     Variable string           var                Set the string fda.var to value plouf was correct
E| repaired      testing_the_audit_bug     Variable string           var                Insert content into /tmp/fda_test was repaired

A quick and dirty fix to avoid this issue is to force the main bundle of a technique to only do method call in the third and last pass, this way, we are sure that the re-execution is not possible.


Subtasks 2 (0 open2 closed)

Bug #26298: Force the block policy mode override to occur only in pass3ReleasedAlexis MoussetActions
Bug #26301: Missing the pass3 on the 8.3 branchReleasedVincent MEMBRÉActions

Updated by Félix DALLIDET over 1 year ago Actions #1

  • Status changed from New to In progress
  • Assignee set to Félix DALLIDET

Updated by Vincent MEMBRÉ over 1 year ago Actions #2

  • Target version changed from 8.2.4 to 8.2.5

Updated by Félix DALLIDET about 1 year ago Actions #3

  • Status changed from In progress to Pending technical review
  • Assignee changed from Félix DALLIDET to Alexis Mousset
  • Pull Request set to https://github.com/Normation/rudder/pull/6144

Updated by Félix DALLIDET about 1 year ago Actions #4

  • Status changed from Pending technical review to Pending release

Updated by Félix DALLIDET about 1 year ago Actions #5

  • Subtask #26298 added

Updated by Félix DALLIDET about 1 year ago Actions #6

  • Subtask #26301 added

Updated by Alexis Mousset about 1 year ago Actions #7

  • Subject changed from Undefined variables can lead to unwated policy override overrides to Undefined variables can lead to unwanted policy overrides

Updated by Félix DALLIDET about 1 year ago Actions #8

  • Fix check changed from To do to Checked

Updated by Vincent MEMBRÉ about 1 year ago Actions #9

This bug has been fixed in Rudder 8.2.5 which was released today.

Updated by Vincent MEMBRÉ 7 months ago Actions #10

  • Status changed from Pending release to Released
Actions

Also available in: PDF Atom