007
無料Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.
日本語の概要は準備中です。原文の説明を表示しています。
Use when working with access policies, field access, authorization middleware, gates, route access control, AccessResult semantics, permission handlers, or files in packages/access/, packages/routing/src/AccessChecker.php, packages/user/src/Middleware/. Covers entity-level access (deny-by-default via isAllowed), field-level access (open-by-default via !isForbidden), the Gate system, route options (_public, _permission, _role, _gate), and the SessionMiddleware/AuthorizationMiddleware pipeline in public/index.php.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
This skill covers the Waaseyaa access control system:
AccessPolicyInterface, EntityAccessHandler, AccessResultFieldAccessPolicyInterface, checkFieldAccess(), filterFields()AccessChecker, route options, AuthorizationMiddlewareGate, GateInterface, PolicyAttribute, AccessDeniedExceptionSessionMiddleware, AccountInterfacePermissionHandler, PermissionHandlerInterfaceResourceSerializer field filtering, SchemaPresenter access annotations#[AccessPolicy] attribute, manifest compilationFile: packages/access/src/AccessPolicyInterface.php
interface AccessPolicyInterface
{
public function access(EntityInterface $entity, string $operation, AccountInterface $account): AccessResult;
public function createAccess(string $entityTypeId, string $bundle, AccountInterface $account): AccessResult;
public function appliesTo(string $entityTypeId): bool;
}
Operations for access(): 'view', 'update', 'delete'.
File: packages/access/src/FieldAccessPolicyInterface.php
interface FieldAccessPolicyInterface
{
public function fieldAccess(
EntityInterface $entity,
string $fieldName,
string $operation, // 'view' or 'edit'
AccountInterface $account,
): AccessResult;
}
Must be implemented alongside AccessPolicyInterface. EntityAccessHandler finds field policies via instanceof FieldAccessPolicyInterface.
File: packages/access/src/AccountInterface.php
interface AccountInterface
{
public function id(): int|string;
public function hasPermission(string $permission): bool;
public function getRoles(): array; // string[]
public function isAuthenticated(): bool;
}
File: packages/access/src/AccessResult.php
Three states: AccessResult::allowed(), AccessResult::neutral(), AccessResult::forbidden().
Combination operators:
orIf(): Forbidden wins, either Allowed yields Allowed. Used by EntityAccessHandler.andIf(): Forbidden wins, both must be Allowed. Used by AccessChecker for route requirements.File: packages/access/src/EntityAccessHandler.php
class EntityAccessHandler
{
public function __construct(array $policies = []);
public function addPolicy(AccessPolicyInterface $policy): void;
public function check(EntityInterface $entity, string $operation, AccountInterface $account): AccessResult;
public function checkCreateAccess(string $entityTypeId, string $bundle, AccountInterface $account): AccessResult;
public function checkFieldAccess(EntityInterface $entity, string $fieldName, string $operation, AccountInterface $account): AccessResult;
public function filterFields(EntityInterface $entity, array $fieldNames, string $operation, AccountInterface $account): array;
}
File: packages/access/src/Gate/GateInterface.php
interface GateInterface
{
public function allows(string $ability, mixed $subject, ?object $user = null): bool;
public function denies(string $ability, mixed $subject, ?object $user = null): bool;
public function authorize(string $ability, mixed $subject, ?object $user = null): void;
}
File: packages/routing/src/AccessChecker.php
final class AccessChecker
{
public function __construct(private readonly ?GateInterface $gate = null);
public function check(Route $route, AccountInterface $account): AccessResult;
public static function applyGateToRoute(Route $route, string $ability, mixed $subject = null): void;
}
Route options: _public (bool), _permission (string), _role (string, comma-separated), _gate (array).
Request -> SessionMiddleware -> AuthorizationMiddleware -> Final Handler -> Response
SessionMiddleware (packages/user/src/Middleware/SessionMiddleware.php): reads $_SESSION['waaseyaa_uid'], loads User entity, falls back to AnonymousUser, sets _account on request attributes.AuthorizationMiddleware (packages/access/src/Middleware/AuthorizationMiddleware.php): reads _account and _route_object from request, delegates to AccessChecker::check(), returns 403 JSON:API response on Forbidden.This is the most critical architectural detail:
| Level | Check Method | Default Stance | Interpretation |
|---|---|---|---|
| Entity | $result->isAllowed() | Deny unless granted | Neutral = denied |
| Field | !$result->isForbidden() | Allow unless denied | Neutral = accessible |
Entity access: deny-by-default. A policy must return Allowed.
Field access: open-by-default. Only explicit Forbidden restricts.
access (layer 1) -- owns AccountInterface, AccessPolicyInterface, FieldAccessPolicyInterface, EntityAccessHandler
|
+-- Does NOT depend on user package
|
user (layer 1) -- owns User, AnonymousUser, SessionMiddleware
|
+-- Depends on access (for AccountInterface)
|
routing (layer 4) -- owns AccessChecker
|
+-- Depends on access (for AccessResult, AccountInterface, GateInterface)
AccountInterface lives in access, not user. This prevents circular dependencies. Always type-hint AccountInterface, not AnonymousUser.
ResourceSerializer::serialize() and SchemaPresenter::present() accept ?EntityAccessHandler + ?AccountInterface. Both must be non-null or both null.
if ($handler !== null && $account !== null) {
// Apply field filtering
}
JSON Schema extension marking fields viewable but not editable. The admin SPA reads this to show disabled widgets. Distinct from system readOnly (id, uuid) which hides the field entirely.
{
"status": {
"type": "boolean",
"readOnly": true,
"x-access-restricted": true
}
}
// WRONG: using isAllowed() for field check
if ($handler->checkFieldAccess($entity, 'title', 'view', $account)->isAllowed()) { ... }
// CORRECT: field access uses !isForbidden()
if (!$handler->checkFieldAccess($entity, 'title', 'view', $account)->isForbidden()) { ... }
// WRONG: importing from user package into access package
use Waaseyaa\User\AnonymousUser;
// CORRECT: type-hint the interface from access package
use Waaseyaa\Access\AccountInterface;
// WRONG: PHPUnit can't mock final class or intersection types
$policy = $this->createMock(AccessPolicyInterface::class); // may fail if final
$policy = $this->createMock(AccessPolicyInterface::class & FieldAccessPolicyInterface::class); // fails
// CORRECT: use anonymous class
$policy = new class implements AccessPolicyInterface, FieldAccessPolicyInterface {
public function access(EntityInterface $entity, string $operation, AccountInterface $account): AccessResult {
return AccessResult::allowed();
}
public function createAccess(string $entityTypeId, string $bundle, AccountInterface $account): AccessResult {
return AccessResult::neutral();
}
public function appliesTo(string $entityTypeId): bool {
return true;
}
public function fieldAccess(EntityInterface $entity, string $fieldName, string $operation, AccountInterface $account): AccessResult {
return AccessResult::neutral();
}
};
EntityAccessHandler skips policies that do not implement FieldAccessPolicyInterface during field access checks. An AccessPolicyInterface-only class will never have fieldAccess() called.
When checking field access before persisting a new entity, create the entity once and reuse it for both the access check and the save. Do not create a throwaway temp entity for the access check.
Passing EntityAccessHandler without AccountInterface (or vice versa) results in no filtering. Both must be provided.
Foundation (layer 0) must never import from access (layer 1). Policy attribute scanning in PackageManifestCompiler uses string constants:
private const POLICY_ATTRIBUTE = 'Waaseyaa\\Access\\Gate\\PolicyAttribute';
// NOT: use Waaseyaa\Access\Gate\PolicyAttribute;
Gate resolves NodePolicy to entity type node via PascalCase-to-snake_case conversion. Use str_replace('_', '', ucwords($name, '_')) for the reverse (snake_case to PascalCase), not ucfirst().
Use real instances, not mocks, for EntityAccessHandler (not a final class but policies often are):
$handler = new EntityAccessHandler([$policy1, $policy2]);
$result = $handler->check($entity, 'view', $account);
self::assertTrue($result->isAllowed());
$policy = new class implements AccessPolicyInterface, FieldAccessPolicyInterface {
// ... implement all methods with inline logic
};
$db = PdoDatabase::createSqlite(); // :memory: SQLite
$storage = new InMemoryEntityStorage(); // from Waaseyaa\Api\Tests\Fixtures
tests/Integration/Phase6/FieldAccessIntegrationTest.php
tests/Integration/Phase11/AuthorizationPipelineTest.php
#[Test]
#[CoversClass(EntityAccessHandler::class)]
public function checkFieldAccessReturnsForbiddenForRestrictedField(): void
Use #[CoversNothing] for integration tests.
docs/specs/access-control.md -- Entity-level access, route access, Gate system, authorization pipelinedocs/specs/field-access.md -- Field-level access, asymmetric semantics, x-access-restricted, testing patternspackages/access/src/AccessPolicyInterface.php
packages/access/src/FieldAccessPolicyInterface.php
packages/access/src/AccessResult.php
packages/access/src/AccessStatus.php
packages/access/src/EntityAccessHandler.php
packages/access/src/AccountInterface.php
packages/access/src/PermissionHandler.php
packages/access/src/PermissionHandlerInterface.php
packages/access/src/Attribute/AccessPolicy.php
packages/access/src/Gate/Gate.php
packages/access/src/Gate/GateInterface.php
packages/access/src/Gate/PolicyAttribute.php
packages/access/src/Gate/AccessDeniedException.php
packages/access/src/Middleware/AuthorizationMiddleware.php
packages/routing/src/AccessChecker.php
packages/user/src/Middleware/SessionMiddleware.php
packages/api/src/ResourceSerializer.php
packages/api/src/JsonApiController.php
packages/api/src/Schema/SchemaPresenter.php
public/index.php
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.
日本語の概要は準備中です。原文の説明を表示しています。
Guides the creation of agile user stories and Gherkin feature files. Use when the user wants to create a user story, write acceptance criteria, define Gherkin scenarios, or author BDD feature files. This should trigger for requests such as Create a user story; Write a user story; I need to write a user story. Part of cursor-rules-java project
日本語の概要は準備中です。原文の説明を表示しています。
Facilitates conversational discovery to create Architectural Decision Records (ADRs) for non-functional requirements using the ISO/IEC 25010:2023 quality model. Use when the user wants to document quality attributes, NFR decisions, security/performance/scalability architecture, or design systems with measurable quality criteria. This should trigger for requests such as Create ADR for Non-functional requirements; Document Non-functional requirements; Capture Non-functional requirements; Generate Non-functional requirements in an ADR. Part of cursor-rules-java project
日本語の概要は準備中です。原文の説明を表示しています。
Run a health check on an existing project: dependency audit, security scan, test runner detection, CI/CD evaluation, and missing configuration analysis. Maps the three execution gates (pre/in/post) from /10x-bootstrapper to an assessment framework for existing codebases. Reads optional context/foundation/stack-assessment.md from /10x-stack-assess to focus checks on identified gaps. Writes context/foundation/health-check.md with findings, prioritized fixes, and an agent-readiness verdict. Use when the user has an existing project and wants to verify its health before working with an agent. Trigger phrases: "health check", "check my project", "audit my project", "is my project healthy", "sprawdź projekt", "audyt projektu", "health-check", "project health". Use AFTER /10x-stack-assess (brownfield chain), BEFORE agent onboarding (m1-l4).
日本語の概要は準備中です。原文の説明を表示しています。
You MUST use this when building projects end-to-end. Orchestrates all 12 team roles — automatically switches between CTO, architect, PM, engineers, SRE, security, DBA, QA, and EM based on the current phase of work. Starts with brainstorming before any implementation.
日本語の概要は準備中です。原文の説明を表示しています。
Use when you need to add or configure Maven plugins in your pom.xml — including quality tools (enforcer, surefire, failsafe, jacoco, pitest, spotbugs, pmd), security scanning (OWASP), code formatting (Spotless), version management, container image build (Jib), build information tracking, and benchmarking (JMH) — through a consultative, modular step-by-step approach that only adds what you actually need. This should trigger for requests such as Add Maven plugins in pom.xml; Improve Maven plugins in pom.xml. Part of cursor-rules-java project
日本語の概要は準備中です。原文の説明を表示しています。