MCPcopy Create free account

hub / github.com/Prejudice-Studio/Twilight / functions

Functions2,686 in github.com/Prejudice-Studio/Twilight

FunctionTestDatabaseAdminBackupRestoreAndAuth
(t *testing.T)
internal/api/app_test.go:3428
FunctionTestDecodeMapEnforcesSizeAndDepthLimits
TestDecodeMapEnforcesSizeAndDepthLimits 验证 decodeMap 在 256KB / 32 层 边界外都返回空 map,避免攻击者通过超大 payload / 深嵌套 JSON 让单次解码 吃光内存或拖慢后续遍历。
internal/api/app_test.go:5454
FunctionTestDefaultErrorCodeCoversAPIStatuses
(t *testing.T)
internal/api/response_test.go:8
FunctionTestDefaultsIncludeUsablePostgresParts
(t *testing.T)
internal/config/config_test.go:285
FunctionTestDeleteRegCodePhysicallyDeletesUsedCode
(t *testing.T)
internal/store/store_test.go:21
FunctionTestDeleteTicketRemovesAttachments
TestDeleteTicketRemovesAttachments 验证删除工单时同步清除其图片目录 (子需求 F)。
internal/api/ticket_handlers_test.go:219
FunctionTestDeleteUserCascadesAllDerivedData
防回归:DeleteUser 必须级联清理所有 UID-键控派生数据。 旧实现仅清 5 个域,留下幽灵关联:复用 UID 创建的新用户会继承旧设备 / 旧 邀请关系 / 旧签到积分。这条测试覆盖每个域至少一条记录。
internal/store/delete_user_test.go:11
FunctionTestDescribePostgresConnectionError
(t *testing.T)
internal/store/postgres_test.go:43
FunctionTestDeveloperJSAdminUserSearchAndControlledUpdate
(t *testing.T)
internal/api/developer_sandbox_test.go:202
FunctionTestDeveloperJSConvenienceObjectsAndHelpers
(t *testing.T)
internal/api/developer_sandbox_test.go:331
FunctionTestDeveloperJSCreateAnnouncement
(t *testing.T)
internal/api/developer_sandbox_test.go:945
FunctionTestDeveloperJSDocsEndpointRequiresAdminAndDescribesGoja
(t *testing.T)
internal/api/developer_sandbox_test.go:18
FunctionTestDeveloperJSExitAndAssertStopWithoutRuntimeError
(t *testing.T)
internal/api/developer_sandbox_test.go:400
FunctionTestDeveloperJSGenerateInviteCodeRespectsFeatureGate
(t *testing.T)
internal/api/developer_sandbox_test.go:902
FunctionTestDeveloperJSGenerateRegcodeCreatesRetrievableCode
(t *testing.T)
internal/api/developer_sandbox_test.go:870
FunctionTestDeveloperJSGenerateRegcodePreviewDoesNotWrite
(t *testing.T)
internal/api/developer_sandbox_test.go:841
FunctionTestDeveloperJSGenerateRegcodeRequiresAdmin
(t *testing.T)
internal/api/developer_sandbox_test.go:817
FunctionTestDeveloperJSGetUserByUIDIsSanitizedAndAdminScoped
(t *testing.T)
internal/api/developer_sandbox_test.go:135
FunctionTestDeveloperJSInlineCallbackOwnerAndEdit
(t *testing.T)
internal/api/developer_sandbox_test.go:495
FunctionTestDeveloperJSInteractionSurvivesSlowNetwork
TestDeveloperJSInteractionSurvivesSlowNetwork guards against the regression where the script execution timeout (formerly 200ms) was shorter than the t
internal/api/developer_sandbox_test.go:646
FunctionTestDeveloperJSPresetReferenceUsesLatestPresetCode
(t *testing.T)
internal/api/developer_sandbox_test.go:679
FunctionTestDeveloperJSPrivateIPBlocksSSRFTargets
TestDeveloperJSPrivateIPBlocksSSRFTargets 锁定 fetch 沙箱的 IP 黑名单, 防止开发者 JS 通过 DNS rebinding / IPv4-mapped IPv6 等手段访问内网、 回环、链路本地(云元数据 169.254.169.254)等敏感目
internal/api/developer_sandbox_test.go:769
FunctionTestDeveloperJSQuickGeneratorsMatchOptionForm
(t *testing.T)
internal/api/developer_sandbox_test.go:990
FunctionTestDeveloperJSRiskTokensWarnButDoNotReject
(t *testing.T)
internal/api/developer_sandbox_test.go:626
FunctionTestDeveloperJSSetLoginNotifyDryRunAndRuntimeMutation
(t *testing.T)
internal/api/developer_sandbox_test.go:441
FunctionTestDeveloperJSSimplifiedUserHelpers
(t *testing.T)
internal/api/developer_sandbox_test.go:254
FunctionTestDeveloperJSUsersAPISanitizesCurrentUser
(t *testing.T)
internal/api/developer_sandbox_test.go:103
FunctionTestDeveloperJSWaitTextConsumesSameUserPlainText
(t *testing.T)
internal/api/developer_sandbox_test.go:571
FunctionTestDeveloperModeDisabledBlocksJSButKeepsPlainTextCommands
(t *testing.T)
internal/api/developer_sandbox_test.go:723
FunctionTestDeviceLifecycleDefaultsSortsAndDeletes
(t *testing.T)
internal/store/device_test.go:8
FunctionTestDirectEmbyRegistrationRecordsRegcodeEquivalentGrant
(t *testing.T)
internal/api/app_test.go:4229
FunctionTestDisabledFeatureFlagsAreExposedAndEnforced
(t *testing.T)
internal/api/app_test.go:1087
FunctionTestEmailGateActiveByRole
(t *testing.T)
internal/api/email_verify_service_test.go:98
FunctionTestEmailGateInactiveWhenForceBindOff
(t *testing.T)
internal/api/email_verify_service_test.go:124
FunctionTestEmailVerificationConsumeOKThenGone
(t *testing.T)
internal/store/email_verification_test.go:5
FunctionTestEmailVerificationDTOSanitizes
TestEmailVerificationDTOSanitizes 锁定管理员审查 DTO 的安全约定:永不外泄 CodeHash, 正确解析关联本地账号用户名,并按 ExpiresAt 标注过期状态。
internal/api/email_admin_test.go:12
FunctionTestEmailVerificationExpiredConsumed
(t *testing.T)
internal/store/email_verification_test.go:34
FunctionTestEmailVerificationTooManyAttempts
(t *testing.T)
internal/store/email_verification_test.go:50
FunctionTestEmbyCapacityCountsPendingEntitlementsSeparatelyFromSystemLimit
(t *testing.T)
internal/api/app_test.go:3748
FunctionTestEmbyRetryOn5xxSkips4xx
TestEmbyRetryOn5xxSkips4xx 直接覆盖 retry helper 的"4xx 不重试"分支, 避免被错误的"什么错都重试"实现悄悄回归。
internal/api/app_test.go:2031
FunctionTestEmbySyncDoesNotRestoreRemoteWhenWebIsActive
(t *testing.T)
internal/api/app_test.go:4463
FunctionTestEmbyURLsDoNotFallbackToInternalServerURL
(t *testing.T)
internal/api/app_test.go:1229
FunctionTestEnforceDeviceLimitEvictsOldestUntrusted
(t *testing.T)
internal/store/device_limit_test.go:5
FunctionTestEnforceDeviceLimitNoopWhenUnderLimit
(t *testing.T)
internal/store/device_limit_test.go:34
FunctionTestEnsureTicketDefaultsPreservesStringList
TestEnsureTicketDefaultsPreservesStringList 回归测试历史 bug: ensureTicketDefaults 早期只对 types 做 []any 类型断言,而 configValues 由 cfg.TicketTypes 产出的是 []string,断言
internal/api/ticket_type_repro_test.go:15
FunctionTestExpiredInviteCannotBeUsedOrConsumed
(t *testing.T)
internal/api/app_test.go:4952
FunctionTestExportUsersCSVSanitizesMaliciousUsername
TestExportUsersCSVSanitizesMaliciousUsername 端到端验证:注册一个公式注入 用户名后,管理员导出的 users.csv 对应单元格被前置单引号中和。
internal/api/security_fixes_test.go:47
FunctionTestFailedRegCodeSaveRollsBackMemory
(t *testing.T)
internal/store/store_test.go:249
FunctionTestFillDeviceIPsFromHistory
TestFillDeviceIPsFromHistory 覆盖离线设备 IP 回填的三条分支: 唯一 IP 全量回填、多 IP 时间相关回填、超窗口不猜;并确认已有 IP 不被覆盖。
internal/api/emby_device_audit_test.go:57
FunctionTestFindUserByEmailVerifiedRequiresVerified
(t *testing.T)
internal/store/email_verification_test.go:124
FunctionTestFirstRegisterWithoutAdminConfigStaysNormalUser
(t *testing.T)
internal/api/setup_handlers_test.go:175
FunctionTestFirstRegistrantIsNotAutoAdmin
TestFirstRegistrantIsNotAutoAdmin 防回归:已移除"空数据库首注册者无条件 成为 Admin"通道。管理员身份只能来自配置文件 admin_uids / admin_usernames。 本测试用一个不含任何 admin 配置的 App,确认首个注册用户只是普通用户。
internal/api/security_fixes_test.go:168
FunctionTestForceBindUnbindConsumesApprovedRebindAndPreservesAudit
TestForceBindUnbindConsumesApprovedRebindAndPreservesAudit 覆盖强制绑定下 "换绑"完整链路的两条关键不变量: 1. 普通用户在 force_bind_telegram 开启时,只有持有 admin 批准的 rebind 请求才能解绑——批准
internal/api/app_test.go:6151
FunctionTestForgotPasswordRejectsExpiredAccount
TestForgotPasswordRejectsExpiredAccount 锁定 R62-7 不变量: emby 鉴权通过但面板侧账号 entitlement 已过期(Active=true & ExpiredAt<now) 时不应进入密码重置 + emby 写新密码流程。否则 1. embyS
internal/api/app_test.go:5907
FunctionTestFrontendRouteCompatibilityDoesNot404
(t *testing.T)
internal/api/app_test.go:589
FunctionTestHashEmailCodeDeterministicAndScoped
(t *testing.T)
internal/api/email_verify_service_test.go:55
FunctionTestIPBlacklistLifecycleExpiryAndSorting
(t *testing.T)
internal/store/ip_blacklist_test.go:9
FunctionTestInventoryCheckUsesEmbyProviderAndSeasons
(t *testing.T)
internal/api/app_test.go:1135
FunctionTestInviteCodeFormatAndDTOUserRecords
(t *testing.T)
internal/api/app_test.go:3863
FunctionTestInviteDisabledStillAllowsExistingChildRenewCodesButBlocksNewInvites
(t *testing.T)
internal/api/app_test.go:5035
FunctionTestInviteMeDoesNotLeakSensitiveFields
TestInviteMeDoesNotLeakSensitiveFields 防回归:invite/me 的 parent / children 不得包含 email / telegram_id / telegram_username / emby_id 等敏感字段(旧实现 直接复用 publicU
internal/api/security_fixes_test.go:73
FunctionTestInviteMeReturnsStableTreeShape
(t *testing.T)
internal/api/app_test.go:933
FunctionTestInviteParentCanDetachDisabledChildWithoutReactivatingWeb
(t *testing.T)
internal/api/app_test.go:4737
FunctionTestInviteParentCanDetachExpiredChildAndKeepWebAccountActive
(t *testing.T)
internal/api/app_test.go:4691
FunctionTestInviteRenewCodeCreatesTargetedRegCode
(t *testing.T)
internal/api/app_test.go:4982
FunctionTestInviteUseRejectsExpiredInviterAndRootLimit
(t *testing.T)
internal/api/app_test.go:5136
FunctionTestInviteUseRevalidatesTreeAndBoundsExpiry
(t *testing.T)
internal/api/app_test.go:5090
FunctionTestLastSchedulerRunByTypeBypassesRecentWindow
TestLastSchedulerRunByTypeBypassesRecentWindow 锁定 LastSchedulerRunByType 不被 SchedulerRuns(20) 的滑动窗口影响:先记一条 auto run,再压入 25 条 manual run,最新 auto 必须仍能被
internal/store/scheduler_test.go:56
FunctionTestLoadDefaultPathIgnoresEnvWhenConfigTomlMissing
(t *testing.T)
internal/config/config_test.go:214
FunctionTestLoadDefaultPathPrefersConfigTomlOverEnv
(t *testing.T)
internal/config/config_test.go:193
FunctionTestLoadEmailCleanupConfigAndEnvOverride
(t *testing.T)
internal/config/config_test.go:46
FunctionTestLoadMultilineArraysAndPostgresConfig
(t *testing.T)
internal/config/config_test.go:113
FunctionTestLoadSetupModeFromAnySection
(t *testing.T)
internal/config/config_test.go:73
FunctionTestLoadSplitCodeFormatsAndEnvOverrides
(t *testing.T)
internal/config/config_test.go:90
FunctionTestLoadTOMLAndEnvOverrides
(t *testing.T)
internal/config/config_test.go:11
FunctionTestLogConfigSupportsLegacyNumericLevels
(t *testing.T)
internal/config/config_test.go:301
FunctionTestLoginByAPIKeyRejectsDisabledAccount
TestLoginByAPIKeyRejectsDisabledAccount 锁定与 handleLogin 同一不变量: 禁用账号无法用 API Key 重新拿到 session。修复前 /auth/login/apikey 只查 API Key 命中即建会话,admin 把 Active=fa
internal/api/app_test.go:5755
FunctionTestLoginDistinguishesExpiredFromDisabled
TestLoginDistinguishesExpiredFromDisabled 锁定 R62-6 不变量: "管理员手动禁用"和"check_expired 触发的到期"两种 Active=false 状态在 api/v1/auth/login 必须返回不同的 error_code,让 webu
internal/api/app_test.go:5792
FunctionTestLoginHistoryFiltersAndLimits
(t *testing.T)
internal/store/login_log_test.go:8
FunctionTestLoginLogDefaultsAndPrunes
(t *testing.T)
internal/store/login_log_test.go:43
FunctionTestMediaDetailSanitizesPathPartsBeforeUpstreamCall
(t *testing.T)
internal/api/app_test.go:1306
FunctionTestMediaRequestGlobalLimitBlocksNonAdmins
TestMediaRequestGlobalLimitBlocksNonAdmins 验证 max_concurrent_requests_global 上限:达到后普通用户的新求片返回 MEDIA_REQUEST_GLOBAL_LIMIT,admin 仍可继续。
internal/api/app_test.go:4644
FunctionTestMediaRequestIgnoresUserSkipInventoryCheck
(t *testing.T)
internal/api/app_test.go:1168
FunctionTestMediaRequestInventoryIssueBypassesDuplicateGuard
(t *testing.T)
internal/api/app_test.go:3776
FunctionTestMediaRequestStatusUpdatesRequireExplicitStatus
(t *testing.T)
internal/api/app_test.go:1201
FunctionTestOpenAPIOnlyExposesPublicRoutes
TestOpenAPIOnlyExposesPublicRoutes 防回归:未鉴权的 openapi.json 不得枚举 admin 攻击面(旧实现列出全部路由,含 /admin/* 与 system/admin/*)。
internal/api/security_fixes_test.go:140
FunctionTestOtherDangerousActionsRequireConfirm
(t *testing.T)
internal/api/app_test.go:5353
FunctionTestParseEmbyTime
(t *testing.T)
internal/api/emby_device_audit_test.go:33
FunctionTestParseRemoteIP
(t *testing.T)
internal/api/emby_device_audit_test.go:9
FunctionTestPasswordHashRoundTripAndLegacy
(t *testing.T)
internal/security/password_test.go:9
FunctionTestPendingEmbyUserCanReplaceEntitlementWithRegisterCode
(t *testing.T)
internal/api/app_test.go:4820
FunctionTestPermanentExpiryNormalizesForPublicAPIAndAdminRenew
(t *testing.T)
internal/api/app_test.go:4527
FunctionTestPlaybackRecordsFiltersDefaultsAndLimits
(t *testing.T)
internal/store/playback_test.go:8
FunctionTestPlaybackRecordsPruneToMax
(t *testing.T)
internal/store/playback_test.go:46
FunctionTestPostJSONWithTimeoutReturnsMarshalError
(t *testing.T)
internal/api/app_test.go:627
FunctionTestPostgresEnvOverridesAndIPv6DSN
(t *testing.T)
internal/config/config_test.go:248
FunctionTestPostgresErrorClassifiersAndIdentifierQuoting
(t *testing.T)
internal/store/postgres_test.go:31
FunctionTestProductionTemplateIncludesPostgresDatabaseSection
(t *testing.T)
internal/config/config_test.go:359
FunctionTestProtectedAdminConfigHiddenPreservedAndApplied
(t *testing.T)
internal/api/app_test.go:771
FunctionTestPublicRegcodeCheckHidesTargetedCodes
(t *testing.T)
internal/api/app_test.go:5079
← previousnext →2,001–2,100 of 2,686, ranked by callers