8000 Act on CodeQL's suggestions for tightening security / improving performance by paulo-ferraz-oliveira · Pull Request #338 · erlef/setup-beam · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Act on CodeQL's suggestions for tightening security / improving performance #338

New issue
8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 3 additions & 6 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: action

permissions:
contents: read

on:
push:
branches:
Expand Down Expand Up @@ -41,8 +44,6 @@ jobs:
name: Expected local npm actions
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -56,8 +57,6 @@ jobs:
name: Action
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: raven-actions/actionlint@v2
Expand Down Expand Up @@ -94,8 +93,6 @@ jobs:
unit_tests_macos:
name: Unit tests (macOS)
runs-on: macos-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/hexpm-mirrors.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: hexpm-mirrors

permissions:
contents: read

on:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
name: macos

permissions:
contents: read

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: ubuntu

permissions:
contents: read

on:
push:
branches:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update_3rd_party_licenses.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: Update 3rd party licenses (automation)

permissions:
contents: write

on:
schedule:
- cron: '0 12 * * *'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: windows

permissions:
contents: read

on:
push:
branches:
Expand Down
7 changes: 4 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26068,18 +26068,19 @@ function requestedVersionFor(tool, version, originListing, mirrors) {
}

async function getElixirVersion(exSpec0, otpVersion0) {
const otpVersion = otpVersion0.match(/^([^-]+-)?(.+)$/)[2]
const otpVersion = otpVersion0.match(/^(?:OTP-)?(.+)$/)[1]
let otpVersionMajor = otpVersion.match(/^([^.]+).*$/)[1]

const userSuppliedOtp = exSpec0.match(/-otp-(\d+)/)?.[1] ?? null
const otpSuffix = /-otp-(\d+)/
const userSuppliedOtp = exSpec0.match(otpSuffix)?.[1] ?? null

if (userSuppliedOtp && isVersion(userSuppliedOtp)) {
otpVersionMajor = userSuppliedOtp
}

const [otpVersionsForElixirMap, elixirVersions, originListing, hexMirrors] =
await getElixirVersions()
const spec = exSpec0.replace(/-otp-.*$/, '')
const spec = exSpec0.replace(otpSuffix, '')
const versions = elixirVersions
const elixirVersionFromSpec = getVersionFromSpec(spec, versions)

Expand Down
7 changes: 4 additions & 3 deletions src/setup-beam.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,19 @@ function requestedVersionFor(tool, version, originListing, mirrors) {
}

async function getElixirVersion(exSpec0, otpVersion0) {
const otpVersion = otpVersion0.match(/^([^-]+-)?(.+)$/)[2]
const otpVersion = otpVersion0.match(/^(?:OTP-)?(.+)$/)[1]
let otpVersionMajor = otpVersion.match(/^([^.]+).*$/)[1]

const userSuppliedOtp = exSpec0.match(/-otp-(\d+)/)?.[1] ?? null
const otpSuffix = /-otp-(\d+)/
const userSuppliedOtp = exSpec0.match(otpSuffix)?.[1] ?? null

if (userSuppliedOtp && isVersion(userSuppliedOtp)) {
otpVersionMajor = userSuppliedOtp
}

const [otpVersionsForElixirMap, elixirVersions, originListing, hexMirrors] =
await getElixirVersions()
const spec = exSpec0.replace(/-otp-.*$/, '')
const spec = exSpec0.replace(otpSuffix, '')
const versions = elixirVersions
const elixirVersionFromSpec = getVersionFromSpec(spec, versions)

Expand Down
0