Skip to content
Closed
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c018d25
fix(hooks): never follow redirects in HTTP hooks
wenshao Aug 2, 2026
cb6ec7c
fix(settings): strip allowedHttpHookUrls from workspace scope
wenshao Aug 2, 2026
38754ef
fix(hooks): never resolve Qwen-internal secrets in env interpolation
wenshao Aug 2, 2026
6d61cf6
fix(hooks): gate project frontmatter hooks on folder trust
wenshao Aug 2, 2026
aed434a
fix(core): apply the internal-secrets denylist to the core envVarReso…
wenshao Aug 2, 2026
5813462
Merge branch 'main' into fix/hooks-security
qwen-code-dev-bot Aug 2, 2026
50b7f86
fix(hooks): case-insensitive secret denylist, narrow fast-path import…
qwen-code-ci-bot Aug 2, 2026
1353d0b
fix(hooks): meaningful casing tests, single env resolver, workspace-s…
qwen-code-ci-bot Aug 2, 2026
e3accbe
fix(hooks): case-insensitive child-env sanitize, denylist-first resol…
qwen-code-ci-bot Aug 3, 2026
9569dbf
fix(core): channel-config secret denylist, skill allowedTools trust g…
qwen-code-ci-bot Aug 3, 2026
832f82b
fix(hooks): throw on internal-secret channel refs, sanitize redirect …
qwen-code-ci-bot Aug 3, 2026
e83f5e1
fix(hooks): event-scoped redirect warnings, merged systemMessages (#8…
qwen-code-ci-bot Aug 3, 2026
199aaee
fix(cli): warn when skill allowedTools trust gate fires in slash-comm…
qwen-code-ci-bot Aug 3, 2026
0f9e98e
fix(core): apply skill side effects when folder trust is granted mid-…
qwen-code-ci-bot Aug 3, 2026
fb7b426
fix(core): honor skill side-effect deferral contract, pin invariants …
qwen-code-ci-bot Aug 4, 2026
6c44667
Merge branch 'main' into fix/hooks-security
qwen-code-dev-bot Aug 4, 2026
b10ec55
fix(cli): remap core envVarResolver subpath in dev loader (#8396)
qwen-code-dev-bot Aug 4, 2026
935ae7e
Merge branch 'main' into fix/hooks-security
qwen-code-dev-bot Aug 4, 2026
502a8aa
fix(hooks): workspace whitelist may only narrow; trust session subage…
qwen-code-dev-bot Aug 4, 2026
846ec2d
fix(hooks): roll back once-hook slot when a 3xx is never delivered (#…
qwen-code-dev-bot Aug 4, 2026
edb11de
fix(hooks): fail closed and scan linearly when narrowing workspace ho…
qwen-code-dev-bot Aug 4, 2026
817e1dc
fix(hooks): harden hook whitelist narrowing and one-shot warning deli…
qwen-code-dev-bot Aug 5, 2026
90002cb
fix(hooks): close home-root trust bypass and non-ASCII pattern diverg…
qwen-code-dev-bot Aug 5, 2026
f36390e
Merge branch 'main' into fix/hooks-security
qwen-code-dev-bot Aug 5, 2026
eedd924
fix(hooks): make home-root trust gates immune to per-agent root rebin…
qwen-code-dev-bot Aug 5, 2026
dce013c
Merge branch 'main' into fix/hooks-security
wenshao Aug 6, 2026
3ef677f
chore(hooks): merge main into fix/hooks-security
qwen-code-dev-bot Aug 6, 2026
d4a76b9
chore(hooks): merge main into fix/hooks-security
qwen-code-dev-bot Aug 13, 2026
ccf1a7a
Merge branch 'main' into fix/hooks-security
wenshao Aug 15, 2026
ad00d83
Merge branch 'main' into fix/hooks-security
wenshao Aug 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/users/features/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ By default, HTTP hooks cannot target private or link-local IP ranges. In platfor

- This setting is **only honored from User, System, and SystemDefaults settings scopes**. A value set in Workspace (project) settings is ignored and logged as a warning, so a cloned repository can never self-grant this bypass.
- The flag relaxes only the general private/CGNAT/link-local **range** checks. Cloud metadata endpoints stay blocked in every configuration: the `BLOCKED_HOSTS` list is matched literally (`metadata.google.internal`, `metadata.azure.internal`, ...), and the metadata IPs `169.254.169.254` and `100.100.100.200` are blocked in all serialized forms (including IPv4-mapped IPv6 such as `::ffff:a9fe:a9fe`) and after DNS resolution.
- The `security.allowedHttpHookUrls` whitelist still applies independently. In managed environments, pair this flag with a whitelist so only the intended internal endpoints are reachable.
- The `security.allowedHttpHookUrls` whitelist still applies independently. In managed environments, pair this flag with a whitelist so only the intended internal endpoints are reachable. Like this flag, the whitelist is **honored from User, System, and SystemDefaults settings scopes**; a value set in Workspace (project) settings can only _narrow_ the User or SystemDefaults whitelist and is logged as a warning: workspace entries that no higher-scope entry covers are dropped, when no higher scope sets a whitelist the workspace value is ignored entirely, and a System-scope whitelist always takes precedence over the workspace value (an empty whitelist means "allow all", so a repository can neither widen where hook payloads may be sent nor establish a whitelist of its own).

> **Warning:** Enabling this flag lets hooks reach internal infrastructure on your network. Enable it only in trusted, managed settings — never in a repository you do not control.

Expand Down
81 changes: 81 additions & 0 deletions packages/cli/src/commands/channel/config-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,3 +796,84 @@ describe('parseChannelConfig', () => {
);
});
});

