mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-07-06 16:41:38 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e72a236d12 | |||
| ba0d7d2ec0 | |||
| efd0857dc4 | |||
| ed485de1ff | |||
| 8872e8d04c | |||
| b163415b47 | |||
| e52a9f8996 | |||
| 8182aa3494 | |||
| 5403a413de |
@@ -19,7 +19,7 @@ jobs:
|
||||
security-events: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
# Must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head of the pull request.
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
|
||||
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
with:
|
||||
languages: 'javascript-typescript'
|
||||
@@ -45,4 +45,4 @@ jobs:
|
||||
npm run all
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
|
||||
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
|
||||
|
||||
+11
-11
@@ -18,7 +18,7 @@ jobs:
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: 24.x
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- run: |
|
||||
@@ -45,13 +45,13 @@ jobs:
|
||||
- "v2.12.2"
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: 24.x
|
||||
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version: oldstable
|
||||
- uses: ./
|
||||
@@ -77,13 +77,13 @@ jobs:
|
||||
- "c0d3ddc9cf3faa61a4e378e879ece580256d76e5"
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: 24.x
|
||||
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version: oldstable
|
||||
- uses: ./
|
||||
@@ -107,13 +107,13 @@ jobs:
|
||||
- fixtures/go-tool
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: 24.x
|
||||
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version: oldstable
|
||||
- uses: ./
|
||||
@@ -138,13 +138,13 @@ jobs:
|
||||
- "v2.12.1"
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: 24.x
|
||||
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version: oldstable
|
||||
- uses: ./
|
||||
@@ -164,13 +164,13 @@ jobs:
|
||||
- windows-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: 24.x
|
||||
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version: oldstable
|
||||
- uses: ./
|
||||
|
||||
@@ -616,6 +616,23 @@ with:
|
||||
|
||||
</details>
|
||||
|
||||
#### `no-run-logs-group`
|
||||
|
||||
(optional)
|
||||
|
||||
This option disables the grouping of logs from golangci-lint run.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yaml
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
experimental: "no-run-logs-group"
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Annotations
|
||||
|
||||
Currently, GitHub parses the action's output and creates [annotations](https://github.blog/2018-12-14-introducing-check-runs-and-annotations/).
|
||||
|
||||
@@ -76,6 +76,7 @@ inputs:
|
||||
description: |
|
||||
Experimental options for the action.
|
||||
List of comma separated options.
|
||||
Available options: `automatic-module-directories`, `no-run-logs-group`
|
||||
default: ""
|
||||
required: false
|
||||
runs:
|
||||
|
||||
+239
-65
@@ -29642,6 +29642,29 @@ function _generateTmpName(opts) {
|
||||
return path.join(tmpDir, opts.dir, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the prefix, postfix, and template options.
|
||||
*
|
||||
* Rejects non-string inputs so that a non-string `.includes('..')` cannot evade
|
||||
* the substring check (e.g. an Array whose `.includes('..')` is element-wise,
|
||||
* or a duck-typed object with a custom `.includes`), and so that the value is
|
||||
* not later coerced to a string with traversal sequences via `Array.prototype.join`
|
||||
* or `path.join`.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function _assertPath(option, value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error(`${option} option must be a string, got "${typeof value}".`);
|
||||
}
|
||||
|
||||
if (value.includes("..")) {
|
||||
throw new Error("Relative value not allowed");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts and sanitizes the basic options.
|
||||
*
|
||||
@@ -29656,13 +29679,19 @@ function _assertOptionsBase(options) {
|
||||
|
||||
// must not fail on valid .<name> or ..<name> or similar such constructs
|
||||
const basename = path.basename(name);
|
||||
if (basename === '..' || basename === '.' || basename !== name)
|
||||
if (basename === '..' || basename === '.' || basename !== name) {
|
||||
throw new Error(`name option must not contain a path, found "${name}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (!_isUndefined(options.template) && !options.template.match(TEMPLATE_PATTERN)) {
|
||||
throw new Error(`Invalid template, found "${options.template}".`);
|
||||
if (!_isUndefined(options.template)) {
|
||||
if (typeof options.template !== 'string') {
|
||||
throw new Error(`template option must be a string, got "${typeof options.template}".`);
|
||||
}
|
||||
if (!options.template.match(TEMPLATE_PATTERN)) {
|
||||
throw new Error(`Invalid template, found "${options.template}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore else */
|
||||
@@ -29678,8 +29707,9 @@ function _assertOptionsBase(options) {
|
||||
options.unsafeCleanup = !!options.unsafeCleanup;
|
||||
|
||||
// for completeness' sake only, also keep (multiple) blanks if the user, purportedly sane, requests us to
|
||||
options.prefix = _isUndefined(options.prefix) ? '' : options.prefix;
|
||||
options.postfix = _isUndefined(options.postfix) ? '' : options.postfix;
|
||||
options.prefix = _isUndefined(options.prefix) ? '' : _assertPath('prefix', options.prefix);
|
||||
options.postfix = _isUndefined(options.postfix) ? '' : _assertPath('postfix', options.postfix);
|
||||
options.template = _isUndefined(options.template) ? undefined : _assertPath('template', options.template);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29695,7 +29725,7 @@ function _getRelativePath(option, name, tmpDir, cb) {
|
||||
|
||||
const relativePath = path.relative(tmpDir, resolvedPath);
|
||||
|
||||
if (!resolvedPath.startsWith(tmpDir)) {
|
||||
if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) {
|
||||
return cb(new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`));
|
||||
}
|
||||
|
||||
@@ -29714,7 +29744,7 @@ function _getRelativePathSync(option, name, tmpDir) {
|
||||
const resolvedPath = _resolvePathSync(name, tmpDir);
|
||||
const relativePath = path.relative(tmpDir, resolvedPath);
|
||||
|
||||
if (!resolvedPath.startsWith(tmpDir)) {
|
||||
if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) {
|
||||
throw new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`);
|
||||
}
|
||||
|
||||
@@ -34810,7 +34840,6 @@ function defaultFactory (origin, opts) {
|
||||
|
||||
class Agent extends DispatcherBase {
|
||||
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
||||
|
||||
if (typeof factory !== 'function') {
|
||||
throw new InvalidArgumentError('factory must be a function.')
|
||||
}
|
||||
@@ -35198,6 +35227,9 @@ const EMPTY_BUF = Buffer.alloc(0)
|
||||
const FastBuffer = Buffer[Symbol.species]
|
||||
const addListener = util.addListener
|
||||
const removeAllListeners = util.removeAllListeners
|
||||
const kIdleSocketValidation = Symbol('kIdleSocketValidation')
|
||||
const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout')
|
||||
const kSocketUsed = Symbol('kSocketUsed')
|
||||
|
||||
let extractBody
|
||||
|
||||
@@ -35420,29 +35452,71 @@ class Parser {
|
||||
|
||||
const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr
|
||||
|
||||
if (ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||
this.onUpgrade(data.slice(offset))
|
||||
} else if (ret === constants.ERROR.PAUSED) {
|
||||
this.paused = true
|
||||
socket.unshift(data.slice(offset))
|
||||
} else if (ret !== constants.ERROR.OK) {
|
||||
const ptr = llhttp.llhttp_get_error_reason(this.ptr)
|
||||
let message = ''
|
||||
/* istanbul ignore else: difficult to make a test case for */
|
||||
if (ptr) {
|
||||
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
|
||||
message =
|
||||
'Response does not match the HTTP/1.1 protocol (' +
|
||||
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
|
||||
')'
|
||||
if (ret !== constants.ERROR.OK) {
|
||||
const body = data.subarray(offset)
|
||||
|
||||
if (ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||
this.onUpgrade(body)
|
||||
} else if (ret === constants.ERROR.PAUSED) {
|
||||
this.paused = true
|
||||
socket.unshift(body)
|
||||
} else {
|
||||
throw this.createError(ret, body)
|
||||
}
|
||||
throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset))
|
||||
}
|
||||
} catch (err) {
|
||||
util.destroy(socket, err)
|
||||
}
|
||||
}
|
||||
|
||||
finish () {
|
||||
assert(currentParser === null)
|
||||
assert(this.ptr != null)
|
||||
assert(!this.paused)
|
||||
|
||||
const { llhttp } = this
|
||||
|
||||
let ret
|
||||
|
||||
try {
|
||||
currentParser = this
|
||||
ret = llhttp.llhttp_finish(this.ptr)
|
||||
} finally {
|
||||
currentParser = null
|
||||
}
|
||||
|
||||
if (ret === constants.ERROR.OK) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (ret === constants.ERROR.PAUSED || ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||
this.paused = true
|
||||
return null
|
||||
}
|
||||
|
||||
return this.createError(ret, EMPTY_BUF)
|
||||
}
|
||||
|
||||
createError (ret, data) {
|
||||
const { llhttp, contentLength, bytesRead } = this
|
||||
|
||||
if (contentLength && bytesRead !== parseInt(contentLength, 10)) {
|
||||
return new ResponseContentLengthMismatchError()
|
||||
}
|
||||
|
||||
const ptr = llhttp.llhttp_get_error_reason(this.ptr)
|
||||
let message = ''
|
||||
if (ptr) {
|
||||
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
|
||||
message =
|
||||
'Response does not match the HTTP/1.1 protocol (' +
|
||||
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
|
||||
')'
|
||||
}
|
||||
|
||||
return new HTTPParserError(message, constants.ERROR[ret], data)
|
||||
}
|
||||
|
||||
destroy () {
|
||||
assert(this.ptr != null)
|
||||
assert(currentParser == null)
|
||||
@@ -35470,6 +35544,11 @@ class Parser {
|
||||
return -1
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0) {
|
||||
util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
|
||||
return -1
|
||||
}
|
||||
|
||||
const request = client[kQueue][client[kRunningIdx]]
|
||||
if (!request) {
|
||||
return -1
|
||||
@@ -35573,6 +35652,11 @@ class Parser {
|
||||
return -1
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0) {
|
||||
util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
|
||||
return -1
|
||||
}
|
||||
|
||||
const request = client[kQueue][client[kRunningIdx]]
|
||||
|
||||
/* istanbul ignore next: difficult to make a test case for */
|
||||
@@ -35746,6 +35830,7 @@ class Parser {
|
||||
request.onComplete(headers)
|
||||
|
||||
client[kQueue][client[kRunningIdx]++] = null
|
||||
socket[kSocketUsed] = true
|
||||
|
||||
if (socket[kWriting]) {
|
||||
assert(client[kRunning] === 0)
|
||||
@@ -35804,6 +35889,9 @@ async function connectH1 (client, socket) {
|
||||
socket[kWriting] = false
|
||||
socket[kReset] = false
|
||||
socket[kBlocking] = false
|
||||
socket[kIdleSocketValidation] = 0
|
||||
socket[kIdleSocketValidationTimeout] = null
|
||||
socket[kSocketUsed] = false
|
||||
socket[kParser] = new Parser(client, socket, llhttpInstance)
|
||||
|
||||
addListener(socket, 'error', function (err) {
|
||||
@@ -35814,8 +35902,11 @@ async function connectH1 (client, socket) {
|
||||
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
||||
// to the user.
|
||||
if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
|
||||
// We treat all incoming data so for as a valid response.
|
||||
parser.onMessageComplete()
|
||||
const parserErr = parser.finish()
|
||||
if (parserErr) {
|
||||
this[kError] = parserErr
|
||||
this[kClient][kOnError](parserErr)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -35834,8 +35925,10 @@ async function connectH1 (client, socket) {
|
||||
const parser = this[kParser]
|
||||
|
||||
if (parser.statusCode && !parser.shouldKeepAlive) {
|
||||
// We treat all incoming data so far as a valid response.
|
||||
parser.onMessageComplete()
|
||||
const parserErr = parser.finish()
|
||||
if (parserErr) {
|
||||
util.destroy(this, parserErr)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -35845,10 +35938,11 @@ async function connectH1 (client, socket) {
|
||||
const client = this[kClient]
|
||||
const parser = this[kParser]
|
||||
|
||||
clearIdleSocketValidation(this)
|
||||
|
||||
if (parser) {
|
||||
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
|
||||
// We treat all incoming data so far as a valid response.
|
||||
parser.onMessageComplete()
|
||||
this[kError] = parser.finish() || this[kError]
|
||||
}
|
||||
|
||||
this[kParser].destroy()
|
||||
@@ -35911,7 +36005,7 @@ async function connectH1 (client, socket) {
|
||||
return socket.destroyed
|
||||
},
|
||||
busy (request) {
|
||||
if (socket[kWriting] || socket[kReset] || socket[kBlocking]) {
|
||||
if (socket[kWriting] || socket[kReset] || socket[kBlocking] || socket[kIdleSocketValidation] === 1) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -35949,6 +36043,31 @@ async function connectH1 (client, socket) {
|
||||
}
|
||||
}
|
||||
|
||||
function clearIdleSocketValidation (socket) {
|
||||
if (socket[kIdleSocketValidationTimeout]) {
|
||||
clearTimeout(socket[kIdleSocketValidationTimeout])
|
||||
socket[kIdleSocketValidationTimeout] = null
|
||||
}
|
||||
|
||||
socket[kIdleSocketValidation] = 0
|
||||
}
|
||||
|
||||
function scheduleIdleSocketValidation (client, socket) {
|
||||
socket[kIdleSocketValidation] = 1
|
||||
socket[kIdleSocketValidationTimeout] = setTimeout(() => {
|
||||
socket[kIdleSocketValidationTimeout] = null
|
||||
socket[kIdleSocketValidation] = 2
|
||||
|
||||
if (client[kSocket] === socket && !socket.destroyed) {
|
||||
client[kResume]()
|
||||
}
|
||||
}, 0)
|
||||
socket[kIdleSocketValidationTimeout].unref?.()
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./client.js')} client
|
||||
*/
|
||||
function resumeH1 (client) {
|
||||
const socket = client[kSocket]
|
||||
|
||||
@@ -35963,6 +36082,32 @@ function resumeH1 (client) {
|
||||
socket[kNoRef] = false
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0 && client[kPending] > 0 && socket[kSocketUsed]) {
|
||||
if (socket[kIdleSocketValidation] === 0) {
|
||||
scheduleIdleSocketValidation(client, socket)
|
||||
socket[kParser].readMore()
|
||||
if (socket.destroyed) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (socket[kIdleSocketValidation] === 1) {
|
||||
socket[kParser].readMore()
|
||||
if (socket.destroyed) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0) {
|
||||
socket[kParser].readMore()
|
||||
if (socket.destroyed) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (client[kSize] === 0) {
|
||||
if (socket[kParser].timeoutType !== TIMEOUT_KEEP_ALIVE) {
|
||||
socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_KEEP_ALIVE)
|
||||
@@ -36056,6 +36201,7 @@ function writeH1 (client, request) {
|
||||
}
|
||||
|
||||
const socket = client[kSocket]
|
||||
clearIdleSocketValidation(socket)
|
||||
|
||||
const abort = (err) => {
|
||||
if (request.aborted || request.completed) {
|
||||
@@ -37928,6 +38074,7 @@ class DispatcherBase extends Dispatcher {
|
||||
|
||||
get webSocketOptions () {
|
||||
return {
|
||||
maxFragments: this[kWebSocketOptions].maxFragments ?? 131072,
|
||||
maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
|
||||
}
|
||||
}
|
||||
@@ -43864,32 +44011,25 @@ function parseUnparsedAttributes (unparsedAttributes, cookieAttributeList = {})
|
||||
// If the attribute-name case-insensitively matches the string
|
||||
// "SameSite", the user agent MUST process the cookie-av as follows:
|
||||
|
||||
// 1. Let enforcement be "Default".
|
||||
let enforcement = 'Default'
|
||||
|
||||
const attributeValueLowercase = attributeValue.toLowerCase()
|
||||
// 2. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "None", set enforcement to "None".
|
||||
if (attributeValueLowercase.includes('none')) {
|
||||
enforcement = 'None'
|
||||
}
|
||||
|
||||
// 3. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Strict", set enforcement to "Strict".
|
||||
if (attributeValueLowercase.includes('strict')) {
|
||||
enforcement = 'Strict'
|
||||
// 1. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "None", append an attribute to the cookie-attribute-list with an
|
||||
// attribute-name of "SameSite" and an attribute-value of "None".
|
||||
if (attributeValueLowercase === 'none') {
|
||||
cookieAttributeList.sameSite = 'None'
|
||||
} else if (attributeValueLowercase === 'strict') {
|
||||
// 2. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Strict", append an attribute to the cookie-attribute-list with
|
||||
// an attribute-name of "SameSite" and an attribute-value of
|
||||
// "Strict".
|
||||
cookieAttributeList.sameSite = 'Strict'
|
||||
} else if (attributeValueLowercase === 'lax') {
|
||||
// 3. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Lax", append an attribute to the cookie-attribute-list with an
|
||||
// attribute-name of "SameSite" and an attribute-value of "Lax".
|
||||
cookieAttributeList.sameSite = 'Lax'
|
||||
}
|
||||
|
||||
// 4. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Lax", set enforcement to "Lax".
|
||||
if (attributeValueLowercase.includes('lax')) {
|
||||
enforcement = 'Lax'
|
||||
}
|
||||
|
||||
// 5. Append an attribute to the cookie-attribute-list with an
|
||||
// attribute-name of "SameSite" and an attribute-value of
|
||||
// enforcement.
|
||||
cookieAttributeList.sameSite = enforcement
|
||||
} else {
|
||||
cookieAttributeList.unparsed ??= []
|
||||
|
||||
@@ -56715,6 +56855,11 @@ const { closeWebSocketConnection } = __nccwpck_require__(86897)
|
||||
const { PerMessageDeflate } = __nccwpck_require__(19469)
|
||||
const { MessageSizeExceededError } = __nccwpck_require__(68707)
|
||||
|
||||
function failWebsocketConnectionWithCode (ws, code, reason) {
|
||||
closeWebSocketConnection(ws, code, reason, Buffer.byteLength(reason))
|
||||
failWebsocketConnection(ws, reason)
|
||||
}
|
||||
|
||||
// This code was influenced by ws released under the MIT license.
|
||||
// Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
|
||||
// Copyright (c) 2013 Arnout Kazemier and contributors
|
||||
@@ -56734,19 +56879,23 @@ class ByteParser extends Writable {
|
||||
/** @type {Map<string, PerMessageDeflate>} */
|
||||
#extensions
|
||||
|
||||
/** @type {number} */
|
||||
#maxFragments
|
||||
|
||||
/** @type {number} */
|
||||
#maxPayloadSize
|
||||
|
||||
/**
|
||||
* @param {import('./websocket').WebSocket} ws
|
||||
* @param {Map<string, string>|null} extensions
|
||||
* @param {{ maxPayloadSize?: number }} [options]
|
||||
* @param {{ maxFragments?: number, maxPayloadSize?: number }} [options]
|
||||
*/
|
||||
constructor (ws, extensions, options = {}) {
|
||||
super()
|
||||
|
||||
this.ws = ws
|
||||
this.#extensions = extensions == null ? new Map() : extensions
|
||||
this.#maxFragments = options.maxFragments ?? 0
|
||||
this.#maxPayloadSize = options.maxPayloadSize ?? 0
|
||||
|
||||
if (this.#extensions.has('permessage-deflate')) {
|
||||
@@ -56770,9 +56919,9 @@ class ByteParser extends Writable {
|
||||
if (
|
||||
this.#maxPayloadSize > 0 &&
|
||||
!isControlFrame(this.#info.opcode) &&
|
||||
this.#info.payloadLength > this.#maxPayloadSize
|
||||
this.#info.payloadLength + this.#fragmentsBytes > this.#maxPayloadSize
|
||||
) {
|
||||
failWebsocketConnection(this.ws, 'Payload size exceeds maximum allowed size')
|
||||
failWebsocketConnectionWithCode(this.ws, 1009, 'Payload size exceeds maximum allowed size')
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -56937,10 +57086,12 @@ class ByteParser extends Writable {
|
||||
this.#state = parserStates.INFO
|
||||
} else {
|
||||
if (!this.#info.compressed) {
|
||||
this.writeFragments(body)
|
||||
if (!this.writeFragments(body)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
|
||||
failWebsocketConnection(this.ws, new MessageSizeExceededError().message)
|
||||
failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -56959,14 +57110,17 @@ class ByteParser extends Writable {
|
||||
this.#info.fin,
|
||||
(error, data) => {
|
||||
if (error) {
|
||||
failWebsocketConnection(this.ws, error.message)
|
||||
const code = error instanceof MessageSizeExceededError ? 1009 : 1007
|
||||
failWebsocketConnectionWithCode(this.ws, code, error.message)
|
||||
return
|
||||
}
|
||||
|
||||
this.writeFragments(data)
|
||||
if (!this.writeFragments(data)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
|
||||
failWebsocketConnection(this.ws, new MessageSizeExceededError().message)
|
||||
failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -57036,8 +57190,17 @@ class ByteParser extends Writable {
|
||||
}
|
||||
|
||||
writeFragments (fragment) {
|
||||
if (
|
||||
this.#maxFragments > 0 &&
|
||||
this.#fragments.length === this.#maxFragments
|
||||
) {
|
||||
failWebsocketConnectionWithCode(this.ws, 1008, 'Too many message fragments')
|
||||
return false
|
||||
}
|
||||
|
||||
this.#fragmentsBytes += fragment.length
|
||||
this.#fragments.push(fragment)
|
||||
return true
|
||||
}
|
||||
|
||||
consumeFragments () {
|
||||
@@ -58090,9 +58253,12 @@ class WebSocket extends EventTarget {
|
||||
// once this happens, the connection is open
|
||||
this[kResponse] = response
|
||||
|
||||
const maxPayloadSize = this[kController]?.dispatcher?.webSocketOptions?.maxPayloadSize
|
||||
const webSocketOptions = this[kController]?.dispatcher?.webSocketOptions
|
||||
const maxFragments = webSocketOptions?.maxFragments
|
||||
const maxPayloadSize = webSocketOptions?.maxPayloadSize
|
||||
|
||||
const parser = new ByteParser(this, parsedExtensions, {
|
||||
maxFragments,
|
||||
maxPayloadSize
|
||||
})
|
||||
parser.on('drain', onParserDrain)
|
||||
@@ -59301,15 +59467,23 @@ function modulesAutoDetection(rootDir) {
|
||||
async function runLint(binPath) {
|
||||
const workingDirectory = getWorkingDirectory();
|
||||
const experimental = core.getInput(`experimental`).split(`,`);
|
||||
const noGroup = experimental.includes(`no-run-logs-group`);
|
||||
if (experimental.includes(`automatic-module-directories`)) {
|
||||
const wds = modulesAutoDetection(workingDirectory);
|
||||
const cwd = process.cwd();
|
||||
for (const wd of wds) {
|
||||
await core.group(`run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd));
|
||||
await optionalGroup(noGroup, `run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd));
|
||||
}
|
||||
return;
|
||||
}
|
||||
await core.group(`run golangci-lint`, () => runGolangciLint(binPath, workingDirectory));
|
||||
await optionalGroup(noGroup, `run golangci-lint`, () => runGolangciLint(binPath, workingDirectory));
|
||||
}
|
||||
async function optionalGroup(noGroup, name, fn) {
|
||||
if (noGroup) {
|
||||
core.info(name);
|
||||
return fn();
|
||||
}
|
||||
return core.group(name, fn);
|
||||
}
|
||||
async function run() {
|
||||
try {
|
||||
|
||||
+239
-65
@@ -29642,6 +29642,29 @@ function _generateTmpName(opts) {
|
||||
return path.join(tmpDir, opts.dir, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the prefix, postfix, and template options.
|
||||
*
|
||||
* Rejects non-string inputs so that a non-string `.includes('..')` cannot evade
|
||||
* the substring check (e.g. an Array whose `.includes('..')` is element-wise,
|
||||
* or a duck-typed object with a custom `.includes`), and so that the value is
|
||||
* not later coerced to a string with traversal sequences via `Array.prototype.join`
|
||||
* or `path.join`.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function _assertPath(option, value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error(`${option} option must be a string, got "${typeof value}".`);
|
||||
}
|
||||
|
||||
if (value.includes("..")) {
|
||||
throw new Error("Relative value not allowed");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts and sanitizes the basic options.
|
||||
*
|
||||
@@ -29656,13 +29679,19 @@ function _assertOptionsBase(options) {
|
||||
|
||||
// must not fail on valid .<name> or ..<name> or similar such constructs
|
||||
const basename = path.basename(name);
|
||||
if (basename === '..' || basename === '.' || basename !== name)
|
||||
if (basename === '..' || basename === '.' || basename !== name) {
|
||||
throw new Error(`name option must not contain a path, found "${name}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (!_isUndefined(options.template) && !options.template.match(TEMPLATE_PATTERN)) {
|
||||
throw new Error(`Invalid template, found "${options.template}".`);
|
||||
if (!_isUndefined(options.template)) {
|
||||
if (typeof options.template !== 'string') {
|
||||
throw new Error(`template option must be a string, got "${typeof options.template}".`);
|
||||
}
|
||||
if (!options.template.match(TEMPLATE_PATTERN)) {
|
||||
throw new Error(`Invalid template, found "${options.template}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore else */
|
||||
@@ -29678,8 +29707,9 @@ function _assertOptionsBase(options) {
|
||||
options.unsafeCleanup = !!options.unsafeCleanup;
|
||||
|
||||
// for completeness' sake only, also keep (multiple) blanks if the user, purportedly sane, requests us to
|
||||
options.prefix = _isUndefined(options.prefix) ? '' : options.prefix;
|
||||
options.postfix = _isUndefined(options.postfix) ? '' : options.postfix;
|
||||
options.prefix = _isUndefined(options.prefix) ? '' : _assertPath('prefix', options.prefix);
|
||||
options.postfix = _isUndefined(options.postfix) ? '' : _assertPath('postfix', options.postfix);
|
||||
options.template = _isUndefined(options.template) ? undefined : _assertPath('template', options.template);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29695,7 +29725,7 @@ function _getRelativePath(option, name, tmpDir, cb) {
|
||||
|
||||
const relativePath = path.relative(tmpDir, resolvedPath);
|
||||
|
||||
if (!resolvedPath.startsWith(tmpDir)) {
|
||||
if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) {
|
||||
return cb(new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`));
|
||||
}
|
||||
|
||||
@@ -29714,7 +29744,7 @@ function _getRelativePathSync(option, name, tmpDir) {
|
||||
const resolvedPath = _resolvePathSync(name, tmpDir);
|
||||
const relativePath = path.relative(tmpDir, resolvedPath);
|
||||
|
||||
if (!resolvedPath.startsWith(tmpDir)) {
|
||||
if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) {
|
||||
throw new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`);
|
||||
}
|
||||
|
||||
@@ -34810,7 +34840,6 @@ function defaultFactory (origin, opts) {
|
||||
|
||||
class Agent extends DispatcherBase {
|
||||
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
||||
|
||||
if (typeof factory !== 'function') {
|
||||
throw new InvalidArgumentError('factory must be a function.')
|
||||
}
|
||||
@@ -35198,6 +35227,9 @@ const EMPTY_BUF = Buffer.alloc(0)
|
||||
const FastBuffer = Buffer[Symbol.species]
|
||||
const addListener = util.addListener
|
||||
const removeAllListeners = util.removeAllListeners
|
||||
const kIdleSocketValidation = Symbol('kIdleSocketValidation')
|
||||
const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout')
|
||||
const kSocketUsed = Symbol('kSocketUsed')
|
||||
|
||||
let extractBody
|
||||
|
||||
@@ -35420,29 +35452,71 @@ class Parser {
|
||||
|
||||
const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr
|
||||
|
||||
if (ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||
this.onUpgrade(data.slice(offset))
|
||||
} else if (ret === constants.ERROR.PAUSED) {
|
||||
this.paused = true
|
||||
socket.unshift(data.slice(offset))
|
||||
} else if (ret !== constants.ERROR.OK) {
|
||||
const ptr = llhttp.llhttp_get_error_reason(this.ptr)
|
||||
let message = ''
|
||||
/* istanbul ignore else: difficult to make a test case for */
|
||||
if (ptr) {
|
||||
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
|
||||
message =
|
||||
'Response does not match the HTTP/1.1 protocol (' +
|
||||
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
|
||||
')'
|
||||
if (ret !== constants.ERROR.OK) {
|
||||
const body = data.subarray(offset)
|
||||
|
||||
if (ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||
this.onUpgrade(body)
|
||||
} else if (ret === constants.ERROR.PAUSED) {
|
||||
this.paused = true
|
||||
socket.unshift(body)
|
||||
} else {
|
||||
throw this.createError(ret, body)
|
||||
}
|
||||
throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset))
|
||||
}
|
||||
} catch (err) {
|
||||
util.destroy(socket, err)
|
||||
}
|
||||
}
|
||||
|
||||
finish () {
|
||||
assert(currentParser === null)
|
||||
assert(this.ptr != null)
|
||||
assert(!this.paused)
|
||||
|
||||
const { llhttp } = this
|
||||
|
||||
let ret
|
||||
|
||||
try {
|
||||
currentParser = this
|
||||
ret = llhttp.llhttp_finish(this.ptr)
|
||||
} finally {
|
||||
currentParser = null
|
||||
}
|
||||
|
||||
if (ret === constants.ERROR.OK) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (ret === constants.ERROR.PAUSED || ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||
this.paused = true
|
||||
return null
|
||||
}
|
||||
|
||||
return this.createError(ret, EMPTY_BUF)
|
||||
}
|
||||
|
||||
createError (ret, data) {
|
||||
const { llhttp, contentLength, bytesRead } = this
|
||||
|
||||
if (contentLength && bytesRead !== parseInt(contentLength, 10)) {
|
||||
return new ResponseContentLengthMismatchError()
|
||||
}
|
||||
|
||||
const ptr = llhttp.llhttp_get_error_reason(this.ptr)
|
||||
let message = ''
|
||||
if (ptr) {
|
||||
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
|
||||
message =
|
||||
'Response does not match the HTTP/1.1 protocol (' +
|
||||
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
|
||||
')'
|
||||
}
|
||||
|
||||
return new HTTPParserError(message, constants.ERROR[ret], data)
|
||||
}
|
||||
|
||||
destroy () {
|
||||
assert(this.ptr != null)
|
||||
assert(currentParser == null)
|
||||
@@ -35470,6 +35544,11 @@ class Parser {
|
||||
return -1
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0) {
|
||||
util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
|
||||
return -1
|
||||
}
|
||||
|
||||
const request = client[kQueue][client[kRunningIdx]]
|
||||
if (!request) {
|
||||
return -1
|
||||
@@ -35573,6 +35652,11 @@ class Parser {
|
||||
return -1
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0) {
|
||||
util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
|
||||
return -1
|
||||
}
|
||||
|
||||
const request = client[kQueue][client[kRunningIdx]]
|
||||
|
||||
/* istanbul ignore next: difficult to make a test case for */
|
||||
@@ -35746,6 +35830,7 @@ class Parser {
|
||||
request.onComplete(headers)
|
||||
|
||||
client[kQueue][client[kRunningIdx]++] = null
|
||||
socket[kSocketUsed] = true
|
||||
|
||||
if (socket[kWriting]) {
|
||||
assert(client[kRunning] === 0)
|
||||
@@ -35804,6 +35889,9 @@ async function connectH1 (client, socket) {
|
||||
socket[kWriting] = false
|
||||
socket[kReset] = false
|
||||
socket[kBlocking] = false
|
||||
socket[kIdleSocketValidation] = 0
|
||||
socket[kIdleSocketValidationTimeout] = null
|
||||
socket[kSocketUsed] = false
|
||||
socket[kParser] = new Parser(client, socket, llhttpInstance)
|
||||
|
||||
addListener(socket, 'error', function (err) {
|
||||
@@ -35814,8 +35902,11 @@ async function connectH1 (client, socket) {
|
||||
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
||||
// to the user.
|
||||
if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
|
||||
// We treat all incoming data so for as a valid response.
|
||||
parser.onMessageComplete()
|
||||
const parserErr = parser.finish()
|
||||
if (parserErr) {
|
||||
this[kError] = parserErr
|
||||
this[kClient][kOnError](parserErr)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -35834,8 +35925,10 @@ async function connectH1 (client, socket) {
|
||||
const parser = this[kParser]
|
||||
|
||||
if (parser.statusCode && !parser.shouldKeepAlive) {
|
||||
// We treat all incoming data so far as a valid response.
|
||||
parser.onMessageComplete()
|
||||
const parserErr = parser.finish()
|
||||
if (parserErr) {
|
||||
util.destroy(this, parserErr)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -35845,10 +35938,11 @@ async function connectH1 (client, socket) {
|
||||
const client = this[kClient]
|
||||
const parser = this[kParser]
|
||||
|
||||
clearIdleSocketValidation(this)
|
||||
|
||||
if (parser) {
|
||||
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
|
||||
// We treat all incoming data so far as a valid response.
|
||||
parser.onMessageComplete()
|
||||
this[kError] = parser.finish() || this[kError]
|
||||
}
|
||||
|
||||
this[kParser].destroy()
|
||||
@@ -35911,7 +36005,7 @@ async function connectH1 (client, socket) {
|
||||
return socket.destroyed
|
||||
},
|
||||
busy (request) {
|
||||
if (socket[kWriting] || socket[kReset] || socket[kBlocking]) {
|
||||
if (socket[kWriting] || socket[kReset] || socket[kBlocking] || socket[kIdleSocketValidation] === 1) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -35949,6 +36043,31 @@ async function connectH1 (client, socket) {
|
||||
}
|
||||
}
|
||||
|
||||
function clearIdleSocketValidation (socket) {
|
||||
if (socket[kIdleSocketValidationTimeout]) {
|
||||
clearTimeout(socket[kIdleSocketValidationTimeout])
|
||||
socket[kIdleSocketValidationTimeout] = null
|
||||
}
|
||||
|
||||
socket[kIdleSocketValidation] = 0
|
||||
}
|
||||
|
||||
function scheduleIdleSocketValidation (client, socket) {
|
||||
socket[kIdleSocketValidation] = 1
|
||||
socket[kIdleSocketValidationTimeout] = setTimeout(() => {
|
||||
socket[kIdleSocketValidationTimeout] = null
|
||||
socket[kIdleSocketValidation] = 2
|
||||
|
||||
if (client[kSocket] === socket && !socket.destroyed) {
|
||||
client[kResume]()
|
||||
}
|
||||
}, 0)
|
||||
socket[kIdleSocketValidationTimeout].unref?.()
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./client.js')} client
|
||||
*/
|
||||
function resumeH1 (client) {
|
||||
const socket = client[kSocket]
|
||||
|
||||
@@ -35963,6 +36082,32 @@ function resumeH1 (client) {
|
||||
socket[kNoRef] = false
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0 && client[kPending] > 0 && socket[kSocketUsed]) {
|
||||
if (socket[kIdleSocketValidation] === 0) {
|
||||
scheduleIdleSocketValidation(client, socket)
|
||||
socket[kParser].readMore()
|
||||
if (socket.destroyed) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (socket[kIdleSocketValidation] === 1) {
|
||||
socket[kParser].readMore()
|
||||
if (socket.destroyed) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0) {
|
||||
socket[kParser].readMore()
|
||||
if (socket.destroyed) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (client[kSize] === 0) {
|
||||
if (socket[kParser].timeoutType !== TIMEOUT_KEEP_ALIVE) {
|
||||
socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_KEEP_ALIVE)
|
||||
@@ -36056,6 +36201,7 @@ function writeH1 (client, request) {
|
||||
}
|
||||
|
||||
const socket = client[kSocket]
|
||||
clearIdleSocketValidation(socket)
|
||||
|
||||
const abort = (err) => {
|
||||
if (request.aborted || request.completed) {
|
||||
@@ -37928,6 +38074,7 @@ class DispatcherBase extends Dispatcher {
|
||||
|
||||
get webSocketOptions () {
|
||||
return {
|
||||
maxFragments: this[kWebSocketOptions].maxFragments ?? 131072,
|
||||
maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
|
||||
}
|
||||
}
|
||||
@@ -43864,32 +44011,25 @@ function parseUnparsedAttributes (unparsedAttributes, cookieAttributeList = {})
|
||||
// If the attribute-name case-insensitively matches the string
|
||||
// "SameSite", the user agent MUST process the cookie-av as follows:
|
||||
|
||||
// 1. Let enforcement be "Default".
|
||||
let enforcement = 'Default'
|
||||
|
||||
const attributeValueLowercase = attributeValue.toLowerCase()
|
||||
// 2. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "None", set enforcement to "None".
|
||||
if (attributeValueLowercase.includes('none')) {
|
||||
enforcement = 'None'
|
||||
}
|
||||
|
||||
// 3. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Strict", set enforcement to "Strict".
|
||||
if (attributeValueLowercase.includes('strict')) {
|
||||
enforcement = 'Strict'
|
||||
// 1. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "None", append an attribute to the cookie-attribute-list with an
|
||||
// attribute-name of "SameSite" and an attribute-value of "None".
|
||||
if (attributeValueLowercase === 'none') {
|
||||
cookieAttributeList.sameSite = 'None'
|
||||
} else if (attributeValueLowercase === 'strict') {
|
||||
// 2. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Strict", append an attribute to the cookie-attribute-list with
|
||||
// an attribute-name of "SameSite" and an attribute-value of
|
||||
// "Strict".
|
||||
cookieAttributeList.sameSite = 'Strict'
|
||||
} else if (attributeValueLowercase === 'lax') {
|
||||
// 3. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Lax", append an attribute to the cookie-attribute-list with an
|
||||
// attribute-name of "SameSite" and an attribute-value of "Lax".
|
||||
cookieAttributeList.sameSite = 'Lax'
|
||||
}
|
||||
|
||||
// 4. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Lax", set enforcement to "Lax".
|
||||
if (attributeValueLowercase.includes('lax')) {
|
||||
enforcement = 'Lax'
|
||||
}
|
||||
|
||||
// 5. Append an attribute to the cookie-attribute-list with an
|
||||
// attribute-name of "SameSite" and an attribute-value of
|
||||
// enforcement.
|
||||
cookieAttributeList.sameSite = enforcement
|
||||
} else {
|
||||
cookieAttributeList.unparsed ??= []
|
||||
|
||||
@@ -56715,6 +56855,11 @@ const { closeWebSocketConnection } = __nccwpck_require__(86897)
|
||||
const { PerMessageDeflate } = __nccwpck_require__(19469)
|
||||
const { MessageSizeExceededError } = __nccwpck_require__(68707)
|
||||
|
||||
function failWebsocketConnectionWithCode (ws, code, reason) {
|
||||
closeWebSocketConnection(ws, code, reason, Buffer.byteLength(reason))
|
||||
failWebsocketConnection(ws, reason)
|
||||
}
|
||||
|
||||
// This code was influenced by ws released under the MIT license.
|
||||
// Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
|
||||
// Copyright (c) 2013 Arnout Kazemier and contributors
|
||||
@@ -56734,19 +56879,23 @@ class ByteParser extends Writable {
|
||||
/** @type {Map<string, PerMessageDeflate>} */
|
||||
#extensions
|
||||
|
||||
/** @type {number} */
|
||||
#maxFragments
|
||||
|
||||
/** @type {number} */
|
||||
#maxPayloadSize
|
||||
|
||||
/**
|
||||
* @param {import('./websocket').WebSocket} ws
|
||||
* @param {Map<string, string>|null} extensions
|
||||
* @param {{ maxPayloadSize?: number }} [options]
|
||||
* @param {{ maxFragments?: number, maxPayloadSize?: number }} [options]
|
||||
*/
|
||||
constructor (ws, extensions, options = {}) {
|
||||
super()
|
||||
|
||||
this.ws = ws
|
||||
this.#extensions = extensions == null ? new Map() : extensions
|
||||
this.#maxFragments = options.maxFragments ?? 0
|
||||
this.#maxPayloadSize = options.maxPayloadSize ?? 0
|
||||
|
||||
if (this.#extensions.has('permessage-deflate')) {
|
||||
@@ -56770,9 +56919,9 @@ class ByteParser extends Writable {
|
||||
if (
|
||||
this.#maxPayloadSize > 0 &&
|
||||
!isControlFrame(this.#info.opcode) &&
|
||||
this.#info.payloadLength > this.#maxPayloadSize
|
||||
this.#info.payloadLength + this.#fragmentsBytes > this.#maxPayloadSize
|
||||
) {
|
||||
failWebsocketConnection(this.ws, 'Payload size exceeds maximum allowed size')
|
||||
failWebsocketConnectionWithCode(this.ws, 1009, 'Payload size exceeds maximum allowed size')
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -56937,10 +57086,12 @@ class ByteParser extends Writable {
|
||||
this.#state = parserStates.INFO
|
||||
} else {
|
||||
if (!this.#info.compressed) {
|
||||
this.writeFragments(body)
|
||||
if (!this.writeFragments(body)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
|
||||
failWebsocketConnection(this.ws, new MessageSizeExceededError().message)
|
||||
failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -56959,14 +57110,17 @@ class ByteParser extends Writable {
|
||||
this.#info.fin,
|
||||
(error, data) => {
|
||||
if (error) {
|
||||
failWebsocketConnection(this.ws, error.message)
|
||||
const code = error instanceof MessageSizeExceededError ? 1009 : 1007
|
||||
failWebsocketConnectionWithCode(this.ws, code, error.message)
|
||||
return
|
||||
}
|
||||
|
||||
this.writeFragments(data)
|
||||
if (!this.writeFragments(data)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
|
||||
failWebsocketConnection(this.ws, new MessageSizeExceededError().message)
|
||||
failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -57036,8 +57190,17 @@ class ByteParser extends Writable {
|
||||
}
|
||||
|
||||
writeFragments (fragment) {
|
||||
if (
|
||||
this.#maxFragments > 0 &&
|
||||
this.#fragments.length === this.#maxFragments
|
||||
) {
|
||||
failWebsocketConnectionWithCode(this.ws, 1008, 'Too many message fragments')
|
||||
return false
|
||||
}
|
||||
|
||||
this.#fragmentsBytes += fragment.length
|
||||
this.#fragments.push(fragment)
|
||||
return true
|
||||
}
|
||||
|
||||
consumeFragments () {
|
||||
@@ -58090,9 +58253,12 @@ class WebSocket extends EventTarget {
|
||||
// once this happens, the connection is open
|
||||
this[kResponse] = response
|
||||
|
||||
const maxPayloadSize = this[kController]?.dispatcher?.webSocketOptions?.maxPayloadSize
|
||||
const webSocketOptions = this[kController]?.dispatcher?.webSocketOptions
|
||||
const maxFragments = webSocketOptions?.maxFragments
|
||||
const maxPayloadSize = webSocketOptions?.maxPayloadSize
|
||||
|
||||
const parser = new ByteParser(this, parsedExtensions, {
|
||||
maxFragments,
|
||||
maxPayloadSize
|
||||
})
|
||||
parser.on('drain', onParserDrain)
|
||||
@@ -59301,15 +59467,23 @@ function modulesAutoDetection(rootDir) {
|
||||
async function runLint(binPath) {
|
||||
const workingDirectory = getWorkingDirectory();
|
||||
const experimental = core.getInput(`experimental`).split(`,`);
|
||||
const noGroup = experimental.includes(`no-run-logs-group`);
|
||||
if (experimental.includes(`automatic-module-directories`)) {
|
||||
const wds = modulesAutoDetection(workingDirectory);
|
||||
const cwd = process.cwd();
|
||||
for (const wd of wds) {
|
||||
await core.group(`run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd));
|
||||
await optionalGroup(noGroup, `run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd));
|
||||
}
|
||||
return;
|
||||
}
|
||||
await core.group(`run golangci-lint`, () => runGolangciLint(binPath, workingDirectory));
|
||||
await optionalGroup(noGroup, `run golangci-lint`, () => runGolangciLint(binPath, workingDirectory));
|
||||
}
|
||||
async function optionalGroup(noGroup, name, fn) {
|
||||
if (noGroup) {
|
||||
core.info(name);
|
||||
return fn();
|
||||
}
|
||||
return core.group(name, fn);
|
||||
}
|
||||
async function run() {
|
||||
try {
|
||||
|
||||
Generated
+22
-12
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "golanci-lint-action",
|
||||
"version": "8.0.0",
|
||||
"version": "9.2.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "golanci-lint-action",
|
||||
"version": "8.0.0",
|
||||
"version": "9.2.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^5.0.3",
|
||||
@@ -20,7 +20,7 @@
|
||||
"@types/semver": "^7.7.1",
|
||||
"@types/tmp": "^0.2.6",
|
||||
"@types/which": "^3.0.4",
|
||||
"tmp": "^0.2.5",
|
||||
"tmp": "^0.2.7",
|
||||
"which": "^7.0.0",
|
||||
"yaml": "^2.9.0"
|
||||
},
|
||||
@@ -3169,10 +3169,20 @@
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz",
|
||||
"integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/puzrin"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/nodeca"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
@@ -4038,9 +4048,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/tmp": {
|
||||
"version": "0.2.5",
|
||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz",
|
||||
"integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==",
|
||||
"version": "0.2.7",
|
||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.7.tgz",
|
||||
"integrity": "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14.14"
|
||||
@@ -4209,9 +4219,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "6.25.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.25.0.tgz",
|
||||
"integrity": "sha512-ZgpWDC5gmNiuY9CnLVXEH8rl50xhRCuLNA97fAUnKi8RRuV4E6KG31pDTsLVUKnohJE0I3XDrTeEydAXRw47xg==",
|
||||
"version": "6.27.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz",
|
||||
"integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18.17"
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "golanci-lint-action",
|
||||
"version": "9.2.1",
|
||||
"version": "9.3.0",
|
||||
"private": true,
|
||||
"description": "golangci-lint github action",
|
||||
"main": "dist/main.js",
|
||||
@@ -38,7 +38,7 @@
|
||||
"@types/semver": "^7.7.1",
|
||||
"@types/tmp": "^0.2.6",
|
||||
"@types/which": "^3.0.4",
|
||||
"tmp": "^0.2.5",
|
||||
"tmp": "^0.2.7",
|
||||
"which": "^7.0.0",
|
||||
"yaml": "^2.9.0"
|
||||
},
|
||||
@@ -59,6 +59,6 @@
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"overrides": {
|
||||
"undici": "^6.24.0"
|
||||
"undici": "^6.27.0"
|
||||
}
|
||||
}
|
||||
|
||||
+14
-2
@@ -205,19 +205,31 @@ async function runLint(binPath: string): Promise<void> {
|
||||
|
||||
const experimental = core.getInput(`experimental`).split(`,`)
|
||||
|
||||
const noGroup = experimental.includes(`no-run-logs-group`)
|
||||
|
||||
if (experimental.includes(`automatic-module-directories`)) {
|
||||
const wds = modulesAutoDetection(workingDirectory)
|
||||
|
||||
const cwd = process.cwd()
|
||||
|
||||
for (const wd of wds) {
|
||||
await core.group(`run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd))
|
||||
await optionalGroup(noGroup, `run golangci-lint in ${path.relative(cwd, wd)}`, () => runGolangciLint(binPath, wd))
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
await core.group(`run golangci-lint`, () => runGolangciLint(binPath, workingDirectory))
|
||||
await optionalGroup(noGroup, `run golangci-lint`, () => runGolangciLint(binPath, workingDirectory))
|
||||
}
|
||||
|
||||
async function optionalGroup<T>(noGroup: boolean, name: string, fn: () => Promise<T>): Promise<T> {
|
||||
if (noGroup) {
|
||||
core.info(name)
|
||||
|
||||
return fn()
|
||||
}
|
||||
|
||||
return core.group(name, fn)
|
||||
}
|
||||
|
||||
export async function run(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user