Commit Graph
21 Commits
Author SHA1 Message Date
CCLUCKY 33806977d1 fix(file): scope commit changes to the target folder tree (#21795)
## Problem

`POST /api/v1/folders/{folder_id}/commits` (also reachable as
`/workspaces/{workspace_id}/commits` and
`/datasets/{dataset_id}/commits`)
authorizes only the folder in the URL. `FileCommitService.CreateCommit`
then
applies every item of the client-supplied `files` array straight to the
`file`
table:

```go
tx.Model(&entity.File{}).Where("id = ?", change.FileID).Updates(map[string]interface{}{
    "location": objKey, "size": fSize,
})
```

None of the `add` / `modify` / `delete` / `rename` branches constrain
the
write by tenant or by folder, so an authenticated caller who is allowed
to
commit in *any* workspace can pass the ID of a file owned by another
workspace
or another tenant and rewrite its `location`, `size`, `name`, or
`status`.
That is the IDOR/CWE-639 class the DAO already documents on
`FileDAO.GetByIDAndTenant`, and the sibling write paths (`DeleteFiles`,
`MoveFiles`) authorize every file they touch.
2026-11-03 19:47:47 +08:00
buua436 ff985091fb refa: derive service identity from context (#21904) 2026-11-03 18:38:32 +08:00
Wang Qi a26066c879 Refactor: refine response data (#21858) 2026-11-03 14:10:05 +08:00
buua436 42fc0bac45 refa: derive permission identity from context (#21892) 2026-11-03 13:24:26 +08:00
buua436 e9b1b6b48f refa: remove permission service wrappers (#21856)
### What problem does this PR solve?

Remove service-layer permission wrappers that only forwarded calls, and
invoke the permission layer directly at call sites. Keep composite
authorization rules with their owning business flows.

### Type of change

- [x] Refactor (no functional change)
2026-11-02 19:25:45 +08:00
CCLUCKY 0d159a9740 fix(file): record commit deletions without a missing status column (#21796) 2026-11-02 16:02:11 +08:00
buua436 e4ab718ca6 feat(permission): enforce tenant and resource access (#21377) 2026-10-23 16:04:46 +08:00
buua436 8a95d55d63 feat: migrate resource checks to permission layer (#20792) 2026-10-13 14:17:43 +08:00
buua436 4c9edbfdf7 refa: centralize Go resource permissions (#20657) 2026-10-10 10:37:43 +08:00
Wang Qi ef8d17b3d9 Fix go workspaces APIs (#20272) 2026-09-28 12:00:57 +08:00
buua436 1cb339ced7 fix: record generated wiki page versions (#19636) 2026-09-15 14:58:28 +08:00
euvre b19a10fb70 fix(wiki): version history always empty on Go API due to page-slug key mismatch (#19305) 2026-09-13 15:50:37 +08:00
Harsh Kashyap fb2f881871 fix(api): authorize dataset and workspace commit routes (#19357)
Fixes #19356

The file-commit endpoints resolved a dataset or folder id but never
checked that the caller can access it. Any logged-in user could read
another tenant's commit history, diffs, and file contents, pull version
history for any file id, and create commits in a workspace they don't
own. Sibling artifact routes in dataset_api.py apply
KnowledgebaseService.accessible for the same data; these did not.
2026-09-09 10:33:23 +08:00
Zhichang Yu b811dce1b0 feat(go): port knowledge compilation template/group + wiki artifact/nav/skill REST APIs from Python (#17656) 2026-07-31 22:57:43 +08:00
Jin Hai f53518c110 Go: add context, part5 (#17392)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-07-27 10:20:16 +08:00
Jin Hai d9e359d481 Go: add context (#17354)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-07-24 20:19:41 +08:00
Jin Hai 0b01171a86 Go: Update response message (#16803)
### Summary

As title.

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-07-10 14:26:54 +08:00
Jin Hai b3d536c48e Go: merge functions (#16622)
### Summary

Merge HTTP response functions into common/response.go

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-07-06 18:14:05 +08:00
Hz_ dfd95c9c5c fix(go): Add tenant filter to file queries (#16526)
## Summary

- Add `tenant_id` filtering to `FileDAO.Query`.
- Pass tenant IDs through existing file query call sites.
- Prevent cross-tenant filename and folder duplicate checks.
2026-07-02 19:54:22 +08:00
Zhichang Yu f58fae5fb7 feat(go-agent): Ported retrieval node, added Keenable web search tool (#16396)
Ported retrieval node, added Keenable web search tool
- [x] New Feature (non-breaking change which adds functionality)
2026-06-29 09:45:16 +08:00
Yingfeng b5bea72e4b Add git-like file commit API (#15978)
### What problem does this PR solve?

| # | Method | Endpoint | Description | Git Equivalent |
|---|--------|----------|-------------|----------------|
| 1 | `POST` | `/api/v1/{prefix}/{folder_id}/commits` | Create a
snapshot commit with file changes (add/modify/delete/rename) | `git add`
+ `git commit` |
| 2 | `GET` | `/api/v1/{prefix}/{folder_id}/commits` | List commit
history (paginated) | `git log` |
| 3 | `GET` | `/api/v1/{prefix}/{folder_id}/commits/{commit_id}` | Get
commit detail with file changes | `git show` |
| 4 | `GET` | `/api/v1/{prefix}/{folder_id}/commits/{commit_id}/files` |
List file changes in a commit | `git show --name-status` |
| 5 | `GET` |
`/api/v1/{prefix}/{folder_id}/commits/diff?from=...&to=...` | Compare
two commits and return differences | `git diff` |
| 6 | `GET` | `/api/v1/{prefix}/{folder_id}/changes` | Get uncommitted
changes (add/modify/delete) | `git status` |
| 7 | `GET` | `/api/v1/{prefix}/{folder_id}/commits/{commit_id}/tree` |
Get the folder tree snapshot at commit time | `git ls-tree` |
| 8 | `GET` |
`/api/v1/{prefix}/{folder_id}/commits/{commit_id}/files/{file_id}/content`
| Get a file's content as it existed in a specific commit | `git show
HEAD:file` |
| 9 | `GET` | `/api/v1/{prefix}/{file_id}/versions` | Get version
history for a specific file across all commits | `git log -- file` |

Where `{prefix}/{id}` can be:
- `folders/{folder_id}` — direct folder access
- `workspaces/{workspace_id}` — alias of `folders/{folder_id}`
- `datasets/{dataset_id}` — resolves to the dataset's folder
- `memories/{memory_id}` — resolves to the memory's folder
- `skills/{skill_id}` — resolves to the skill's folder

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
- [x] Documentation Update
2026-06-15 11:19:56 +08:00