Security Model, Scoping, and Blast Radius Reduction
The Four Scoping Dimensions
Every presigned URL should be scoped across four dimensions. Object scope limits access to a specific key or prefix. Signing uploads/user-123/profile.jpg prevents accessing other users files. Operation scope restricts to GET or PUT. A download URL cannot become an upload URL. Time scope sets expiration, typically 300-900 seconds for production. Longer times increase leak risk. Size scope for uploads sets content length conditions to prevent abuse.
Blast Radius Analysis
Consider what happens when a URL leaks. A poorly scoped URL might grant: access to any object in a bucket, ability to list objects, upload capability, and unlimited time. A well scoped URL limits damage to: one specific object, read or write not both, 5 minute window, no list or delete capability. A leaked poorly scoped URL could expose millions of files. A well scoped URL exposes one file briefly.
Credential Scope vs URL Scope
Presigned URLs inherit permissions from signing credentials. If you sign with root keys that can access all buckets, the URL inherits that broad scope regardless of intent. This creates layered security requirements. The signing credentials should have minimal permissions scoped to specific prefixes. Even with broad credential access, the URL should request specific scope. Network controls like VPC endpoints add another defense layer.
Audit and Detection
Scoping alone is insufficient without visibility. Log all URL generation with: requesting identity, requested scope, expiration time, and request context. Alert on anomalies: unusual object patterns, high generation rates, access from unexpected regions. Correlate generation logs with access logs to detect leaked URLs used from multiple IPs or regions. This detection transforms a leak from unknown breach to contained incident with clear scope.