MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / getAutoModeConfig

Function getAutoModeConfig

source code/utils/settings/settings.ts:938–984  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

936 * otherwise inject classifier allow/deny rules (RCE risk).
937 */
938export function getAutoModeConfig():
939 | { allow?: string[]; soft_deny?: string[]; environment?: string[] }
940 | undefined {
941 if (feature('TRANSCRIPT_CLASSIFIER')) {
942 const schema = z.object({
943 allow: z.array(z.string()).optional(),
944 soft_deny: z.array(z.string()).optional(),
945 deny: z.array(z.string()).optional(),
946 environment: z.array(z.string()).optional(),
947 })
948
949 const allow: string[] = []
950 const soft_deny: string[] = []
951 const environment: string[] = []
952
953 for (const source of [
954 'userSettings',
955 'localSettings',
956 'flagSettings',
957 'policySettings',
958 ] as const) {
959 const settings = getSettingsForSource(source)
960 if (!settings) continue
961 const result = schema.safeParse(
962 (settings as Record<string, unknown>).autoMode,
963 )
964 if (result.success) {
965 if (result.data.allow) allow.push(...result.data.allow)
966 if (result.data.soft_deny) soft_deny.push(...result.data.soft_deny)
967 if (process.env.USER_TYPE === 'ant') {
968 if (result.data.deny) soft_deny.push(...result.data.deny)
969 }
970 if (result.data.environment)
971 environment.push(...result.data.environment)
972 }
973 }
974
975 if (allow.length > 0 || soft_deny.length > 0 || environment.length > 0) {
976 return {
977 ...(allow.length > 0 && { allow }),
978 ...(soft_deny.length > 0 && { soft_deny }),
979 ...(environment.length > 0 && { environment }),
980 }
981 }
982 }
983 return undefined
984}
985
986export function rawSettingsContainsKey(key: string): boolean {
987 for (const source of getEnabledSettingSources()) {

Callers 3

buildYoloSystemPromptFunction · 0.85
autoModeConfigHandlerFunction · 0.85
autoModeCritiqueHandlerFunction · 0.85

Calls 1

getSettingsForSourceFunction · 0.85

Tested by

no test coverage detected