Compare commits
32
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b24f92e45 | ||
|
|
4fefed4466 | ||
|
|
b511bc151f | ||
|
|
5d8e1ee68b | ||
|
|
e4ae385d1a | ||
|
|
b708d5ba60 | ||
|
|
4557cd07bb | ||
|
|
c285ab1ccd | ||
|
|
833d5cadab | ||
|
|
1f4b3fac06 | ||
|
|
8d92c9c903 | ||
|
|
0db3029fcf | ||
|
|
e6e29846f2 | ||
|
|
7c15bf6f40 | ||
|
|
bc713ab90d | ||
|
|
a9d266bb7c | ||
|
|
cf3dd065b8 | ||
|
|
6ec51745ad | ||
|
|
0f91c9c203 | ||
|
|
e18b2d8a33 | ||
|
|
4fd425926c | ||
|
|
83dffb7746 | ||
|
|
1d1d5456e3 | ||
|
|
9e06993ffc | ||
|
|
3630ea6eed | ||
|
|
c2d3089f83 | ||
|
|
652109d32c | ||
|
|
f2aa430c9d | ||
|
|
d2b7d85e7c | ||
|
|
409d616a6e | ||
|
|
e3c2a88bbf | ||
|
|
c6005c2a3c |
Generated
+6
-6
@@ -8954,9 +8954,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/http-cache-semantics": {
|
"node_modules/http-cache-semantics": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
|
||||||
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==",
|
"integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/http-proxy-agent": {
|
"node_modules/http-proxy-agent": {
|
||||||
@@ -23868,9 +23868,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"http-cache-semantics": {
|
"http-cache-semantics": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
|
||||||
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==",
|
"integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"http-proxy-agent": {
|
"http-proxy-agent": {
|
||||||
|
|||||||
Vendored
+7
-1
@@ -111,4 +111,10 @@
|
|||||||
- Added support for verbose logging about cache version during cache miss.
|
- Added support for verbose logging about cache version during cache miss.
|
||||||
|
|
||||||
### 3.1.2
|
### 3.1.2
|
||||||
- Fix issue with symlink restoration on windows.
|
- Fix issue with symlink restoration on windows.
|
||||||
|
|
||||||
|
### 3.1.3
|
||||||
|
- Fix to prevent from setting MYSYS environement variable globally [#1329](https://github.com/actions/toolkit/pull/1329).
|
||||||
|
|
||||||
|
### 3.1.4
|
||||||
|
- Fix zstd not being used due to `zstd --version` output change in zstd 1.5.4 release. See [#1353](https://github.com/actions/toolkit/pull/1353).
|
||||||
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.1.2",
|
"version": "3.1.4",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.1.2",
|
"version": "3.1.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.1.2",
|
"version": "3.1.4",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions cache lib",
|
"description": "Actions cache lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
+11
-11
@@ -71,11 +71,15 @@ export async function unlinkFile(filePath: fs.PathLike): Promise<void> {
|
|||||||
return util.promisify(fs.unlink)(filePath)
|
return util.promisify(fs.unlink)(filePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getVersion(app: string): Promise<string> {
|
async function getVersion(
|
||||||
core.debug(`Checking ${app} --version`)
|
app: string,
|
||||||
|
additionalArgs: string[] = []
|
||||||
|
): Promise<string> {
|
||||||
let versionOutput = ''
|
let versionOutput = ''
|
||||||
|
additionalArgs.push('--version')
|
||||||
|
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`)
|
||||||
try {
|
try {
|
||||||
await exec.exec(`${app} --version`, [], {
|
await exec.exec(`${app}`, additionalArgs, {
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
@@ -94,18 +98,14 @@ async function getVersion(app: string): Promise<string> {
|
|||||||
|
|
||||||
// Use zstandard if possible to maximize cache performance
|
// Use zstandard if possible to maximize cache performance
|
||||||
export async function getCompressionMethod(): Promise<CompressionMethod> {
|
export async function getCompressionMethod(): Promise<CompressionMethod> {
|
||||||
const versionOutput = await getVersion('zstd')
|
const versionOutput = await getVersion('zstd', ['--quiet'])
|
||||||
const version = semver.clean(versionOutput)
|
const version = semver.clean(versionOutput)
|
||||||
|
core.debug(`zstd version: ${version}`)
|
||||||
|
|
||||||
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
|
if (versionOutput === '') {
|
||||||
// zstd is not installed
|
|
||||||
return CompressionMethod.Gzip
|
return CompressionMethod.Gzip
|
||||||
} else if (!version || semver.lt(version, 'v1.3.2')) {
|
|
||||||
// zstd is installed but using a version earlier than v1.3.2
|
|
||||||
// v1.3.2 is required to use the `--long` options in zstd
|
|
||||||
return CompressionMethod.ZstdWithoutLong
|
|
||||||
} else {
|
} else {
|
||||||
return CompressionMethod.Zstd
|
return CompressionMethod.ZstdWithoutLong
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,44 @@ describe('proxy', () => {
|
|||||||
expect(bypass).toBeFalsy()
|
expect(bypass).toBeFalsy()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('checkBypass returns true if host with subdomain in no_proxy', () => {
|
||||||
|
process.env['no_proxy'] = 'myserver.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://sub.myserver.com'))
|
||||||
|
expect(bypass).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('checkBypass returns false if no_proxy is subdomain', () => {
|
||||||
|
process.env['no_proxy'] = 'myserver.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://myserver.com.evil.org'))
|
||||||
|
expect(bypass).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('checkBypass returns false if no_proxy is part of domain', () => {
|
||||||
|
process.env['no_proxy'] = 'myserver.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://evilmyserver.com'))
|
||||||
|
expect(bypass).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
// Do not strip leading dots as per https://github.com/actions/runner/blob/97195bad5870e2ad0915ebfef1616083aacf5818/docs/adrs/0263-proxy-support.md
|
||||||
|
it('checkBypass returns false if host with leading dot in no_proxy', () => {
|
||||||
|
process.env['no_proxy'] = '.myserver.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://myserver.com'))
|
||||||
|
expect(bypass).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('checkBypass returns true if host with subdomain in no_proxy defined with leading "."', () => {
|
||||||
|
process.env['no_proxy'] = '.myserver.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://sub.myserver.com'))
|
||||||
|
expect(bypass).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
// Do not match wildcard ("*") as per https://github.com/actions/runner/blob/97195bad5870e2ad0915ebfef1616083aacf5818/docs/adrs/0263-proxy-support.md
|
||||||
|
it('checkBypass returns true if no_proxy is "*"', () => {
|
||||||
|
process.env['no_proxy'] = '*'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://anything.whatsoever.com'))
|
||||||
|
expect(bypass).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
it('HttpClient does basic http get request through proxy', async () => {
|
it('HttpClient does basic http get request through proxy', async () => {
|
||||||
process.env['http_proxy'] = _proxyUrl
|
process.env['http_proxy'] = _proxyUrl
|
||||||
const httpClient = new httpm.HttpClient()
|
const httpClient = new httpm.HttpClient()
|
||||||
@@ -199,6 +237,31 @@ describe('proxy', () => {
|
|||||||
expect(_proxyConnects).toHaveLength(0)
|
expect(_proxyConnects).toHaveLength(0)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('HttpClient bypasses proxy for loopback addresses (localhost, ::1, 127.*)', async () => {
|
||||||
|
// setup a server listening on localhost:8091
|
||||||
|
const server = http.createServer((request, response) => {
|
||||||
|
response.writeHead(200)
|
||||||
|
request.pipe(response)
|
||||||
|
})
|
||||||
|
server.listen(8091)
|
||||||
|
try {
|
||||||
|
process.env['http_proxy'] = _proxyUrl
|
||||||
|
const httpClient = new httpm.HttpClient()
|
||||||
|
let res = await httpClient.get('http://localhost:8091')
|
||||||
|
expect(res.message.statusCode).toBe(200)
|
||||||
|
res = await httpClient.get('http://127.0.0.1:8091')
|
||||||
|
expect(res.message.statusCode).toBe(200)
|
||||||
|
|
||||||
|
// no support for ipv6 for now
|
||||||
|
expect(httpClient.get('http://[::1]:8091')).rejects.toThrow()
|
||||||
|
|
||||||
|
// proxy at _proxyUrl was ignored
|
||||||
|
expect(_proxyConnects).toEqual([])
|
||||||
|
} finally {
|
||||||
|
server.close()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
it('proxyAuth not set in tunnel agent when authentication is not provided', async () => {
|
it('proxyAuth not set in tunnel agent when authentication is not provided', async () => {
|
||||||
process.env['https_proxy'] = 'http://127.0.0.1:8080'
|
process.env['https_proxy'] = 'http://127.0.0.1:8080'
|
||||||
const httpClient = new httpm.HttpClient()
|
const httpClient = new httpm.HttpClient()
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ export function checkBypass(reqUrl: URL): boolean {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const reqHost = reqUrl.hostname
|
||||||
|
if (isLoopbackAddress(reqHost)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''
|
const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''
|
||||||
if (!noProxy) {
|
if (!noProxy) {
|
||||||
return false
|
return false
|
||||||
@@ -51,10 +56,28 @@ export function checkBypass(reqUrl: URL): boolean {
|
|||||||
.split(',')
|
.split(',')
|
||||||
.map(x => x.trim().toUpperCase())
|
.map(x => x.trim().toUpperCase())
|
||||||
.filter(x => x)) {
|
.filter(x => x)) {
|
||||||
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
if (
|
||||||
|
upperReqHosts.some(
|
||||||
|
x =>
|
||||||
|
x === upperNoProxyItem ||
|
||||||
|
x.endsWith(`.${upperNoProxyItem}`) ||
|
||||||
|
(upperNoProxyItem.startsWith('.') &&
|
||||||
|
x.endsWith(`${upperNoProxyItem}`))
|
||||||
|
)
|
||||||
|
) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isLoopbackAddress(host: string): boolean {
|
||||||
|
const hostLower = host.toLowerCase()
|
||||||
|
return (
|
||||||
|
hostLower === 'localhost' ||
|
||||||
|
hostLower.startsWith('127.') ||
|
||||||
|
hostLower.startsWith('[::1]') ||
|
||||||
|
hostLower.startsWith('[0:0:0:0:0:0:0:1]')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user