Runtime state guard: hold a provider reference's node and module to the mesh's name pattern, so no credential rides in one (issue 1126)
mesh/delivery merged: source.main moved to novox/mesh-tools@95a12105cf7b
mesh/check being carried to 2966c1e32c3d on 95a12105cf7b | from 27266f99a3c3

This commit is contained in:
2026-10-28 21:49:52 +01:00
parent 1a0424117a
commit 2966c1e32c
2 changed files with 8 additions and 4 deletions
+5 -2
View File
@@ -432,7 +432,7 @@ func credentialField(value json.RawMessage) string {
return walk(v)
}
// providerReference says whether v is exactly {"node": <string>, "module": <string>}.
// providerReference says whether v is exactly {"node": <name>, "module": <name>}, each a name as mesh-sdk names them.
func providerReference(v any) bool {
m, ok := v.(map[string]any)
if !ok || len(m) != 2 {
@@ -440,5 +440,8 @@ func providerReference(v any) bool {
}
node, okN := m["node"].(string)
module, okM := m["module"].(string)
return okN && okM && node != "" && module != ""
return okN && okM && referenceName.MatchString(node) && referenceName.MatchString(module)
}
// referenceName is a node's or a module's name as mesh-sdk names them: lower case, digits and dashes.
var referenceName = regexp.MustCompile(`^[a-z0-9][a-z0-9-]*$`)