Skip to content

Commit df33740

Browse files
authored
Merge branch 'main' into feat/wildguard-scorer
2 parents f737059 + 6fd7193 commit df33740

656 files changed

Lines changed: 66257 additions & 16458 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.azuredevops/component-governance.yml‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,27 @@ pool:
99
vmImage: "ubuntu-latest"
1010

1111
steps:
12-
# Component Governance does not support pyproject.toml yet.
13-
# For that reason, use toml-to-requirements to export the
14-
# dependencies into a requirements.txt file.
15-
- script: pip install --upgrade setuptools pip
16-
name: UpgradePip
17-
18-
- script: pip install toml-to-requirements
19-
20-
- script: toml-to-req --toml-file pyproject.toml
21-
2212
- task: ComponentGovernanceComponentDetection@0
23-
env:
24-
PIP_INDEX_URL: https://pypi.python.org/simple
13+
displayName: Detect components
2514

2615
- task: notice@0
2716
displayName: Generate NOTICE file
2817
inputs:
2918
outputfile: $(System.DefaultWorkingDirectory)/obj/NOTICE
3019
outputformat: text
20+
additionaldata: $(System.DefaultWorkingDirectory)/THIRD_PARTY_NOTICES.txt
3121

3222
- publish: $(System.DefaultWorkingDirectory)/obj/NOTICE
3323
artifact: NOTICE
24+
displayName: Publish generated NOTICE
25+
26+
- bash: |
27+
checked_in="$(System.DefaultWorkingDirectory)/NOTICE.txt"
28+
generated="$(System.DefaultWorkingDirectory)/obj/NOTICE"
29+
30+
if diff --brief --strip-trailing-cr "$checked_in" "$generated" > /dev/null; then
31+
echo "NOTICE.txt matches the generated artifact."
32+
else
33+
echo "NOTICE.txt differs from the generated artifact. The updated file is available in the NOTICE artifact."
34+
fi
35+
displayName: Compare NOTICE file

‎.github/ISSUE_TEMPLATE/bug_report.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Sample code to reproduce the problem
4242
Please provide the following information:
4343
- OS: [e.g. Windows]
4444
- Browser (if you're reporting a bug in jupyter): [e.g. Edge, Firefox, Chrome, Safari]
45-
- Python version: [e.g. 3.10.11]
45+
- Python version: [e.g. 3.11.9]
4646
- PyRIT version: [e.g. 0.1.0 or installed from main branch in editable mode]
4747
- version of Python packages: please run the following snippet and paste the output:
4848
```python

‎.github/docs-versions.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99
# after `latest`, and update `default:` / `stable:` if the new release should become the
1010
# landing page. The picker renders this list in file order, so the newest release goes first.
1111

12-
default: "1.0.1" # served at the site root (microsoft.github.io/PyRIT/)
13-
stable: "1.0.1" # served at /stable/ and shown as "(stable)" in the picker
12+
default: "1.1.0" # served at the site root (microsoft.github.io/PyRIT/)
13+
stable: "1.1.0" # served at /stable/ and shown as "(stable)" in the picker
1414

1515
versions:
1616
- slug: latest
1717
name: "latest (dev, main)"
1818
ref: main
19+
- slug: "1.1.0"
20+
name: "1.1.0"
21+
ref: releases/v1.1.0
1922
- slug: "1.0.1"
2023
name: "1.0.1"
2124
ref: releases/v1.0.1

‎.github/instructions/frontend-test.instructions.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ The following are already mocked globally in `src/setupTests.ts` — do NOT re-m
325325
- `Element.prototype.scrollTo` / `scrollIntoView`
326326
- `URL.createObjectURL` / `revokeObjectURL`
327327
- `import.meta.env` variables (`VITE_API_URL`, `MODE`)
328+
- JSDOM focus layout (`offsetParent` and viewport-sized body bounds). Disconnected elements and `display: none` ancestors have no simulated layout; visibility and disabled checks remain intact. This does not simulate positioning or actual dimensions.
329+
330+
For modal timer regressions, use fake timers with `userEvent.setup({ advanceTimers: jest.advanceTimersByTime })` and advance timers inside `act`. Keep normal accessible-role queries; querying hidden dialogs or extending timeouts can mask focus-management failures.
331+
After navigating from a modal, wait for an accessible element on the destination page, not just a test ID. Restoring background accessibility is also deferred.
328332

329333
## What to Test
330334

‎.github/instructions/output.instructions.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ When reviewing: reject any `CentralMemory` import in a non-leaf file (`pretty.py
2626

2727
### Sinks must use async I/O
2828

29-
Sink implementations must not block the event loop. Use `asyncio.to_thread()` or native async libraries for I/O operations. `FileSink` uses an `asyncio.Lock` to prevent concurrent write races.
29+
Sink implementations must not block the event loop. Use `asyncio.to_thread()` or native async libraries for I/O operations. `FileSink` uses a `threading.Lock` inside its worker thread to prevent concurrent write races, including when one sink is reused across event loops.
3030

3131
When reviewing: reject synchronous `open()`, `write()`, or network calls inside a sink's `write_async`.
3232

‎.github/instructions/style-guide.instructions.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def validate_input(self, data: dict) -> None: # Should be private
8787
- **EVERY** function MUST declare its return type
8888
- Use `None` for functions that don't return a value
8989

90-
### Modern Type Syntax (Python 3.10+)
90+
### Modern Type Syntax
9191
- Use built-in generics and union syntax:
9292
- `list[str]` not `List[str]`
9393
- `dict[str, Any]` not `Dict[str, Any]`
@@ -210,17 +210,17 @@ Within the same package, import from the specific file to avoid circular imports
210210

211211
### Typing Backports (`typing_extensions`)
212212

213-
For typing features that don't exist on every supported Python (`Self`,
214-
`override`, `TypeAlias`, `Unpack`, `NotRequired`, etc.), import from
215-
``typing_extensions`` rather than ``typing``. `typing_extensions` is already a
216-
transitive dependency (pulled in by ``pydantic``) and works across all supported
217-
Python versions, so this avoids per-version branching and ``# type: ignore`` noise.
213+
Import typing features from ``typing`` when they exist on every supported Python
214+
version. For newer features, import from ``typing_extensions``. It is already a
215+
transitive dependency (pulled in by ``pydantic``), so this avoids per-version
216+
branching and ``# type: ignore`` noise.
218217

