Skip to content

Fix secret variable disclosure in edit and release views - #14

Open
DeveloperDurp wants to merge 1 commit into
mainfrom
codex/fix-secret-variable-leak-in-views
Open

Fix secret variable disclosure in edit and release views#14
DeveloperDurp wants to merge 1 commit into
mainfrom
codex/fix-secret-variable-leak-in-views

Conversation

@DeveloperDurp

Copy link
Copy Markdown
Owner

Motivation

  • Secret-marked variables were still rendered into the edit-row input value and into release detail rows, exposing secrets in HTML/DOM despite the new secret flag.
  • The intent is to prevent secret values from being present in server-rendered HTML while preserving the UX of leaving the value blank to keep an existing secret on update.

Description

  • Added variableEditValue(variable db.Variable) string to views/pages/variables.templ to return an empty string for secret variables and used it for the edit-row value attribute, and updated the placeholder to Leave blank to keep existing secret.
  • Updated internal/handler/variable.go UpdateVariable to load the current variable and preserve its stored value when secret remains set and the submitted value is blank, so clients can omit the secret on submit without losing it.
  • Ensured the temporary variable used for rendering form re-errors carries the Secret flag so the edit UI state remains correct on validation errors.
  • Masked snapshotted secret variables in views/pages/releases.templ so release detail pages display bullets for secret values instead of the stored plaintext.

Testing

  • Ran quick static checks and assertions against the modified template files (Python assertions verifying the edit-row uses variableEditValue, the new placeholder text, and the release template masks v.Secret) which passed.
  • Attempted templ generate but it failed in this environment because templ/module downloads are not available here, so generated *_templ.go could not be produced locally.
  • Executed go test -v -count=1 ./... which ran many package tests (notably internal/db, internal/auth, internal/repository, internal/runner, internal/notify, internal/migrate, internal/secret, and others) and those package tests passed; the full test run failed to build packages that require generated templ files and the embedded swagger-ui assets (e.g., cmd/server, internal/server, internal/handler, internal/handler/api, and static) because of the missing generated files and swagger assets, which is expected on a fresh checkout without templ generate / make swagger-ui-copy.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant