Skip to content

Fix: VelaUX fixes from the v1.12 release testing - #984

Draft
briankane wants to merge 10 commits into
kubevela:mainfrom
briankane:release-1.12/fixes
Draft

briankane wants to merge 10 commits into
kubevela:mainfrom
briankane:release-1.12/fixes

Conversation

@briankane

@briankane briankane commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Description of your changes

The VelaUX fixes from the v1.12 release testing, one commit each, best reviewed commit by commit:

  • Fix(api): require a signed-in user for the expression endpoints
  • Fix(config): refuse a config template from another namespace
  • Fix(auth): keep the token signing key in a Secret
  • Fix(config): edit a Config whose template is still a legacy ConfigMap
  • Fix: create an application or environment only in the project authorized
  • Fix: filter the application list by its search query
  • Fix: leave module definitions out of the definition lists
  • Fix: leave the Dex client secret out of the public Dex config
  • Fix: give each install its own Dex client secret
  • Fix(auth): end a user's sessions on disable, password or role change, delete and logout

Each commit message says what was wrong and what changed. The user-visible ones are in the v1.12 upgrade guide
(kubevela/kubevela.github.io#1473).

I have:

  • All commits are signed off (DCO).

How has this code been tested

Each fix has a test written first that fails without it. The Go tests pass (25 packages), lint is clean, and the UI
type-checks.

Special notes for your reviewer

/api/v1/expressions/env and /check were the only routes without the
authentication filter, so they answered anyone.

A test now sends every registered route a request without a token and
fails on any that does not refuse it, apart from a short list of public
routes, each with the reason a signed-out user needs it.

Signed-off-by: Brian Kane <briankane1@gmail.com>
CreateConfig took the template's namespace from the request and
rendered it with VelaUX's own service account, whatever the project.

A config may now use a template only from the system namespace or, for
a project config, the project's namespace, the namespaces VelaUX lists
templates from. An update keeps the config's existing template, so
configs created elsewhere still edit as before.

Signed-off-by: Brian Kane <briankane1@gmail.com>
The key VelaUX signs access and refresh tokens with was stored in the
system info record, which the default datastore keeps in a ConfigMap.

The key now lives in the velaux-token-signing-key Secret, created on
first start. A key still held in the system info record is removed and
not reused, so every user signs in again once after the upgrade.

Signed-off-by: Brian Kane <briankane1@gmail.com>
Migration adopts a config before its template, and addons install their
config templates as legacy ConfigMaps, so a Config can stand on a
template that is not a ConfigTemplate. Updating one looked the template
up only as a ConfigTemplate and failed with 16005, the template does
not exist, leaving the config uneditable in VelaUX.

The update now resolves the template with Factory.LoadTemplate, the
ConfigTemplate first and the legacy ConfigMap after it, and validates
the properties against whichever it finds.

Signed-off-by: Brian Kane <briankane1@gmail.com>
The permission filter authorized the project in the request's path or
query, while an application or environment create wrote to the project
named in its body, and an environment create granted RBAC in that
project's namespaces.

The create refuses (403, 30011) a body project other than the one the
request was authorized for. A request authorized with no project held a
permission over every project and is not limited. The UI sends the same
project in both places, so it is unaffected.

Signed-off-by: Brian Kane <briankane1@gmail.com>
The search box on the application list sends ?query=, and the list
skipped an app only when the query was missing from its alias but
present in both its name and its description, so a search left the
list as it was.

An app is listed when the query appears in its name, alias or
description, ignoring case.

Signed-off-by: Brian Kane <briankane1@gmail.com>
VelaUX offered a module's component types under their definitions'
installed names, which KubeVela refuses for a module-backed definition
(it takes module/version/name), so a component made from one could not
be created.

Modules are still in development, so their definitions, which carry the
definition.oam.dev/module label, are left out of every definition list
VelaUX serves, the type pickers included.

Signed-off-by: Brian Kane <briankane1@gmail.com>
The login page reads /auth/dex_config before anyone signs in, so the
endpoint answers without authentication, and its response carried the
Dex static client's secret.

The response now holds only what the browser sees in the authorize
redirect: the issuer, the client ID and the redirect URL. The server's
own code exchange reads the secret from the stored Dex config.

Signed-off-by: Brian Kane <briankane1@gmail.com>
Every install's Dex static client had the same secret, velaux-secret.

A new Dex config gets a random secret (32 bytes from crypto/rand). At
startup, an install still holding the old default is given one of its
own and Dex is restarted to read it; a secret anyone set is kept. A
failure to replace it is logged and VelaUX starts as before.

Signed-off-by: Brian Kane <briankane1@gmail.com>
… delete and logout

The local login built its own user record without the Disabled flag, so
a disabled user could still sign in with a password. Tokens were checked
only for their signature and expiry, never against their user, and
refreshing returned the same refresh token.

Local login now refuses a disabled user before recording the login.
Every user carries a token generation, stamped into each token issued to
them; every request and every refresh loads the user and accepts the
token only while the user exists, is enabled and is at that generation.
Disabling, a password change, a change of roles and the new
POST /api/v1/auth/logout raise it, ending all of the user's sessions
(code 12013). Refreshing issues a new refresh token, and each token
carries an id. The user the check loads is handed on in the request
context, so the RBAC filter and the plugin proxy do not read it again.

The UI's logout calls the new endpoint before clearing the browser's
tokens, and a request refused with 12013 goes to the sign-in prompt as
an expired refresh token does.

Signed-off-by: Brian Kane <briankane1@gmail.com>
@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 43.93939% with 111 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.65%. Comparing base (208aa8a) to head (62ff1ee).
⚠️ Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
pkg/server/domain/service/authentication.go 42.69% 51 Missing ⚠️
pkg/server/interfaces/api/authentication.go 55.17% 13 Missing ⚠️
pkg/server/domain/service/system_info.go 60.00% 12 Missing ⚠️
pkg/server/domain/service/config_crd.go 0.00% 11 Missing ⚠️
pkg/server/domain/service/user.go 0.00% 8 Missing ⚠️
pkg/server/domain/service/application.go 40.00% 6 Missing ⚠️
pkg/server/domain/service/config.go 20.00% 4 Missing ⚠️
pkg/server/domain/service/rbac.go 33.33% 4 Missing ⚠️
pkg/server/domain/service/env.go 50.00% 1 Missing ⚠️
pkg/server/domain/service/project_scope.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #984       +/-   ##
===========================================
+ Coverage   12.17%   48.65%   +36.47%     
===========================================
  Files         120      155       +35     
  Lines       19935    20248      +313     
===========================================
+ Hits         2428     9852     +7424     
+ Misses      17218    10396     -6822     
+ Partials      289        0      -289     
Flag Coverage Δ
apiserver-unittests ?
server-e2e-tests 48.65% <43.93%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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