SPB Git

Repository Public

qyvora-parsers.yaml 3.8 KB 100 lines yaml

1# =============================================================================2#                  SP BOUCHER | SOFTWARE & RESEARCH3#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# Project          : QYVORA7# File             : security/policies/semgrep/qyvora-parsers.yaml8# Module           : Security9# Repository       : https://git.spboucher.ai/qyvora10# Project Website  : Not specified11# Created          : 2026-12-0412# Last Modified    : 2026-12-0413#14# Author           : Simon-Pierre Boucher15# Position         : Professor of Finance16# Institution      : Université du Québec en Outaouais (UQO)17# Organization     : SP Boucher18# Website          : https://spboucher.ai19# Git              : https://git.spboucher.ai20#21# Preferred Contact: contact@spboucher.ai22# Development      : dev@spboucher.ai23# Support          : support@spboucher.ai24# Security/Admin   : admin@spboucher.ai25#26# Copyright (c) 202627# Simon-Pierre Boucher28# All rights reserved where applicable. This file is governed by the29# applicable project license, copyright notices and relevant law.30# Existing third-party rights and notices remain unaffected.31#32# License          : None specified (no license file in this repository)33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# QYVORA custom Semgrep rules — scope: every engine and service module that parses untrusted input42# (see scopes.json). A trap in these files is a denial of service reachable from a file, a QR code,43# a pasted string or a network answer.44rules:45  - id: qyvora-parser-try-bang46    languages: [swift]47    severity: WARNING48    message: >-49      `try!` traps when the call throws. In code that handles untrusted input, propagate the error.50    metadata:51      kind: regex52      note: "The Swift pattern `try! $X` also matches `try` and `try?` in Semgrep 1.172.0, hence a regex."53      cwe: "CWE-248"54      masvs: "MASVS-CODE-4"55      qy_severity: medium56    pattern-regex: ^(?!\s*(//|///|\*))[^\n"]*\btry!\s5758  - id: qyvora-parser-trap-call59    languages: [swift]60    severity: WARNING61    message: >-62      fatalError / precondition / preconditionFailure / assertionFailure in a module that handles untrusted63      input: confirm it cannot be reached from attacker-controlled data, otherwise return an error.64    metadata:65      kind: pattern66      cwe: "CWE-617"67      masvs: "MASVS-CODE-4"68      qy_severity: low69    pattern-either:70      - pattern: fatalError(...)71      - pattern: precondition(...)72      - pattern: preconditionFailure(...)73      - pattern: assertionFailure(...)7475  - id: qyvora-parser-force-unwrap76    languages: [swift]77    severity: INFO78    message: >-79      Force unwrap (`!`) or forced cast (`as!`) in a module that handles untrusted input: confirm the value80      cannot be nil for attacker-controlled data.81    metadata:82      kind: regex83      cwe: "CWE-476"84      masvs: "MASVS-CODE-4"85      qy_severity: low86    pattern-regex: ^(?!\s*(//|///|\*))[^\n"]*([\w\)\]](?<!\btry)!(\.|\)|\s|,|\[|$)|\bas!\s)[^\n]*$8788  - id: qyvora-parser-unchecked-length-arithmetic89    languages: [swift]90    severity: INFO91    message: >-92      Array(repeating:count:) / reserveCapacity with a length read from the input (inventory rule): a huge93      declared length must be bounded before allocation.94    metadata:95      kind: regex96      cwe: "CWE-789"97      masvs: "MASVS-CODE-4"98      qy_severity: low99    pattern-regex: \b(reserveCapacity\s*\(\s*(?i:\w*(len|length|count|size|n)\w*)\s*\)|repeating\s*:[^\n]*count\s*:\s*(?i:\w*(len|length|declared|size)\w*))100
Files main
Menu

Theme