function renderConnection(connection, user) {
  const replaced = {};
  Object.keys(connection).forEach((key) => {
    // data is an object of values, but values may be top level too
    if (key === 'data') {
      const value = renderConnection(connection.data, user);
      connection.data = value;
    } else {
      const value = connection[key];
      if (typeof value === 'string') {
        replaced[key] = mustache.render(value, { user });
      } else {
        replaced[key] = value;
      }
    }
  });
  return replaced;
}
The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.