Skip to content

rrezartprebreza/spring-boot-skills / skills/spring-boot-4/spring-security-review

spring-security-review

Verified

Use when explicitly reviewing or hardening a Spring Boot application's authorization, request handling, or exposed management endpoints. Not a replacement for ordinary JWT setup or a license to scan deployed systems.

FileKindSize
SKILL.mdskill md4.9 KB
agents/openai.yamlconfig267 B
examples/bad-review.mdmarkdown357 B
examples/good-review.mdmarkdown729 B
templates/DocumentAccess.javaother1.6 KB

templates/DocumentAccess.java

View on GitHub
package com.example.securityreview;

import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;

public final class DocumentAccess {
    public record AccountIdentity(UUID tenantId, UUID accountId) {
        public AccountIdentity {
            Objects.requireNonNull(tenantId);
            Objects.requireNonNull(accountId);
        }
    }

    public interface Store {
        Optional<String> findByIdAndTenantIdAndOwnerId(UUID documentId, UUID tenantId, UUID ownerId);
    }

    private final Store store;

    public DocumentAccess(Store store) {
        this.store = Objects.requireNonNull(store);
    }

    // AccountIdentity must be created by trusted authentication/identity mapping, not request binding.
    public Optional<String> read(Authentication authentication, UUID documentId) {
        if (authentication == null || !authentication.isAuthenticated()
                || authentication instanceof AnonymousAuthenticationToken
                || !(authentication.getPrincipal() instanceof AccountIdentity identity)
                || authentication.getAuthorities().stream()
                    .noneMatch(authority -> "documents:read".equals(authority.getAuthority()))) {
            throw new AccessDeniedException("Document access denied");
        }
        Objects.requireNonNull(documentId);
        return store.findByIdAndTenantIdAndOwnerId(documentId, identity.tenantId(), identity.accountId());
    }
}
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall