Skip to main content

Module pathmap

Module pathmap 

Source
Expand description

Path translation: storage (“real”) paths vs. client-visible shadow paths.

Some deployments do not want real storage layout (directory names, hierarchy, naming habits) to reach the client. A PathCodec converts between the two sides:

  • encode: real → shadow (outbound; response bodies, listings, upload echoes).
  • decode: shadow → real (inbound; request URLs).

Codecs operate on canonical relative paths (what the server’s validate_rel_path produces): no leading /, no ./.., no empty segments. The root is "".

Authorization is unaffected by translation: the server validates the real path against allowed_paths (see the resolve_client_path helper in libfw-server), so claims always apply to the real path.

Hierarchical composition: resolve_client_path also accepts a shadow with literal child segments appended ({dirShadow}/sub/file): it decodes the longest decodable segment prefix and appends the remainder verbatim, then authorizes the combined real path — a directory shadow covers its whole subtree, with no per-path shadow minting. Whole-string codecs such as EncryptedPathCodec get this for free; prefix codecs like MountPathCodec already behave that way natively.

§Codecs

CodecShadow looks likeUse when
IdentityPathCodecthe real pathdefault; no translation
EncryptedPathCodecv1.<base64url> opaque blobreal paths must be hidden completely
MountPathCodeca readable alias (home/alice/…)readable, stable shadow namespaces

Structs§

EncryptedPathCodec
Encrypting codec: shadow paths are opaque v1.<base64url> blobs.
IdentityPathCodec
The default codec: shadow paths are real paths. No translation.
MountPathCodec
Prefix-mapping codec: readable shadow namespaces backed by real subtrees.

Enums§

PathCodecError
Error decoding a client-supplied shadow path back to a real path.

Traits§

PathCodec
Converts between real storage paths and client-visible shadow paths.