From 935b02a25f055fd50a41802c7d1079bf4eae4831 Mon Sep 17 00:00:00 2001 From: Yardapestr <125946481+Yardapestr@users.noreply.github.com> Date: Wed, 31 Jul 2024 18:16:04 -0500 Subject: [PATCH 1/7] Create c-cpp.yml --- .github/workflows/c-cpp.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/c-cpp.yml diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 000000000000..fed11953fd35 --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -0,0 +1,23 @@ +name: C/C++ YertCoins + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: configure + run: ./configure + - name: make + run: make + - name: make check + run: make check + - name: make distcheck + run: make distcheck From 31253d7f6c814bc65fb31c5927ec07e66052d1d4 Mon Sep 17 00:00:00 2001 From: Yardapestr <125946481+Yardapestr@users.noreply.github.com> Date: Fri, 4 Apr 2025 05:09:24 -0500 Subject: [PATCH 2/7] Create codeql.yml --- .github/workflows/codeql.yml | 104 +++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000000..54d938e4744f --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,104 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + schedule: + - cron: '32 20 * * 3' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: c-cpp + build-mode: autobuild + - language: python + build-mode: none + - language: ruby + build-mode: none + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From 96e2a7db3da39c676a9fd72248df280badc4b08c Mon Sep 17 00:00:00 2001 From: Yardapestr <125946481+Yardapestr@users.noreply.github.com> Date: Fri, 4 Apr 2025 05:27:48 -0500 Subject: [PATCH 3/7] Update codeql.yml --- .github/workflows/codeql.yml | 51 +++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 54d938e4744f..da40a6d16d9f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -98,7 +98,56 @@ jobs: echo ' make release' exit 1 - - name: Perform CodeQL Analysis + - name: Perform CodeQL Analysisname: CodeQL Advanced + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '0 0 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + strategy: + matrix: + language: [ 'c-cpp' ] + build-mode: [ 'autobuild' ] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install mako + + - name: Initialize the CodeQL tools + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + config-file: .github/codeql/codeql-config.yml + + - name: Autobuild + run: | + if [ "${{ matrix.build-mode }}" == "autobuild" ]; then + /opt/hostedtoolcache/CodeQL/2.20.7/x64/codeql/cpp/tools/autobuild.sh + else + echo "Manual build mode" + fi + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + upload: true uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" From 83822c3a890032e9ede603603de30529863d0bff Mon Sep 17 00:00:00 2001 From: Yardapestr <125946481+Yardapestr@users.noreply.github.com> Date: Fri, 4 Apr 2025 06:18:06 -0500 Subject: [PATCH 4/7] Update pypi.yml --- .github/workflows/pypi.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 19b9aa94d9ad..55e03468c4bf 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -1,4 +1,13 @@ ---- +steps: + - name: Set version + run: | + TAG=$(git describe --tags --abbrev=0) + if [ -z "$TAG" ]; then + echo "No tags found!" + exit 1 + fi + export VERSION=$TAG.post$(git rev-list $TAG..HEAD --count) + echo "VERSION=$VERSION" >> $GITHUB_ENV--- name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI on: # Only deploy if we're the result of a PR being merged From 389a5c929792af04b69e67c07455e2166b69e4ea Mon Sep 17 00:00:00 2001 From: Yardapestr <125946481+Yardapestr@users.noreply.github.com> Date: Fri, 4 Apr 2025 06:20:09 -0500 Subject: [PATCH 5/7] Potential fix for code scanning alert no. 25: Uncontrolled data used in path expression Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- tests/rkls_github_canned_server.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/rkls_github_canned_server.py b/tests/rkls_github_canned_server.py index 138054a6ff9e..d419f855b7f5 100644 --- a/tests/rkls_github_canned_server.py +++ b/tests/rkls_github_canned_server.py @@ -27,7 +27,11 @@ def github_plugin_tree_api(github_user, github_repo, plugin_name): "tree": [] } # FIXME: Pull contents from directory - for file in os.listdir(f'tests/data/recklessrepo/{github_user}/{plugin_name}'): + base_path = 'tests/data/recklessrepo' + user_path = os.path.normpath(os.path.join(base_path, github_user, plugin_name)) + if not user_path.startswith(base_path): + raise Exception("Invalid path") + for file in os.listdir(user_path): dir_json["tree"].append({"path": file}) resp = flask.Response(response=json.dumps(dir_json), headers={'Content-Type': 'application/json; charset=utf-8'}) From 0ac3a572c0283702c1520abb0ac5029b7f5006d6 Mon Sep 17 00:00:00 2001 From: Yardapestr <125946481+Yardapestr@users.noreply.github.com> Date: Fri, 4 Apr 2025 06:23:39 -0500 Subject: [PATCH 6/7] Update codeql.yml --- .github/workflows/codeql.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index da40a6d16d9f..e460dc99bb03 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,4 +1,23 @@ -# For most projects, this workflow file will not need changing; you simply need + - name: Cache + uses: actions/cache@v4.2.3 + with: + # A list of files, directories, and wildcard patterns to cache and restore + path: + # An explicit key for restoring and saving the cache + key: + # An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case. + restore-keys: # optional + # The chunk size used to split up large files during upload, in bytes + upload-chunk-size: # optional + # An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms + enableCrossOsArchive: # optional, default is false + # Fail the workflow if cache entry is not found + fail-on-cache-miss: # optional, default is false + # Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache + lookup-only: # optional, default is false + # Run the post step to save the cache even if another step before fails + save-always: # optional, default is false + # For most projects, this workflow file will not need changing; you simply need # to commit it to your repository. # # You may wish to alter this file to override the set of languages analyzed, From 8b43a1a0474fa1d2598115bd8b386cf0a3ed39a7 Mon Sep 17 00:00:00 2001 From: Yardapestr <125946481+Yardapestr@users.noreply.github.com> Date: Fri, 4 Apr 2025 07:15:16 -0500 Subject: [PATCH 7/7] Update bsd.yml --- .github/workflows/bsd.yml | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 7868003cdfe9..184056ee5a42 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -1,5 +1,51 @@ name: FreeBSD Test +on: + push: + branches: + - "master" + pull_request: + +jobs: + testfreebsd: + runs-on: ubuntu-latest + name: Build and test on FreeBSD + timeout-minutes: 120 + steps: + - uses: actions/checkout@v4 + - name: Test in FreeBSD + id: test + uses: vmactions/freebsd-vm@v1 + with: + usesh: true + prepare: | + pkg install -y \ + wget \ + py38-pip \ + py38-sqlite3 \ + gmake \ + git \ + python \ + postgresql12-server \ + autoconf \ + automake \ + libtool \ + bash \ + gettext \ + sqlite3 \ + lowdown \ + curl \ + sudo + + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly-2021-08-3z1 + + cd /tmp/ || exit 1 + wget https://bitcoincore.org/bin/bitcoin-core-27.1/bitcoin-27.1-x86_64-linux-gnu.tar.gz + tar -xf bitcoin-27.1-x86_64-linux-gnu.tar.gz + sudo mv bitcoin-27.1/bin/* /usr/local/bin + rm -rf \ + bitcoin ▋name: FreeBSD Test + on: push: branches: