Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript
1.1 KB
Raw Blame
import { afterEach, describe, expect, it, vi } from 'vitest'

describe('HCC image-allowlist config', () => {
  afterEach(() => {
    delete process.env.CONTEXT_MAPPER_ALLOWED_IMAGE_PREFIXES
    delete process.env.CONTEXT_MAPPER_ENFORCE_IMAGE_ALLOWLIST
    vi.resetModules()
  })

  it('defaults to the shared permissive allowlist and enforce=false', async () => {
    vi.resetModules()
    const { config } = await import('../src/config')
    const { DEFAULT_ALLOWED_PLUGIN_IMAGE_PREFIXES } = await import('@clerum/image-policy')
    expect(config.allowedPluginImagePrefixes).toEqual([...DEFAULT_ALLOWED_PLUGIN_IMAGE_PREFIXES])
    expect(config.enforcePluginImageAllowlist).toBe(false)
  })

  it('parses env overrides (list + bool)', async () => {
    process.env.CONTEXT_MAPPER_ALLOWED_IMAGE_PREFIXES = 'registry.evenfire.ai/, ghcr.io/acme/'
    process.env.CONTEXT_MAPPER_ENFORCE_IMAGE_ALLOWLIST = 'true'
    vi.resetModules()
    const { config } = await import('../src/config')
    expect(config.allowedPluginImagePrefixes).toEqual(['registry.evenfire.ai/', 'ghcr.io/acme/'])
    expect(config.enforcePluginImageAllowlist).toBe(true)
  })
})