@mrciphersmith/keryx 0.4.28 → 0.4.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +4916 -3655
- package/dist/core.js +91 -28
- package/dist/keryx-general-worker-entry.js +413 -240
- package/package.json +1 -1
- package/src/gdskills/bundled/install-manifest.json +3 -0
- package/src/gdskills/bundled/rules/core/api-contracts.mdc +21 -136
- package/src/gdskills/bundled/rules/core/async-patterns.mdc +18 -171
- package/src/gdskills/bundled/rules/core/clean-architecture.mdc +40 -150
- package/src/gdskills/bundled/rules/core/cli-interface-design.mdc +63 -194
- package/src/gdskills/bundled/rules/core/code-style-patterns.mdc +36 -48
- package/src/gdskills/bundled/rules/core/concurrency-patterns.mdc +32 -0
- package/src/gdskills/bundled/rules/core/database-patterns.mdc +26 -148
- package/src/gdskills/bundled/rules/core/error-handling.mdc +57 -109
- package/src/gdskills/bundled/rules/core/frontend-assistant.mdc +14 -29
- package/src/gdskills/bundled/rules/core/layout-rendering.mdc +51 -0
- package/src/gdskills/bundled/rules/core/mobx-store-template.mdc +69 -511
- package/src/gdskills/bundled/rules/core/nestjs-dto.mdc +18 -36
- package/src/gdskills/bundled/rules/core/playwright-testing.mdc +35 -308
- package/src/gdskills/bundled/rules/core/security-baseline.mdc +18 -140
- package/src/gdskills/bundled/rules/core/skill-authoring.mdc +190 -0
- package/src/gdskills/bundled/rules/core/skills-storage-workflow.mdc +5 -0
- package/src/gdskills/bundled/rules/core/solid-principles.mdc +70 -121
- package/src/gdskills/bundled/rules/core/storybook-guidelines.mdc +20 -22
- package/src/gdskills/bundled/rules/core/tdd-workflow.mdc +37 -74
- package/src/gdskills/bundled/rules/core/ui-anti-slop.mdc +48 -37
- package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.md +2 -2
- package/src/gdskills/bundled/skills/quality/deprecation-path/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/review-architecture/SKILL.md +25 -61
- package/src/gdskills/bundled/skills/review/review-backend/SKILL.md +15 -69
- package/src/gdskills/bundled/skills/review/review-clean-code/SKILL.md +84 -418
- package/src/gdskills/bundled/skills/review/review-core-boundaries/SKILL.md +2 -2
- package/src/gdskills/bundled/skills/review/review-degradation/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/review-flow-graph/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/review-frontend/SKILL.md +17 -311
- package/src/gdskills/bundled/skills/review/review-frontend-conventions/SKILL.md +8 -22
- package/src/gdskills/bundled/skills/review/review-highload/SKILL.md +84 -228
- package/src/gdskills/bundled/skills/review/review-layout/SKILL.md +22 -28
- package/src/gdskills/bundled/skills/review/review-logic/SKILL.md +9 -10
- package/src/gdskills/bundled/skills/review/review-performance/SKILL.md +16 -38
- package/src/gdskills/bundled/skills/review/review-premise/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/review-regression/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/review-security-code/SKILL.md +8 -8
- package/src/gdskills/bundled/skills/review/review-style/SKILL.md +49 -88
- package/src/gdskills/bundled/skills/review/review-testing-practices/SKILL.md +22 -40
- package/src/gdskills/bundled/skills/review/review-ui-ux/SKILL.md +42 -82
- package/src/gdskills/bundled/stacks/angular/rules/coding-style.mdc +15 -57
- package/src/gdskills/bundled/stacks/angular/rules/patterns.mdc +16 -60
- package/src/gdskills/bundled/stacks/angular/rules/security.mdc +11 -49
- package/src/gdskills/bundled/stacks/angular/rules/testing.mdc +13 -52
- package/src/gdskills/bundled/stacks/c-cpp/rules/coding-style.mdc +33 -57
- package/src/gdskills/bundled/stacks/c-cpp/rules/patterns.mdc +35 -62
- package/src/gdskills/bundled/stacks/c-cpp/rules/security.mdc +35 -62
- package/src/gdskills/bundled/stacks/c-cpp/rules/testing.mdc +34 -54
- package/src/gdskills/bundled/stacks/ci-github-gitlab/rules/patterns.mdc +27 -56
- package/src/gdskills/bundled/stacks/ci-github-gitlab/rules/security.mdc +51 -119
- package/src/gdskills/bundled/stacks/csharp-dotnet/rules/coding-style.mdc +42 -74
- package/src/gdskills/bundled/stacks/csharp-dotnet/rules/patterns.mdc +45 -83
- package/src/gdskills/bundled/stacks/csharp-dotnet/rules/security.mdc +34 -59
- package/src/gdskills/bundled/stacks/csharp-dotnet/rules/testing.mdc +33 -62
- package/src/gdskills/bundled/stacks/django/rules/coding-style.mdc +15 -56
- package/src/gdskills/bundled/stacks/django/rules/patterns.mdc +16 -68
- package/src/gdskills/bundled/stacks/django/rules/security.mdc +13 -71
- package/src/gdskills/bundled/stacks/django/rules/testing.mdc +16 -62
- package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/coding-style.mdc +30 -53
- package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/patterns.mdc +20 -56
- package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/security.mdc +52 -122
- package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/testing.mdc +23 -42
- package/src/gdskills/bundled/stacks/fastapi/rules/coding-style.mdc +13 -47
- package/src/gdskills/bundled/stacks/fastapi/rules/patterns.mdc +18 -81
- package/src/gdskills/bundled/stacks/fastapi/rules/security.mdc +13 -75
- package/src/gdskills/bundled/stacks/fastapi/rules/testing.mdc +14 -58
- package/src/gdskills/bundled/stacks/flutter-dart/rules/coding-style.mdc +36 -74
- package/src/gdskills/bundled/stacks/flutter-dart/rules/patterns.mdc +30 -66
- package/src/gdskills/bundled/stacks/flutter-dart/rules/security.mdc +33 -67
- package/src/gdskills/bundled/stacks/flutter-dart/rules/testing.mdc +41 -73
- package/src/gdskills/bundled/stacks/go/rules/coding-style.mdc +36 -57
- package/src/gdskills/bundled/stacks/go/rules/patterns.mdc +27 -42
- package/src/gdskills/bundled/stacks/go/rules/security.mdc +26 -43
- package/src/gdskills/bundled/stacks/go/rules/testing.mdc +23 -41
- package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/coding-style.mdc +21 -40
- package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/patterns.mdc +26 -43
- package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/security.mdc +25 -37
- package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/testing.mdc +34 -50
- package/src/gdskills/bundled/stacks/kotlin-android/rules/coding-style.mdc +28 -65
- package/src/gdskills/bundled/stacks/kotlin-android/rules/patterns.mdc +34 -78
- package/src/gdskills/bundled/stacks/kotlin-android/rules/security.mdc +35 -68
- package/src/gdskills/bundled/stacks/kotlin-android/rules/testing.mdc +34 -68
- package/src/gdskills/bundled/stacks/mobx/rules/coding-style.mdc +18 -64
- package/src/gdskills/bundled/stacks/mobx/rules/patterns.mdc +13 -66
- package/src/gdskills/bundled/stacks/mobx/rules/security.mdc +8 -35
- package/src/gdskills/bundled/stacks/mobx/rules/testing.mdc +10 -39
- package/src/gdskills/bundled/stacks/nestjs/rules/coding-style.mdc +32 -45
- package/src/gdskills/bundled/stacks/nestjs/rules/patterns.mdc +40 -60
- package/src/gdskills/bundled/stacks/nestjs/rules/security.mdc +30 -50
- package/src/gdskills/bundled/stacks/nestjs/rules/testing.mdc +27 -47
- package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/coding-style.mdc +14 -48
- package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/patterns.mdc +15 -67
- package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/security.mdc +12 -50
- package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/testing.mdc +11 -43
- package/src/gdskills/bundled/stacks/php-laravel/rules/coding-style.mdc +17 -58
- package/src/gdskills/bundled/stacks/php-laravel/rules/patterns.mdc +15 -56
- package/src/gdskills/bundled/stacks/php-laravel/rules/security.mdc +13 -50
- package/src/gdskills/bundled/stacks/php-laravel/rules/testing.mdc +14 -55
- package/src/gdskills/bundled/stacks/python/rules/coding-style.mdc +13 -41
- package/src/gdskills/bundled/stacks/python/rules/patterns.mdc +20 -61
- package/src/gdskills/bundled/stacks/python/rules/security.mdc +15 -57
- package/src/gdskills/bundled/stacks/python/rules/testing.mdc +16 -50
- package/src/gdskills/bundled/stacks/react/rules/coding-style.mdc +14 -40
- package/src/gdskills/bundled/stacks/react/rules/patterns.mdc +15 -55
- package/src/gdskills/bundled/stacks/react/rules/security.mdc +13 -49
- package/src/gdskills/bundled/stacks/react/rules/testing.mdc +10 -37
- package/src/gdskills/bundled/stacks/ruby-rails/rules/coding-style.mdc +15 -48
- package/src/gdskills/bundled/stacks/ruby-rails/rules/patterns.mdc +18 -67
- package/src/gdskills/bundled/stacks/ruby-rails/rules/security.mdc +11 -60
- package/src/gdskills/bundled/stacks/ruby-rails/rules/testing.mdc +14 -65
- package/src/gdskills/bundled/stacks/rust/rules/coding-style.mdc +39 -65
- package/src/gdskills/bundled/stacks/rust/rules/patterns.mdc +33 -60
- package/src/gdskills/bundled/stacks/rust/rules/security.mdc +35 -57
- package/src/gdskills/bundled/stacks/rust/rules/testing.mdc +29 -52
- package/src/gdskills/bundled/stacks/sql-db/rules/coding-style.mdc +12 -48
- package/src/gdskills/bundled/stacks/sql-db/rules/patterns.mdc +22 -113
- package/src/gdskills/bundled/stacks/sql-db/rules/security.mdc +11 -56
- package/src/gdskills/bundled/stacks/sql-db/rules/testing.mdc +14 -59
- package/src/gdskills/bundled/stacks/swift-ios/rules/coding-style.mdc +29 -65
- package/src/gdskills/bundled/stacks/swift-ios/rules/patterns.mdc +41 -88
- package/src/gdskills/bundled/stacks/swift-ios/rules/security.mdc +28 -53
- package/src/gdskills/bundled/stacks/swift-ios/rules/testing.mdc +32 -65
- package/src/gdskills/bundled/stacks/vue/rules/coding-style.mdc +17 -52
- package/src/gdskills/bundled/stacks/vue/rules/patterns.mdc +17 -63
- package/src/gdskills/bundled/stacks/vue/rules/security.mdc +11 -41
- package/src/gdskills/bundled/stacks/vue/rules/testing.mdc +16 -48
|
@@ -7,74 +7,33 @@ metadata:
|
|
|
7
7
|
|
|
8
8
|
# PHP / Laravel patterns
|
|
9
9
|
|
|
10
|
-
Narrows `core-common-rules`'
|
|
11
|
-
Laravel application design and its common anti-patterns. Applies only to
|
|
12
|
-
`*.php` files.
|
|
10
|
+
Narrows `core-common-rules`' design guidance to idiomatic Laravel design and its anti-patterns. Applies only to `*.php` files.
|
|
13
11
|
|
|
14
12
|
## Layered responsibility
|
|
15
13
|
|
|
16
|
-
- Controllers orchestrate;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
constructor.
|
|
20
|
-
- A Form Request class owns validation rules and authorization for one
|
|
21
|
-
request shape (`rules()`, `authorize()`); do not duplicate the same
|
|
22
|
-
validation array across multiple controller methods when a shared Form
|
|
23
|
-
Request would do.
|
|
24
|
-
- Eloquent model classes own their own data shape (casts, relationships,
|
|
25
|
-
scopes, accessors); keep cross-model orchestration (a multi-model
|
|
26
|
-
transaction, a workflow spanning several models) in a service or action
|
|
27
|
-
class, not stuffed into one model's methods.
|
|
14
|
+
- Controllers orchestrate; push non-trivial logic into an Eloquent model method, an invokable action class (`app/Actions/...`), or a constructor-injected service class.
|
|
15
|
+
- A Form Request owns validation rules and authorization (`rules()`, `authorize()`) for one request shape; do not duplicate a validation array across controller methods.
|
|
16
|
+
- Models own their data shape (casts, relationships, scopes, accessors); keep cross-model orchestration (a multi-model transaction or workflow) in a service or action class.
|
|
28
17
|
|
|
29
18
|
## Eloquent relationships and queries
|
|
30
19
|
|
|
31
|
-
- Eager-load
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"just how Eloquent works."
|
|
35
|
-
- For a result set too large to hold in memory, use `chunk()`/`chunkById()`
|
|
36
|
-
or `cursor()`/`lazy()` instead of `all()`/an unbounded `get()`;
|
|
37
|
-
`chunkById()` (not plain `chunk()`) when the loop body updates or
|
|
38
|
-
deletes rows, since plain `chunk()`'s offset pagination skips rows as
|
|
39
|
-
the underlying set shifts.
|
|
40
|
-
- Use query scopes (`scopeActive`, `scopePublished`) for a filter reused
|
|
41
|
-
across more than one call site instead of repeating the same `where()`
|
|
42
|
-
chain.
|
|
20
|
+
- Eager-load (`with()`, or `load()`) before iterating a collection that accesses a relationship in the loop.
|
|
21
|
+
- For a result set too large for memory, use `chunk()`/`chunkById()` or `cursor()`/`lazy()` instead of `all()`/an unbounded `get()`; use `chunkById()` when the loop body updates or deletes rows.
|
|
22
|
+
- Use query scopes (`scopeActive`, `scopePublished`) for a filter reused across call sites.
|
|
43
23
|
|
|
44
24
|
## Dependency injection and the service container
|
|
45
25
|
|
|
46
|
-
- Type-hint
|
|
47
|
-
|
|
48
|
-
inside business logic — reserve container-pulling for genuinely
|
|
49
|
-
dynamic resolution (a class name only known at runtime).
|
|
50
|
-
- Bind an interface to its implementation in a service provider's
|
|
51
|
-
`register()` when a class needs to be swappable (a payment gateway, a
|
|
52
|
-
notification channel); do not introduce an interface with exactly one
|
|
53
|
-
implementation and no swapping need "for testability" alone when
|
|
54
|
-
Laravel's own container-based mocking (`$this->mock(...)` in tests)
|
|
55
|
-
already covers that.
|
|
26
|
+
- Type-hint dependencies and let the container resolve them; reserve `app(SomeClass::class)`/`resolve(...)` for resolution by a class name known only at runtime.
|
|
27
|
+
- Bind an interface in a service provider's `register()` only when the class must be swappable (a payment gateway, a notification channel); no single-implementation interface "for testability" alone, since `$this->mock(...)` covers it.
|
|
56
28
|
|
|
57
29
|
## Jobs, events, and idempotency
|
|
58
30
|
|
|
59
|
-
- A queued job that can be delivered more than once (
|
|
60
|
-
|
|
61
|
-
checks/records its own side effect before repeating it — do not assume
|
|
62
|
-
a job runs exactly once.
|
|
63
|
-
- Prefer a domain event (`event(new OrderShipped($order))`) with
|
|
64
|
-
dedicated listeners over stacking unrelated side effects directly in
|
|
65
|
-
the code path that triggers them, when more than one unrelated concern
|
|
66
|
-
needs to react to the same occurrence.
|
|
31
|
+
- A queued job that can be delivered more than once implements `ShouldBeUnique`/`uniqueId()` or checks/records its side effect before repeating it.
|
|
32
|
+
- Prefer a domain event (`event(new OrderShipped($order))`) with dedicated listeners when more than one unrelated concern reacts to the same occurrence.
|
|
67
33
|
|
|
68
34
|
## Anti-patterns to flag
|
|
69
35
|
|
|
70
|
-
- A
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
be treated as a defect, not a convenience default.
|
|
75
|
-
- Business logic duplicated between a web controller and an API
|
|
76
|
-
controller for the same underlying action — extract the shared action/
|
|
77
|
-
service both call.
|
|
78
|
-
- A trait used to share mutable state between unrelated models instead of
|
|
79
|
-
genuinely shared, stateless behavior — prefer composition (an injected
|
|
80
|
-
collaborator) when the "shared behavior" is really shared state.
|
|
36
|
+
- A fat controller that validates, queries, transforms and formats the response inline.
|
|
37
|
+
- `protected $guarded = []` outside a factory/seeder context.
|
|
38
|
+
- Business logic duplicated between a web controller and an API controller; extract the shared action/service.
|
|
39
|
+
- A trait sharing mutable state between unrelated models; prefer an injected collaborator.
|
|
@@ -7,74 +7,37 @@ metadata:
|
|
|
7
7
|
|
|
8
8
|
# PHP / Laravel security
|
|
9
9
|
|
|
10
|
-
Narrows `core-common-rules`'
|
|
11
|
-
specific, OWASP-relevant risks and the framework API to use instead.
|
|
12
|
-
Applies only to `*.php` files.
|
|
10
|
+
Narrows `core-common-rules`' security rules to PHP/Laravel-specific, OWASP-relevant risks. Applies only to `*.php` files.
|
|
13
11
|
|
|
14
12
|
## Mass assignment
|
|
15
13
|
|
|
16
|
-
- Every Eloquent model
|
|
17
|
-
|
|
18
|
-
`$guarded = []` mass-assigns every column, attacker-controlled fields
|
|
19
|
-
(`is_admin`, `role`, `user_id` on someone else's record) included.
|
|
20
|
-
- Build a create/update from `$request->validated()` (the Form Request's
|
|
21
|
-
validated subset), not raw `$request->all()`/`$request->input()` — even
|
|
22
|
-
with `$fillable` set, validating first catches type/shape problems
|
|
23
|
-
`$fillable` alone does not.
|
|
14
|
+
- Every Eloquent model ever constructed from request data declares `$fillable` (allowlist) or `$guarded`; never an empty `$guarded = []`.
|
|
15
|
+
- Build creates/updates from `$request->validated()`, not raw `$request->all()`/`$request->input()`.
|
|
24
16
|
|
|
25
17
|
## SQL and data access
|
|
26
18
|
|
|
27
|
-
- Use
|
|
28
|
-
|
|
29
|
-
every value that varies with input; never interpolate a variable
|
|
30
|
-
directly into a raw SQL string (`DB::select("... where id = $id")`,
|
|
31
|
-
`DB::statement("... = '{$value}'")`) — that is SQL injection regardless
|
|
32
|
-
of how "internal" the input looks.
|
|
33
|
-
- `DB::raw()`/`whereRaw()`/`selectRaw()` still take bindings as a second
|
|
34
|
-
argument for any variable part of the expression — pass the value
|
|
35
|
-
there, not by interpolating it into the raw string.
|
|
19
|
+
- Use parameter binding (`where('email', $email)`, `DB::select('... where id = ?', [$id])`) for every input-varying value; never interpolate a variable into a raw SQL string (`DB::select("... where id = $id")`, `DB::statement("... = '{$value}'")`).
|
|
20
|
+
- Pass bindings as the second argument to `DB::raw()`/`whereRaw()`/`selectRaw()`, not interpolated.
|
|
36
21
|
|
|
37
22
|
## Output encoding (Blade/XSS)
|
|
38
23
|
|
|
39
|
-
- Blade's `{{ $value }}`
|
|
40
|
-
|
|
41
|
-
- `{!! $value !!}` performs no escaping — reserve it for content the
|
|
42
|
-
application itself fully controls and trusts (a sanitized rich-text
|
|
43
|
-
field explicitly passed through a purifier, not raw user input) and
|
|
44
|
-
say so at the point of use when it is used at all.
|
|
24
|
+
- Use Blade's escaping `{{ $value }}` for anything that can contain user-influenced content.
|
|
25
|
+
- Reserve `{!! $value !!}` for content the application fully controls (a rich-text field passed through a purifier), and say so at the point of use.
|
|
45
26
|
|
|
46
27
|
## CSRF and state-changing requests
|
|
47
28
|
|
|
48
|
-
- Every state-changing route (
|
|
49
|
-
|
|
50
|
-
`ValidateCsrfToken` middleware (the default for the `web` middleware
|
|
51
|
-
group) and includes `@csrf` in the form or the `X-CSRF-TOKEN`/
|
|
52
|
-
`X-XSRF-TOKEN` header for an AJAX call.
|
|
53
|
-
- Adding a route to the CSRF-exempt list is a deliberate, narrow decision
|
|
54
|
-
for a genuinely stateless endpoint (a signed webhook, an API token
|
|
55
|
-
route already outside the `web` group) — never a workaround for a
|
|
56
|
-
request that is failing CSRF verification for an unrelated reason.
|
|
29
|
+
- Every state-changing browser route relies on `VerifyCsrfToken`/`ValidateCsrfToken` (default in the `web` group) and includes `@csrf` in the form or the `X-CSRF-TOKEN`/`X-XSRF-TOKEN` header for AJAX.
|
|
30
|
+
- Exempt a route from CSRF only for a genuinely stateless endpoint (a signed webhook, an API token route outside the `web` group), never as a workaround for a failing verification.
|
|
57
31
|
|
|
58
32
|
## Secrets and configuration
|
|
59
33
|
|
|
60
|
-
- Read secrets from `.env`/`config/*.php` via
|
|
61
|
-
|
|
62
|
-
file (`.env.example` gets placeholder values only).
|
|
63
|
-
- Laravel's `APP_KEY` (used for encryption and signed URLs) is generated
|
|
64
|
-
per environment (`php artisan key:generate`) and never shared between
|
|
65
|
-
environments or committed to version control.
|
|
34
|
+
- Read secrets from `.env`/`config/*.php` via `config()`; never commit a real credential, API key or signing secret (`.env.example` gets placeholders only).
|
|
35
|
+
- Generate `APP_KEY` per environment (`php artisan key:generate`); never share it between environments or commit it.
|
|
66
36
|
|
|
67
37
|
## Queues and background work
|
|
68
38
|
|
|
69
|
-
-
|
|
70
|
-
assuming its connection can redeliver it (true of most production
|
|
71
|
-
configurations): guard the side effect with
|
|
72
|
-
`ShouldBeUnique`, a `uniqueId()`, or an idempotency check recorded
|
|
73
|
-
before the effect runs, not an assumption that retries "shouldn't
|
|
74
|
-
normally happen."
|
|
39
|
+
- Write a queue job handling security- or money-relevant work assuming redelivery: guard the side effect with `ShouldBeUnique`, a `uniqueId()`, or an idempotency check recorded before the effect runs.
|
|
75
40
|
|
|
76
41
|
## Dependency hygiene
|
|
77
42
|
|
|
78
|
-
- Run `composer audit` when introducing or updating dependencies, or when
|
|
79
|
-
asked to check for known vulnerabilities in the project's Composer
|
|
80
|
-
packages.
|
|
43
|
+
- Run `composer audit` when introducing or updating dependencies, or when asked to check for known vulnerabilities.
|
|
@@ -7,76 +7,35 @@ metadata:
|
|
|
7
7
|
|
|
8
8
|
# PHP / Laravel testing
|
|
9
9
|
|
|
10
|
-
Narrows `core-common-rules`'
|
|
11
|
-
testing stack — Pest (the current default for new Laravel apps) or
|
|
12
|
-
PHPUnit, plus Laravel's HTTP/database testing helpers. Applies only to
|
|
13
|
-
`*.php` files.
|
|
10
|
+
Narrows `core-common-rules`' testing rules to Laravel's stack: Pest (default for new apps) or PHPUnit, plus Laravel's HTTP/database helpers. Applies only to `*.php` files.
|
|
14
11
|
|
|
15
12
|
## Layout and naming
|
|
16
13
|
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
already uses for a given kind of test rather than defaulting one way.
|
|
21
|
-
- Pest: a test file is a plain script of `test('...', function () {...})`/
|
|
22
|
-
`it('...', function () {...})` calls, optionally grouped with
|
|
23
|
-
`describe(...)`. PHPUnit: a test class extends `Tests\TestCase`, with
|
|
24
|
-
each test a `public function test_...(): void` method or a method
|
|
25
|
-
annotated `#[Test]`.
|
|
26
|
-
- Name a test for the behavior it verifies ("rejects an order with no
|
|
27
|
-
line items"), not the method under test alone ("test_store").
|
|
14
|
+
- Put framework-touching tests (HTTP, database, queue, auth) in `tests/Feature` and isolated class tests in `tests/Unit`; match the project's existing split.
|
|
15
|
+
- Pest: `test('...', function () {...})`/`it(...)`, optionally grouped with `describe(...)`. PHPUnit: extend `Tests\TestCase`, with `public function test_...(): void` or `#[Test]`.
|
|
16
|
+
- Name a test for the behavior it verifies ("rejects an order with no line items"), not the method under test.
|
|
28
17
|
|
|
29
18
|
## Database and factories
|
|
30
19
|
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
hand-inserting rows; override only the fields the test cares about.
|
|
34
|
-
- Apply `RefreshDatabase` (or `DatabaseTransactions`, on a project already
|
|
35
|
-
using it) on any test that touches the database, so each test starts
|
|
36
|
-
from a known, isolated state — do not rely on execution order between
|
|
37
|
-
tests for shared fixture data.
|
|
20
|
+
- Build test data with model factories (`User::factory()->create([...])`), overriding only the fields the test cares about.
|
|
21
|
+
- Apply `RefreshDatabase` (or `DatabaseTransactions` on a project already using it) on any test touching the database; do not rely on execution order.
|
|
38
22
|
|
|
39
23
|
## HTTP and feature tests
|
|
40
24
|
|
|
41
|
-
- Exercise routes through
|
|
42
|
-
|
|
43
|
-
assert on the response (`assertStatus`, `assertJson`, `assertSee`,
|
|
44
|
-
`assertRedirect`) rather than calling controller methods directly —
|
|
45
|
-
a feature test should exercise the same path a real request takes
|
|
46
|
-
(routing, middleware, validation included).
|
|
47
|
-
- Assert authorization/validation failures explicitly
|
|
48
|
-
(`assertForbidden()`, `assertInvalid(['field'])`) instead of only
|
|
49
|
-
checking the happy path.
|
|
25
|
+
- Exercise routes through `$this->get(...)`, `$this->postJson(...)`, `actingAs($user)` and assert with `assertStatus`, `assertJson`, `assertSee`, `assertRedirect`, not by calling controller methods directly.
|
|
26
|
+
- Assert authorization/validation failures explicitly (`assertForbidden()`, `assertInvalid(['field'])`).
|
|
50
27
|
|
|
51
28
|
## Fakes over real side effects
|
|
52
29
|
|
|
53
|
-
- Use
|
|
54
|
-
|
|
55
|
-
dispatched, a mail was queued, or an HTTP call was made — never let a
|
|
56
|
-
test actually send an email, hit a real queue, or make a real outbound
|
|
57
|
-
HTTP request.
|
|
58
|
-
- After `Queue::fake()`, assert with `Queue::assertPushed(JobClass::class,
|
|
59
|
-
fn ($job) => ...)` to check the job's own state, not just that some job
|
|
60
|
-
of that class was pushed.
|
|
30
|
+
- Use `Queue::fake()`, `Mail::fake()`, `Event::fake()`, `Storage::fake('disk')`, `Http::fake([...])`; never send a real email, hit a real queue or make a real outbound HTTP request.
|
|
31
|
+
- After `Queue::fake()`, assert with `Queue::assertPushed(JobClass::class, fn ($job) => ...)` to check the job's state.
|
|
61
32
|
|
|
62
33
|
## Assertions and determinism
|
|
63
34
|
|
|
64
|
-
- Never synchronize with `sleep()`/a fixed delay
|
|
65
|
-
|
|
66
|
-
was dispatched, or run the job synchronously in the test
|
|
67
|
-
(`ShouldQueue` jobs can be dispatched and handled inline via
|
|
68
|
-
`Bus::fake()`/direct `handle()` invocation) instead of waiting on a
|
|
69
|
-
real worker.
|
|
70
|
-
- Prefer Pest's `expect($value)->toBe(...)` (or PHPUnit's
|
|
71
|
-
`assertSame`) over a loose equality check when the type matters (`===`
|
|
72
|
-
semantics), especially for IDs, enum cases, and money values.
|
|
35
|
+
- Never synchronize with `sleep()`/a fixed delay; use `Queue::fake()` and assert what was dispatched, or run the job inline (`Bus::fake()`/direct `handle()`).
|
|
36
|
+
- Prefer Pest's `expect($value)->toBe(...)` (or PHPUnit's `assertSame`) over loose equality when type matters (IDs, enum cases, money values).
|
|
73
37
|
|
|
74
38
|
## Static analysis and running
|
|
75
39
|
|
|
76
|
-
- Run the
|
|
77
|
-
|
|
78
|
-
suite when configured — a green test suite with new static-analysis
|
|
79
|
-
errors is not a finished change.
|
|
80
|
-
- Run `php artisan test` (Pest or PHPUnit, whichever the project uses) or
|
|
81
|
-
`./vendor/bin/pest`/`./vendor/bin/phpunit` directly; do not skip a slow
|
|
82
|
-
test file to get a faster local loop without saying so in the report.
|
|
40
|
+
- Run the configured static analysis (`./vendor/bin/phpstan analyse`, typically via Larastan) alongside the suite.
|
|
41
|
+
- Run `php artisan test`, `./vendor/bin/pest` or `./vendor/bin/phpunit`; do not skip a slow test file without saying so in the report.
|
|
@@ -7,57 +7,29 @@ metadata:
|
|
|
7
7
|
|
|
8
8
|
# Python coding style
|
|
9
9
|
|
|
10
|
-
Narrows `core-common-rules`'
|
|
11
|
-
idiom. Applies only to `*.py`/`*.pyi` files — everything not
|
|
12
|
-
Python-specific still comes from the common rules this file `extends`.
|
|
10
|
+
Narrows `core-common-rules`' style rules to Python; follows PEP 8. Applies only to `*.py`/`*.pyi` files.
|
|
13
11
|
|
|
14
12
|
## Formatting and typing
|
|
15
13
|
|
|
16
|
-
- Format with the project's configured formatter (`ruff format` or `black`);
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-> str:`), including `Optional`/`| None` for a parameter or return that can
|
|
20
|
-
be absent. Do not add hints to untouched code in the same change.
|
|
21
|
-
- Prefer `from __future__ import annotations` in modules that predate PEP 604
|
|
22
|
-
(`int | None`) rather than importing `Optional`/`Union` piecemeal.
|
|
14
|
+
- Format with the project's configured formatter (`ruff format` or `black`); do not hand-format around it.
|
|
15
|
+
- Type-hint every new or touched public function signature, including `Optional`/`| None`; do not add hints to untouched code in the same change.
|
|
16
|
+
- Prefer `from __future__ import annotations` in modules that predate PEP 604 over importing `Optional`/`Union` piecemeal.
|
|
23
17
|
- Use `pathlib.Path`, not `os.path` string joins, for new filesystem code.
|
|
24
|
-
- Use f-strings for interpolation
|
|
25
|
-
|
|
26
|
-
interpolation is correct (see `rules/patterns.mdc`).
|
|
27
|
-
- Run `ruff check .` (or the project's configured equivalent) instead of
|
|
28
|
-
hand-checking unused imports, shadowed builtins, or import order; fix what
|
|
29
|
-
it flags rather than adding a blanket `# noqa`.
|
|
18
|
+
- Use f-strings for interpolation, not `%`-formatting or `.format()`; logging calls keep lazy `%s` (see `rules/patterns.mdc`).
|
|
19
|
+
- Run `ruff check .` (or the project's configured equivalent) instead of hand-checking unused imports, shadowed builtins or import order; fix what it flags rather than adding a blanket `# noqa`.
|
|
30
20
|
|
|
31
21
|
## Naming and structure
|
|
32
22
|
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
baseline, not a house variant of it.
|
|
36
|
-
- One public class or cohesive function group per module; a module that
|
|
37
|
-
outgrows one screen's worth of unrelated public names should split.
|
|
38
|
-
- Private module/class internals get a single leading underscore
|
|
39
|
-
(`_helper`), not name-mangled double-underscore unless subclass
|
|
40
|
-
name-clash protection is the actual intent.
|
|
23
|
+
- One public class or cohesive function group per module; split a module that outgrows one screen of unrelated public names.
|
|
24
|
+
- Private internals get a single leading underscore (`_helper`), not name-mangled double-underscore unless subclass name-clash protection is the intent.
|
|
41
25
|
|
|
42
26
|
## Errors and imports
|
|
43
27
|
|
|
44
|
-
- Raise a specific exception type
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- Absolute imports (`from mypackage.module import thing`), not relative
|
|
48
|
-
dot-imports (`from ..module import thing`), for anything crossing a
|
|
49
|
-
package boundary; relative imports are fine within one package's own
|
|
50
|
-
submodules.
|
|
51
|
-
- Group imports stdlib / third-party / local, each group alphabetized, one
|
|
52
|
-
blank line between groups — the convention `isort`/`ruff --select I`
|
|
53
|
-
enforce; run it instead of hand-ordering when the project has it
|
|
54
|
-
configured.
|
|
28
|
+
- Raise a specific exception type, never a bare `except:` or `except Exception:` that swallows an unrelated failure.
|
|
29
|
+
- Absolute imports for anything crossing a package boundary; relative imports only within one package's own submodules.
|
|
30
|
+
- Group imports stdlib / third-party / local, alphabetized; run `isort`/`ruff --select I` when configured instead of hand-ordering.
|
|
55
31
|
|
|
56
32
|
## Docstrings
|
|
57
33
|
|
|
58
|
-
- Every public function, class and module gets a docstring
|
|
59
|
-
|
|
60
|
-
— a one-line summary is enough when the signature is already
|
|
61
|
-
self-describing.
|
|
62
|
-
- Match the project's existing docstring convention (Google-style, NumPy-style,
|
|
63
|
-
or plain reST) rather than introducing a second style in one file.
|
|
34
|
+
- Every public function, class and module gets a docstring; a one-line summary is enough when the signature is self-describing.
|
|
35
|
+
- Match the project's docstring convention (Google, NumPy or reST); do not introduce a second style in one file.
|
|
@@ -7,82 +7,41 @@ metadata:
|
|
|
7
7
|
|
|
8
8
|
# Python patterns
|
|
9
9
|
|
|
10
|
-
Narrows `core-common-rules`'
|
|
11
|
-
Python 3.12/3.13 patterns and the anti-patterns they replace. Applies only to
|
|
12
|
-
`*.py`/`*.pyi` files.
|
|
10
|
+
Narrows `core-common-rules`' design guidance to idiomatic Python 3.12/3.13. Applies only to `*.py`/`*.pyi` files.
|
|
13
11
|
|
|
14
12
|
## Data and typing
|
|
15
13
|
|
|
16
|
-
- Model a fixed set of related fields with `@dataclass` (or `attrs` if the
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- Use `TypedDict` for a dict shape that genuinely must stay a `dict` (e.g. a
|
|
21
|
-
JSON payload), not for data your own code constructs and passes around.
|
|
22
|
-
- Reach for `typing.Protocol` to type "anything with this method" instead of
|
|
23
|
-
requiring a concrete base class when the caller only needs structural
|
|
24
|
-
compatibility — this keeps callers free to pass any matching object.
|
|
25
|
-
- Use `Generic[T]`/type parameter syntax (`class Box[T]:` on 3.12+) for a
|
|
26
|
-
container or wrapper whose element type varies by call site, rather than
|
|
27
|
-
typing it `Any` and re-casting at every use.
|
|
14
|
+
- Model a fixed set of related fields with `@dataclass` (or `attrs` if the project already depends on it), not a `dict` with string keys.
|
|
15
|
+
- Use `TypedDict` only for a dict shape that must stay a `dict` (e.g. a JSON payload), not for data your own code constructs.
|
|
16
|
+
- Use `typing.Protocol` rather than a concrete base class when the caller only needs structural compatibility.
|
|
17
|
+
- Use `Generic[T]`/`class Box[T]:` (3.12+) for a container whose element type varies, not `Any` plus casts.
|
|
28
18
|
|
|
29
19
|
## Control flow and resources
|
|
30
20
|
|
|
31
|
-
- Acquire any closable/lockable resource
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
`@contextlib.contextmanager` rather than a hand-rolled
|
|
36
|
-
`__enter__`/`__exit__` class, unless the class also needs other methods.
|
|
37
|
-
- Raise a new exception `from` the one being handled
|
|
38
|
-
(`raise ValueError(...) from exc`) instead of a bare `raise ValueError(...)`
|
|
39
|
-
inside an `except` block — this preserves the causal chain instead of
|
|
40
|
-
presenting the new exception as unrelated.
|
|
41
|
-
- Prefer early return over nested `if`/`else` for guard conditions; a
|
|
42
|
-
function whose happy path is indented inside three levels of conditionals
|
|
43
|
-
should invert its guards.
|
|
21
|
+
- Acquire any closable/lockable resource with `with`/`async with`; never rely on `del`, GC or a manual `.close()`.
|
|
22
|
+
- Write a custom context manager with `@contextlib.contextmanager` unless the class needs other methods.
|
|
23
|
+
- Inside an `except` block, raise the new exception `from` the one being handled.
|
|
24
|
+
- Prefer early return over nested `if`/`else` for guard conditions.
|
|
44
25
|
|
|
45
26
|
## Async
|
|
46
27
|
|
|
47
|
-
- Group
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
when one fails.
|
|
51
|
-
- Treat `asyncio.CancelledError` as a signal to clean up and re-raise. Since
|
|
52
|
-
Python 3.8 it subclasses `BaseException`, not `Exception`, so a broad
|
|
53
|
-
`except Exception` does *not* catch it; only a bare `except:` or an
|
|
54
|
-
explicit `except BaseException` does, and either one must re-raise it
|
|
55
|
-
rather than swallow it.
|
|
56
|
-
- Never call a blocking function (`requests.get`, `time.sleep`, synchronous
|
|
57
|
-
file I/O, a CPU-bound loop) directly inside an `async def` — use the async
|
|
58
|
-
client, `asyncio.sleep`, or `asyncio.to_thread`/an executor instead.
|
|
28
|
+
- Group related concurrent awaitables with `asyncio.TaskGroup` (3.11+), not manual task lists with `asyncio.gather`.
|
|
29
|
+
- Treat `asyncio.CancelledError` as a signal to clean up and re-raise; it subclasses `BaseException`, so a bare `except:` or `except BaseException` must re-raise it.
|
|
30
|
+
- Never call a blocking function (`requests.get`, `time.sleep`, synchronous file I/O, a CPU-bound loop) inside an `async def`; use the async client, `asyncio.sleep`, or `asyncio.to_thread`/an executor.
|
|
59
31
|
|
|
60
32
|
## Iteration and collections
|
|
61
33
|
|
|
62
|
-
- Prefer a generator or generator expression over
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
`groupby`) instead of hand-rolled loops that reimplement them.
|
|
66
|
-
- Avoid a mutable default argument (`def f(items=[])`); default to `None`
|
|
67
|
-
and initialize inside the function body — a mutable default is shared and
|
|
68
|
-
mutated across every call that omits the argument.
|
|
34
|
+
- Prefer a generator or generator expression over an intermediate list when the result is iterated once.
|
|
35
|
+
- Use `itertools`/`collections` (`defaultdict`, `Counter`, `chain`, `groupby`) instead of hand-rolled equivalents.
|
|
36
|
+
- No mutable default argument (`def f(items=[])`); default to `None`.
|
|
69
37
|
|
|
70
38
|
## Logging
|
|
71
39
|
|
|
72
|
-
- Use the standard `logging` module (or the project's
|
|
73
|
-
|
|
74
|
-
- Pass interpolation arguments to the logging call
|
|
75
|
-
(`logger.info("got %s", value)`), not an f-string
|
|
76
|
-
(`logger.info(f"got {value}")`) — the f-string formats even when the log
|
|
77
|
-
level is disabled, and the lazy form does not.
|
|
40
|
+
- Use the standard `logging` module (or the project's structured logger), not `print`, beyond a throwaway script.
|
|
41
|
+
- Pass interpolation arguments to the logging call (`logger.info("got %s", value)`), not an f-string.
|
|
78
42
|
|
|
79
43
|
## Anti-patterns to flag, not introduce
|
|
80
44
|
|
|
81
|
-
- Wrapping
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
- Reassigning a loop variable's type mid-loop, or reusing one name for two
|
|
85
|
-
unrelated purposes in the same function — confuses both readers and type
|
|
86
|
-
checkers.
|
|
87
|
-
- Deep inheritance chains built to share a few methods — prefer composition
|
|
88
|
-
or a `Protocol` unless the hierarchy models a genuine is-a relationship.
|
|
45
|
+
- Wrapping a whole function body in `try/except Exception: pass`.
|
|
46
|
+
- Reusing one name for two unrelated purposes in a function, or reassigning a loop variable's type mid-loop.
|
|
47
|
+
- Deep inheritance chains built to share a few methods; prefer composition or a `Protocol` unless the hierarchy is a genuine is-a.
|
|
@@ -7,78 +7,36 @@ metadata:
|
|
|
7
7
|
|
|
8
8
|
# Python security
|
|
9
9
|
|
|
10
|
-
Narrows `core-common-rules`'
|
|
11
|
-
OWASP-style sinks and the safe API each one has a direct replacement for.
|
|
12
|
-
Applies only to `*.py`/`*.pyi` files.
|
|
10
|
+
Narrows `core-common-rules`' security guidance to Python's OWASP-style sinks. Applies only to `*.py`/`*.pyi` files.
|
|
13
11
|
|
|
14
12
|
## Command and code execution
|
|
15
13
|
|
|
16
|
-
- Never call `subprocess.run`/`Popen`/`call` with `shell=True` or a single
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
input.
|
|
20
|
-
- Never pass untrusted input to `eval`/`exec`, `compile()` of untrusted
|
|
21
|
-
source, or `os.system` — there is no safe way to sandbox these; parse the
|
|
22
|
-
input with a real parser (`json`, `ast.literal_eval` for literals) instead.
|
|
23
|
-
- Treat `ast.literal_eval` as the only acceptable "eval-like" call on
|
|
24
|
-
untrusted text, and only for literal Python values, never arbitrary
|
|
25
|
-
expressions.
|
|
14
|
+
- Never call `subprocess.run`/`Popen`/`call` with `shell=True` or a single interpolated command string; pass an argument list.
|
|
15
|
+
- Never pass untrusted input to `eval`/`exec`, `compile()` or `os.system`; parse with `json` or `ast.literal_eval`.
|
|
16
|
+
- `ast.literal_eval` is the only acceptable eval-like call on untrusted text, and only for literals.
|
|
26
17
|
|
|
27
18
|
## Deserialization
|
|
28
19
|
|
|
29
|
-
- Never unpickle (`pickle.load`/`loads`, `dill`, `shelve`) data from a
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- Use `yaml.safe_load`, never `yaml.load`, for any YAML that did not
|
|
33
|
-
originate from your own trusted config in the repo.
|
|
34
|
-
- Parse XML with `defusedxml` instead of raw
|
|
35
|
-
`xml.etree.ElementTree`/`xml.dom.minidom` on untrusted input. Current
|
|
36
|
-
`xml.etree`/expat no longer fetch external entities by default, so classic
|
|
37
|
-
XXE is not the risk; the remaining risk is entity-expansion ("billion
|
|
38
|
-
laughs") and similar resource-exhaustion DoS attacks, which the stdlib
|
|
39
|
-
parsers do not guard against and `ET.parse` has no option to disable —
|
|
40
|
-
`defusedxml` is still the safe choice for untrusted input.
|
|
20
|
+
- Never unpickle (`pickle.load`/`loads`, `dill`, `shelve`) data from a source you do not fully control; use `json` or a schema-validated format.
|
|
21
|
+
- Use `yaml.safe_load`, never `yaml.load`, unless the YAML is your own trusted in-repo config.
|
|
22
|
+
- Parse untrusted XML with `defusedxml`, not `xml.etree.ElementTree`/`xml.dom.minidom` (entity-expansion DoS; current stdlib no longer fetches external entities).
|
|
41
23
|
|
|
42
24
|
## Data access
|
|
43
25
|
|
|
44
|
-
- Build SQL with parameterized queries
|
|
45
|
-
|
|
46
|
-
into a SQL string with f-strings/`%`/`.format()`.
|
|
47
|
-
- Validate and normalize any filesystem path built from user input before
|
|
48
|
-
using it; resolve with `Path(...).resolve()` and check it stays under the
|
|
49
|
-
intended base directory to prevent path traversal (`../../etc/passwd`).
|
|
26
|
+
- Build SQL with parameterized queries or the ORM's query builder, never f-strings/`%`/`.format()` interpolation.
|
|
27
|
+
- Resolve user-built filesystem paths with `Path(...).resolve()` and check they stay under the intended base directory.
|
|
50
28
|
|
|
51
29
|
## Secrets and randomness
|
|
52
30
|
|
|
53
|
-
- Generate tokens, session IDs
|
|
54
|
-
|
|
55
|
-
— `random` is not cryptographically secure and its output is predictable.
|
|
56
|
-
- Never hard-code a credential, API key, or secret in source; read it from
|
|
57
|
-
the project's configured secret store or environment, and never log it.
|
|
31
|
+
- Generate tokens, session IDs and reset codes with `secrets` (`token_urlsafe`, `compare_digest`), never `random`.
|
|
32
|
+
- Never hard-code a credential, API key or secret; read it from the configured secret store or environment, and never log it.
|
|
58
33
|
|
|
59
34
|
## Network calls
|
|
60
35
|
|
|
61
|
-
- Always pass an explicit `timeout` to `requests`/`httpx` calls
|
|
62
|
-
|
|
63
|
-
- Never set `verify=False` (requests) or disable TLS certificate validation
|
|
64
|
-
to work around a cert error; fix the underlying trust-store/cert issue
|
|
65
|
-
instead.
|
|
36
|
+
- Always pass an explicit `timeout` to `requests`/`httpx` calls.
|
|
37
|
+
- Never set `verify=False` or disable TLS certificate validation; fix the trust store or cert.
|
|
66
38
|
|
|
67
39
|
## Dependencies
|
|
68
40
|
|
|
69
|
-
- Run the project's dependency audit tool (`pip-audit`, or `uv pip list
|
|
70
|
-
|
|
71
|
-
third-party dependency with security-sensitive functionality (auth,
|
|
72
|
-
crypto, deserialization, subprocess wrapping).
|
|
73
|
-
- Pin dependencies the project already pins (lockfile present) rather than
|
|
74
|
-
loosening a version constraint to resolve a conflict without checking the
|
|
75
|
-
changelog for the versions in between.
|
|
76
|
-
|
|
77
|
-
## Red flags
|
|
78
|
-
|
|
79
|
-
- "I'll just use `shell=True` here, the input is only ever a filename" — an
|
|
80
|
-
attacker-controlled filename can still contain shell metacharacters;
|
|
81
|
-
always pass an argument list.
|
|
82
|
-
- "`eval` is fine, this string only comes from our own config file" — if the
|
|
83
|
-
config file is ever user-editable or fetched remotely, this stops being
|
|
84
|
-
true; prefer `ast.literal_eval` or `json.loads` regardless.
|
|
41
|
+
- Run the project's dependency audit tool (`pip-audit`, or `uv pip list --outdated` plus the configured scanner) before adding a security-sensitive dependency (auth, crypto, deserialization, subprocess wrapping).
|
|
42
|
+
- Keep pins the project already has (lockfile present); do not loosen a constraint without checking the changelog for the versions in between.
|