-
-
Notifications
You must be signed in to change notification settings - Fork 699
feat: integrate Atlas Cloud provider #1672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ccojocar
merged 10 commits into
securego:master
from
lucaszhu-hue:feat/atlas-cloud-provider
May 26, 2026
+214
−8
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8cb907f
feat: integrate Atlas Cloud provider
lucaszhu-hue 12553fa
Update .env.example for review feedback
lucaszhu-hue 91425c2
Update README.md for review feedback
lucaszhu-hue eeccf71
Update autofix/ai.go for review feedback
lucaszhu-hue 2a6ed6f
Update autofix/atlas.go for review feedback
lucaszhu-hue 0f3853a
Update autofix/atlas_test.go for review feedback
lucaszhu-hue 810a27f
Update cmd/gosec/main.go for review feedback
lucaszhu-hue c959ad5
Remove temporary Atlas review document
lucaszhu-hue 3811b45
Fix lint in autofix atlas tests
lucaszhu-hue a76925a
docs: add Atlas Cloud README intro
lucaszhu-hue File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| GOSEC_AI_API_KEY=your_atlas_cloud_api_key | ||
| ATLASCLOUD_API_KEY=your_atlas_cloud_api_key | ||
| GOSEC_AI_PROVIDER=atlas | ||
| GOSEC_AI_MODEL=atlas | ||
| GOSEC_AI_BASE_URL=https://api.atlascloud.ai/v1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,10 +33,12 @@ coverage.out | |
| *.prof | ||
|
|
||
| .DS_Store | ||
| .env.local | ||
| .env.*.local | ||
|
|
||
| .vscode | ||
| .idea | ||
|
|
||
| # SBOMs generated during CI | ||
| /bom.json | ||
| 1 | ||
| 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Atlas Cloud Provider Review | ||
|
ccojocar marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## What Changed | ||
|
|
||
| - Added a first-class `atlas` AI provider preset in `autofix`. | ||
| - Defaulted Atlas Cloud traffic to `https://api.atlascloud.ai/v1`. | ||
| - Added Atlas model aliases: | ||
| - `atlas` -> `deepseek-ai/deepseek-v4-flash` | ||
| - `atlas-deepseek-v4-flash` -> `deepseek-ai/deepseek-v4-flash` | ||
| - `atlas-qwen3-coder-next` -> `qwen/qwen3-coder-next` | ||
| - `atlas-kimi-k2.6` -> `moonshotai/kimi-k2.6` | ||
| - `atlas/<model-id>` and `atlas:<model-id>` for direct model pass-through | ||
| - Added `ATLASCLOUD_API_KEY` fallback support in the CLI when `-ai-api-provider` starts with `atlas`. | ||
| - Updated README with Atlas Cloud usage, examples, and the official link: | ||
| `https://www.atlascloud.ai/?utm_source=github&utm_medium=link&utm_campaign=gosec` | ||
| - Added `.env.example` for local setup and ignored `.env.local` files. | ||
|
|
||
| ## Files Changed | ||
|
|
||
| - `autofix/ai.go` | ||
| - `autofix/atlas.go` | ||
| - `autofix/ai_test.go` | ||
| - `autofix/atlas_test.go` | ||
| - `cmd/gosec/main.go` | ||
| - `README.md` | ||
| - `.gitignore` | ||
| - `.env.example` | ||
|
|
||
| ## Local Validation Plan | ||
|
|
||
| - Unit test the `autofix` package. | ||
| - Build and run `gosec` against a temporary vulnerable sample with `-ai-api-provider=atlas`. | ||
| - Validate direct Atlas Cloud non-stream and stream responses with the provided API key. | ||
|
|
||
| ## Validation Results | ||
|
|
||
| - `go test ./...` passed. | ||
| - Atlas Cloud `/v1/models` responded successfully and returned account-accessible model IDs. | ||
| - Atlas Cloud non-stream chat completion succeeded with `deepseek-ai/deepseek-v4-flash`. | ||
| - Atlas Cloud stream chat completion succeeded with `deepseek-ai/deepseek-v4-flash`. | ||
| - `gosec` binary integration succeeded: | ||
| `-ai-api-provider=atlas` generated a live Autofix for a temporary `G402` sample. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| package autofix | ||
|
|
||
| import "strings" | ||
|
|
||
| const ( | ||
| ModelAtlasDefault = "deepseek-ai/deepseek-v4-flash" | ||
|
ccojocar marked this conversation as resolved.
Outdated
|
||
| ModelAtlasDeepSeekV4Flash = "deepseek-ai/deepseek-v4-flash" | ||
| ModelAtlasQwenCoderNext = "qwen/qwen3-coder-next" | ||
| ModelAtlasKimiK26 = "moonshotai/kimi-k2.6" | ||
|
|
||
| DefaultAtlasBaseURL = "https://api.atlascloud.ai/v1" | ||
| ) | ||
|
|
||
| type AtlasConfig struct { | ||
| Model string | ||
| APIKey string `json:"-"` | ||
| BaseURL string | ||
| MaxTokens int | ||
| Temperature float64 | ||
| SkipSSL bool | ||
| } | ||
|
|
||
| func NewAtlasClient(config AtlasConfig) (GenAIClient, error) { | ||
| baseURL := config.BaseURL | ||
| if baseURL == "" { | ||
| baseURL = DefaultAtlasBaseURL | ||
| } | ||
|
|
||
| return NewOpenAIClient(OpenAIConfig{ | ||
| Model: parseAtlasModel(config.Model), | ||
| APIKey: config.APIKey, | ||
| BaseURL: baseURL, | ||
| MaxTokens: config.MaxTokens, | ||
| Temperature: config.Temperature, | ||
| SkipSSL: config.SkipSSL, | ||
| }) | ||
| } | ||
|
|
||
| func parseAtlasModel(model string) string { | ||
| switch model { | ||
| case "", "atlas", "atlas-deepseek-v4-flash": | ||
| return ModelAtlasDefault | ||
| case "atlas-qwen3-coder-next", "atlas-qwen-turbo": | ||
| return ModelAtlasQwenCoderNext | ||
| case "atlas-kimi-k2.6", "atlas-kimi-k2": | ||
| return ModelAtlasKimiK26 | ||
| } | ||
|
|
||
| for _, prefix := range []string{"atlas/", "atlas:"} { | ||
| if strings.HasPrefix(model, prefix) { | ||
| trimmed := strings.TrimPrefix(model, prefix) | ||
| if trimmed != "" { | ||
| return trimmed | ||
| } | ||
| return ModelAtlasDefault | ||
| } | ||
| } | ||
|
|
||
| if strings.HasPrefix(model, "atlas-") { | ||
| trimmed := strings.TrimPrefix(model, "atlas-") | ||
| if trimmed != "" { | ||
| return trimmed | ||
| } | ||
| return ModelAtlasDefault | ||
| } | ||
|
|
||
| return model | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| package autofix | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestParseAtlasModel(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| input string | ||
| expected string | ||
| }{ | ||
| { | ||
| name: "atlas defaults to deepseek v3", | ||
| input: "atlas", | ||
| expected: ModelAtlasDefault, | ||
| }, | ||
| { | ||
| name: "atlas deepseek alias", | ||
| input: "atlas-deepseek-v4-flash", | ||
| expected: ModelAtlasDeepSeekV4Flash, | ||
| }, | ||
| { | ||
| name: "atlas qwen alias", | ||
| input: "atlas-qwen3-coder-next", | ||
| expected: ModelAtlasQwenCoderNext, | ||
| }, | ||
| { | ||
| name: "atlas kimi alias", | ||
| input: "atlas-kimi-k2.6", | ||
| expected: ModelAtlasKimiK26, | ||
| }, | ||
| { | ||
| name: "atlas slash syntax", | ||
| input: "atlas/deepseek-v3", | ||
| expected: "deepseek-v3", | ||
| }, | ||
| { | ||
| name: "atlas colon syntax", | ||
| input: "atlas:qwen-plus", | ||
| expected: "qwen-plus", | ||
| }, | ||
| { | ||
| name: "unknown non atlas model passes through", | ||
| input: "custom-model", | ||
| expected: "custom-model", | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| assert.Equal(t, tt.expected, parseAtlasModel(tt.input)) | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestNewAtlasClient_Defaults(t *testing.T) { | ||
| client, err := NewAtlasClient(AtlasConfig{ | ||
| Model: "atlas", | ||
| APIKey: "test-key", | ||
| }) | ||
| require.NoError(t, err) | ||
| require.NotNil(t, client) | ||
|
|
||
| wrapper, ok := client.(*openaiWrapper) | ||
| require.True(t, ok) | ||
| assert.Equal(t, ModelAtlasDefault, string(wrapper.model)) | ||
| assert.Equal(t, 1024, wrapper.maxTokens) | ||
| assert.InEpsilon(t, 0.7, wrapper.temperature, 0.001) | ||
| } | ||
|
|
||
| func TestNewAtlasClient_CustomModelSyntax(t *testing.T) { | ||
| client, err := NewAtlasClient(AtlasConfig{ | ||
| Model: "atlas/moonshot-v1-8k", | ||
| APIKey: "test-key", | ||
| BaseURL: DefaultAtlasBaseURL, | ||
| }) | ||
| require.NoError(t, err) | ||
|
|
||
| wrapper := client.(*openaiWrapper) | ||
| assert.Equal(t, "moonshot-v1-8k", string(wrapper.model)) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.