mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-08 06:26:45 +02:00
fix(security): add Azure metadata endpoint to SSRF blocklist
Add metadata.azure.internal to BLOCKED_METADATA_HOSTS alongside the existing AWS/GCP endpoints. Closes the coverage gap identified in #125. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ const BLOCKED_METADATA_HOSTS = new Set([
|
|||||||
'169.254.169.254', // AWS/GCP/Azure instance metadata
|
'169.254.169.254', // AWS/GCP/Azure instance metadata
|
||||||
'fd00::', // IPv6 unique local (metadata in some cloud setups)
|
'fd00::', // IPv6 unique local (metadata in some cloud setups)
|
||||||
'metadata.google.internal', // GCP metadata
|
'metadata.google.internal', // GCP metadata
|
||||||
|
'metadata.azure.internal', // Azure IMDS
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ describe('validateNavigationUrl', () => {
|
|||||||
expect(() => validateNavigationUrl('http://metadata.google.internal/computeMetadata/v1/')).toThrow(/cloud metadata/i);
|
expect(() => validateNavigationUrl('http://metadata.google.internal/computeMetadata/v1/')).toThrow(/cloud metadata/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('blocks Azure metadata hostname', () => {
|
||||||
|
expect(() => validateNavigationUrl('http://metadata.azure.internal/metadata/instance')).toThrow(/cloud metadata/i);
|
||||||
|
});
|
||||||
|
|
||||||
it('blocks metadata hostname with trailing dot', () => {
|
it('blocks metadata hostname with trailing dot', () => {
|
||||||
expect(() => validateNavigationUrl('http://metadata.google.internal./computeMetadata/v1/')).toThrow(/cloud metadata/i);
|
expect(() => validateNavigationUrl('http://metadata.google.internal./computeMetadata/v1/')).toThrow(/cloud metadata/i);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user