Skip to content

Commit 4cd4edc

Browse files
lpcoxCopilot
andauthored
fix: AWF_ENABLE_HOST_ACCESS safety net sets '1' instead of 'true' (#2227)
The allowHostServicePorts safety net in docker-manager.ts was setting AWF_ENABLE_HOST_ACCESS='true', but entrypoint.sh checks for '1'. This caused host access features to silently fail when allowHostServicePorts was set without explicit enableHostAccess. Fixes #1728 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b6b306f commit 4cd4edc

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/docker-manager.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,6 +1980,15 @@ describe('docker-manager', () => {
19801980

19811981
expect(env.AWF_ENABLE_HOST_ACCESS).toBeUndefined();
19821982
});
1983+
1984+
it('should set AWF_ENABLE_HOST_ACCESS to 1 via safety net when allowHostServicePorts is set without enableHostAccess', () => {
1985+
const config = { ...mockConfig, allowHostServicePorts: '5432,6379' };
1986+
const result = generateDockerCompose(config, mockNetworkConfig);
1987+
const env = result.services.agent.environment as Record<string, string>;
1988+
1989+
expect(env.AWF_ENABLE_HOST_ACCESS).toBe('1');
1990+
expect(env.AWF_HOST_SERVICE_PORTS).toBe('5432,6379');
1991+
});
19831992
});
19841993

19851994
describe('NO_PROXY baseline', () => {

src/docker-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ export function generateDockerCompose(
10671067
// Ensure host access is enabled (setup-iptables.sh requires AWF_ENABLE_HOST_ACCESS)
10681068
// The CLI auto-enables this, but this is a safety net for programmatic usage
10691069
if (!environment.AWF_ENABLE_HOST_ACCESS) {
1070-
environment.AWF_ENABLE_HOST_ACCESS = 'true';
1070+
environment.AWF_ENABLE_HOST_ACCESS = '1';
10711071
}
10721072
}
10731073

0 commit comments

Comments
 (0)