describe('internal-secret denylist', () => {
const SECRET = 'QWEN_SERVER_TOKEN';

afterEach(() => {
delete process.env[SECRET];
delete process.env[SECRET.toLowerCase()];
});

it('resolveEnvVars rejects Qwen-internal secrets instead of yielding the name as a value', () => {
process.env[SECRET] = 'daemon-secret';
expect(() => resolveEnvVars(`$${SECRET}`)).toThrow(
`${SECRET} is a Qwen-internal secret`,
);
});

it('resolveEnvVars rejects case variants (Windows-style process.env)', () => {
process.env[SECRET.toLowerCase()] = 'daemon-secret';
expect(() => resolveEnvVars(`$${SECRET.toLowerCase()}`)).toThrow(
'is a Qwen-internal secret',
);
});

it('parseChannelConfig rejects internal secrets in channel credentials', async () => {
process.env[SECRET] = 'daemon-secret';

await expect(
parseChannelConfig('bot', {
type: 'github',
token: `$${SECRET}`,
}),
).rejects.toThrow(`${SECRET} is a Qwen-internal secret`);

await expect(
parseChannelConfig(
'bot',
{ type: 'github', token: `$${SECRET}` },
undefined,
{ resolveEnvVars: 'available' },
),
).rejects.toThrow(`${SECRET} is a Qwen-internal secret`);
});

it('webhook secret and secretEnv reject Qwen-internal secrets', async () => {
process.env[SECRET] = 'daemon-secret';

await expect(
parseChannelConfig('dingtalk-main', {
type: 'bare',
token: 'token',
webhooks: {
sources: {
custom: {
secret: `$${SECRET}`,
targets: { default: { chatId: 'group-1', senderId: 'webhook' } },
},
},
},
}),
).rejects.toThrow(`${SECRET} is a Qwen-internal secret`);

// secretEnv used to return the variable *name* as the secret — a
// public constant that makes HMAC verification bypassable.
await expect(
parseChannelConfig('dingtalk-main', {
type: 'bare',
token: 'token',
webhooks: {
sources: {
custom: {
secretEnv: SECRET,
targets: { default: { chatId: 'group-1', senderId: 'webhook' } },
},
},
},
}),
).rejects.toThrow(
`references a Qwen-internal secret (${SECRET}); internal secrets are never resolved into channel config`,
);
});
});
21 changes: 21 additions & 0 deletions packages/cli/src/commands/channel/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
ChannelWebhookSourceConfig,
ChannelWebhookTargetConfig,
} from '@qwen-code/channel-base';
import { isInternalSecretEnvVar } from '@qwen-code/qwen-code-core/envVarResolver';
import { resolveChannelCwd } from './channel-cwd.js';
import { getPlugin, supportedTypes } from './channel-registry.js';

Expand All @@ -29,6 +30,16 @@ export function resolveEnvVars(
}
if (value.startsWith('$')) {
const envName = value.substring(1);
// Qwen-internal secrets never resolve into channel config: resolved
// values are sent to repo-configured endpoints. The core resolver
// preserves placeholders, but channel config throws at config time
// like every other unresolvable reference — silently keeping the
// literal would turn a secret *name* into a public, guessable value.
if (isInternalSecretEnvVar(envName)) {
throw new Error(
`Environment variable ${envName} is a Qwen-internal secret; internal secrets are never resolved into channel config (referenced as ${value})`,
);
}
const envValue = env[envName];
if (envValue === undefined) {
throw new Error(
Expand Down Expand Up @@ -76,6 +87,11 @@ function resolveConfigEnvVar(value: string, mode: EnvResolution): string {
if (value.startsWith('$$')) return value.substring(1);
if (mode === 'available' && value.startsWith('$')) {
const envName = value.substring(1);
if (isInternalSecretEnvVar(envName)) {
throw new Error(
`Environment variable ${envName} is a Qwen-internal secret; internal secrets are never resolved into channel config (referenced as ${value})`,
);
}
const envValue = process.env[envName];
if (envValue === undefined) {
throw new Error(
Expand Down Expand Up @@ -290,6 +306,11 @@ function resolveWebhookSecretEnv(
`Channel "${channelName}" field "${path}.secretEnv" must be an environment variable name or $-prefixed reference.`,
);
}
if (isInternalSecretEnvVar(envName)) {
throw new Error(
`Channel "${channelName}" field "${path}.secretEnv" references a Qwen-internal secret (${envName}); internal secrets are never resolved into channel config.`,
);
}
const envValue = env[envName];
if (envValue === undefined) {
throw new Error(
Expand Down
Loading
Loading