opencode-skills-collection 4.0.54 → 4.0.55

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.
Files changed (71) hide show
  1. package/bundled-skills/.antigravity-install-manifest.json +1 -1
  2. package/bundled-skills/antigravity-maintainer-batch-release/SKILL.md +10 -1
  3. package/bundled-skills/backend-security-coder/resources/implementation-playbook.md +23 -0
  4. package/bundled-skills/business-analyst/resources/implementation-playbook.md +23 -0
  5. package/bundled-skills/devops-troubleshooter/resources/implementation-playbook.md +23 -0
  6. package/bundled-skills/distributed-tracing/SKILL.md +22 -435
  7. package/bundled-skills/distributed-tracing/references/instrumentation.md +13 -0
  8. package/bundled-skills/distributed-tracing/references/jaeger-setup.md +13 -0
  9. package/bundled-skills/distributed-tracing/resources/implementation-playbook.md +23 -0
  10. package/bundled-skills/django-pro/resources/implementation-playbook.md +23 -0
  11. package/bundled-skills/embedding-strategies/SKILL.md +40 -64
  12. package/bundled-skills/embedding-strategies/resources/implementation-playbook.md +23 -0
  13. package/bundled-skills/fastapi-pro/resources/implementation-playbook.md +23 -0
  14. package/bundled-skills/find-complementary-founders/scripts/assess_profile.py +7 -1
  15. package/bundled-skills/frontend-security-coder/SKILL.md +5 -5
  16. package/bundled-skills/frontend-security-coder/resources/implementation-playbook.md +23 -0
  17. package/bundled-skills/github-actions-templates/SKILL.md +34 -314
  18. package/bundled-skills/github-actions-templates/references/common-workflows.md +13 -0
  19. package/bundled-skills/github-actions-templates/resources/implementation-playbook.md +23 -0
  20. package/bundled-skills/google-docs-automation/SKILL.md +19 -69
  21. package/bundled-skills/google-sheets-automation/SKILL.md +20 -128
  22. package/bundled-skills/google-slides-automation/SKILL.md +19 -128
  23. package/bundled-skills/grafana-dashboards/SKILL.md +6 -6
  24. package/bundled-skills/grafana-dashboards/references/dashboard-design.md +13 -0
  25. package/bundled-skills/grafana-dashboards/resources/implementation-playbook.md +23 -0
  26. package/bundled-skills/incident-responder/resources/implementation-playbook.md +23 -0
  27. package/bundled-skills/instagram/scripts/config.py +33 -8
  28. package/bundled-skills/ios-developer/resources/implementation-playbook.md +23 -0
  29. package/bundled-skills/junta-leiloeiros/scripts/.snyk +5 -0
  30. package/bundled-skills/junta-leiloeiros/scripts/requirements.txt +2 -0
  31. package/bundled-skills/kpi-dashboard-design/SKILL.md +7 -67
  32. package/bundled-skills/kpi-dashboard-design/resources/implementation-playbook.md +23 -0
  33. package/bundled-skills/kpi-dashboard-design/resources/metric-queries.sql +30 -0
  34. package/bundled-skills/lint-and-validate/SKILL.md +17 -45
  35. package/bundled-skills/lint-and-validate/scripts/lint_runner.py +17 -8
  36. package/bundled-skills/lint-and-validate/scripts/type_coverage.py +77 -167
  37. package/bundled-skills/mobile-developer/resources/implementation-playbook.md +23 -0
  38. package/bundled-skills/multi-platform-apps-multi-platform/resources/implementation-playbook.md +23 -0
  39. package/bundled-skills/notebooklm/scripts/config.py +33 -11
  40. package/bundled-skills/observability-and-instrumentation/SKILL.md +4 -1
  41. package/bundled-skills/observability-and-instrumentation/references/observability-checklist.md +13 -0
  42. package/bundled-skills/pci-compliance/SKILL.md +23 -469
  43. package/bundled-skills/pci-compliance/resources/implementation-playbook.md +23 -0
  44. package/bundled-skills/postmortem-writing/SKILL.md +1 -1
  45. package/bundled-skills/postmortem-writing/resources/implementation-playbook.md +23 -0
  46. package/bundled-skills/pydantic-models-py/SKILL.md +1 -3
  47. package/bundled-skills/secrets-management/SKILL.md +24 -349
  48. package/bundled-skills/secrets-management/references/github-secrets.md +13 -0
  49. package/bundled-skills/secrets-management/references/vault-setup.md +13 -0
  50. package/bundled-skills/security-and-hardening/SKILL.md +8 -6
  51. package/bundled-skills/security-and-hardening/references/security-checklist.md +13 -0
  52. package/bundled-skills/seo-content-planner/resources/implementation-playbook.md +23 -0
  53. package/bundled-skills/seo-content-writer/SKILL.md +2 -2
  54. package/bundled-skills/seo-content-writer/resources/implementation-playbook.md +23 -0
  55. package/bundled-skills/shopify-development/scripts/.snyk +3 -0
  56. package/bundled-skills/slack-gif-creator/.snyk +5 -0
  57. package/bundled-skills/slack-gif-creator/requirements.txt +2 -2
  58. package/bundled-skills/slo-implementation/SKILL.md +24 -9
  59. package/bundled-skills/slo-implementation/references/error-budget.md +13 -0
  60. package/bundled-skills/slo-implementation/references/slo-definitions.md +13 -0
  61. package/bundled-skills/slo-implementation/resources/implementation-playbook.md +23 -0
  62. package/bundled-skills/sql-optimization-patterns/SKILL.md +10 -6
  63. package/bundled-skills/sql-optimization-patterns/resources/implementation-playbook.md +52 -56
  64. package/bundled-skills/telegram/assets/boilerplate/nodejs/package-lock.json +1888 -0
  65. package/bundled-skills/telegram/assets/boilerplate/nodejs/package.json +3 -0
  66. package/bundled-skills/vector-database-engineer/resources/implementation-playbook.md +23 -0
  67. package/bundled-skills/videodb/scripts/ws_listener.py +8 -1
  68. package/bundled-skills/whatsapp-cloud-api/assets/boilerplate/nodejs/package-lock.json +1881 -0
  69. package/bundled-skills/whatsapp-cloud-api/assets/boilerplate/nodejs/package.json +3 -0
  70. package/bundled-skills/whatsapp-cloud-api/assets/boilerplate/python/.snyk +3 -0
  71. package/package.json +1 -1
