Tax exemption certificates are validated where required
Why it matters
A tax exemption flag on the customer record that is granted without any certificate validation — no upload, no expiry check, no certificate number format validation — is an open door for fraudulent exemption claims. US state resale exemption certificate laws (and the Streamlined Sales Tax Agreement for member states) require sellers to retain a valid certificate to defend a tax-free sale during an audit. An expired 2019 resale certificate that still exempts a customer today invalidates the seller's audit defense: the state can assess tax plus penalties on every sale covered by an invalid certificate. CWE-682 applies when the exemption calculation returns $0 on the basis of unvalidated input.
Severity rationale
Low because fraudulent exemption abuse requires deliberate exploitation, but audit liability from accepting expired certificates is a routine compliance risk that scales with B2B transaction volume.
Remediation
Implement certificate validation in lib/tax-exemption.ts before granting exemption:
// lib/tax-exemption.ts
interface TaxExemptCertificate {
id: string
customerId: string
certificateNumber: string
issuerState: string
expiryDate: Date
fileUrl: string // uploaded scan
}
function isCertificateValid(cert: TaxExemptCertificate): boolean {
const expired = new Date(cert.expiryDate) < new Date()
const hasNumber = /^[A-Z0-9-]{5,20}$/.test(cert.certificateNumber)
return !expired && hasNumber && Boolean(cert.fileUrl)
}
function getEffectiveTaxExempt(
customer: Customer,
cert: TaxExemptCertificate | null
): boolean {
if (!customer.is_tax_exempt || !cert) return false
return isCertificateValid(cert)
}
Add the certificate table migration and wire getEffectiveTaxExempt into the checkout tax calculation so exemption requires both a flag and a currently-valid certificate.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Shipping & Tax Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- external · us-state-resale-exemption-certificates — US state exemption certificate requirements — states require valid, non-expired certificates for tax-exempt B2B sales (MTC Uniform Certificate, state-specific forms)
- external · streamlined-sales-tax-agreement-exemption-cert — SSUTA Exemption Certificate rules — member states require certificate validation including expiry and seller verification
- cwe · CWE-682 — Incorrect Calculation
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ecommerce-shipping-tax·automated