Skip to content

CFE-3294: expose the secret tag and a predicate for it - #6326

Closed
nickanderson wants to merge 3 commits into
cfengine:masterfrom
nickanderson:CFE-3294-tag-introspection/master
Closed

CFE-3294: expose the secret tag and a predicate for it#6326
nickanderson wants to merge 3 commits into
cfengine:masterfrom
nickanderson:CFE-3294-tag-introspection/master

Conversation

@nickanderson

@nickanderson nickanderson commented Aug 19, 2026

Copy link
Copy Markdown
Member

VARIABLE_TAG_SECRET was a private #define in variable.c, so no code outside
that file could ask whether a variable is secret — which is what every caller that
copies a value into a new variable must do before it can propagate the tag.

Moves the constant to variable.h and adds EvalContextVariableIsTaggedSecret()
next to EvalContextVariableTags(). It resolves the variable directly rather than
building a tag set to test one membership.

No behaviour change on its own; the two propagation PRs stacked on it use it.

Stacked on #6304.

EvalContextVariableGet() always returned the plaintext value, so a caller had
no way to ask for a secret-tagged variable to be redacted. Adds a get_secret
parameter and *Plaintext wrappers, and moves every existing caller onto the
plaintext form.

No behaviour change: every call site asks for plaintext, exactly as before.

Ticket: CFE-3293
Changelog: None
EvalContextVariableGet() kept the variable's declared type while returning the
redacted scalar sentinel, so an indexed read of a secret-tagged container --
mydata[key] -- took the container branch and handed that string to
RvalContainerValue(), which aborts with a ProgrammingError. Deriving the type
from the value actually being returned fixes it and removes the separate
type_out special case.

Not reachable yet: no caller passes get_secret=false until the CFE-3294 work.

test_secret_container_redacts_indexed_read aborts (SIGABRT) without this and
passes with it, and asserts the plaintext reads still work so redaction cannot
be faked by breaking container reads.

Ticket: CFE-3293
Changelog: None
VARIABLE_TAG_SECRET was a private #define in variable.c, so no code outside that
file could ask whether a variable is secret -- which is what every caller that
copies a value into a new variable has to do before it can propagate the tag.

Moves the constant to variable.h and adds EvalContextVariableIsTaggedSecret()
next to EvalContextVariableTags(). Answering via a tag set means allocating one
to test a single membership, so this goes straight through VariableResolve().

No behaviour change on its own; the propagation commits that follow use it.

Ticket: CFE-3294
Changelog: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant