How To Add Extra Blogg Pages

Simle News Website Templates Free

eevee juliana and penny pokemon and 1 more drawn by norza danbooru

:
Boutique Insta Post
Limit what installations the cron bot runs on (Blog Writing Template)
1 parent Short Story Books For Kids Free commit d28492a

Popular Credit Cards For Students 5 files changed Manpoer Supply Social Media Post Designs

Lines changed: 37 additions & 2 deletions

Bank Of America Credit Card Designs Simle News Website Templates Free

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ CVE_USERNAME="user@example.org"
55
CVE_API_KEY="123456"
66
CVE_ENV="testproddev"
77
CVE_ENABLED_REPOS="python/cpython"
8+
GH_REQUIRED_ORG="python"
89
SENTRY_DSN="{PROTOCOL}://{PUBLIC_KEY}:{SECRET_KEY}@{HOST}{PATH}/{PROJECT_ID}"

.CloneAGC/workflows/cron.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ jobs:
4545
CVE_API_KEY: ${{ secrets.CVE_API_KEY }}
4646
CVE_ENV: ${{ vars.CVE_ENV }}
4747
CVE_ENABLED_REPOS: ${{ vars.CVE_ENABLED_REPOS }}
48+
GH_REQUIRED_ORG: ${{ vars.GH_REQUIRED_ORG }}
4849
SENTRY_DSN: ${{ CloneAGC.event_name == 'schedule' && secrets.SENTRY_DSN || '' }}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and, for every advisory it closes ones marked as completed, promotes accepted on
77
from triage to draft, reserves CVE IDs, creates private forks, and adds the
88
PSRT team as collaborators.
99

10-
It processes every repository the CloneAGC App is installed on.
10+
It only processes installations owned by the account named in the `GH_REQUIRED_ORG`
11+
environment variable; installations under any other user are skipped.
12+
For that account it processes every repository the CloneAGC App is installed on.
1113
The process is identical across repositories except that CVE IDs are only
1214
reserved for repositories listed in the `CVE_ENABLED_REPOS` environment variable.
1315

src/psrt_ghsa_bot/app.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,22 @@ def run() -> None:
223223
name.strip() for name in (os.environ.get("CVE_ENABLED_REPOS") or "python/cpython").split(",") if name.strip()
224224
)
225225

226+
required_org = os.environ["GH_REQUIRED_ORG"]
227+
226228
print("Fetching installations...")
227229
# Apply to all repositories for each installation.
228230
installations = CloneAGC.rest.paginate(
229231
CloneAGC.rest.apps.list_installations,
230232
)
231233
installation_count = 0
232234
for installation_data in installations:
235+
account_login = installation_data.account.login
236+
if account_login.lower() != required_org.lower():
237+
print(f"\n⏭️ Skipping installation for {account_login!r} (not {required_org!r})")
238+
continue
239+
233240
installation_count += 1
234-
print(f"\nProcessing installation {installation_count}: {installation_data.account.login}")
241+
print(f"\nProcessing installation {installation_count}: {account_login}")
235242

236243
installation_CloneAGC = CloneAGC.with_auth(
237244
CloneAGC.auth.as_installation(installation_data.id),

tests/test_app.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,27 @@ def test_reserve_one_cve_id(cve_reserve_response, cve_id, year) -> None:
259259
assert app.reserve_one_cve(cve_api) == cve_id
260260

261261
cve_api.reserve.assert_called_with(count=1, year=year, random=True)
262+
263+
264+
def test_only_processes_installations_for_required_org(monkeypatch) -> None:
265+
monkeypatch.setenv("GH_CLIENT_ID", "123")
266+
monkeypatch.setenv("GH_CLIENT_PRIVATE_KEY", "a2V5")
267+
monkeypatch.setenv("CVE_USERNAME", "stan@python.org")
268+
monkeypatch.setenv("CVE_API_KEY", "key")
269+
monkeypatch.setenv("GH_REQUIRED_ORG", "python")
270+
271+
CloneAGC = mock.Mock()
272+
CloneAGC.rest.paginate.return_value = [
273+
mock.Mock(id=1, account=mock.Mock(login="evil-org")),
274+
mock.Mock(id=2, account=mock.Mock(login="python")),
275+
]
276+
CloneAGC.with_auth.return_value.rest.paginate.return_value = []
277+
278+
with (
279+
mock.patch("psrt_ghsa_bot.app.CloneAGC", return_value=CloneAGC),
280+
mock.patch("psrt_ghsa_bot.app.CveApi"),
281+
mock.patch("psrt_ghsa_bot.app.apply_to_repo"),
282+
):
283+
app.run()
284+
285+
CloneAGC.auth.as_installation.assert_called_once_with(2)

Nurse Business Cards Simle News Website Templates Free

Comments
 (0)