Repository Public
1# =============================================================================2# SP BOUCHER | SOFTWARE & RESEARCH3# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# Project : QYVORA7# File : security/policies/semgrep/qyvora-crypto.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: the cryptographic modules and the modules that compare42# authentication values (see scopes.json).43rules:44 - id: qyvora-nonconstant-time-compare45 languages: [swift]46 severity: ERROR47 message: >-48 `==` / `!=` on a value named like an authentication tag, MAC, digest, checksum-of-secret or key.49 Array comparison exits at the first difference: use ConstantTime.equal.50 metadata:51 kind: pattern52 cwe: "CWE-208"53 masvs: "MASVS-CRYPTO-1"54 qy_severity: high55 patterns:56 - pattern-either:57 - pattern: $A == $B58 - pattern: $A != $B59 - metavariable-regex:60 metavariable: $A61 regex: (?i)^[\w.]*(tag|mac|hmac|digest|secret|sharedSecret|verifier|authKey|masterKey|privateKey|expectedTag|computedTag|keyCheck|confirmation|seed|chainCode|expandedKey|signingKey|secretScalar)$62 - pattern-not: $A == nil63 - pattern-not: $A != nil64 - pattern-not: $A.count == $B65 - pattern-not: $A.count != $B66 - pattern-not: $A.isEmpty == $B6768 - id: qyvora-nonconstant-time-compare-rhs69 languages: [swift]70 severity: ERROR71 message: >-72 `==` / `!=` whose right operand is named like an authentication tag, MAC or secret: use ConstantTime.equal.73 metadata:74 kind: pattern75 cwe: "CWE-208"76 masvs: "MASVS-CRYPTO-1"77 qy_severity: high78 patterns:79 - pattern-either:80 - pattern: $A == $B81 - pattern: $A != $B82 - metavariable-regex:83 metavariable: $B84 regex: (?i)^[\w.]*(tag|mac|hmac|secret|sharedSecret|verifier|expectedTag|computedTag|keyCheck|confirmation|chainCode|expandedKey|signingKey|secretScalar)$85 - metavariable-regex:86 metavariable: $A87 regex: ^(?!.*\.count$).*$8889 - id: qyvora-secret-dependent-division90 languages: [swift]91 severity: INFO92 message: >-93 Division or remainder in a cryptographic module (inventory rule). `/` and `%` are variable-time on94 many CPUs: confirm the operands are public (lengths, indices, parameters), never secret coefficients.95 metadata:96 kind: regex97 cwe: "CWE-208"98 masvs: "MASVS-CRYPTO-1"99 qy_severity: info100 pattern-regex: ^(?!\s*(//|///|\*))[^\n"]*[\w\)\]]\s(%|/)\s[\w\(][^\n]*$101