Repository navigation
Conversation
- Add secret sources that sync key/value pairs from Doppler, Infisical, Vault, 1Password Connect, and generic HTTP or container providers into variables - Scope each source to all environments or selected ones - Keep credentials out of API responses - Add migration 00117 granting secret-sources permissions to full admins and their API keys - Add secret source API routes, `/secrets` page, and CLI `variables sources` commands
- Require secret sources create permission to test an unsaved source - Require update permission only when a saved test changes fetch settings - Update saved sources by ID and return not found when no row matches - Add a switch to clear a saved optional credential in the source form - Reset the refresh button's loading state before showing the result - Print JSON from `secrets sources test` when JSON output is enabled
- Check the error from w.Write in serveSecrets instead of discarding it - Panic on failure so lint no longer flags the ignored error
- Move external secret sources into a Secrets tab on the Variables page - Remove the standalone /secrets route, its sidebar entry, and its auth prefix - Gate the Variables page on variables or secret-sources permissions and show each tab only when its permission is granted - Rename the Variables nav item and page to "Variables & Secrets"
- Wrap the variables page parallel loads in tryCatch - Route load failures through throwPageLoadError so the page error boundary renders them
05d7b71 to
0cfc6d4
Compare
…nal-secrets # Conflicts: # backend/internal/database/database_test.go # frontend/messages/en.json
| }, | ||
| } | ||
| bindSourceFlags(command, &opts) | ||
| _ = command.MarkFlagRequired("name") |
There was a problem hiding this comment.
Flag errors go unexplained. This new call discards the error from
MarkFlagRequired without explanation. The Go guide requires handling every error or adding a comment explaining why it can be ignored. Handle it, or document that bindSourceFlags already registered the flag.
Rule Used: --- name: go-struct-literals description: Write Go 1.27+ in a declarative, composite-literal style. Every value (structs, slices, maps, configs, errors, servers, test tables, constructor results) is built with one keyed composite literal instead of f... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: cli/pkg/variables/sources.go
Line: 283
Comment:
**Flag errors go unexplained.** This new call discards the error from `MarkFlagRequired` without explanation. The Go guide requires handling every error or adding a comment explaining why it can be ignored. Handle it, or document that `bindSourceFlags` already registered the flag.
**Rule Used:** --- name: go-struct-literals description: Write Go 1.27+ in a declarative, composite-literal style. Every value (structs, slices, maps, configs, errors, servers, test tables, constructor results) is built with one keyed composite literal instead of f... ([source](https://app.greptile.com/-/switch-tenant?tenant=getarcaneapp&next=%2Fcustom-context%3Fmemory%3D214b40a8-9695-4738-986d-5949b5d65ff1))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
…nal-secrets # Conflicts: # frontend/src/lib/components/sheets/webhook-form-sheet.svelte # frontend/src/routes/(app)/projects/variables/+page.svelte
| "strings" | ||
| "time" | ||
|
|
||
| cerrdefs "github.com/containerd/errdefs" |
There was a problem hiding this comment.
Imports break the Go guide.
container.go renames github.com/containerd/errdefs to cerrdefs, but no other import conflicts with errdefs. The repository guide requires default import names and allows aliases only to fix a real conflict. Remove this alias and use errdefs.IsNotFound.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: backend/pkg/secretsource/container.go
Line: 17
Comment:
**Imports break the Go guide.** `container.go` renames `github.com/containerd/errdefs` to `cerrdefs`, but no other import conflicts with `errdefs`. The repository guide requires default import names and allows aliases only to fix a real conflict. Remove this alias and use `errdefs.IsNotFound`.
**Context Used:** AGENTS.md ([source](https://github.com/getarcaneapp/arcane/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
- Rename secret-sources:* permissions to variables:sources:* in the authz catalog, access policy, routes, webhook refresh mapping, and frontend permission checks - Update migration 00118 and its tests to the new permission strings (feature is unreleased)
- Remove the separate "External Secrets" permission resource - List its actions under Variables as sources-list through sources-refresh - Relabel them "... external secrets" and update the Variables description
- Drop saved credentials when the preset, custom YAML, base URL, or container inputs change, and ask the user to re-enter them - Serialize secret source updates with the fetch lock and refetch after saving - Check environment scope under the fetch lock when building effective layers - Remove secret source containers along with their volumes - CLI: accept CRLF line endings in credentials files
- Preload each source's environments in EffectiveLayers - Skip sources that are not all-environments and not assigned to the requested environment
- Move scope replacement and validation into shared environment helpers (ScopeTable, NormalizeScope, ResolveScope) - Global variables and secret sources use the same scope code - Detect duplicate secret source names from the DB error instead of a pre-check - Keep stored credentials only for fields the definition still declares, and drop them when the source is retargeted - Record fetch status and refresh the source cache under the per-source lock
| return nil | ||
| } | ||
|
|
||
| func NormalizeScope(ctx context.Context, db *database.DB, allEnvironments bool, envIDs []string) ([]string, error) { |
There was a problem hiding this comment.
Scope helper skips options.
NormalizeScope is newly public with four arguments, including the allEnvironments flag. The repository guide requires an options struct instead of boolean flags or long argument lists on exported functions. Put the scope settings in an options struct and update its callers.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: backend/internal/environment/scope.go
Line: 61
Comment:
**Scope helper skips options.** `NormalizeScope` is newly public with four arguments, including the `allEnvironments` flag. The repository guide requires an options struct instead of boolean flags or long argument lists on exported functions. Put the scope settings in an options struct and update its callers.
**Context Used:** AGENTS.md ([source](https://github.com/getarcaneapp/arcane/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
…nal-secrets # Conflicts: # backend/internal/database/database_test.go # backend/internal/webhook/service.go # backend/pkg/httpx/safe_remote.go # frontend/messages/en.json
| accepted := make([]types.EnvVariable, 0, len(entries)) | ||
| for _, entry := range entries { | ||
| key := config.keyPrefix + strings.TrimSpace(entry.Key) | ||
| if projects.EnvKeyPattern.MatchString(key) { | ||
| accepted = append(accepted, types.EnvVariable{ | ||
| Key: key, | ||
| Value: entry.Value, | ||
| }) |
There was a problem hiding this comment.
Trimmed keys break test previews. A response such as
{"TOKEN":"one"," TOKEN ":"two"} passes through extract as two different keys. This loop trims both to TOKEN and keeps both. Test then returns duplicate names, but the sheet uses each name as a unique row key, causing a rendering error. Reject invalid raw names or deduplicate after trimming.
Prompt To Fix With AI
This is a comment left during a code review.
Path: backend/internal/variable/children/source/service.go
Line: 455-462
Comment:
**Trimmed keys break test previews.** A response such as `{"TOKEN":"one"," TOKEN ":"two"}` passes through `extract` as two different keys. This loop trims both to `TOKEN` and keeps both. `Test` then returns duplicate names, but the sheet uses each name as a unique row key, causing a rendering error. Reject invalid raw names or deduplicate after trimming.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if err != nil { | ||
| return types.SecretSource{}, err | ||
| } | ||
| return types.SecretSource{ |
There was a problem hiding this comment.
DTOs skip required field checks.
toDTO returns a full types.SecretSource literal without //exhaustruct:enforce. The Go guide requires that marker on DTO and record mappings so added fields cannot be silently missed. Add it here and on the updated record literal; other new mappings have the same gap.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: backend/internal/variable/children/source/service.go
Line: 622
Comment:
**DTOs skip required field checks.** `toDTO` returns a full `types.SecretSource` literal without `//exhaustruct:enforce`. The Go guide requires that marker on DTO and record mappings so added fields cannot be silently missed. Add it here and on the `updated` record literal; other new mappings have the same gap.
**Context Used:** AGENTS.md ([source](https://github.com/getarcaneapp/arcane/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| var urlErr *url.Error | ||
| if errors.As(err, &urlErr) { | ||
| err = urlErr.Err | ||
| } |
There was a problem hiding this comment.
Error checks skip required helper. This branch uses a predeclared
urlErr plus errors.As. The Go guide requires errors.AsType instead. The module already targets Go 1.27.4, so use the required helper here.
Rule Used: --- name: go-struct-literals description: Write Go 1.27+ in a declarative, composite-literal style. Every value (structs, slices, maps, configs, errors, servers, test tables, constructor results) is built with one keyed composite literal instead of f... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: backend/pkg/secretsource/http.go
Line: 174-177
Comment:
**Error checks skip required helper.** This branch uses a predeclared `urlErr` plus `errors.As`. The Go guide requires `errors.AsType` instead. The module already targets Go 1.27.4, so use the required helper here.
**Rule Used:** --- name: go-struct-literals description: Write Go 1.27+ in a declarative, composite-literal style. Every value (structs, slices, maps, configs, errors, servers, test tables, constructor results) is built with one keyed composite literal instead of f... ([source](https://app.greptile.com/-/switch-tenant?tenant=getarcaneapp&next=%2Fcustom-context%3Fmemory%3D214b40a8-9695-4738-986d-5949b5d65ff1))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
…nal-secrets # Conflicts: # backend/internal/database/database_test.go # backend/internal/webhook/service.go # frontend/messages/en.json # frontend/src/routes/(app)/projects/variables/+page.svelte
…nal-secrets # Conflicts: # backend/internal/database/database_test.go # frontend/messages/en.json
Checklist
mainbranchm.*())What This PR Implements
Arcane can now pull variables from an external secrets manager, store them as variables, and sync them to environments and agents. Each source is described by a YAML definition, so a new provider needs a definition file and no new Go code.
Shipped presets: Infisical, Doppler, Vault KV v2 (AppRole and token auth), 1Password Connect, generic HTTP JSON, and generic container. Custom definitions can be pasted in and validated before saving.
Addresses discussion #4036 (external secrets managers). This is a discussion, not an issue, so there is no issue number to close.
Changes Made
backend/internal/variable/children/sourceadds create, read, update, delete, refresh, test, definition validation, and preset listing under/api/variables/sources.backend/pkg/secretsourceparses definitions, fetches over HTTP or from a container, extracts keys, renders templates, and loads presets frombackend/resources/secretsources/*.yaml.environment.ReplaceScopeRows.secretsource.secret-sources:*permissions (list, read, create, update, delete, refresh) in the authz catalog.secret_sourcesandsecret_source_environments. It also grants the new permissions to roles and API keys that already hold every prior permission (full admins). Partial roles and keys get nothing. The down migration removes the tables, the grants, and the webhooks targeting sources.backend/pkg/httpx/safe_remote.gois reworked for remote source fetches.projects.EnvKeyPatternreplaces a duplicate regex in the lifecycle service.arcane variables sourcescommands incli/pkg/variables/sources.go.Testing Done
TestMigration117_AddsSecretSourcesAndGrantsFullAdminscovers the up migration, full-admin grants, partial role and key exclusion, name uniqueness, and the down migration.TestMigration102_CleansUpRBACPermissionsnow migrates to 117.backend/internal/variable/children/source/service_test.go.backend/internal/variable/service_test.gois updated for the new variable flow.Not verified yet:
AI Tool Used (if applicable)
Additional Context
secret-sources:*permissions automatically.secret-sourcesnaming in the code.Disclaimer Greptiles Reviews use AI, make sure to check over its work.
To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike
To have Greptile Re-Review the changes, mention
greptileai.The Go guide requirements must be satisfied before merging; the duplicate-key preview bug is also worth fixing.
Fix with agent prompt
Summary
Adds external secret sources that fetch variables from HTTP APIs or temporary containers, then share them with selected environments.
kmendell manually resolved the earlier response-close finding without explanation. Static review only; no tests, browser checks, or live-provider checks were run.
Reviews (14) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile