@johsam-f/scry 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +274 -0
- package/dist/index.js +20026 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 John Sambani
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# scry
|
|
2
|
+
|
|
3
|
+
**A security-focused CLI that reveals hidden risks in JavaScript and Node.js codebases.**
|
|
4
|
+
|
|
5
|
+
> In fantasy, _to scry_ means to reveal hidden truths. `scry` applies the same idea to code.
|
|
6
|
+
|
|
7
|
+
## What is scry?
|
|
8
|
+
|
|
9
|
+
**scry** is a command-line security scanner that detects common but dangerous security mistakes in JavaScript/TypeScript projects and provides:
|
|
10
|
+
|
|
11
|
+
- **Clear explanations** of why each issue is risky
|
|
12
|
+
- **Actionable fixes** with code examples
|
|
13
|
+
- **Educational context** to build security awareness
|
|
14
|
+
- **Fast, focused scanning** without overwhelming noise
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
Clone and run from source:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git clone https://github.com/johsam-f/scry.git
|
|
22
|
+
cd scry
|
|
23
|
+
bun install
|
|
24
|
+
bun run dev scan .
|
|
25
|
+
|
|
26
|
+
bun scan examples/vulnerable-app/vulnerable-code.ts --output compact
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
> for you to test the tool, see [commands.md](./commands.md) for a comprehensive list of all available commands and options to test
|
|
30
|
+
|
|
31
|
+
Or after building:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# This assumes you have built and installed the package globally or locally, which would expose `scry` as a command
|
|
35
|
+
|
|
36
|
+
# Scan current directory
|
|
37
|
+
scry scan .
|
|
38
|
+
|
|
39
|
+
# Scan specific path
|
|
40
|
+
scry scan ./src
|
|
41
|
+
|
|
42
|
+
# Strict mode (exit code 1 if issues found)
|
|
43
|
+
scry scan . --strict
|
|
44
|
+
|
|
45
|
+
# Output as JSON
|
|
46
|
+
scry scan . --output json
|
|
47
|
+
|
|
48
|
+
# general command structure
|
|
49
|
+
scry scan <path> [options]
|
|
50
|
+
|
|
51
|
+
# For example, to scan a file inside app with compact output:
|
|
52
|
+
scry scan ./app/file.ts --output compact
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> you can also use [commands.md](./commands.md) after installation, just replace `bun scan` with `scry scan` in the example commands
|
|
56
|
+
|
|
57
|
+
Note: npm package coming soon.
|
|
58
|
+
|
|
59
|
+
## Testing the Tool
|
|
60
|
+
|
|
61
|
+
**For you to test the Tool:** See [commands.md](./commands.md) for a comprehensive list of all available commands and options to test, including:
|
|
62
|
+
|
|
63
|
+
- Single file and directory scans
|
|
64
|
+
- All output formats (table, json, markdown, compact)
|
|
65
|
+
- Severity filtering
|
|
66
|
+
- Strict mode
|
|
67
|
+
- Explanations and fixes
|
|
68
|
+
- Configuration file usage
|
|
69
|
+
- And much more!
|
|
70
|
+
|
|
71
|
+
All example commands use `examples/vulnerable-app` as the test path.
|
|
72
|
+
|
|
73
|
+
## What scry Detects
|
|
74
|
+
|
|
75
|
+
### Security Rules
|
|
76
|
+
|
|
77
|
+
1. **Hardcoded Secrets** - API keys, tokens, passwords, AWS credentials
|
|
78
|
+
2. **JWT in Client Storage** - JWT tokens in localStorage/sessionStorage
|
|
79
|
+
3. **Insecure Cookies** - Missing httpOnly, secure, sameSite flags
|
|
80
|
+
4. **eval() Usage** - Dangerous code execution
|
|
81
|
+
5. **CORS Misconfiguration** - Overly permissive CORS settings
|
|
82
|
+
6. **.env Exposure** - Environment files in version control or public directories
|
|
83
|
+
7. **Weak Cryptography** - MD5, SHA1, DES, unsalted hashing, low iterations
|
|
84
|
+
8. **Password Security** - Plaintext storage, weak validation, insecure transmission
|
|
85
|
+
|
|
86
|
+
## Example Output
|
|
87
|
+
|
|
88
|
+
Table format (default):
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Severity | Rule | File | Line | Message
|
|
92
|
+
---------|--------------------| --------------|------|---------------------
|
|
93
|
+
HIGH | hardcoded-secrets | src/config.ts | 14 | Hardcoded API key
|
|
94
|
+
HIGH | jwt-storage | src/auth.ts | 28 | JWT in localStorage
|
|
95
|
+
MEDIUM | cors-config | src/server.ts | 45 | Permissive CORS
|
|
96
|
+
|
|
97
|
+
Summary:
|
|
98
|
+
Files scanned: 847
|
|
99
|
+
Duration: 2.3s
|
|
100
|
+
|
|
101
|
+
Results:
|
|
102
|
+
HIGH: 3
|
|
103
|
+
MEDIUM: 6
|
|
104
|
+
LOW: 3
|
|
105
|
+
Total: 12
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Installation
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# From source
|
|
112
|
+
git clone https://github.com/johsam/scry.git
|
|
113
|
+
cd scry
|
|
114
|
+
bun install
|
|
115
|
+
bun run dev scan .
|
|
116
|
+
|
|
117
|
+
# From npm (coming soon)
|
|
118
|
+
npm install -g scry
|
|
119
|
+
scry scan .
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Usage
|
|
123
|
+
|
|
124
|
+
### Basic Scanning
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Current directory
|
|
128
|
+
scry scan
|
|
129
|
+
|
|
130
|
+
# Specific path
|
|
131
|
+
scry scan ./src
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Output Formats
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Table (default) - Clean summary with findings table
|
|
138
|
+
scry scan . --output table
|
|
139
|
+
|
|
140
|
+
# Add detailed explanations for each finding
|
|
141
|
+
scry scan . --explain
|
|
142
|
+
|
|
143
|
+
# Add suggested fixes for each finding
|
|
144
|
+
scry scan . --fix
|
|
145
|
+
|
|
146
|
+
# Show both explanations and fixes
|
|
147
|
+
scry scan . --explain --fix
|
|
148
|
+
|
|
149
|
+
# Compact - Minimal, file-grouped output
|
|
150
|
+
scry scan . --output compact
|
|
151
|
+
|
|
152
|
+
# JSON - For CI/CD integration
|
|
153
|
+
scry scan . --output json > results.json
|
|
154
|
+
|
|
155
|
+
# Markdown - For reports and documentation
|
|
156
|
+
scry scan . --output markdown > SECURITY.md
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Supported formats: `table` (default), `compact`, `json`, `markdown`
|
|
160
|
+
|
|
161
|
+
**See [Output Formats Guide](./docs/output-formats.md) for detailed examples and use cases.**
|
|
162
|
+
|
|
163
|
+
### Filter by Severity
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Only show high severity issues
|
|
167
|
+
scry scan . --min-severity high
|
|
168
|
+
|
|
169
|
+
# Show medium and high severity issues
|
|
170
|
+
scry scan . --min-severity medium
|
|
171
|
+
|
|
172
|
+
# Show all issues (default)
|
|
173
|
+
scry scan . --min-severity low
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Severity levels:** `high` (critical), `medium` (significant), `low` (minor)
|
|
177
|
+
|
|
178
|
+
### Strict Mode
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Fail with exit code 1 if any issues found
|
|
182
|
+
scry scan . --strict
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Configuration
|
|
186
|
+
|
|
187
|
+
Create `.scryrc.json` in your project root:
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"rules": {
|
|
192
|
+
"hardcoded-secrets": "error",
|
|
193
|
+
"eval-usage": "error",
|
|
194
|
+
"jwt-storage": "error",
|
|
195
|
+
"cookie-security": "warn",
|
|
196
|
+
"cors-config": "warn",
|
|
197
|
+
"env-exposure": "error",
|
|
198
|
+
"weak-crypto": "error",
|
|
199
|
+
"password-security": "error"
|
|
200
|
+
},
|
|
201
|
+
"ignore": ["**/tests/**", "**/fixtures/**", "**/mocks/**"],
|
|
202
|
+
"extensions": [".js", ".ts", ".jsx", ".tsx"],
|
|
203
|
+
"strict": false,
|
|
204
|
+
"minSeverity": "low",
|
|
205
|
+
"showFixes": true,
|
|
206
|
+
"showExplanations": true
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Why scry?
|
|
211
|
+
|
|
212
|
+
Modern developers ship code fast, often faster than they can think about security.
|
|
213
|
+
|
|
214
|
+
While powerful tools like linters exist, many:
|
|
215
|
+
|
|
216
|
+
- Focus on rules without context
|
|
217
|
+
- Assume prior security knowledge
|
|
218
|
+
- Overwhelm with noise
|
|
219
|
+
|
|
220
|
+
**scry is different:**
|
|
221
|
+
|
|
222
|
+
- Opinionated, not exhaustive
|
|
223
|
+
- Educational, not noisy
|
|
224
|
+
- Focused on real-world security footguns
|
|
225
|
+
|
|
226
|
+
## Documentation
|
|
227
|
+
|
|
228
|
+
For more detailed information, see:
|
|
229
|
+
|
|
230
|
+
- [Installation Guide](docs/INSTALLATION_GUIDE.md) - Setup and configuration
|
|
231
|
+
- [Security Rules Guide](docs/SECURITY_RULES_GUIDE.md) - Detailed rule documentation
|
|
232
|
+
- [Copilot Impact](docs/COPILOT_IMPACT.md) - How GitHub Copilot CLI enhanced development
|
|
233
|
+
- [Configuration Reference](docs/configuration.md) - Configuration file options
|
|
234
|
+
- [Implementation Guide](docs/IMPLEMENTATION_GUIDE.md) - Architecture and development
|
|
235
|
+
|
|
236
|
+
## Contributing
|
|
237
|
+
|
|
238
|
+
Contributions welcome! Areas to help:
|
|
239
|
+
|
|
240
|
+
- [ ] Add more security rules
|
|
241
|
+
- [ ] Framework-specific rules (React, Vue, Angular)
|
|
242
|
+
- [ ] VS Code extension
|
|
243
|
+
- [ ] CI/CD integrations
|
|
244
|
+
- [ ] Better regex patterns
|
|
245
|
+
- [ ] Documentation improvements
|
|
246
|
+
|
|
247
|
+
## License
|
|
248
|
+
|
|
249
|
+
MIT
|
|
250
|
+
|
|
251
|
+
## Built for the GitHub Copilot CLI Challenge
|
|
252
|
+
|
|
253
|
+
This project was created for the [GitHub Copilot CLI Challenge](https://dev.to/challenges/github-2026-01-21) and demonstrates how GitHub Copilot CLI can accelerate security tool development.
|
|
254
|
+
|
|
255
|
+
**Key Achievement Highlights:**
|
|
256
|
+
|
|
257
|
+
- 8 security rules implemented with Copilot-assisted pattern generation
|
|
258
|
+
- Comprehensive test coverage with AI-generated test cases
|
|
259
|
+
- Multiple output formatters for different workflows
|
|
260
|
+
- Full configuration file support for flexible deployments
|
|
261
|
+
|
|
262
|
+
For detailed information on how Copilot CLI enhanced the development process, see [Copilot Impact Documentation](docs/copilot%20workings).
|
|
263
|
+
|
|
264
|
+
## Technology Stack
|
|
265
|
+
|
|
266
|
+
- **Bun** - Fast JavaScript runtime
|
|
267
|
+
- **TypeScript** - Type-safe development
|
|
268
|
+
- **Commander.js** - CLI framework
|
|
269
|
+
- **Chalk** - Terminal colors
|
|
270
|
+
- **Glob** - File pattern matching
|
|
271
|
+
|
|
272
|
+
## Support
|
|
273
|
+
|
|
274
|
+
For questions or issues, please check the [documentation](docs/) or create an issue on GitHub.
|