219218
```python
220-
# CORRECT — works on 3.10+
221-
from typing_extensions import Self, override
219+
# CORRECT — works on every supported Python version
220+
from typing import Self
221+
from typing_extensions import override
222222

223-
# INCORRECT — `Self` is 3.11+, `override` is 3.12+, breaks on older runtimes
223+
# INCORRECT — `override` is 3.12+ and breaks on Python 3.11
224224
from typing import Self, override
225225
```
226226

‎.github/instructions/test.instructions.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ Most tests should be unit tests. Integration and end-to-end tests are for testin
2727
- Group tests in classes prefixed with `Test`
2828
- Use `@pytest.mark.usefixtures("patch_central_database")` on classes touching Central Memory
2929
- Reuse `tests/unit/mocks.py` helpers: `MockPromptTarget`, `get_sample_conversations`, `get_mock_target_identifier`, `openai_chat_response_json_dict`
30-
- Key fixtures from `tests/unit/conftest.py`: `patch_central_database`, `sqlite_instance`
30+
- Key memory fixtures from `tests/unit/conftest.py`:
31+
- Use `patch_central_database` for tests that access `CentralMemory` or construct targets, scorers, or attacks. Declare it explicitly even in constructor, validation, or identifier tests that do not directly query memory.
32+
- Use `sqlite_instance` when the test needs to interact with the real isolated SQLite backend.
33+
- Do not rely on memory or singleton state left behind by another test. Each test must declare its own memory dependency.
34+
- When changing shared memory fixtures, install all optional dependencies with `uv sync --extra all` and run `make unit-test`. Optional component tests must also exercise fixture isolation.
3135
- No network calls should ever happen in unit tests, but file access is okay
3236
- Unit tests should be fast and can be run in parallel.
3337

‎.github/workflows/build_and_test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
fail-fast: true
9191
matrix:
9292
os: [ubuntu-latest, windows-latest, macos-latest]
93-
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
93+
python: ["3.11", "3.12", "3.13", "3.14"]
9494
package_name: ["pyrit"]
9595
package_extras: ["dev", "dev_all"]
9696
runs-on: ${{ matrix.os }}

‎.github/workflows/diff_cover.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
run: uv sync --extra all
5050

5151
- name: Run unit tests with coverage (fail under 78%)
52+
env:
53+
COVERAGE_CORE: sysmon
5254
run: make unit-test-cov-xml
5355

5456
- name: Code Coverage Report

‎.github/workflows/docs.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,4 @@ jobs:
248248

249249
- name: Deploy to GitHub Pages
250250
id: deployment
251-
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
251+
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1

0 commit comments

Comments
 (0)