

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
12345# Java Security67> This file extends [common/security.md](../common/security.md) with Java-specific content.89## Secrets Management1011- Never hardcode API keys, tokens, or credentials in source code12- Use environment variables: `System.getenv("API_KEY")`13- Use a secret manager (Vault, AWS Secrets Manager) for production secrets14- Keep local config files with secrets in `.gitignore`1516```java17// BAD18private static final String API_KEY = "sk-abc123...";1920// GOOD — environment variable21String apiKey = System.getenv("PAYMENT_API_KEY");22Objects.requireNonNull(apiKey, "PAYMENT_API_KEY must be set");23```2425## SQL Injection Prevention2627- Always use parameterized queries — never concatenate user input into SQL28- Use `PreparedStatement` or your framework's parameterized query API29- Validate and sanitize any input used in native queries3031```java32// BAD — SQL injection via string concatenation33Statement stmt = conn.createStatement();34String sql = "SELECT * FROM orders WHERE name = '" + name + "'";35stmt.executeQuery(sql);3637// GOOD — PreparedStatement with parameterized query38PreparedStatement ps = conn.prepareStatement("SELECT * FROM orders WHERE name = ?");39ps.setString(1, name);4041// GOOD — JDBC template42jdbcTemplate.query("SELECT * FROM orders WHERE name = ?", mapper, name);43```4445## Input Validation4647- Validate all user input at system boundaries before processing48- Use Bean Validation (`@NotNull`, `@NotBlank`, `@Size`) on DTOs when using a validation framework49- Sanitize file paths and user-provided strings before use50- Reject input that fails validation with clear error messages5152```java53// Validate manually in plain Java54public Order createOrder(String customerName, BigDecimal amount) {55 if (customerName == null || customerName.isBlank()) {56 throw new IllegalArgumentException("Customer name is required");57 }58 if (amount == null || amount.compareTo(BigDecimal.ZERO) <= 0) {59 throw new IllegalArgumentException("Amount must be positive");60 }61 return new Order(customerName, amount);62}63```6465## Authentication and Authorization6667- Never implement custom auth crypto — use established libraries68- Store passwords with bcrypt or Argon2, never MD5/SHA169- Enforce authorization checks at service boundaries70- Clear sensitive data from logs — never log passwords, tokens, or PII7172## Dependency Security7374- Run `mvn dependency:tree` or `./gradlew dependencies` to audit transitive dependencies75- Use OWASP Dependency-Check or Snyk to scan for known CVEs76- Keep dependencies updated — set up Dependabot or Renovate7778## Error Messages7980- Never expose stack traces, internal paths, or SQL errors in API responses81- Map exceptions to safe, generic client messages at handler boundaries82- Log detailed errors server-side; return generic messages to clients8384```java85// Log the detail, return a generic message86try {87 return orderService.findById(id);88} catch (OrderNotFoundException ex) {89 log.warn("Order not found: id={}", id);90 return ApiResponse.error("Resource not found"); // generic, no internals91} catch (Exception ex) {92 log.error("Unexpected error processing order id={}", id, ex);93 return ApiResponse.error("Internal server error"); // never expose ex.getMessage()94}95```9697## References9899See skill: `springboot-security` for Spring Security authentication and authorization patterns.100See skill: `security-review` for general security checklists.101
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| ThanhTrunggDEV/DontBeLazy.cursor/rules/zh-agents.mdc · 6 | Cursor rules | no sections | 50/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/zh-patterns.mdc · 6 | Cursor rules | api | 30/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.agent/AGENTS.md · 6 | AGENTS.md | buildteststylearch+4 | 77/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/AGENTS.md · 6 | AGENTS.md | buildteststylearch+4 | 77/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-agents.mdc · 6 | Cursor rules | agent-behaviour | 50/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-code-review.mdc · 6 | Cursor rules | styletesting-strategygitsecurity+3 | 65/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-coding-style.mdc · 6 | Cursor rules | style | 54/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-development-workflow.mdc · 6 | Cursor rules | gitagent-behaviour | 39/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-git-workflow.mdc · 6 | Cursor rules | lint-formatgitagent-behaviour | 43/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-hooks.mdc · 6 | Cursor rules | styletypessecuritydo-not | 36/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-patterns.mdc · 6 | Cursor rules | lint-formatstyleapi | 52/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-performance.mdc · 6 | Cursor rules | buildperformance | 48/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-security.mdc · 6 | Cursor rules | security | 39/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-testing.mdc · 6 | Cursor rules | testtesting-strategyagent-behaviour | 34/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/cpp-coding-style.mdc · 6 | Cursor rules | lint-formatstyle | 52/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/cpp-hooks.mdc · 6 | Cursor rules | buildlint-formatdeployment | 60/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/cpp-patterns.mdc · 6 | Cursor rules | style | 54/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/cpp-security.mdc · 6 | Cursor rules | securityperformancedo-not | 73/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/cpp-testing.mdc · 6 | Cursor rules | testtesting-strategy | 55/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/csharp-coding-style.mdc · 6 | Cursor rules | lint-formatstyletypes | 66/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/thanhtrunggdev-dontbelazy-cursor-rules-java-security)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.