{"record":{"id":"8c29b796fcbb633e","repo":"apache/hadoop","slug":"listxattrs-on-path-is-not-within-a-mount-poin","errorCode":null,"errorMessage":"listXAttrs on path `{}' is not within a mount point","messagePattern":"listXAttrs on path `(.+?)' is not within a mount point","errorType":"exception","errorClass":"NotInMountpointException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java","lineNumber":1856,"sourceCode":"    @Override\n    public byte[] getXAttr(Path path, String name) throws IOException {\n      throw new NotInMountpointException(path, \"getXAttr\");\n    }\n\n    @Override\n    public Map<String, byte[]> getXAttrs(Path path) throws IOException {\n      throw new NotInMountpointException(path, \"getXAttrs\");\n    }\n\n    @Override\n    public Map<String, byte[]> getXAttrs(Path path, List<String> names)\n        throws IOException {\n      throw new NotInMountpointException(path, \"getXAttrs\");\n    }\n\n    @Override\n    public List<String> listXAttrs(Path path) throws IOException {\n      throw new NotInMountpointException(path, \"listXAttrs\");\n    }\n\n    @Override\n    public void removeXAttr(Path path, String name) throws IOException {\n      checkPathIsSlash(path);\n      throw readOnlyMountTable(\"removeXAttr\", path);\n    }\n\n    @Override\n    public Path createSnapshot(Path path, String snapshotName)\n        throws IOException {\n      checkPathIsSlash(path);\n      throw readOnlyMountTable(\"createSnapshot\", path);\n    }\n\n    @Override\n    public void renameSnapshot(Path path, String snapshotOldName,\n        String snapshotNewName) throws IOException {","sourceCodeStart":1838,"sourceCodeEnd":1874,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java#L1838-L1874","documentation":"listXAttrs on ViewFileSystem's InternalDirOfViewFs throws NotInMountpointException when invoked on an internal mount-table directory — a virtual node (like \"/\" or an intermediate container dir) that has no child FileSystem behind it. The exception is unchecked (extends UnsupportedOperationException), so it escapes typical IOException-only handling.","triggerScenarios":"fs.listXAttrs(new Path(\"/\")) on viewfs://; listXAttrs on /project when the mount table only defines links under /project/a and /project/b; audit tools enumerating xattrs from the top of a viewfs namespace.","commonSituations":"Security/audit tooling (Ranger tag policies, Atlas) scanning federated namespaces through viewfs; scripts that walk from the root and list xattrs on every directory they traverse.","solutions":["Only call listXAttrs on paths inside a mount point","Mount the queried prefix explicitly (fs.viewfs.mounttable.<cluster>.link.<path>)","Configure linkFallback or linkMergeSlash so the root is backed by a real FileSystem","Guard the tree walk with try/catch on NotInMountpointException and skip virtual dirs"],"exampleFix":"// before\nList<String> names = fs.listXAttrs(dir);\n\n// after\nList<String> names;\ntry {\n  names = fs.listXAttrs(dir);\n} catch (NotInMountpointException e) {\n  names = Collections.emptyList(); // virtual mount-table dir\n}","handlingStrategy":"try-catch","validationCode":"static boolean listXAttrsSafe(FileSystem fs, Path p, List<String> out) {\n  try { out.addAll(fs.listXAttrs(p)); return true; }\n  catch (NotInMountpointException e) { return false; } // virtual dir\n}","typeGuard":null,"tryCatchPattern":"try {\n  names = fs.listXAttrs(dir);\n} catch (NotInMountpointException e) {\n  names = Collections.emptyList();\n}","preventionTips":["Audit tools should whitelist mount-point subtrees instead of scanning from root","Treat UnsupportedOperationException from viewfs paths as a mount-coverage signal in monitoring"],"tags":["viewfs","mount-table","xattr","hadoop-common","java"],"backgroundTag":"viewfs-not-in-mountpoint","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}