feat(audit): sync upstream localized security audit logs + auth method tracking - #159
Closed
jjcc123312 wants to merge 4 commits into
Closed
feat(audit): sync upstream localized security audit logs + auth method tracking#159jjcc123312 wants to merge 4 commits into
jjcc123312 wants to merge 4 commits into
Conversation
Upstream commits d0c4305 and 1ac0f58 only updated 6 of our 8 frontend locales. Add real Spanish and Portuguese translations for the 72 new audit log keys so they do not fall back to English. Template vars ({{method}}, {{route}}, {{from}}, {{to}}, etc.) preserved. Verified via bun run i18n:sync: es/pt untranslatedCount=0, missingCount=0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Existing locale entries keep Passkey untranslated; align the 3 new audit keys (Deleted/Registered/Reset passkey) to the same house style. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Author
|
暂不同步:此 PR 同步的是上游代码,且 OpenCodeReview 指出上游实现存在质量问题(非本次合并引入)。当前无强需求,改为按需单独同步。先关闭,需要时再开。 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Syncs the upstream security audit logs feature into the fork. Audit logs record manage/operation actions (channel CRUD, user CRUD, redemption codes, system settings, 2FA/passkey changes, upstream model sync, option changes) plus successful logins, with localized human-readable descriptions surfaced in the usage-logs UI.
Commits synced (in order)
d0c4305a1— feat(audit): add localized security audit logs (feat(audit): add localized security audit logs QuantumNous/new-api#5462)controller/audit.go,middleware/audit.gomodel/log.go: addsLogTypeLogin = 7(no DB schema change)controller/{channel,user,twofa,passkey,redemption,option,channel_upstream_update}.goandmiddleware/auth.go1ac0f5807— feat(audit): add authentication method tracking in audit logs (applied cleanly)i18n(audit)— adds es/pt translations (see below)Conflict resolutions
controller/user.go(substantive): insetupLogin, kept our fork's variadic signature (isNewUser ...bool), ourdatamap, and theis_new_useronboarding block, AND added upstream'srecordLoginAudit(user, c)call. They coexist — the audit call only reads user+context and writes a log; it does not touch thedatamap. All other user.go hunks (UpdateUser/DeleteUser/CreateUser/ManageUser/AdminClearUserBinding audit calls) took upstream's additions.constant/context_key.go: take-both — kept ourContextKeyBlockRunSettlementand added upstream'sContextKeyAuditLoggedin the same const block.web/default/src/i18n/locales/{en,fr,ja,ru,vi,zh}.json: positional take-both — kept our existing keys and upstream's new audit keys; valid JSON.AGENTS.md,CLAUDE.md: kept ours (--ours); skipped upstream's cosmetic doc note. Verified 0 diff vsmain.es/pt translations (our fork has 8 locales; upstream edited only 6)
Upstream's two commits added 72 new frontend keys but only to 6 locales. Added real Spanish and Portuguese translations for all 72 keys to
es.jsonandpt.jsonso they do not fall back to English. i18next template vars ({{method}},{{route}},{{from}},{{to}},{{count}},{{id}}, etc.) preserved; the format-literal key{{method}} {{route}}kept as-is.Verified via
bun run i18n:sync: all 8 locales reportmissingCount: 0,untranslatedCount: 0. No per-locale*.untranslated.jsonfiles were produced (the tool only writes them when untranslated keys exist), confirming none of the new audit keys are untranslated.No DB schema change
LogTypeLogin = 7is a new log-type constant only; no migration.Verification
go build ./controller/... ./middleware/... ./model/... ./constant/...→ exit 0go vet ./controller/... ./middleware/... ./model/...→ exit 0controller middleware model constant web/default/src→ no matchesgo build ./...fails on a pre-existingweb/classic/distembed unrelated to this change; built specific packages instead.)🤖 Generated with Claude Code