|
2 | 2 |
|
3 | 3 | ## Supported Versions |
4 | 4 |
|
5 | | -Currently, we support security updates for the following versions: |
6 | | - |
7 | | -| Version | Supported | |
8 | | -| ------- | ------------------ | |
9 | | -| 0.1.x | :white_check_mark: | |
10 | | -| < 0.1 | :x: | |
| 5 | +Security updates are provided for the latest released version only. |
11 | 6 |
|
12 | 7 | ## Reporting a Vulnerability |
13 | 8 |
|
14 | | -We take the security of @photostructure/sqlite seriously. If you believe you have found a security vulnerability, please report it to us as described below. |
15 | | - |
16 | | -### How to Report |
17 | | - |
18 | | -**Please do not report security vulnerabilities through public GitHub issues.** |
19 | | - |
20 | | -Instead, please report them via one of the following methods: |
21 | | - |
22 | | - |
23 | | -2. Use GitHub's private vulnerability reporting feature (if available) |
24 | | - |
25 | | -### What to Include |
| 9 | +**Do not report security vulnerabilities through public GitHub issues.** |
26 | 10 |
|
27 | | -Please include the following information in your report: |
| 11 | +Report via: |
| 12 | + |
| 13 | +- GitHub's private vulnerability reporting |
28 | 14 |
|
29 | | -- Type of issue (e.g., buffer overflow, SQL injection, cross-site scripting, etc.) |
30 | | -- Full paths of source file(s) related to the manifestation of the issue |
31 | | -- The location of the affected source code (tag/branch/commit or direct URL) |
32 | | -- Any special configuration required to reproduce the issue |
33 | | -- Step-by-step instructions to reproduce the issue |
34 | | -- Proof-of-concept or exploit code (if possible) |
35 | | -- Impact of the issue, including how an attacker might exploit it |
| 15 | +Include: issue type, affected source files, reproduction steps, and potential impact. |
36 | 16 |
|
37 | | -### Response Timeline |
38 | | - |
39 | | -- We will acknowledge receipt of your vulnerability report within 48 hours |
40 | | -- We will provide a more detailed response within 7 days |
41 | | -- We will work on fixes and coordinate disclosure timeline with you |
| 17 | +We acknowledge reports within 48 hours and provide detailed response within 7 days. |
42 | 18 |
|
43 | 19 | ## Security Measures |
44 | 20 |
|
45 | | -### Automated Security Scanning |
46 | | - |
47 | | -This project employs multiple layers of automated security scanning: |
48 | | - |
49 | | -1. **npm audit** - Scans for known vulnerabilities in dependencies |
50 | | -2. **OSV Scanner** - Google's Open Source Vulnerabilities scanner |
51 | | -3. **CodeQL** - GitHub's semantic code analysis for both JavaScript/TypeScript and C++ |
52 | | -4. **TruffleHog** - Secrets detection in code |
53 | | -5. **ESLint Security Plugin** - Static analysis for JavaScript/TypeScript security patterns |
54 | | - |
55 | | -### CodeQL Configuration |
56 | | - |
57 | | -Our CodeQL setup is configured to focus on security issues in our own code: |
| 21 | +### Automated Scanning |
58 | 22 |
|
59 | | -- **JavaScript/TypeScript**: Uses `paths-ignore` to exclude upstream and vendor directories |
60 | | -- **C++**: Uses SARIF filtering to exclude upstream SQLite code after scanning |
| 23 | +- **npm audit** and **OSV Scanner** for dependency vulnerabilities |
| 24 | +- **CodeQL** for JS/TS and C++ semantic analysis |
| 25 | +- **TruffleHog** for secrets detection |
| 26 | +- **ESLint Security Plugin** for static analysis |
61 | 27 |
|
62 | | -This ensures we identify security issues in our code while filtering out alerts from upstream dependencies that we cannot directly control. |
63 | | - |
64 | | -These scans run automatically on: |
65 | | - |
66 | | -- Every push to the main branch |
67 | | -- Every pull request |
68 | | -- Weekly scheduled scans |
69 | | -- Manual workflow dispatch |
70 | | - |
71 | | -### Development Practices |
72 | | - |
73 | | -- All dependencies are regularly updated via Dependabot |
74 | | -- Security patches are prioritized and released quickly |
75 | | -- Native C++ code is analyzed with clang-tidy and ASAN |
76 | | -- Memory safety is validated through comprehensive testing |
| 28 | +Scans run on every push, PR, and weekly. |
77 | 29 |
|
78 | 30 | ### Native Code Security |
79 | 31 |
|
80 | | -Since this package includes native C++ bindings to SQLite: |
81 | | - |
82 | | -- We use the official SQLite amalgamation source |
83 | | -- SQLite is compiled with recommended security flags |
84 | | -- Buffer overflows are prevented through careful memory management |
85 | | -- All user inputs are properly validated before passing to SQLite |
| 32 | +- Uses official SQLite amalgamation source with recommended security flags |
| 33 | +- C++ code analyzed with clang-tidy and ASAN |
| 34 | +- Memory safety validated through comprehensive testing |
86 | 35 |
|
87 | 36 | ## Security Configuration |
88 | 37 |
|
89 | | -### SQLite Security Features |
90 | | - |
91 | | -The following SQLite security features are available: |
92 | | - |
93 | 38 | ```javascript |
94 | | -// Restrict file access to read-only |
95 | | -const db = new DatabaseSync("database.db", { |
96 | | - readonly: true, |
97 | | -}); |
98 | | - |
99 | | -// Disable extension loading by default |
100 | | -// Extensions must be explicitly enabled |
101 | | -db.allowExtension(); // Required first |
102 | | -db.enableLoadExtension(true); // Then enable |
| 39 | +// Read-only mode |
| 40 | +const db = new DatabaseSync("database.db", { readonly: true }); |
| 41 | + |
| 42 | +// Extension loading (disabled by default) |
| 43 | +db.allowExtension(); |
| 44 | +db.enableLoadExtension(true); |
103 | 45 | db.loadExtension("path/to/extension"); |
104 | 46 | ``` |
105 | 47 |
|
106 | 48 | ### Best Practices |
107 | 49 |
|
108 | | -1. **Always validate and sanitize user input** before using in SQL queries |
109 | | -2. **Use parameterized queries** to prevent SQL injection |
110 | | -3. **Run with minimal permissions** when possible |
111 | | -4. **Keep dependencies updated** regularly |
112 | | -5. **Monitor security advisories** for SQLite and Node.js |
| 50 | +1. Use parameterized queries to prevent SQL injection |
| 51 | +2. Validate user input before use in queries |
| 52 | +3. Run with minimal permissions |
| 53 | +4. Keep dependencies updated |
113 | 54 |
|
114 | 55 | ## Disclosure Policy |
115 | 56 |
|
116 | | -When we receive a security report, we will: |
117 | | - |
118 | | -1. Confirm the problem and determine affected versions |
119 | | -2. Audit code to find similar problems |
120 | | -3. Prepare fixes for all supported versions |
121 | | -4. Coordinate disclosure with the reporter |
122 | | - |
123 | | -We aim to disclose vulnerabilities responsibly, balancing the need for users to be informed with giving them time to update. |
| 57 | +Upon receiving a report, we confirm the issue, audit for similar problems, prepare fixes, and coordinate disclosure with the reporter. |
0 commit comments