diff --git a/.jules/sentinel.md b/.jules/sentinel.md index a21dad7..f717ebe 100644 --- a/.jules/sentinel.md +++ b/.jules/sentinel.md @@ -27,6 +27,11 @@ **Vulnerability:** `File(path).canonicalFile`를 사용하여 심볼릭 링크 여부를 검사하면, `canonicalFile` 함수 내부에서 심볼릭 링크를 이미 대상(target) 파일의 실제 경로로 해석(resolve)해 버리기 때문에, 이후에 진행되는 `Files.isDirectory(..., LinkOption.NOFOLLOW_LINKS)` 등의 심볼릭 링크 제한 검사가 완전히 무력화되는 취약점이 발견되었습니다. **Learning:** `canonicalFile`은 보안 검사(경로 조작 등)를 위해 절대 경로를 얻을 때 유용할 수 있지만, 심볼릭 링크 자체의 특성(심볼릭 링크인지 아닌지)을 보존해야 하는 맥락에서는 사용하면 안 됩니다. **Prevention:** 심볼릭 링크 여부를 검사해야 하거나 심볼릭 링크 자체를 제한해야 하는 경우에는 `canonicalFile` 대신 `absoluteFile.toPath().normalize().toFile()`과 같이 심볼릭 링크를 해석하지 않고 경로만 정규화하는 방식을 사용해야 합니다. +## 2024-05-27 - [Migrated from 'unsafe-inline' to Nonce-based CSP for Inline Styles] +**Vulnerability:** The static HTML generated by the tool used a strict Content-Security-Policy (CSP) that included `style-src 'unsafe-inline'`, which allows the execution of potentially malicious inline styles, increasing the risk of XSS attacks. +**Learning:** To adhere strictly to CSP best practices in static HTML generators, dynamic components like nonces should be generated at build/generation time. In Kotlin, this can be efficiently done using `SecureRandom()` to create a 16-byte nonce encoded in Base64. +**Prevention:** Avoid using `'unsafe-inline'` in `Content-Security-Policy` headers or meta tags. Instead, generate a unique nonce for each request or generated file and apply it to `