```ts
/**
 * The KEY=VALUE pairs of a config file, ignoring blank lines and comments.
 */
export function parseConfig(text: string): Record<string, string> {
  const config: Record<string, string> = {};
  for (const line of text.split("\n")) {
    const trimmedLine = line.trim();
    if (!trimmedLine || trimmedLine.startsWith("#")) {
      continue;
    }
    const index = trimmedLine.indexOf("=");
    if (index === -1) {
      throw new Error(`Invalid config line: ${line}`);
    }
    const key = trimmedLine.substring(0, index).trim();
    if (key === "__proto__") {
      throw new Error("__proto__ is not allowed as a config key");
    }
    if (!key) {
      throw new Error("Empty key in config line");
    }
    const value = trimmedLine.substring(index + 1).trim();
    config[key] = value;
  }
  return config;
}
```