* feat: add window.setAuthToken for IDE integration
Add window.setAuthToken() function to allow IDE extensions to programmatically inject authentication tokens into the configuration dialog token input field. The function also marks the form as dirty to properly track the change.
* feat: add token validation with context-aware error messages
Add comprehensive token validation that checks format based on the selected
authentication method (OAuth2, PAT, or Legacy API Token). Refactor validation
logic to use a global state pattern with real-time updates via event listeners.
- Add token format validators: UUID (legacy), PAT pattern, OAuth2 JSON
- Display context-aware error messages based on auth method selection
- Trigger validation when token changes or auth method switches
- Refactor validation to use validateAndShowError helper to eliminate duplication
- Replace validateAllBeforeSave with getFormValidationInfo that queries state
- Simplify SAVE_STATUS codes to generic validation_error
- Update setAuthToken to trigger validation automatically
- Add token-error element to config.html for displaying validation messages
* feat: add test panel for config dialog validation and dirty state
Add interactive test panel to config-dialog script that displays real-time
validation status, dirty state, and saved JSON output. Replace alert-based
testing with persistent UI panel.
- Add fixed status panel showing form validity and dirty state
- Display saved JSON in scrollable section with copy button
- Update validation status every 100ms for real-time feedback
- Set test token to valid UUID format for testing
- Replace alert() calls with panel updates for better UX
* fix: convert string boolean values to actual booleans in form serialization
Ensure form fields with string values "true"/"false" are converted to actual boolean values when serializing to JSON. This affects enableDeltaFindings, enableTrustedFoldersFeature, and orgSetByUser fields.
* test: disable auto auth in 2 more tests (#1065)
Following on from a3f87ec these two tests were missed as they have custom init params.
Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>
* refactor: rename baseUrl to cliBaseDownloadURL for clarity
Renamed the configuration field from `baseUrl` to `cliBaseDownloadURL` to better reflect its purpose as the base URL for downloading Snyk CLI binaries. This change improves code clarity and makes the field's purpose more explicit.
Changes:
- Renamed Config field from `baseUrl` to `cliBaseDownloadURL`
- Updated getter/setter methods to `CliBaseDownloadURL()` and `SetCliBaseDownloadURL()`
- Updated constant from `configBaseUrl` to `configCliBaseDownloadURL`
- Updated Settings struct field and JSON tag in LSP types
- Updated HTML form field IDs and names in config template
- Updated function name from `updateBaseUrl()` to `updateCliBaseDownloadURL()`
- Updated all references and variable names for consistency
* feat: clear preferred org
* fix: never send progress with empty value (#1108)
* refactor: remove backward compatibility fallbacks for ConfigApp namespaces
Standardize on modern naming conventions across all configuration template JavaScript files:
- Use ConfigApp.dom instead of ConfigApp.helpers
- Use ConfigApp.formHandler instead of ConfigApp.formData
Remove all fallback logic that maintained backward compatibility with legacy names.
This eliminates redundant code paths and simplifies maintenance.
Changes:
- Remove duplicate exports from source files (dom.js, form-handler.js)
- Remove fallback checks in consumer code (app.js, authentication.js, auto-save.js, folders.js, form-state.js, form-handler.js)
- Update validation.js to consistently use 'dom' instead of 'helpers' (33 occurrences)
- Simplify validateAdditionalEnv using regex pattern matching
Also includes:
- Remove unused enableTrustedFoldersFeature hidden input from config.html
- Update test token in config-dialog main.go
- Fix default auth method from "token" to "oauth" in validation.js
* fix: additionalParameters saved as array
* feat: add auto-save to testing sandbox
* refactor: remove fallback code and improve endpoint validation
Remove backward compatibility fallbacks across configuration UI:
- Remove direct window function fallbacks in auto-save, authentication
- Remove namespace aliases (formStateTracking, folderManagement, trustedFolders)
- Simplify endpoint validation regex to single pattern
- Fix endpoint error message to match validation pattern
- Add TODOs for proper cloning in base_scan.go and lsp.go
All code now assumes required modules and IDE bridge are present.
---------
Co-authored-by: Ben Durrans <Benjamin.Durrans@snyk.io>
Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>