Skip to content

[CLIENT-4350] Add runtime flag /RTC1 to raise an error when uninitialized read occurs#990

Draft
juliannguyen4 wants to merge 43 commits intodevfrom
CLIENT-4350-add-runtime-flag-RTCu-to-raise-error-when-uninitialized-read-occurs
Draft

[CLIENT-4350] Add runtime flag /RTC1 to raise an error when uninitialized read occurs#990
juliannguyen4 wants to merge 43 commits intodevfrom
CLIENT-4350-add-runtime-flag-RTCu-to-raise-error-when-uninitialized-read-occurs

Conversation

@juliannguyen4
Copy link
Collaborator

No description provided.

Comment on lines +8 to +47
runs-on: ["self-hosted", "Windows", "X64"]
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
with:
egress-policy: audit

- name: Get tests and Github action scripts
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ inputs.use_jfrog_builds && inputs.jfrog-build-version-to-test || github.sha }}

- run: Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"

- run: |
pyenv --version
pyenv install --debug 3.10

- uses: ./.github/actions/run-ee-server
with:
registry-name: ${{ inputs.registry-name }}
registry-username: ${{ env.REGISTRY_USERNAME }}
registry-password: ${{ env.REGISTRY_PASSWORD }}
image-name: ${{ inputs.image-name }}
server-tag: ${{ inputs.server-tag }}
where-is-client-connecting-from: 'remote-connection'

- name: Install wheel
run: |
python3-dbg -m pip install build -c requirements.txt
python3-dbg -m pip -m build
python3-dbg -m pip install dist/*.whl

- name: Install test dependencies
run: python3-dbg -m pip install pytest -c requirements.txt
working-directory: test

- name: Run tests
run: python3-dbg -m pytest new_tests/
working-directory: test

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 4 days ago

In general, to fix this issue you must explicitly declare a permissions: block in the workflow or in the specific job, restricting the GITHUB_TOKEN to the least privileges required (typically contents: read for workflows that only need to check out code). This overrides potentially broader repo/org defaults.

For this specific workflow, the simplest, non‑breaking fix is to add a root‑level permissions: block that applies to all jobs, immediately under the on: section. The job uses actions/checkout (which needs contents: read) but does not appear to need to write to the repository or manage issues, PRs, etc. Therefore contents: read is sufficient and safe. No changes are needed to steps or secrets usage; they are unaffected by the GITHUB_TOKEN scope.

Concretely, in .github/workflows/build-and-run-dev-tests-with-windows-python-dbg.yml, insert:

permissions:
  contents: read

between the trigger block (on: ...) and the jobs: key. No imports or additional methods are needed since this is a YAML configuration change only.

Suggested changeset 1
.github/workflows/build-and-run-dev-tests-with-windows-python-dbg.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/build-and-run-dev-tests-with-windows-python-dbg.yml b/.github/workflows/build-and-run-dev-tests-with-windows-python-dbg.yml
--- a/.github/workflows/build-and-run-dev-tests-with-windows-python-dbg.yml
+++ b/.github/workflows/build-and-run-dev-tests-with-windows-python-dbg.yml
@@ -3,6 +3,9 @@
   workflow_dispatch:
   pull_request:
 
+permissions:
+  contents: read
+
 jobs:
   windows-python-dbg:
     runs-on: ["self-hosted", "Windows", "X64"]
EOF
@@ -3,6 +3,9 @@
workflow_dispatch:
pull_request:

permissions:
contents: read

jobs:
windows-python-dbg:
runs-on: ["self-hosted", "Windows", "X64"]
Copilot is powered by AI and may make mistakes. Always verify output.
working-directory: test

windows-dbg:
uses: .github/workflows/build-and-run-dev-tests-with-windows-python-dbg.yml

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 8 days ago

In general, the problem is fixed by adding an explicit permissions: block to the workflow or to the specific job so that the GITHUB_TOKEN is limited to the minimum required scope, typically contents: read (and other read scopes if needed). This documents the workflow’s expectations and prevents accidental elevation if repository or organization defaults change.

For this specific workflow, the smallest, least intrusive fix is to add a permissions: block at the root level of .github/workflows/stage-tests.yml, right after the on: definition. That block will apply to all jobs that do not override permissions, including windows-dbg. Since the shown jobs only check out code, run tests, pull Docker images, and use reusable workflows, they only need read access to repository contents; write permissions are not required. Therefore, we can safely set permissions: contents: read globally. No imports or additional methods are needed because this is a YAML configuration change only.

Concretely, in .github/workflows/stage-tests.yml, add:

permissions:
  contents: read

immediately after the on: block (after the workflow_call: configuration). This will satisfy CodeQL’s requirement and enforce least privilege for the GITHUB_TOKEN used by all jobs, including the windows-dbg job that reuses another workflow.

Suggested changeset 1
.github/workflows/stage-tests.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/stage-tests.yml b/.github/workflows/stage-tests.yml
--- a/.github/workflows/stage-tests.yml
+++ b/.github/workflows/stage-tests.yml
@@ -41,6 +41,9 @@
         description: 'Test macOS x86 wheels (unstable)'
 
 env:
+
+permissions:
+  contents: read
   REGISTRY_USERNAME: ${{ inputs.registry-name == 'docker.io' && secrets.DOCKER_HUB_BOT_USERNAME || secrets.QE_DOCKER_REGISTRY_USERNAME }}
   REGISTRY_PASSWORD: ${{ inputs.registry-name == 'docker.io' && secrets.DOCKER_HUB_BOT_PW || secrets.QE_DOCKER_REGISTRY_PASSWORD }}
 
EOF
@@ -41,6 +41,9 @@
description: 'Test macOS x86 wheels (unstable)'

env:

permissions:
contents: read
REGISTRY_USERNAME: ${{ inputs.registry-name == 'docker.io' && secrets.DOCKER_HUB_BOT_USERNAME || secrets.QE_DOCKER_REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ inputs.registry-name == 'docker.io' && secrets.DOCKER_HUB_BOT_PW || secrets.QE_DOCKER_REGISTRY_PASSWORD }}

Copilot is powered by AI and may make mistakes. Always verify output.
@codecov-commenter
Copy link

codecov-commenter commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.48%. Comparing base (88dadfa) to head (e3a589f).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #990   +/-   ##
=======================================
  Coverage   83.48%   83.48%           
=======================================
  Files          99       99           
  Lines       14402    14402           
=======================================
  Hits        12024    12024           
  Misses       2378     2378           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@juliannguyen4 juliannguyen4 changed the title Client 4350 add runtime flag rt cu to raise error when uninitialized read occurs Client 4350 add runtime flag /RTC1 to raise error when uninitialized read occurs Mar 12, 2026
@juliannguyen4 juliannguyen4 changed the title Client 4350 add runtime flag /RTC1 to raise error when uninitialized read occurs [CLIENT-4350] Add runtime flag /RTC1 to raise an error when uninitialized read occurs Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants