BigCommerce Security
Before writing code
Fetch live docs:
- Web-search
site:developer.bigcommerce.com security authentication for auth security
- Web-search
bigcommerce app security best practices for app security
- Web-search
bigcommerce pci compliance for PCI guidance
API Authentication Security
Token Management
- Never expose API tokens in client-side code or public repositories
- Store tokens in environment variables or encrypted secret stores
- Use separate tokens for development and production
- Rotate tokens periodically
- Use minimum required OAuth scopes (principle of least privilege)
Token Types
| Token Type |
Security Level |
Storage |
| API Account Token |
Highest — full API access |
Server-side only, encrypted |
| OAuth App Token |
High — scoped access |
Server-side, per-store |
| Storefront API Token |
Medium — read-only storefront data |
Client-side OK (limited scope) |
| Customer Impersonation Token |
High — customer data access |
Server-side only |
Rate Limiting as Security
Rate limits prevent abuse:
- Monitor
X-Rate-Limit-Requests-Left header
- Implement exponential backoff
- Never retry 401/403 responses (authentication/authorization failures)
OAuth Security
JWT Verification
Always verify JWTs in Load, Uninstall, and Remove User callbacks:
- Verify signature using your Client Secret (HMAC-SHA256)
- Check
iss (issuer) matches BigCommerce
- Check
exp (expiration) — reject expired tokens
- Check
aud (audience) matches your Client ID
- Extract
store_hash and user only after verification
Callback URL Security
- Use HTTPS for all callback URLs
- Validate the
state parameter in OAuth flows to prevent CSRF
- Don't accept arbitrary redirect URLs — whitelist allowed paths
Token Storage
- Encrypt OAuth access tokens at rest in your database
- Associate tokens with store hash — verify on every API call
- Handle token revocation (when app is uninstalled)
- Don't log tokens in application logs
Webhook Security
Verification
BigCommerce doesn't sign webhook payloads with HMAC, so:
Webhook Handler Security
- Respond with 200 OK quickly — don't process inline
- Validate payload structure before processing
- Use idempotency (check
hash field) to prevent replay attacks
- Don't trust the
data.id blindly — verify by fetching the resource via API
- Rate limit your webhook handler to prevent flood attacks
Content Security Policy (CSP)
For Embedded Apps
When your app loads in the BigCommerce admin iframe:
- Set
Content-Security-Policy: frame-ancestors 'self' *.bigcommerce.com
- Or use
X-Frame-Options: ALLOW-FROM https://store-{hash}.mybigcommerce.com
- Block framing from unauthorized domains
For Stencil Themes
Add CSP headers via Script Manager or theme configuration to restrict:
script-src — allowed script sources
style-src — allowed style sources
img-src — allowed image sources
connect-src — allowed API endpoints
Input Validation
API Input
- Validate all data before sending to BigCommerce API
- Sanitize user input — escape HTML, validate types
- Validate email formats, phone numbers, postal codes
- Enforce maximum lengths for text fields
Webhook Input
- Validate JSON structure of incoming payloads
- Verify resource IDs are numeric and within expected range
- Don't use webhook data directly — fetch fresh data via API
Stencil Theme Input
- Escape all dynamic content in Handlebars templates (auto-escaping by default)
- Use
{{{raw_html}}} triple-braces only for trusted content
- Sanitize any user-generated content before rendering
PCI Compliance
Reducing Scope
BigCommerce is PCI DSS Level 1 compliant as a platform:
- Native/Embedded Checkout — BigCommerce handles payment form rendering → you're out of PCI scope
- Custom Checkout with tokenized payments — use gateway JS SDKs (Stripe Elements, etc.) → minimal PCI scope
- Custom Checkout with raw card data — requires full PCI DSS compliance for your infrastructure
Recommendations
- Use Embedded Checkout for headless — simplest PCI path
- Never log, store, or transmit raw card data
- Use tokenized payment methods in the Payments API
- Serve all pages over HTTPS
App Marketplace Security Requirements
For Marketplace Submission
- HTTPS for all endpoints
- Proper JWT verification on all callbacks
- Secure token storage (encrypted at rest)
- Handle uninstall callback (clean up data)
- No hardcoded credentials in source code
- OWASP Top 10 compliance
Best Practices
- Store API tokens encrypted, never in code or logs
- Verify JWTs on every callback — check signature, expiry, audience
- Use custom webhook headers for verification
- Validate and sanitize all input — from users, webhooks, and APIs
- Use Embedded Checkout or tokenized payments to minimize PCI scope
- Set CSP headers for iframe embedding
- Implement rate limiting on your webhook handlers
- Rotate credentials periodically
- Use separate credentials per environment (dev/staging/production)
- Audit third-party dependencies for known vulnerabilities
Fetch the BigCommerce security documentation and app review requirements for exact JWT verification patterns, CSP configuration, and current security best practices before implementing.
1---2name: bc-security3description: Implement BigCommerce security — OAuth token management, API authentication, webhook verification, CSP, input validation, PCI compliance, and app security best practices. Use when hardening integrations or reviewing security posture.4allowed-tools: Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch5metadata:6 source: https://skillmd.com/skills/orcaqubits/bc-security7---89# BigCommerce Security1011## Before writing code1213**Fetch live docs**:141. Web-search `site:developer.bigcommerce.com security authentication` for auth security152. Web-search `bigcommerce app security best practices` for app security163. Web-search `bigcommerce pci compliance` for PCI guidance1718## API Authentication Security1920### Token Management2122- **Never expose** API tokens in client-side code or public repositories23- Store tokens in environment variables or encrypted secret stores24- Use separate tokens for development and production25- Rotate tokens periodically26- Use minimum required OAuth scopes (principle of least privilege)2728### Token Types2930| Token Type | Security Level | Storage |31|------------|---------------|---------|32| API Account Token | Highest — full API access | Server-side only, encrypted |33| OAuth App Token | High — scoped access | Server-side, per-store |34| Storefront API Token | Medium — read-only storefront data | Client-side OK (limited scope) |35| Customer Impersonation Token | High — customer data access | Server-side only |3637### Rate Limiting as Security3839Rate limits prevent abuse:40- Monitor `X-Rate-Limit-Requests-Left` header41- Implement exponential backoff42- Never retry 401/403 responses (authentication/authorization failures)4344## OAuth Security4546### JWT Verification4748Always verify JWTs in Load, Uninstall, and Remove User callbacks:49- Verify signature using your Client Secret (HMAC-SHA256)50- Check `iss` (issuer) matches BigCommerce51- Check `exp` (expiration) — reject expired tokens52- Check `aud` (audience) matches your Client ID53- Extract `store_hash` and `user` only after verification5455### Callback URL Security5657- Use HTTPS for all callback URLs58- Validate the `state` parameter in OAuth flows to prevent CSRF59- Don't accept arbitrary redirect URLs — whitelist allowed paths6061### Token Storage6263- Encrypt OAuth access tokens at rest in your database64- Associate tokens with store hash — verify on every API call65- Handle token revocation (when app is uninstalled)66- Don't log tokens in application logs6768## Webhook Security6970### Verification7172BigCommerce doesn't sign webhook payloads with HMAC, so:73- Use custom headers for basic verification:74 ```json75 { "headers": { "X-Webhook-Secret": "your-shared-secret" } }76 ```77- Verify the header value in your handler78- Validate `store_id` matches expected stores7980### Webhook Handler Security8182- Respond with 200 OK quickly — don't process inline83- Validate payload structure before processing84- Use idempotency (check `hash` field) to prevent replay attacks85- Don't trust the `data.id` blindly — verify by fetching the resource via API86- Rate limit your webhook handler to prevent flood attacks8788## Content Security Policy (CSP)8990### For Embedded Apps9192When your app loads in the BigCommerce admin iframe:93- Set `Content-Security-Policy: frame-ancestors 'self' *.bigcommerce.com`94- Or use `X-Frame-Options: ALLOW-FROM https://store-{hash}.mybigcommerce.com`95- Block framing from unauthorized domains9697### For Stencil Themes9899Add CSP headers via Script Manager or theme configuration to restrict:100- `script-src` — allowed script sources101- `style-src` — allowed style sources102- `img-src` — allowed image sources103- `connect-src` — allowed API endpoints104105## Input Validation106107### API Input108109- Validate all data before sending to BigCommerce API110- Sanitize user input — escape HTML, validate types111- Validate email formats, phone numbers, postal codes112- Enforce maximum lengths for text fields113114### Webhook Input115116- Validate JSON structure of incoming payloads117- Verify resource IDs are numeric and within expected range118- Don't use webhook data directly — fetch fresh data via API119120### Stencil Theme Input121122- Escape all dynamic content in Handlebars templates (auto-escaping by default)123- Use `{{{raw_html}}}` triple-braces only for trusted content124- Sanitize any user-generated content before rendering125126## PCI Compliance127128### Reducing Scope129130BigCommerce is PCI DSS Level 1 compliant as a platform:131- **Native/Embedded Checkout** — BigCommerce handles payment form rendering → you're out of PCI scope132- **Custom Checkout with tokenized payments** — use gateway JS SDKs (Stripe Elements, etc.) → minimal PCI scope133- **Custom Checkout with raw card data** — requires full PCI DSS compliance for your infrastructure134135### Recommendations136137- Use Embedded Checkout for headless — simplest PCI path138- Never log, store, or transmit raw card data139- Use tokenized payment methods in the Payments API140- Serve all pages over HTTPS141142## App Marketplace Security Requirements143144### For Marketplace Submission145146- HTTPS for all endpoints147- Proper JWT verification on all callbacks148- Secure token storage (encrypted at rest)149- Handle uninstall callback (clean up data)150- No hardcoded credentials in source code151- OWASP Top 10 compliance152153## Best Practices154155- Store API tokens encrypted, never in code or logs156- Verify JWTs on every callback — check signature, expiry, audience157- Use custom webhook headers for verification158- Validate and sanitize all input — from users, webhooks, and APIs159- Use Embedded Checkout or tokenized payments to minimize PCI scope160- Set CSP headers for iframe embedding161- Implement rate limiting on your webhook handlers162- Rotate credentials periodically163- Use separate credentials per environment (dev/staging/production)164- Audit third-party dependencies for known vulnerabilities165166Fetch the BigCommerce security documentation and app review requirements for exact JWT verification patterns, CSP configuration, and current security best practices before implementing.