Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91d3933eb5 | |||
| a6bf8726aa | |||
| ae9272d5cb | |||
| f481b8c8dc | |||
| 59851786d4 |
+12
-1
@@ -50,7 +50,18 @@ function setSecret(secret: string): void {}
|
||||
|
||||
Now, future logs containing BAR will be masked. E.g. running `echo "Hello FOO BAR World"` will now print `Hello FOO **** World`.
|
||||
|
||||
**WARNING** The add-mask and setSecret commands only support single line secrets. To register a multiline secrets you must register each line individually otherwise it will not be masked.
|
||||
**WARNING** The add-mask and setSecret commands only support single-line
|
||||
secrets or multi-line secrets that have been escaped. `@actions/core`
|
||||
`setSecret` will escape the string you provide by default. When an escaped
|
||||
multi-line string is provided the whole string and each of its lines
|
||||
individually will be masked. For example you can mask `first\nsecond\r\nthird`
|
||||
using:
|
||||
|
||||
```sh
|
||||
echo "::add-mask::first%0Asecond%0D%0Athird"
|
||||
```
|
||||
|
||||
This will mask `first%0Asecond%0D%0Athird`, `first`, `second` and `third`.
|
||||
|
||||
**WARNING** Do **not** mask short values if you can avoid it, it could render your output unreadable (and future steps' output as well).
|
||||
For example, if you mask the letter `l`, running `echo "Hello FOO BAR World"` will now print `He*********o FOO BAR Wor****d`
|
||||
|
||||
@@ -161,7 +161,11 @@ describe('@actions/core', () => {
|
||||
|
||||
it('setSecret produces the correct command', () => {
|
||||
core.setSecret('secret val')
|
||||
assertWriteCalls([`::add-mask::secret val${os.EOL}`])
|
||||
core.setSecret('multi\nline\r\nsecret')
|
||||
assertWriteCalls([
|
||||
`::add-mask::secret val${os.EOL}`,
|
||||
`::add-mask::multi%0Aline%0D%0Asecret${os.EOL}`
|
||||
])
|
||||
})
|
||||
|
||||
it('prependPath produces the correct commands and sets the env', () => {
|
||||
|
||||
@@ -91,6 +91,12 @@ describe('proxy', () => {
|
||||
expect(proxyUrl).toBeDefined()
|
||||
})
|
||||
|
||||
it('getProxyUrl returns proxyUrl if http_proxy has no protocol', () => {
|
||||
process.env['http_proxy'] = 'myproxysvr'
|
||||
const proxyUrl = pm.getProxyUrl(new URL('http://github.com'))
|
||||
expect(proxyUrl?.toString()).toBe('http://myproxysvr/')
|
||||
})
|
||||
|
||||
it('checkBypass returns true if host as no_proxy list', () => {
|
||||
process.env['no_proxy'] = 'myserver'
|
||||
const bypass = pm.checkBypass(new URL('https://myserver'))
|
||||
|
||||
@@ -14,7 +14,12 @@ export function getProxyUrl(reqUrl: URL): URL | undefined {
|
||||
})()
|
||||
|
||||
if (proxyVar) {
|
||||
return new URL(proxyVar)
|
||||
try {
|
||||
return new URL(proxyVar)
|
||||
} catch {
|
||||
if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
|
||||
return new URL(`http://${proxyVar}`)
|
||||
}
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user