Skip to content

fix: apply traversal-safe path normalization to direct-fetch asset fallback - #5

Open
Smeagol1907 wants to merge 1 commit into
AxisAIOrg:mainfrom
Smeagol1907:Smeagol1907-patch-1
Open

fix: apply traversal-safe path normalization to direct-fetch asset fallback#5
Smeagol1907 wants to merge 1 commit into
AxisAIOrg:mainfrom
Smeagol1907:Smeagol1907-patch-1

Conversation

@Smeagol1907

Copy link
Copy Markdown

loadMuJoCoAssets() extracts texture/mesh file paths from task XML via
/ attributes, then loads each asset
either from a zip index or by falling back to a direct fetch.

The zip-lookup path is traversal-safe: buildZipCandidates() calls
normalizeZipPath(), which strips ".." segments before using the path as a
map key. The direct-fetch fallback, however, used the raw assetPath
straight from the regex-extracted XML attribute with no normalization at
all, before concatenating it into ${apiBase}/${apiPath} and fetching it.

I haven't been able to confirm end-to-end whether task XML is ever
attacker-influenced in the production task-authoring flow (the task
generation tooling in this org looks server-side/offline from what's
public), so I can't say for certain this is reachable by an external
attacker today. Still, it's an inconsistency worth closing: one code path
in the same function treats this exact string as untrusted and sanitizes
it, the other doesn't.

Fix: normalize assetPath through the same normalizeZipPath() function
before it's used for either the zip lookup or the direct-fetch fallback,
so both paths get identical treatment. Verified normal paths pass through
unchanged and "../" sequences get safely collapsed rather than escaping
the intended directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant