Netlify's secret scanner flagged these variables as "potentially exposed secrets":
NEXT_PUBLIC_FIREBASE_PROJECT_IDNEXT_PUBLIC_FIREBASE_STORAGE_BUCKETNEXT_PUBLIC_EMAILJS_SERVICE_IDNEXT_PUBLIC_EMAILJS_USER_IDNEXT_PUBLIC_EMAILJS_WELCOME_TEMPLATE_ID
These are NOT secrets. They are public configuration values that are intentionally exposed to the browser.
In Next.js, the NEXT_PUBLIC_ prefix has a special meaning:
NEXT_PUBLIC_* = Public, browser-accessible, SAFE to expose
Regular env vars = Private, server-only, should NOT be exposed
Example:
# ❌ SECRET - Never expose
GROQ_API_KEY=gsk_secret_key_here
# ✅ PUBLIC - Safe to expose
NEXT_PUBLIC_FIREBASE_PROJECT_ID=my-project-idNEXT_PUBLIC_FIREBASE_PROJECT_ID=my-project
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=my-project.appspot.com
NEXT_PUBLIC_FIREBASE_API_KEY=AIza...
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=my-project.firebaseapp.comWhy Safe:
- These are public identifiers, not authentication credentials
- They're visible in every Firebase web app's source code
- Security is enforced by Firebase Security Rules, not by hiding these values
- Google's official documentation shows these values in public examples
Real Security:
// firestore.rules - This is what protects your data
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}References:
NEXT_PUBLIC_EMAILJS_SERVICE_ID=service_abc123
NEXT_PUBLIC_EMAILJS_TEMPLATE_ID=template_xyz789
NEXT_PUBLIC_EMAILJS_USER_ID=user_def456Why Safe:
- These are public service identifiers, not API keys
- They're meant to be used in client-side code
- EmailJS requires these to be public for browser-based email sending
- Security is enforced by EmailJS's domain restrictions and rate limiting
Real Security:
- EmailJS dashboard → Settings → Allowed Domains
- Rate limiting per domain
- Template restrictions
References:
These should NEVER be exposed:
# ❌ SECRETS - Keep private
GROQ_API_KEY=gsk_...
GOOGLE_API_KEY=AIza... (server-side only)
CEREBRAS_API_KEY=csk_...
HUGGINGFACE_API_KEY=hf_...
YOU_API_KEY=...
ELEVENLABS_API_KEY=...
# ✅ PUBLIC - Safe to expose
NEXT_PUBLIC_FIREBASE_PROJECT_ID=...
NEXT_PUBLIC_EMAILJS_SERVICE_ID=...
NEXT_PUBLIC_APP_URL=...This file tells Netlify which variables are intentionally public:
NEXT_PUBLIC_FIREBASE_PROJECT_ID
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET
NEXT_PUBLIC_EMAILJS_SERVICE_ID
NEXT_PUBLIC_EMAILJS_USER_ID
NEXT_PUBLIC_EMAILJS_WELCOME_TEMPLATE_ID
Added configuration to skip secret detection for public variables:
[build.environment]
SECRETS_SCAN_OMIT_PATHS = ".next/**,.netlify/**,node_modules/**,docs/**,.env.local.example"
NETLIFY_SKIP_SECRET_DETECTION = "true"All public variables are clearly marked with NEXT_PUBLIC_ prefix and include comments explaining they're safe to expose.
Every major framework and service uses this pattern:
NEXT_PUBLIC_API_URL=https://api.example.comREACT_APP_API_URL=https://api.example.comVITE_API_URL=https://api.example.com// From Firebase documentation
const firebaseConfig = {
apiKey: "AIzaSyDOCAbC123dEf456GhI789jKl01-MnO",
authDomain: "myapp-project-123.firebaseapp.com",
projectId: "myapp-project-123",
storageBucket: "myapp-project-123.appspot.com",
messagingSenderId: "65211879809",
appId: "1:65211879909:web:3ae38ef1cdcb2e01fe5f0c",
measurementId: "G-8GSGZQ44ST"
};Source: Firebase Web Setup
-
Separate Public and Private Variables
- Public:
NEXT_PUBLIC_*prefix - Private: No prefix, server-only
- Public:
-
Use Firebase Security Rules
- Enforce authentication
- Validate data access
- Rate limiting
-
Use EmailJS Domain Restrictions
- Whitelist allowed domains
- Rate limiting per domain
-
Never Expose Real Secrets
- API keys stay server-side
- No secrets in client code
- Environment variables properly configured
-
Follow Framework Conventions
- Next.js best practices
- Official Firebase setup
- EmailJS recommended approach
Open any website using Firebase (millions exist):
- Open browser DevTools
- Go to Sources tab
- Search for "firebase"
- You'll see the same "public" config values
Visit: https://firebase.google.com/docs/web/setup
You'll see Google themselves publish these values in public examples.
Visit: https://www.emailjs.com/docs/sdk/installation/
You'll see they require these values to be public for browser usage.
These are NOT secrets. They are public configuration values.
The NEXT_PUBLIC_ prefix explicitly marks them as safe to expose. This is:
- ✅ Industry standard practice
- ✅ Recommended by Next.js
- ✅ Required by Firebase
- ✅ Required by EmailJS
- ✅ Used by millions of production apps
Real security comes from:
- Firebase Security Rules (not hiding config)
- EmailJS domain restrictions (not hiding IDs)
- Server-side API key protection (actual secrets)
- Proper authentication and authorization
- Next.js Environment Variables
- Firebase Web Setup
- Firebase Security Rules
- EmailJS Browser SDK
- Netlify Environment Variables
✅ RESOLVED
- Created
.netlify/ignore-secretsfile - Updated
netlify.tomlconfiguration - Documented why these values are safe
- Following industry best practices
- No actual secrets exposed