Commit graph

473 commits

Author SHA1 Message Date
XiaoSeS
3522bad295
Merge pull request #623 from gale-popai/fix/oauth-return-to
fix(auth): keep the OAuth return target through the provider callback
2026-08-26 15:29:48 +08:00
wrj97
5a95278528
fix(compat): prioritize PUBLIC/GLOBAL skills in legacy slug lookup (#750)
Some checks are pending
Security / Dependency Review (push) Waiting to run
Security / CodeQL (java-kotlin) (push) Waiting to run
Security / CodeQL (javascript-typescript) (push) Waiting to run
Security / CodeQL (python) (push) Waiting to run
* fix(compat): prioritize PUBLIC/GLOBAL skills in legacy slug lookup

When multiple skills share the same slug across namespaces,
findByLegacySlug now prefers PUBLIC visibility and GLOBAL
namespace over NAMESPACE_ONLY/PRIVATE ones, so plain slug
lookups resolve to the most accessible skill. Namespaces are
batch-fetched via findByIdIn to avoid N+1 database queries.

Signed-off-by: wurongjie <wurongjie@uniontech.com>

* fix(compat): prefer published legacy slug candidates

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: wurongjie <wurongjie@uniontech.com>
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Co-authored-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-25 16:58:17 +08:00
FenjuFu
91d0ae1504
feat(api): return skill labels from the skill listing endpoints on request (#730)
* feat(api): return skill labels from the skill listing endpoints on request

Skill labels were reachable only one skill at a time, through
/api/{v1,web}/skills/{namespace}/{slug}/labels, so a client rendering a list had
to issue a follow-up request per row.

Add includeLabels=true to GET /api/v1/skills and GET /api/web/skills. The labels
array is populated only when the parameter is set and left out of the payload
otherwise, so existing responses are byte-identical.

Labels for the whole page are resolved by SkillLabelProjectionService in three
queries — assignments, definitions, translations — rather than three per skill.

Closes #710

Signed-off-by: FenjuFu <fufenjupku@gmail.com>

* fix(api): use include parameter for skill labels

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* test(api): reject unsupported include before search

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: FenjuFu <fufenjupku@gmail.com>
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Co-authored-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-25 13:49:24 +08:00
FenjuFu
954dfce7a4
fix(publish): accept Windows zip directory entries (#742)
* fix(publish): accept Windows zip directory entries

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>

* chore: restore repository line endings

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>

---------

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
2026-08-24 19:58:18 +08:00
FenjuFu
d5c6411ce6
fix(i18n): disable host locale fallback (#741)
Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
2026-08-24 19:54:05 +08:00
FenjuFu
f846da230c
feat: add initial RISC-V image support (#725)
Some checks failed
Security / Dependency Review (push) Waiting to run
Security / CodeQL (java-kotlin) (push) Waiting to run
Security / CodeQL (javascript-typescript) (push) Waiting to run
Security / CodeQL (python) (push) Waiting to run
Deploy Docs / build (push) Has been cancelled
Deploy Docs / Deploy (push) Has been cancelled
* feat: add initial RISC-V image support

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>

* chore(ci): tighten riscv64 image guardrails

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Co-authored-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-24 16:37:34 +08:00
XiaoSeS
15ce199e1a
fix(publish): emit event on confirm publish (#738)
Some checks are pending
Security / Dependency Review (push) Waiting to run
Security / CodeQL (java-kotlin) (push) Waiting to run
Security / CodeQL (javascript-typescript) (push) Waiting to run
Security / CodeQL (python) (push) Waiting to run
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-21 17:52:25 +08:00
FenjuFu
fa04d2fa23
fix(auth): close API token policy gaps against the authorization list (#729)
RouteSecurityPolicyRegistry keeps two policy lists — AUTHORIZATION_POLICIES for
session/cookie access and API_TOKEN_POLICIES for Bearer tokens — with nothing
keeping them in step. Routes the authorization list opens but the token list
never registers fall through to the catch-all and answer
API token cannot access endpoint: <path>.

Register the routes reported in #713 (/api/v1/labels, the star and rating
writes) plus the same-class gaps for /api/v1/auth/methods and paths below
/api/v1/download, and add a guard test that walks the authorization list and
fails when a route is neither token-reachable nor declared session-only.

DELETE /api/v1/skills/{id}/star also matched the SUPER_ADMIN rule for
DELETE /api/v1/skills/*/*, so un-starring was refused for ordinary accounts on
the session path too. Star and rating writes now have their own authorization
entries ahead of that rule.

Closes #713

Signed-off-by: FenjuFu <fufenjupku@gmail.com>
2026-08-21 16:08:50 +08:00
FenjuFu
51457bfa2c
fix(security): 扫描任务改为事务提交后发布 (Closes #612) (#733)
* fix(security): publish scan task after transaction commit

SecurityScanService.triggerScan is @Transactional but published the Redis
Stream scan task inline, before the transaction committed. The stream
consumer could receive the task before the skill_version / security_audit
rows were visible, fail with "SkillVersion not found" / "SecurityAudit not
found", exhaust its immediate retries while the publishing transaction was
still open, and leave the committed version stuck in SCANNING.

Defer the publish to an afterCommit transaction synchronization so the
consumer only ever sees the task once the rows are committed and visible; on
rollback the task is never published. Falls back to an inline publish when
called outside a transaction.

Closes #612

Signed-off-by: FenjuFu <fufenjupku@gmail.com>

* test(security): cover scan task after-commit publishing

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* refactor(security): hide scan publish transaction callback

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: FenjuFu <fufenjupku@gmail.com>
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Co-authored-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-21 14:18:40 +08:00
XiaoSeS
d2403bb591
feat(namespace): add admin namespace management
Some checks failed
Security / Dependency Review (push) Has been cancelled
Security / CodeQL (java-kotlin) (push) Has been cancelled
Security / CodeQL (javascript-typescript) (push) Has been cancelled
Security / CodeQL (python) (push) Has been cancelled
Closes #580
2026-08-12 12:39:24 +08:00
XiaoSeS
81be20a6b5
fix(namespace): let super admin view namespaces (#705)
Some checks failed
Security / Dependency Review (push) Waiting to run
Security / CodeQL (java-kotlin) (push) Waiting to run
Security / CodeQL (javascript-typescript) (push) Waiting to run
Security / CodeQL (python) (push) Waiting to run
Deploy Docs / build (push) Has been cancelled
Deploy Docs / Deploy (push) Has been cancelled
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-11 16:04:28 +08:00
XiaoSeS
00f55c2db3 feat(search): surface compliance mappings in discovery
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-07 16:37:07 +08:00
XiaoSeS
da5c3cba3b feat(search): index compliance snapshot mappings
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-07 15:46:06 +08:00
XiaoSeS
a7b25b072b feat(metadata): expose compliance snapshots in version views
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-07 15:46:06 +08:00
XiaoSeS
725bbe165b feat(metadata): add x-astron compliance snapshot
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-07 15:46:06 +08:00
XiaoSeS
5e3f4e72e7 fix(deploy): keep PR 576 backport focused
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-06 19:05:36 +08:00
XiaoSeS
d0b7a7c5d4 fix(deploy): backport sub-path runtime fixes to PR 576
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-06 18:59:37 +08:00
philsun
34f244e7a4 feat(web): support configurable base-path deployment
Signed-off-by: philsun <xinyi.sun@daocloud.io>
2026-08-05 12:50:26 +08:00
XiaoSeS
51ff9b99d2
Merge pull request #684 from iflytek/fix/search-rebuild-observability-597
fix(search): observe label search rebuild failures
2026-08-04 17:42:17 +08:00
XiaoSeS
27113ce60c
fix(api): map Spring MVC client errors to 4xx (#685)
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-04 17:16:09 +08:00
XiaoSeS
b6cd414588 fix(search): observe label search rebuild failures
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-04 11:17:38 +08:00
XiaoSeS
55e5c1e10e
feat(observability): add generic request correlation and tracing foundation (#664)
* feat(observability): establish request correlation boundary

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* feat(observability): add selectable tracing modes

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* feat(observability): propagate async trace context

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* docs(observability): document tracing deployment modes

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(observability): tighten tracing integration boundaries

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(observability): harden operational log privacy

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* feat(observability): propagate message trace context

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(observability): document message propagation semantics

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* test(auth): isolate security context between tests

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(observability): skip otlp exporter without endpoint

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-08-04 10:26:42 +08:00
FenjuFu
34dc4fa29c fix(compat): percent-encode ClawHub download redirect Location
Downloading a skill whose slug is non-ASCII (e.g. a Chinese name) through
the ClawHub CLI compatibility route failed: the 302 Location header was
built by string-concatenating the raw slug, and Tomcat encodes header
values as ISO-8859-1, so a character outside 0-255 makes it drop the
Location header entirely and the download breaks. The skillhub CLI path
was unaffected because it doesn't go through this redirect.

Build the Location with UriComponentsBuilder.pathSegment(...).encode(), so
each segment is percent-encoded while the '/' separators stay literal.
"需求" becomes %E9%9C%80%E6%B1%82 and the header is ISO-8859-1-writable.

Fixes #658

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
2026-08-02 02:18:36 +08:00
XiaoSeS
31d037de02 test(bootstrap): cover builtin skill upgrade conflicts
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-31 19:08:32 +08:00
XiaoSeS
5f7c48b7a4 feat(bootstrap): publish starter skills in runtime manifest
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-31 18:27:25 +08:00
XiaoSeS
b20ad397ad Merge codex/builtin-skills-content into codex/builtin-skills-release
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-31 18:27:25 +08:00
wowo-zZ
7885cc568b feat(builtin-skills): add reviewed starter collection
Signed-off-by: wowo-zZ <zhenggui5228@126.com>
2026-07-31 14:22:23 +08:00
wowo-zZ
7f934e63ab feat(bootstrap): verify built-in skill artifacts
Signed-off-by: wowo-zZ <zhenggui5228@126.com>
2026-07-31 11:14:42 +08:00
XiaoSeS
b264f3a0d2 fix(governance): safely delete version dependencies
Remove terminal review tasks before deleting an allowed skill version. Lock all versions of the aggregate in stable order so concurrent deletes preserve the last-version invariant and return business errors instead of 500 responses.

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-30 17:52:08 +08:00
wowo-zZ
0bf822290b feat(builtin-skills): add reviewed starter collection
Signed-off-by: wowo-zZ <zhenggui5228@126.com>
2026-07-30 15:54:09 +08:00
Gal Eyal
35c080b65c fix(auth): keep the OAuth return target through the provider callback
OAuth2AuthorizationRequestRedirectFilter invokes the resolver on every
request in the chain and the delegate answers null for anything that is
not an authorization request. Recording the return target on those calls
cleared it again on the next request without a returnTo parameter — the
provider callback included, which this filter processes before login
succeeds. The success handler therefore always found an empty session
attribute and fell back to the default target, so returnTo never worked.

Guard the write on a non-null authorization request. As a side effect,
anonymous API requests no longer allocate a session via getSession().

Signed-off-by: Gal Eyal <gal.e@popai.health>
2026-07-29 12:44:00 +03:00
XiaoSeS
3db3c9685f feat(redis): complete cluster connection support
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-29 17:36:06 +08:00
XiaoSeS
dad3c15f92 chore(redis): merge current main for cluster support
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-29 16:11:31 +08:00
XiaoSeS
2854b26b5d fix(helm): resolve deployment review blockers
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-29 14:04:26 +08:00
XiaoSeS
e72c17b09f chore(helm): merge current main for validation
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-29 13:49:18 +08:00
XiaoSeS
9f602f8184
Merge pull request #480 from yaffir/main
fix(auth): hide placeholder OAuth providers
2026-07-29 09:00:19 +08:00
XiaoSeS
7872e64177
Merge pull request #609 from iflytek/fix/auth-revoked-token-validation
test(auth): cover revoked CLI token lifecycles
2026-07-29 03:37:47 +08:00
XiaoSeS
19c3070291
Merge pull request #607 from gale-popai/fix/device-auth-redis-typing
fix(auth): read device-code state via ObjectMapper conversion, not cast
2026-07-29 03:37:25 +08:00
XiaoSeS
c5a2b18fd9
Merge pull request #592 from shychee/fix/label-search-sync-async
fix(search): rebuild search index asynchronously after label change
2026-07-28 23:35:11 +08:00
XiaoSeS
155ab8f6d5 fix(auth): hide placeholder OAuth providers
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-28 22:16:45 +08:00
ylhu16
fab07cbc92 Merge remote-tracking branch 'origin/main' into review/pr480-20260728 2026-07-28 22:10:53 +08:00
gale-popai
d977ea9dc4
fix(api): tell callers why a request was forbidden (#610)
* fix(api): tell callers why a request was forbidden

The scope filter already computes an exact reason ("Missing API token
scope: skill:delete", "API token cannot access endpoint: /x") and the
access-denied handler discarded it, returning a bare "Forbidden" for
every case: missing scope, endpoint closed to API tokens, and paths
that simply don't exist. Clients cannot tell those apart, so they
guess — the published CLI reports every 403 as "token may lack
required scope", which sent us debugging token scopes for an hour when
the real causes were a revoked token and a mistyped namespace path.

The reason now rides in the response via a new error.forbidden.detail
message (en + zh), and is logged alongside the exception type.

Signed-off-by: Gal Eyal <gal.e@popai.health>

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(api): safely expose API token denial reasons

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-28 17:42:20 +08:00
Gal Eyal
8435ee1ab1 fix(auth): read device-code state via ObjectMapper conversion, not cast
The shared RedisTemplate uses GenericJackson2JsonRedisSerializer with
the application ObjectMapper, which embeds no type information, so
stored DeviceCodeData deserializes as a LinkedHashMap. The typed casts
in pollToken and authorizeDeviceCode then throw ClassCastException on
every call, making the whole device authorization flow unusable
(every poll returns 500).

Convert the raw value with ObjectMapper.convertValue instead of
casting; this reads both the current untyped map format and any typed
format, so no stored-data migration is needed. Adds bean setters to
DeviceCodeData for map conversion and regression tests that feed the
service exactly what Redis returns in production (untyped maps).

Fixes #604

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Gal Eyal <gal.e@popai.health>
2026-07-28 10:27:37 +03:00
dongmucat
5012b31af2 test(auth): cover CLI session fallback (#605)
Signed-off-by: dongmucat <1127093059@qq.com>
2026-07-28 15:22:11 +08:00
FenjuFu
4fdc7e3dc5
fix(publish): delete review tasks of any status when replacing a version (#601)
Some checks are pending
Deploy Docs / build (push) Waiting to run
Deploy Docs / Deploy (push) Blocked by required conditions
Security / Dependency Review (push) Waiting to run
Security / CodeQL (java-kotlin) (push) Waiting to run
Security / CodeQL (javascript-typescript) (push) Waiting to run
Security / CodeQL (python) (push) Waiting to run
* fix(publish): delete review tasks of any status when replacing a version

Re-uploading a rejected version under the same version number returned
HTTP 500. deleteReplaceableVersionArtifacts only removed a PENDING review
task, but a rejected version owns a REJECTED one; that row kept a foreign
key on the skill_version, so the subsequent delete hit a constraint
violation that surfaced as a 500.

Delete every review task attached to the version instead.

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>

* test(publish): drop the spring-test dependency from the new test

skillhub-domain has no spring-test on its test classpath, so
ReflectionTestUtils does not resolve there. Use plain JDK reflection for
setting the generated id and invoking the private method.

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>

* fix(publish): constrain rejected version replacement

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* test(publish): verify replaced review is deleted

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* test(e2e): use generated API response types

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Co-authored-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-28 13:57:35 +08:00
dongmucat
726eeac8b2 test(auth): cover token replay and private search (#605)
Signed-off-by: dongmucat <1127093059@qq.com>
2026-07-28 13:52:26 +08:00
dongmucat
06cecd4237 test(auth): cover restricted CLI read authorization (#605)
Signed-off-by: dongmucat <1127093059@qq.com>
2026-07-28 12:51:09 +08:00
dongmucat
52843c8020 fix(test): assert CLI download media type (#605)
Signed-off-by: dongmucat <1127093059@qq.com>
2026-07-28 12:16:28 +08:00
dongmucat
83b621880e test(auth): cover persisted CLI token states (#605)
Signed-off-by: dongmucat <1127093059@qq.com>
2026-07-28 12:03:24 +08:00
shychee
de033da537 fix(search): make index writes REQUIRES_NEW to survive async caller-runs fallback
The @Async rebuildSkill fix relied on a fresh thread giving a clean
transaction boundary. But skillhubEventExecutor uses CallerRunsPolicy:
under saturation the rejected task runs on the caller (request) thread,
back inside the afterCommit synchronization phase — the original failure
context where the @Transactional index write is silently dropped.

Mark SearchIndexService.index as REQUIRES_NEW so it always suspends any
lingering post-commit synchronization and commits in its own transaction,
independent of whether the async dispatch actually happened.

Add regression tests: detach removes the label keyword, and a synchronous
rebuild inside the afterCommit phase still persists the document (fails
without REQUIRES_NEW).

Signed-off-by: shychee <shychee96@gmail.com>
2026-07-22 18:54:38 +08:00