Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: use source string (#11864)

p0ny30334905c3a6
diff --git a/backend/common/cel.go b/backend/common/cel.go
index 23ff4bb0e5..badfcec00f 100644
--- a/backend/common/cel.go
+++ b/backend/common/cel.go
@@ -35,7 +35,7 @@ var RiskFactors = []cel.EnvOption{
// ApprovalFactors are the variables when finding the approval template.
var ApprovalFactors = []cel.EnvOption{
cel.Variable("level", cel.IntType),
- cel.Variable("source", cel.IntType),
+ cel.Variable("source", cel.StringType),
cel.ParserExpressionSizeLimit(celLimit),
}
diff --git a/backend/runner/approval/runner.go b/backend/runner/approval/runner.go
index 272992d6d1..c907f0452f 100644
--- a/backend/runner/approval/runner.go
+++ b/backend/runner/approval/runner.go
@@ -346,7 +346,7 @@ func getApprovalTemplate(approvalSetting *storepb.WorkspaceApprovalSetting, risk
out, _, err := prg.Eval(map[string]any{
"level": riskLevel,
- "source": int64(convertToSource(riskSource)),
+ "source": convertToSource(riskSource).String(),
})
if err != nil {
return nil, err
diff --git a/frontend/src/plugins/cel/types/factor.ts b/frontend/src/plugins/cel/types/factor.ts
index be9dab3c0b..4e591d1eae 100644
--- a/frontend/src/plugins/cel/types/factor.ts
+++ b/frontend/src/plugins/cel/types/factor.ts
@@ -3,7 +3,6 @@ export const NumberFactorList = [
"affected_rows",
"table_rows",
"level",
- "source",
// Grant request issue related factors
"request.row_limit",
@@ -16,6 +15,7 @@ export type NumberFactor = (typeof NumberFactorList)[number];
export const StringFactorList = [
// Risk related factors
+ "source",
"environment_id", // using `environment.resource_id`
"project_id", // using `project.resource_id`
"database_name",