Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
6941013
FEAT Add Key Vault environment resolution
Aug 11, 2026
07a85c5
Merge branch 'main' into env-refactor
ValbuenaVC Aug 11, 2026
4e7fa7a
Merge branch 'main' into env-refactor
ValbuenaVC Aug 12, 2026
eafe42c
FEAT: Removed recursion for KV lookups
Aug 12, 2026
f1deb1f
Merge remote-tracking branch 'refs/remotes/ValbuenaVC/env-refactor' i…
Aug 12, 2026
d14821b
FEAT: Added strict mode for KV
Aug 12, 2026
de5be15
FIX: Restore ambient-only setup path
Aug 12, 2026
dd30926
FEAT: Changed precedence for AKV secrets. No longer raises on both .e…
Aug 12, 2026
be956df
FEAT: Refactored precedence order and simplified environment variable…
Aug 12, 2026
5304ef8
Merge branch 'main' into env-refactor
ValbuenaVC Aug 12, 2026
2a2d8a8
Merge branch 'main' into env-refactor
ValbuenaVC Aug 13, 2026
9a97358
Merge branch 'main' into env-refactor
ValbuenaVC Aug 13, 2026
8ee9c63
FEAT Simplification refactor
Aug 13, 2026
90c3ff9
Merge branch 'env-refactor' of https://github.com/ValbuenaVC/PyRIT in…
Aug 13, 2026
8529c9d
FIX: precommit
Aug 13, 2026
9d98fb1
FIX: docs
Aug 13, 2026
3ecb38d
Merge branch 'main' into env-refactor
ValbuenaVC Aug 13, 2026
f3f7ebb
Update doc/getting_started/pyrit_conf.md
ValbuenaVC Aug 13, 2026
dc5e133
FIX: docs consistency
Aug 13, 2026
7c189b0
Merge branch 'env-refactor' of https://github.com/ValbuenaVC/PyRIT in…
Aug 13, 2026
53b06d3
Merge branch 'main' into env-refactor
ValbuenaVC Aug 14, 2026
9fe85a9
FEAT: Fixing .env_example drift
Aug 14, 2026
7c0c971
Merge branch 'main' into env-refactor
ValbuenaVC Aug 14, 2026
8d34516
Merge branch 'main' into env-refactor
ValbuenaVC Aug 14, 2026
2063af3
FIX: Remove extra newlines from .env_example
Aug 14, 2026
21685dd
Merge branch 'main' into env-refactor
ValbuenaVC Aug 14, 2026
e8612b2
FEAT: Addressing latest PR comments
Aug 14, 2026
59d36c4
Merge branch 'env-refactor' of https://github.com/ValbuenaVC/PyRIT in…
Aug 14, 2026
0d8c5ad
FEAT: env local integratoin test
Aug 14, 2026
cfd24ff
FEAT: Update .env_example
Aug 14, 2026
47c1a28
Merge branch 'main' into env-refactor
ValbuenaVC Aug 14, 2026
8abf245
Merge branch 'main' into env-refactor
ValbuenaVC Aug 17, 2026
294fa0e
FEAT: Integration tests for env drift
Aug 17, 2026
9265a6b
Merge branch 'main' into env-refactor
ValbuenaVC Aug 17, 2026
74f4bef
FIX: Outdated integration test
Aug 17, 2026
876402e
Merge branch 'main' into env-refactor
ValbuenaVC Aug 18, 2026
b635045
FIX: Updates to tests and atomic file writing
Aug 18, 2026
6abc700
Merge branch 'main' into env-refactor
ValbuenaVC Aug 18, 2026
67aa886
Merge branch 'main' into env-refactor
ValbuenaVC Aug 19, 2026
3df3f62
FIX: Incorporating latest feedback
Aug 19, 2026
b360b51
Merge branch 'main' into env-refactor
ValbuenaVC Aug 19, 2026
227a8bc
Merge branch 'main' into env-refactor
ValbuenaVC Aug 19, 2026
2cfacab
Merge branch 'main' into env-refactor
ValbuenaVC Aug 19, 2026
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
36 changes: 28 additions & 8 deletions .azuredevops/test-job-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,40 @@ jobs:
versionSpec: '3.12'
addToPath: true
- bash: |
mkdir -p ~/.pyrit
install -d -m 700 ~/.pyrit
displayName: "Create PyRIT configuration directory"
name: create_pyrit_dir
- task: AzureKeyVault@2
displayName: Azure Key Vault - retrieve .env file secret
displayName: Azure Key Vault - retrieve environment secrets
inputs:
azureSubscription: 'integration-test-service-connection'
KeyVaultName: 'pyrit-environment'
SecretsFilter: 'env-global'
RunAsPreJob: false
- bash: |
python -c "
import os;
secret = os.environ.get('PYRIT_TEST_SECRET');
python - <<'PY'
import os
import pathlib
import tempfile

secret = os.environ.get("PYRIT_TEST_SECRET")
if not secret:
raise ValueError('PYRIT_TEST_SECRET is not set');
with open(os.path.expanduser('~/.pyrit/.env'), 'w') as file:
file.write(secret)"
raise ValueError("PYRIT_TEST_SECRET is not set")

env_file = pathlib.Path.home() / ".pyrit" / ".env"
file_descriptor, temporary_name = tempfile.mkstemp(prefix=".env.", suffix=".tmp", dir=env_file.parent)
temporary_file = pathlib.Path(temporary_name)
try:
os.fchmod(file_descriptor, 0o600)
with os.fdopen(file_descriptor, "w", encoding="utf-8", newline="") as stream:
file_descriptor = -1
stream.write(secret)
os.replace(temporary_file, env_file)
finally:
if file_descriptor >= 0:
os.close(file_descriptor)
temporary_file.unlink(missing_ok=True)
PY
env:
PYRIT_TEST_SECRET: $(env-global)
name: create_env_file
Expand Down Expand Up @@ -92,10 +108,14 @@ jobs:
cp -r $PyRIT_DIR/doc $NEW_DIR
cp -r $PyRIT_DIR/assets $NEW_DIR
cp -r $PyRIT_DIR/tests/${{ parameters.testsFolder }} $NEW_DIR/tests
cp $PyRIT_DIR/.env_example $NEW_DIR/.env_example
cd $NEW_DIR
displayName: "Create and switch to new test directory"
- task: AzureCLI@2
displayName: "Authenticate with service principal, cache Cognitive Services access token, and run tests"
env:
PYRIT_ENV_EXAMPLE_PATH: $(Build.SourcesDirectory)/../${{ parameters.newDir }}/.env_example
PYRIT_REPOSITORY_ROOT: $(Build.SourcesDirectory)
inputs:
azureSubscription: ${{ parameters.testAzureSubscription }}
scriptType: 'bash'
Expand Down
Loading
Loading