Security and Compliance Notes – Secrets and PII
This section outlines how the Prep Network Events platform secures sensitive information and maintains compliance regarding secrets management and personally identifiable information (PII).
Environment-Driven Secrets Management 🔒
All third-party credentials reside outside of code, preventing accidental exposure. Laravel loads them from environment variables, centralizing sensitive data handling.
Key aspects:
- Separation of code and credentials: No API keys or secrets are hard-coded.
- Environment files:
.env(and environment-specific variants) hold all secret values. - Config/services.php: Maps each service to its respective environment variables .
// config/services.php
return [
'google' => [
'map_key' => env('GOOGLE_MAPS_API_KEY'),
'recaptcha_site' => env('GOOGLE_RECAPTCHA_SITE_KEY'),
'recaptcha_secret' => env('GOOGLE_RECAPTCHA_SECRET_KEY'),
],
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
],
'stripe' => [
'model' => App\Models\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
'webhook' => [
'secret' => env('STRIPE_PAYMENT_WEBHOOK_SECRET'),
'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300),
],
],
'twilio' => [
'account' => env('TWILIO_ACCOUNT_SID'),
'token' => env('TWILIO_AUTH_TOKEN'),
'from' => env('TWILIO_FROM'),
'message_service' => env('TWILIO_MESSAGE_SERVICE'),
],
// ... additional services ...
'sentry' => [
'api_key' => env('SENTRY_API_KEY'),
],
];
| Service | Env Variable(s) | Purpose |
|---|---|---|
| Google Maps & ReCAPTCHA | GOOGLE_MAPS_API_KEYGOOGLE_RECAPTCHA_* |
Mapping and bot protection |
| Mailgun | MAILGUN_DOMAINMAILGUN_SECRET |
Email delivery |
| SparkPost | SPARKPOST_SECRET |
Alternative email service |
| Stripe | STRIPE_KEYSTRIPE_SECRETSTRIPE_PAYMENT_WEBHOOK_SECRET |
Payment processing & webhooks |
| Twilio | TWILIO_ACCOUNT_SIDTWILIO_AUTH_TOKEN |
SMS/Text messaging |
| PN Data | PN_DATA_URLPN_DATA_TOKEN |
Internal data API |
| Vertical Insurance | VI_IDVI_SECRET |
Insurance integration |
| WordPress | WORDPRESS_USERWORDPRESS_PASSWORD |
CMS synchronization |
| Shopify | VKTRY_KEYMOOLAH_KEY |
E-commerce integrations |
| Event Connect | EVENT_CONNECT_TOKEN |
Third-party event syncing |
| Sentry | SENTRY_API_KEY |
Error reporting |
PII Protection via Sentry Configuration 🛡️
To prevent unintentional leakage of PII in error reports, Sentry’s default behavior is disabled:
// config/sentry.php
return [
'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
'environment' => env('SENTRY_ENVIRONMENT'),
'breadcrumbs' => [
'logs' => true,
'sql_queries' => true,
'queue_info' => true,
'command_info' => true,
],
// Disable sending user PII by default
'send_default_pii' => false,
'traces_sample_rate' => floatval(env('SENTRY_TRACES_SAMPLE_RATE', 0.0)),
];
- send_default_pii set to
falseensures user identifiers and other PII are not sent by default . - Developers can opt-in to additional data on a per-use basis, following strict review.
HTTPS Enforcement in Production 🌐
All traffic in production is forced over HTTPS, safeguarding data in transit and complying with industry standards.
Implemented in the application bootstrap:
// app/Providers/AppServiceProvider.php
public function boot(): void
{
require_once __DIR__.'/../Http/helpers.php';
Illuminate\Pagination\Paginator::useBootstrap();
if ($this->app->environment('production')) {
// Force all generated URLs to use HTTPS
\URL::forceScheme('https');
}
Illuminate\Http\Resources\Json\JsonResource::withoutWrapping();
}
- The
forceScheme('https')call instructs Laravel to generate secure links and redirects . - Ensures compliance with PCI-DSS for payment flows and protects PII during transport.
Best Practices & Recommendations
- Never commit
.envfiles or secrets to version control. - Rotate credentials regularly and on each personnel change.
- Leverage a secrets manager (e.g., AWS Secrets Manager, Vault) in higher-security environments.
- Audit logs for access to secret stores and Sentry settings changes.
- Enforce least privilege for all service accounts and tokens.
- Regularly review
send_default_piiand opt-in sparingly, only for debugging critical issues.
Adhering to these patterns ensures that secrets remain confidential, PII is protected, and all production communications stay secure.