Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

getContainerElements can return urls outside of the container

未关闭
#62 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
typescript
领域
api, security

调研方向

从 src/util/containerLogic.ts 中的 getContainerElements 开始,使用 issue 中的 Turtle 示例复现该行为。确保结果仅包含容器 URL 下的资源,然后验证外部 URL 会从返回的元素中排除,且不能被视为子元素。

由索引模型根据 Issue 内容生成。

描述

I think intuitively the getContainerElements function should only return elements that have this folder as a parent (e.g. for /folder/ only /folder/* and not /other/). The current implementation allows any urls to be returned if the turtle file specifies this.

As an implication, when creating a folder with additional containment triples, these folders:

  • recursive deletion can delete arbitrary urls (not tested, but the code looks like it would simply fetch all "contained" resources and then delete them, even if they are on a different server)
  • are displayed to have children that could be arbitrary urls (tested, see below for an example)

Creating folders with additional containment triples is currently possible with ESS. Also note that it's not forbidden by the spec to add additional data when POSTing new folders, so it's something we should consider in the applications. An example turtle is following, which will display the public folder inside of confusion/:

@prefix ldp:  <http://www.w3.org/ns/ldp#> .
@prefix me:   <https://storage.inrupt.com/ba39f662-260a-415e-aee1-3290e3974092/reviews/confusion/> .
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

me:     rdf:type      ldp:Container , ldp:BasicContainer ;
        ldp:contains  <https://sheep.solidcommunity.net/public/> .

Currently you can test this here, not sure how long I'll keep the link (note that it shows a folder of inrupt.com, but contains a child from solidcommunity.net): https://solidos.github.io/mashlib/dist/browse.html?uri=https%3A%2F%2Fstorage.inrupt.com%2Fba39f662-260a-415e-aee1-3290e3974092%2Freviews%2Fconfusion%2F

As a fix, I'd suggest that getContainerElements filters out urls that do not start with the container url. eg for the container https://example.org/public/ it should have the filter urls.filter(url => url.startsWith("https://example.org/public/")) (not sure how this looks like with rdflib objects).

主要语言
TypeScript
星标
12
派生
13
平均合并
15 小时 15 分钟
30 天内合并 PR
3

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

SolidOS/solid-logic 的其他 Issue

查看 SolidOS/solid-logic 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。