-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Codex/sync upstream 20260709 #6055
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
Changes from all commits
8248906
98d32a0
3f36a2e
6475eb0
3d661da
e85b052
35d3edf
b29b326
a47774c
f3cee0b
859dc87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Publish GHCR image | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build and push image | ||
| runs-on: ubuntu-latest | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| steps: | ||
| - name: Check out | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Normalize GHCR repository | ||
| run: echo "GHCR_REPOSITORY=${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to GHCR | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Extract metadata | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ghcr.io/${{ env.GHCR_REPOSITORY }} | ||
| tags: | | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
| type=ref,event=branch | ||
| type=sha,prefix=sha- | ||
|
|
||
| - name: Build and push | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64 | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| provenance: false | ||
| sbom: false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ func SetApiRouter(router *gin.Engine) { | |
| //apiRouter.GET("/midjourney", controller.GetMidjourney) | ||
| apiRouter.GET("/home_page_content", controller.GetHomePageContent) | ||
| apiRouter.GET("/pricing", middleware.HeaderNavModuleAuth("pricing"), controller.GetPricing) | ||
| apiRouter.GET("/subscription/plans", controller.GetSubscriptionPlans) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Inspect the SubscriptionPlan model definition and its JSON tags
fd -t f 'subscription' model/ | head
rg -nP -C2 'type\s+SubscriptionPlan\s+struct' --type=go
# Show full struct with json tags to audit exposed fields
ast-grep run --pattern 'type SubscriptionPlan struct { $$$ }' --lang go
# Check NormalizeDefaults to confirm it does not populate sensitive data
rg -nP -C3 'func .*NormalizeDefaults' --type=goRepository: QuantumNous/new-api Length of output: 471 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- model/subscription.go (lines) ---'
wc -l model/subscription.go
cat -n model/subscription.go | sed -n '1,260p'
echo '--- search GetSubscriptionPlans / DTO ---'
rg -n -C 3 'GetSubscriptionPlans|SubscriptionPlanDTO|type .*SubscriptionPlan.*DTO|subscription/plans' controller router modelRepository: QuantumNous/new-api Length of output: 12692 Hide internal plan metadata from the public plans endpoint
🤖 Prompt for AI Agents |
||
| perfMetricsRoute := apiRouter.Group("/perf-metrics") | ||
| perfMetricsRoute.Use(middleware.HeaderNavModulePublicOrUserAuth("pricing")) | ||
| { | ||
|
|
@@ -151,7 +152,6 @@ func SetApiRouter(router *gin.Engine) { | |
| subscriptionRoute := apiRouter.Group("/subscription") | ||
| subscriptionRoute.Use(middleware.UserAuth()) | ||
| { | ||
| subscriptionRoute.GET("/plans", controller.GetSubscriptionPlans) | ||
| subscriptionRoute.GET("/self", controller.GetSubscriptionSelf) | ||
| subscriptionRoute.PUT("/self/preference", controller.UpdateSubscriptionPreference) | ||
| subscriptionRoute.POST("/balance/pay", middleware.CriticalRateLimit(), controller.SubscriptionRequestBalancePay) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Set
persist-credentials: falseon the checkout step.actions/checkout@v4defaults topersist-credentials: true, which stores theGITHUB_TOKENin.git/configon the runner. Since the Dockerfile copies the entire build context (COPY . .), these credentials could leak into the image if.gitis not excluded by.dockerignore. Addingpersist-credentials: falseis a simple hardening measure since this workflow only needs to read the source, not push back to the repo.🔒 Proposed fix
- name: Check out uses: actions/checkout@v4 + with: + persist-credentials: false📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.26.1)
[warning] 19-20: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Source: Linters/SAST tools