Sample: Java — see SquidGate detect findings - #5
Conversation
Demo only — hardcoded secret + injection / dangerous API patterns. See examples/README.md
🛡️ Security Scan ResultsThree high-severity vulnerabilities introduced: hardcoded credential, SQL injection via string concatenation, and OS command injection via Runtime.exec. ⛔ 3 finding(s) block merge. HIGH — Hardcoded API KeyFile: A secret API key is hardcoded directly in the source code. This exposes the credential to anyone with access to the source or compiled artifacts. CWE: CWE-798 | OWASP: A07:2021 Recommendation: Remove the hardcoded value and load the secret from environment variables or a secure secrets manager, e.g. System.getenv("API_KEY"). HIGH — SQL InjectionFile: User-controlled input 'id' is directly concatenated into a SQL query using Statement.executeQuery without parameterization or escaping, allowing arbitrary SQL execution. CWE: CWE-89 | OWASP: A03:2021 Recommendation: Use PreparedStatement with parameterized queries: PreparedStatement ps = c.prepareStatement("SELECT * FROM users WHERE id = ?"); ps.setString(1, id); HIGH — OS Command InjectionFile: User-controlled input 'cmd' is concatenated into a shell command and executed via Runtime.exec without sanitization or validation, enabling arbitrary command execution. CWE: CWE-78 | OWASP: A03:2021 Recommendation: Avoid executing shell commands with user input. If necessary, use ProcessBuilder with argument arrays and strict validation/whitelisting of allowed commands. |
SquidGate language sample — Java
This PR intentionally introduces insecure patterns so you can see SquidGate work on Java:
File
examples/java/UserDao.javaWhat to look for
block_on(defaulthigh)All language samples · Setup SquidGate on your repo