UploadPathPolicy
final class UploadPathPolicy (View source)
| internal | UploadFactory and upload storage apply this boundary for configured and custom options. |
Resolves visibility-specific upload roots and rejects paths that escape them or traverse symbolic links.
Constants
| private PRIVATE_ROOT |
|
| private STAGING_ROOT |
|
| private CHUNK_ROOT |
|
Methods
Retains the application paths used to separate public publication from private writable storage.
Normalizes a configured directory and rejects absolute, traversing, control-character, or platform-ambiguous paths.
Returns the absolute storage root assigned to the requested visibility.
Returns the private writable root used for immutable upload snapshots before validation and publication.
Returns the private writable root used for incomplete chunk sessions.
Resolves a safe configured directory below its visibility-specific storage root.
Returns the persisted path relative to the public root or writable storage root.
Rejects deployments where private upload storage is reachable below the configured public web root.
Rejects deployments where upload snapshots could be reached through the public web root.
Rejects deployments where incomplete chunk payloads could be reached through the public web root.
Rejects runtime targets outside their assigned root or behind any symbolic-link path component.
Rejects staging directories outside the private staging root or behind symbolic-link components.
Rejects chunk storage paths outside the private root or behind symbolic-link components.
Details
__construct
__construct(ApplicationContext $context)
Retains the application paths used to separate public publication from private writable storage.
normalizeRelativeDirectory
static string
normalizeRelativeDirectory(string $directory)
Normalizes a configured directory and rejects absolute, traversing, control-character, or platform-ambiguous paths.
root
string
root(UploadVisibility $visibility)
Returns the absolute storage root assigned to the requested visibility.
stagingRoot
string
stagingRoot()
Returns the private writable root used for immutable upload snapshots before validation and publication.
chunkRoot
string
chunkRoot()
Returns the private writable root used for incomplete chunk sessions.
targetDirectory
string
targetDirectory(UploadVisibility $visibility, string $relativeDirectory)
Resolves a safe configured directory below its visibility-specific storage root.
storedRelativeDirectory
string
storedRelativeDirectory(UploadVisibility $visibility, string $relativeDirectory)
Returns the persisted path relative to the public root or writable storage root.
assertStorageRootsSeparated
void
assertStorageRootsSeparated()
Rejects deployments where private upload storage is reachable below the configured public web root.
assertStagingRootSeparated
void
assertStagingRootSeparated()
Rejects deployments where upload snapshots could be reached through the public web root.
assertChunkRootSeparated
void
assertChunkRootSeparated()
Rejects deployments where incomplete chunk payloads could be reached through the public web root.
assertTargetDirectory
void
assertTargetDirectory(string $targetDirectory, UploadVisibility $visibility)
Rejects runtime targets outside their assigned root or behind any symbolic-link path component.
assertStagingDirectory
void
assertStagingDirectory(string $directory)
Rejects staging directories outside the private staging root or behind symbolic-link components.
assertChunkDirectory
void
assertChunkDirectory(string $directory)
Rejects chunk storage paths outside the private root or behind symbolic-link components.