Most static findings are false positives caused by Markdown code examples, inline backticks, localhost URLs, and ordinary architecture terms. The confirmed security issue is guidance that places an OpenAI API key in frontend public configuration, with additional semantic concerns around browser token storage and development test-token bypasses. No prompt injection attempt was found in the reviewed skill files.
- `NEXT_PUBLIC_OPENAI_API_KEY` = Optional (if frontend needs direct OpenAI access)
The guidance suggests NEXT_PUBLIC_OPENAI_API_KEY for frontend use, which would expose an OpenAI secret in browser-visible code if copied. This is a real credential exposure risk, not just a placeholder mention.
The .env.local example places NEXT_PUBLIC_OPENAI_API_KEY with an sk-style placeholder in frontend configuration. NEXT_PUBLIC variables are bundled for the browser, so this pattern can leak API credentials.
The documentation recommends NEXT_PUBLIC_OPENAI_API_KEY in frontend configuration. In Next.js, NEXT_PUBLIC values are exposed to the browser, so copying this guidance can leak an OpenAI API key.
The exact variable name appears in frontend environment guidance and includes an sk-style placeholder in the detailed integration guide. The risk follows directly from Next.js public environment variable behavior.
The frontend examples read and write JWT bearer tokens in localStorage and sessionStorage. This pattern can expose sessions to XSS and should be replaced or mitigated for production deployments.
The cited snippets explicitly store and retrieve access tokens from browser storage. This is a known session handling risk, although some applications may accept it with strong XSS controls.
The backend example accepts bearer tokens that start with test-token when the environment is development. This is acceptable for local testing but can become an authentication bypass if the environment gate is misconfigured.
The bypass is explicitly scoped to development, so malicious intent is not evident. The pattern is still risky guidance because a copied or misconfigured deployment could accept forged user IDs.
04
补救措施
本次审计记录了建议的修复措施。实施这些措施是维护者的责任。
FIX-001
高
OpenAI API key is shown as a NEXT_PUBLIC frontend variable.
Remove NEXT_PUBLIC_OPENAI_API_KEY from frontend examples. Keep OpenAI API keys only in backend environment variables and proxy any required calls through authenticated server endpoints.
FIX-002
中
JWT bearer tokens are stored in localStorage and sessionStorage examples.
Prefer HttpOnly, Secure, SameSite cookies or another token handling design with explicit XSS mitigations and short-lived access tokens.
FIX-003
中
Development test-token authentication shortcut could be copied into production.
Remove the shortcut from production examples or guard it with compile-time or deployment-only controls that cannot be enabled by user-controlled configuration.
FIX-004
低
Some examples return raw exception messages to clients.
Return generic client-facing errors and log detailed exceptions server-side with sensitive values redacted.