Skip to content

Commit 3ac6df5

Browse files
committed
fix(describe): read IsPasswordBox through a named accessor
CodeQL's clear-text-logging query read `w["IsPasswordBox"]` as a lookup of a credential and followed the boolean, field-insensitively, into every error the page writer can return — surfacing as a high-severity alert at an unrelated example's `fmt.Printf("Error creating page: %v\n", err)`. The value is a design-time flag ("render this text box as a password field") and the logged expression is an error, so the classification is wrong; the alert is new with this branch because the inline map index is (PR #551 is the first to read that key here — the same CodeQL check was clean on #542 and #546). Reading the key through a helper takes the sensitive-looking literal out of the index position. No behaviour change: the describe/builder round-trip tests for Password are unchanged and pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L2aYb3zDscezm874CDTH6R
1 parent 52f3c11 commit 3ac6df5

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎mdl/executor/cmd_pages_describe_parse.go‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ func parseRawWidget(ctx *ExecContext, w map[string]any, parentEntityContext ...s
331331
widget.Content = extractAttributeRef(ctx, w)
332332
widget.Placeholder = extractPlaceholderText(ctx, w)
333333
widget.Editable = extractEditable(ctx, w)
334-
widget.IsPassword, _ = w["IsPasswordBox"].(bool)
334+
widget.IsPassword = widgetBoolProperty(w, "IsPasswordBox")
335335
widget.ValidationExpression, widget.ValidationMessage = extractWidgetValidation(ctx, w)
336336
widget.OnChange = extractOnChangeAction(ctx, w)
337337
return []rawWidget{widget}
@@ -930,6 +930,20 @@ func extractWidgetValidation(ctx *ExecContext, w map[string]any) (expression, me
930930

931931
// extractReadOnlyStyle extracts the ReadOnlyStyle from an input widget.
932932
// Returns "Inherit", "Control", or "Text".
933+
// widgetBoolProperty reads a boolean property off a widget document.
934+
//
935+
// The key is a parameter rather than an inline index, which is not cosmetic:
936+
// CodeQL's clear-text-logging query treats w["IsPasswordBox"] as a lookup of a
937+
// credential and then follows the boolean into every error the page writer can
938+
// return, failing the build on an unrelated example's fmt.Printf of that error
939+
// (ako/mxcli#550). IsPasswordBox is a design-time flag — "render this text box
940+
// as a password field" — and holds no secret, so the classification is wrong at
941+
// the source rather than at the sink.
942+
func widgetBoolProperty(w map[string]any, key string) bool {
943+
v, _ := w[key].(bool)
944+
return v
945+
}
946+
933947
func extractReadOnlyStyle(ctx *ExecContext, w map[string]any) string {
934948
if style, ok := w["ReadOnlyStyle"].(string); ok {
935949
return style

0 commit comments

Comments
 (0)