@@ -4,6 +4,7 @@ Centralizes constants, selectors, and paths
4
4
  """
5
5
 
6
6
  import os
7
+ import stat
7
8
  from pathlib import Path
8
9
 
9
10
  # Paths
@@ -19,6 +20,35 @@ STATE_FILE = BROWSER_STATE_DIR / "state.json"
19
20
  AUTH_INFO_FILE = DATA_DIR / "auth_info.json"
20
21
  LIBRARY_FILE = DATA_DIR / "library.json"
21
22
 
23
+ def protect_state_path(path, *, directory=False):
24
+ """Repair only owned state paths; never follow links or mutate hard links."""
25
+ flags = os.O_RDONLY | getattr(os, "O_NOFOLLOW", 0) | getattr(os, "O_NONBLOCK", 0)
26
+ if path.is_symlink():
27
+ raise OSError(f"Refusing linked state path: {path}")
28
+ if directory:
29
+ path.mkdir(parents=True, exist_ok=True, mode=0o700)
30
+ # Windows does not support opening directories this way; privacy there
31
+ # is governed by the user profile ACL, not POSIX permission bits.
32
+ if os.name == "nt":
33
+ path.chmod(0o700)
34
+ return
35
+ flags |= getattr(os, "O_DIRECTORY", 0)
36
+ elif not path.exists():
37
+ return
38
+ fd = os.open(path, flags)
39
+ try:
40
+ info = os.fstat(fd)
41
+ valid = stat.S_ISDIR(info.st_mode) if directory else stat.S_ISREG(info.st_mode) and info.st_nlink == 1
42
+ if not valid:
43
+ raise OSError(f"Refusing unsafe state path: {path}")
44
+ if hasattr(os, "fchmod"):
45
+ os.fchmod(fd, 0o700 if directory else 0o600)
46
+ else:
47
+ os.chmod(path, 0o600)
48
+ finally:
49
+ os.close(fd)
50
+
51
+
22
52
  # Browser profiles and storage-state files contain live Google credentials.
23
53
  # A restrictive umask also covers files created later by Chromium.
24
54
  os.umask(0o077)
@@ -31,18 +61,10 @@ def ensure_private_state():
31
61
  DATA_DIR.parent.mkdir(parents=True, exist_ok=True, mode=0o700)
32
62
  shutil.move(str(LEGACY_DATA_DIR), str(DATA_DIR))
33
63
  print(f"⚠️ Migrated sensitive NotebookLM state to private user storage: {DATA_DIR}")
34
- for directory in (DATA_DIR.parent.parent, DATA_DIR.parent, DATA_DIR, BROWSER_STATE_DIR, BROWSER_PROFILE_DIR):
35
- directory.mkdir(parents=True, exist_ok=True, mode=0o700)
36
- try:
37
- directory.chmod(0o700)
38
- except OSError:
39
- pass
64
+ for directory in (DATA_DIR, BROWSER_STATE_DIR, BROWSER_PROFILE_DIR):
65
+ protect_state_path(directory, directory=True)
40
66
  for file_path in (STATE_FILE, AUTH_INFO_FILE, LIBRARY_FILE):
41
- if file_path.exists() and not file_path.is_symlink():
42
- try:
43
- file_path.chmod(0o600)
44
- except OSError:
45
- pass
67
+ protect_state_path(file_path)
46
68
 
47
69
  # NotebookLM Selectors
48
70
  QUERY_INPUT_SELECTORS = [
@@ -88,7 +88,10 @@ logger.warn({
88
88
  ```typescript
89
89
  // Express: child logger per request, ID propagated downstream
90
90
  app.use((req, res, next) => {
91
- req.id = req.headers['x-request-id'] ?? crypto.randomUUID();
91
+ const suppliedId = req.headers['x-request-id'];
92
+ req.id = typeof suppliedId === 'string' && /^[A-Za-z0-9_-]{1,64}$/.test(suppliedId)
93
+ ? suppliedId
94
+ : crypto.randomUUID();
92
95
  req.log = logger.child({ requestId: req.id });
93
96
  res.setHeader('x-request-id', req.id);
94
97
  next();
@@ -0,0 +1,13 @@
1
+ # Instrumentation acceptance checklist
2
+
3
+ ## Inputs
4
+
5
+ Write the on-call questions and identify the authorized staging environment.
6
+
7
+ ## Procedure and verification
8
+
9
+ Check structured event names and bounded correlation identifiers; reject or regenerate malformed external identifiers. Confirm redaction on nested errors and request paths. Verify rate, error and duration metrics with bounded labels; follow a request across service boundaries. Exercise an allowed failure and verify its log, metric and trace. Test alert delivery only to an authorized test destination, then restore any changed thresholds.
10
+
11
+ ## Limitations
12
+
13
+ Record evidence and untested boundaries before launch. Do not send private data to an external telemetry backend without authorization. Head sampling can discard errors before tail sampling sees them; document that coverage limit.
@@ -1,488 +1,42 @@
1
1
  ---
2
2
  name: pci-compliance
3
- description: "Master PCI DSS (Payment Card Industry Data Security Standard) compliance for secure payment processing and handling of cardholder data."
3
+ description: "Review payment data flows and engineering control evidence for a scoped PCI assessment, without claiming certification."
4
4
  risk: critical
5
5
  source: community
6
6
  date_added: "2026-02-27"
7
7
  ---
8
8
 
9
- # PCI Compliance
9
+ # Payment Data and PCI Evidence Review
10
10
 
11
- Master PCI DSS (Payment Card Industry Data Security Standard) compliance for secure payment processing and handling of cardholder data.
11
+ ## When to Use
12
12
 
13
- ## Do not use this skill when
13
+ Review payment data flows, prepare engineering controls or collect evidence for a scoped PCI assessment. This skill does not certify compliance or determine assessment eligibility on its own.
14
14
 
15
- - The task is unrelated to pci compliance
16
- - You need a different domain or tool outside this scope
15
+ ## Inputs and prerequisites
17
16
 
18
- ## Instructions
17
+ Identify the merchant/service-provider role, acquiring institution, processor integration, systems handling account data and the applicable assessment documents. Obtain the current documents from the [PCI SSC document library](https://www.pcisecuritystandards.org/document_library/); confirm applicability with the responsible assessor or acquiring institution.
19
18
 
20
- - Clarify goals, constraints, and required inputs.
21
- - Apply relevant best practices and validate outcomes.
22
- - Provide actionable steps and verification.
23
- - If detailed examples are required, open `resources/implementation-playbook.md`.
19
+ ## Procedure
24
20
 
25
- ## Use this skill when
21
+ 1. Follow `resources/implementation-playbook.md` to map forms, APIs, storage, queues, logs, telemetry, backups and support exports.
22
+ 2. Prefer provider-hosted collection when appropriate. Verify what the application actually receives; a tokenization claim does not prove that raw account data never reaches another system.
23
+ 3. Minimize retained data and document purpose, access, retention and deletion. Do not retain sensitive authentication data after authorization, even encrypted. Do not build a custom card vault from an illustrative encryption snippet.
24
+ 4. Map required controls to implementation evidence: network boundaries, system configuration, data protection, access, monitoring, testing and operational ownership. Keep unverified controls marked as gaps.
25
+ 5. Use allowlisted event fields in logs and responses. Test nested errors and retries with synthetic data; denylist filtering cannot anticipate every sensitive field name.
26
+ 6. Verify role and resource authorization together. A broad payment role does not grant access to every customer's payment method.
27
+ 7. Produce a control/evidence/gap/owner table and remediation plan. Treat SAQ eligibility, transaction thresholds and formal attestation as decisions requiring the applicable current guidance.
26
28
 
27
- - Building payment processing systems
28
- - Handling credit card information
29
- - Implementing secure payment flows
30
- - Conducting PCI compliance audits
31
- - Reducing PCI compliance scope
32
- - Implementing tokenization and encryption
33
- - Preparing for PCI DSS assessments
29
+ ## Example
34
30
 
35
- ## PCI DSS Requirements (12 Core Requirements)
31
+ Input: a checkout webhook is copied into application logs. Replace the log payload with approved event type, internal request ID and outcome fields. Exercise success, failure and retries using the processor's test environment. Verify the logs contain no synthetic account-data markers and that payment handling still meets its contract.
36
32
 
37
- ### Build and Maintain Secure Network
38
- 1. Install and maintain firewall configuration
39
- 2. Don't use vendor-supplied defaults for passwords
33
+ ## Verification
40
34
 
41
- ### Protect Cardholder Data
42
- 3. Protect stored cardholder data
43
- 4. Encrypt transmission of cardholder data across public networks
44
-
45
- ### Maintain Vulnerability Management
46
- 5. Protect systems against malware
47
- 6. Develop and maintain secure systems and applications
48
-
49
- ### Implement Strong Access Control
50
- 7. Restrict access to cardholder data by business need-to-know
51
- 8. Identify and authenticate access to system components
52
- 9. Restrict physical access to cardholder data
53
-
54
- ### Monitor and Test Networks
55
- 10. Track and monitor all access to network resources and cardholder data
56
- 11. Regularly test security systems and processes
57
-
58
- ### Maintain Information Security Policy
59
- 12. Maintain a policy that addresses information security
60
-
61
- ## Compliance Levels
62
-
63
- **Level 1**: > 6 million transactions/year (annual ROC required)
64
- **Level 2**: 1-6 million transactions/year (annual SAQ)
65
- **Level 3**: 20,000-1 million e-commerce transactions/year
66
- **Level 4**: < 20,000 e-commerce or < 1 million total transactions
67
-
68
- ## Data Minimization (Never Store)
69
-
70
- ```python
71
- # NEVER STORE THESE
72
- PROHIBITED_DATA = {
73
- 'full_track_data': 'Magnetic stripe data',
74
- 'cvv': 'Card verification code/value',
75
- 'pin': 'PIN or PIN block'
76
- }
77
-
78
- # CAN STORE (if encrypted)
79
- ALLOWED_DATA = {
80
- 'pan': 'Primary Account Number (card number)',
81
- 'cardholder_name': 'Name on card',
82
- 'expiration_date': 'Card expiration',
83
- 'service_code': 'Service code'
84
- }
85
-
86
- class PaymentData:
87
- """Safe payment data handling."""
88
-
89
- def __init__(self):
90
- self.prohibited_fields = ['cvv', 'cvv2', 'cvc', 'pin']
91
-
92
- def sanitize_log(self, data):
93
- """Remove sensitive data from logs."""
94
- sanitized = data.copy()
95
-
96
- # Mask PAN
97
- if 'card_number' in sanitized:
98
- card = sanitized['card_number']
99
- sanitized['card_number'] = f"{card[:6]}{'*' * (len(card) - 10)}{card[-4:]}"
100
-
101
- # Remove prohibited data
102
- for field in self.prohibited_fields:
103
- sanitized.pop(field, None)
104
-
105
- return sanitized
106
-
107
- def validate_no_prohibited_storage(self, data):
108
- """Ensure no prohibited data is being stored."""
109
- for field in self.prohibited_fields:
110
- if field in data:
111
- raise SecurityError(f"Attempting to store prohibited field: {field}")
112
- ```
113
-
114
- ## Tokenization
115
-
116
- ### Using Payment Processor Tokens
117
- ```python
118
- import stripe
119
-
120
- class TokenizedPayment:
121
- """Handle payments using tokens (no card data on server)."""
122
-
123
- @staticmethod
124
- def create_payment_method_token(card_details):
125
- """Create token from card details (client-side only)."""
126
- # THIS SHOULD ONLY BE DONE CLIENT-SIDE WITH STRIPE.JS
127
- # NEVER send card details to your server
128
-
129
- """
130
- // Frontend JavaScript
131
- const stripe = Stripe('pk_...');
132
-
133
- const {token, error} = await stripe.createToken({
134
- card: {
135
- number: '4242424242424242',
136
- exp_month: 12,
137
- exp_year: 2024,
138
- cvc: '123'
139
- }
140
- });
141
-
142
- // Send token.id to server (NOT card details)
143
- """
144
- pass
145
-
146
- @staticmethod
147
- def charge_with_token(token_id, amount):
148
- """Charge using token (server-side)."""
149
- import os
150
-
151
- # Your server only sees the token, never the card number
152
- stripe.api_key = os.environ["STRIPE_SECRET_KEY"]
153
-
154
- charge = stripe.Charge.create(
155
- amount=amount,
156
- currency="usd",
157
- source=token_id, # Token instead of card details
158
- description="Payment"
159
- )
160
-
161
- return charge
162
-
163
- @staticmethod
164
- def store_payment_method(customer_id, payment_method_token):
165
- """Store payment method as token for future use."""
166
- stripe.Customer.modify(
167
- customer_id,
168
- source=payment_method_token
169
- )
170
-
171
- # Store only customer_id and payment_method_id in your database
172
- # NEVER store actual card details
173
- return {
174
- 'customer_id': customer_id,
175
- 'has_payment_method': True
176
- # DO NOT store: card number, CVV, etc.
177
- }
178
- ```
179
-
180
- ### Custom Tokenization (Advanced)
181
- ```python
182
- import secrets
183
- from cryptography.fernet import Fernet
184
-
185
- class TokenVault:
186
- """Secure token vault for card data (if you must store it)."""
187
-
188
- def __init__(self, encryption_key):
189
- self.cipher = Fernet(encryption_key)
190
- self.vault = {} # In production: use encrypted database
191
-
192
- def tokenize(self, card_data):
193
- """Convert card data to token."""
194
- # Generate secure random token
195
- token = secrets.token_urlsafe(32)
196
-
197
- # Encrypt card data
198
- encrypted = self.cipher.encrypt(json.dumps(card_data).encode())
199
-
200
- # Store token -> encrypted data mapping
201
- self.vault[token] = encrypted
202
-
203
- return token
204
-
205
- def detokenize(self, token):
206
- """Retrieve card data from token."""
207
- encrypted = self.vault.get(token)
208
- if not encrypted:
209
- raise ValueError("Token not found")
210
-
211
- # Decrypt
212
- decrypted = self.cipher.decrypt(encrypted)
213
- return json.loads(decrypted.decode())
214
-
215
- def delete_token(self, token):
216
- """Remove token from vault."""
217
- self.vault.pop(token, None)
218
- ```
219
-
220
- ## Encryption
221
-
222
- ### Data at Rest
223
- ```python
224
- from cryptography.hazmat.primitives.ciphers.aead import AESGCM
225
- import os
226
-
227
- class EncryptedStorage:
228
- """Encrypt data at rest using AES-256-GCM."""
229
-
230
- def __init__(self, encryption_key):
231
- """Initialize with 256-bit key."""
232
- self.key = encryption_key # Must be 32 bytes
233
-
234
- def encrypt(self, plaintext):
235
- """Encrypt data."""
236
- # Generate random nonce
237
- nonce = os.urandom(12)
238
-
239
- # Encrypt
240
- aesgcm = AESGCM(self.key)
241
- ciphertext = aesgcm.encrypt(nonce, plaintext.encode(), None)
242
-
243
- # Return nonce + ciphertext
244
- return nonce + ciphertext
245
-
246
- def decrypt(self, encrypted_data):
247
- """Decrypt data."""
248
- # Extract nonce and ciphertext
249
- nonce = encrypted_data[:12]
250
- ciphertext = encrypted_data[12:]
251
-
252
- # Decrypt
253
- aesgcm = AESGCM(self.key)
254
- plaintext = aesgcm.decrypt(nonce, ciphertext, None)
255
-
256
- return plaintext.decode()
257
-
258
- # Usage
259
- storage = EncryptedStorage(os.urandom(32))
260
- encrypted_pan = storage.encrypt("4242424242424242")
261
- # Store encrypted_pan in database
262
- ```
263
-
264
- ### Data in Transit
265
- ```python
266
- # Always use TLS 1.2 or higher
267
- # Flask/Django example
268
- app.config['SESSION_COOKIE_SECURE'] = True # HTTPS only
269
- app.config['SESSION_COOKIE_HTTPONLY'] = True
270
- app.config['SESSION_COOKIE_SAMESITE'] = 'Strict'
271
-
272
- # Enforce HTTPS
273
- from flask_talisman import Talisman
274
- Talisman(app, force_https=True)
275
- ```
276
-
277
- ## Access Control
278
-
279
- ```python
280
- from functools import wraps
281
- from flask import session
282
-
283
- def require_pci_access(f):
284
- """Decorator to restrict access to cardholder data."""
285
- @wraps(f)
286
- def decorated_function(*args, **kwargs):
287
- user = session.get('user')
288
-
289
- # Check if user has PCI access role
290
- if not user or 'pci_access' not in user.get('roles', []):
291
- return {'error': 'Unauthorized access to cardholder data'}, 403
292
-
293
- # Log access attempt
294
- audit_log(
295
- user=user['id'],
296
- action='access_cardholder_data',
297
- resource=f.__name__
298
- )
299
-
300
- return f(*args, **kwargs)
301
-
302
- return decorated_function
303
-
304
- @app.route('/api/payment-methods')
305
- @require_pci_access
306
- def get_payment_methods():
307
- """Retrieve payment methods (restricted access)."""
308
- # Only accessible to users with pci_access role
309
- pass
310
- ```
311
-
312
- ## Audit Logging
313
-
314
- ```python
315
- import logging
316
- from datetime import datetime
317
-
318
- class PCIAuditLogger:
319
- """PCI-compliant audit logging."""
320
-
321
- def __init__(self):
322
- self.logger = logging.getLogger('pci_audit')
323
- # Configure to write to secure, append-only log
324
-
325
- def log_access(self, user_id, resource, action, result):
326
- """Log access to cardholder data."""
327
- entry = {
328
- 'timestamp': datetime.utcnow().isoformat(),
329
- 'user_id': user_id,
330
- 'resource': resource,
331
- 'action': action,
332
- 'result': result,
333
- 'ip_address': request.remote_addr
334
- }
335
-
336
- self.logger.info(json.dumps(entry))
337
-
338
- def log_authentication(self, user_id, success, method):
339
- """Log authentication attempt."""
340
- entry = {
341
- 'timestamp': datetime.utcnow().isoformat(),
342
- 'user_id': user_id,
343
- 'event': 'authentication',
344
- 'success': success,
345
- 'method': method,
346
- 'ip_address': request.remote_addr
347
- }
348
-
349
- self.logger.info(json.dumps(entry))
350
-
351
- # Usage
352
- audit = PCIAuditLogger()
353
- audit.log_access(user_id=123, resource='payment_methods', action='read', result='success')
354
- ```
355
-
356
- ## Security Best Practices
357
-
358
- ### Input Validation
359
- ```python
360
- import re
361
-
362
- def validate_card_number(card_number):
363
- """Validate card number format (Luhn algorithm)."""
364
- # Remove spaces and dashes
365
- card_number = re.sub(r'[\s-]', '', card_number)
366
-
367
- # Check if all digits
368
- if not card_number.isdigit():
369
- return False
370
-
371
- # Luhn algorithm
372
- def luhn_checksum(card_num):
373
- def digits_of(n):
374
- return [int(d) for d in str(n)]
375
-
376
- digits = digits_of(card_num)
377
- odd_digits = digits[-1::-2]
378
- even_digits = digits[-2::-2]
379
- checksum = sum(odd_digits)
380
- for d in even_digits:
381
- checksum += sum(digits_of(d * 2))
382
- return checksum % 10
383
-
384
- return luhn_checksum(card_number) == 0
385
-
386
- def sanitize_input(user_input):
387
- """Sanitize user input to prevent injection."""
388
- # Remove special characters
389
- # Validate against expected format
390
- # Escape for database queries
391
- pass
392
- ```
393
-
394
- ## PCI DSS SAQ (Self-Assessment Questionnaire)
395
-
396
- ### SAQ A (Least Requirements)
397
- - E-commerce using hosted payment page
398
- - No card data on your systems
399
- - ~20 questions
400
-
401
- ### SAQ A-EP
402
- - E-commerce with embedded payment form
403
- - Uses JavaScript to handle card data
404
- - ~180 questions
405
-
406
- ### SAQ D (Most Requirements)
407
- - Store, process, or transmit card data
408
- - Full PCI DSS requirements
409
- - ~300 questions
410
-
411
- ## Compliance Checklist
412
-
413
- ```python
414
- PCI_COMPLIANCE_CHECKLIST = {
415
- 'network_security': [
416
- 'Firewall configured and maintained',
417
- 'No vendor default passwords',
418
- 'Network segmentation implemented'
419
- ],
420
- 'data_protection': [
421
- 'No storage of CVV, track data, or PIN',
422
- 'PAN encrypted when stored',
423
- 'PAN masked when displayed',
424
- 'Encryption keys properly managed'
425
- ],
426
- 'vulnerability_management': [
427
- 'Anti-virus installed and updated',
428
- 'Secure development practices',
429
- 'Regular security patches',
430
- 'Vulnerability scanning performed'
431
- ],
432
- 'access_control': [
433
- 'Access restricted by role',
434
- 'Unique IDs for all users',
435
- 'Multi-factor authentication',
436
- 'Physical security measures'
437
- ],
438
- 'monitoring': [
439
- 'Audit logs enabled',
440
- 'Log review process',
441
- 'File integrity monitoring',
442
- 'Regular security testing'
443
- ],
444
- 'policy': [
445
- 'Security policy documented',
446
- 'Risk assessment performed',
447
- 'Security awareness training',
448
- 'Incident response plan'
449
- ]
450
- }
451
- ```
452
-
453
- ## Resources
454
-
455
- - **references/data-minimization.md**: Never store prohibited data
456
- - **references/tokenization.md**: Tokenization strategies
457
- - **references/encryption.md**: Encryption requirements
458
- - **references/access-control.md**: Role-based access
459
- - **references/audit-logging.md**: Comprehensive logging
460
- - **assets/pci-compliance-checklist.md**: Complete checklist
461
- - **assets/encrypted-storage.py**: Encryption utilities
462
- - **scripts/audit-payment-system.sh**: Compliance audit script
463
-
464
- ## Common Violations
465
-
466
- 1. **Storing CVV**: Never store card verification codes
467
- 2. **Unencrypted PAN**: Card numbers must be encrypted at rest
468
- 3. **Weak Encryption**: Use AES-256 or equivalent
469
- 4. **No Access Controls**: Restrict who can access cardholder data
470
- 5. **Missing Audit Logs**: Must log all access to payment data
471
- 6. **Insecure Transmission**: Always use TLS 1.2+
472
- 7. **Default Passwords**: Change all default credentials
473
- 8. **No Security Testing**: Regular penetration testing required
474
-
475
- ## Reducing PCI Scope
476
-
477
- 1. **Use Hosted Payments**: Stripe Checkout, PayPal, etc.
478
- 2. **Tokenization**: Replace card data with tokens
479
- 3. **Network Segmentation**: Isolate cardholder data environment
480
- 4. **Outsource**: Use PCI-compliant payment processors
481
- 5. **No Storage**: Never store full card details
482
-
483
- By minimizing systems that touch card data, you reduce compliance burden significantly.
35
+ - Data-flow inventory reconciled with actual integration and telemetry.
36
+ - Access denial produces no payment or data side effect.
37
+ - Redaction checked on nested data and exceptions.
38
+ - Evidence tied to actual configuration and test results, with explicit gaps.
484
39
 
485
40
  ## Limitations
486
- - Use this skill only when the task clearly matches the scope described above.
487
- - Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
488
- - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
41
+
42
+ Encryption, hosted checkout or a passed scan alone does not prove compliance. This package includes no automated audit script, payment processor client or certified encryption utility. Use reviewed integration code and qualified assessment for the actual environment; never use live cardholder data as a test fixture.
@@ -0,0 +1,23 @@
1
+ # Payment control evidence review
2
+
3
+ ## Inputs
4
+
5
+ Payment data-flow map, integration type, provider responsibilities, applicable assessment documents and a nonproduction environment.
6
+
7
+ ## Procedure
8
+
9
+ 1. Identify where account data could enter forms, logs, traces, queues, backups and support exports. Prefer provider-hosted collection and minimize local data handling.
10
+ 2. Map each required control to actual implementation evidence, owner and gap. Verify access boundaries and redaction using synthetic payment test data; do not copy live card data into the report.
11
+ 3. Prepare a remediation list and assessment questions for the responsible qualified reviewer or acquiring institution. Keep engineering tests separate from compliance attestation.
12
+
13
+ ## Worked example
14
+
15
+ A payment webhook is logged in full. Replace it with an allowlisted event record and test nested fields, exceptions and retry logs for data exposure.
16
+
17
+ ## Verification and handoff
18
+
19
+ Report the actual files or configuration changed, checks performed, observed results and any untested environment. Keep the original inputs and evidence sufficient to reproduce the conclusion.
20
+
21
+ ## Limitations
22
+
23
+ Encryption alone does not establish compliance. SAQ eligibility and assessment requirements must be confirmed for the actual payment integration.
@@ -167,7 +167,7 @@ The deployment completed at 14:23, but the first alert didn't fire until 14:31 (
167
167
  ### Customer Impact
168
168
  - 12,000 unique customers affected
169
169
  - Average impact duration: 35 minutes
170
- - 847 support tickets (23% of affected users)
170
+ - 847 support tickets (about 7.1% of the affected-user count; not necessarily unique users)
171
171
  - Customer satisfaction score dropped 12 points
172
172
 
173
173
  ### Business Impact
@@ -0,0 +1,23 @@
1
+ # Evidence-based postmortem
2
+
3
+ ## Inputs
4
+
5
+ Incident timeline, impact measurements, recovery evidence and access-controlled source links.
6
+
7
+ ## Procedure
8
+
9
+ 1. Normalize timestamps and distinguish detection, mitigation and full recovery. Mark estimates and unknown intervals explicitly.
10
+ 2. Link causal statements to observations. Describe conditions and system safeguards rather than assigning blame; do not force a single cause or a fixed number of whys.
11
+ 3. Assign each accepted action an owner, deadline and observable completion criterion. Review factual disagreements before sharing the document with the authorized audience.
12
+
13
+ ## Worked example
14
+
15
+ An outage spans 10:00 to 10:20, while detection occurs at 10:05. Report twenty minutes of impact and five minutes to detection, with sources for both.
16
+
17
+ ## Verification and handoff
18
+
19
+ Report the actual files or configuration changed, checks performed, observed results and any untested environment. Keep the original inputs and evidence sufficient to reproduce the conclusion.
20
+
21
+ ## Limitations
22
+
23
+ Template incident details are fictional and must not be copied as evidence. Ticket creation and publication are separate from drafting.
@@ -12,9 +12,7 @@ Create Pydantic models following the multi-model pattern for clean API contracts
12
12
 
13
13
  ## Quick Start
14
14
 
15
- Copy the template from assets/template.py and replace placeholders:
16
- - `{{ResourceName}}` → PascalCase name (e.g., `Project`)
17
- - `{{resource_name}}` → snake_case name (e.g., `project`)
15
+ Use the inline model patterns below and adapt class names and fields to the actual API contract. Inspect the installed Pydantic version before selecting configuration syntax; these fragments require the imports and application types shown by your project. Do not assume a standalone template file is bundled.
18
16
 
19
17
  ## Multi-Model Pattern
20
18