diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..d35f504b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 + # Fetch and update latest `github-actions` pkgs + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + time: '00:00' + open-pull-requests-limit: 10 + commit-message: + prefix: chore + include: scope \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..a931540e --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,58 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '38 23 * * 6' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: [ 'cpp', 'javascript', 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + + - run: | + chmod +x setup.sh && chmod +x source/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build + ./setup.sh + cd source && ./build.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..1f369b12 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,18 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| Latest Release | :white_check_mark: | +| master | :white_check_mark: | + +## Reporting a Vulnerability + +1. Report in an issue please and tag @ralim +2. All issues are read within 1 working week in general; often within 24 hours +3. Issue shall recieve a comment within 14 days; but goal is < 2. +4. Issue will be open until the vulnerability is closed in all supported versions diff --git a/Translations/make_translation.py b/Translations/make_translation.py index fe6aaebc..764d9934 100755 --- a/Translations/make_translation.py +++ b/Translations/make_translation.py @@ -274,12 +274,12 @@ def getFontMapAndTable(textList): for sym in forcedFirstSymbols: if sym not in fontTable: log("Missing Large font element for {}".format(sym)) - exit(1) + sys.exit(1) fontLine = fontTable[sym] fontTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym], sym)) if sym not in fontSmallTable: log("Missing Small font element for {}".format(sym)) - exit(1) + sys.exit(1) fontLine = fontSmallTable[sym] fontSmallTableStrings.append( fontLine + "//{} -> {}".format(symbolMap[sym], sym) @@ -291,7 +291,7 @@ def getFontMapAndTable(textList): fromFont = getCJKGlyph(sym) if fromFont is None: log("Missing Large font element for {}".format(sym)) - exit(1) + sys.exit(1) # We store the glyph back to the fontTable. fontTable[sym] = fromFont # We also put a "replacement character" in the small font table @@ -302,7 +302,7 @@ def getFontMapAndTable(textList): fontTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym], sym)) if sym not in fontSmallTable: log("Missing Small font element for {}".format(sym)) - exit(1) + sys.exit(1) fontLine = fontSmallTable[sym] fontSmallTableStrings.append( fontLine + "//{} -> {}".format(symbolMap[sym], sym) diff --git a/Translations/translation_DE.json b/Translations/translation_DE.json index 13383ac3..e09bb542 100644 --- a/Translations/translation_DE.json +++ b/Translations/translation_DE.json @@ -38,7 +38,7 @@ "SettingFastChar": "S", "SettingSlowChar": "L", "SettingMediumChar": "M", - "SettingOffChar":"A", + "SettingOffChar": "A", "SettingStartSolderingChar": "L", "SettingStartSleepChar": "R", "SettingStartSleepOffChar": "K", @@ -55,10 +55,10 @@ "menuGroups": { "PowerMenu": { "text2": [ - "Power", - "settings" + "Energie-", + "einstellungen" ], - "desc": "Power settings" + "desc": "Energieeinstellungen" }, "SolderingMenu": { "text2": [ @@ -289,37 +289,37 @@ "MinVolCell": { "text2": [ "Minimum", - "voltage" + "Spannung" ], - "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + "desc": "Minimal zulässige Spannung pro Zelle <3S - 3,0V - 3,7V, 4/5/6S - 2,4V - 3,7V>" }, "AnimLoop": { "text2": [ "Anim.", - "loop" + "Schleife" ], - "desc": "Loop icon animations in root menu" + "desc": "Icon-Animationen im Stammmenü wiederholen" }, "AnimSpeed": { "text2": [ "Anim.", - "speed" + "Geschw." ], - "desc": "Speed of icon animations in menu " + "desc": "Geschwindigkeit der Icon-Animationen im Menü " }, "PowerPulseWait": { "text2": [ - "Power pulse", - "wait time" + "Leistungsimpulse", + "Wartezeit" ], - "desc": "Time to wait before triggering every keep-awake pulse (x 2.5s)" + "desc": "Wartezeit vor dem Auslösen jedes Wachhalteimpulses (x 2,5s)" }, "PowerPulseDuration": { "text2": [ - "Power pulse", - "duration" + "Leistungsimpulse", + "Dauer" ], - "desc": "Keep-awake-pulse duration (x 250ms)" + "desc": "Dauer des Wachhalteimpulses (x 250ms)" } } -} +} \ No newline at end of file diff --git a/Translations/translation_IT.json b/Translations/translation_IT.json index 79a19ec3..bcf62601 100644 --- a/Translations/translation_IT.json +++ b/Translations/translation_IT.json @@ -49,15 +49,15 @@ "SettingLockDisableChar": "D", "SettingLockBoostChar": "T", "SettingLockFullChar": "C", - "SettingNAChar": "N/A" + "SettingNAChar": "NA" }, "menuGroups": { "PowerMenu": { "text2": [ - "Power", - "settings" + "Opzioni", + "alimentaz" ], - "desc": "Power settings" + "desc": "Menù d'impostazioni per l'alimentazione" }, "SolderingMenu": { "text2": [ @@ -94,42 +94,42 @@ "Sorgente", "alimentaz" ], - "desc": "Scegli la sorgente di alimentazione; se a batteria, limita lo scaricamento al valore di soglia " + "desc": "Imposta una tensione minima di alimentazione attraverso la selezione di una sorgente [DC: 10 V; 3S/4S/5S/6S: 3,3 V per cella]" }, "SleepTemperature": { "text2": [ "Temp", "riposo" ], - "desc": "Imposta la temperatura da mantenere in modalità Riposo <°C/°F>" + "desc": "Imposta la temperatura da mantenere in modalità Riposo [°C/°F]" }, "SleepTimeout": { "text2": [ "Timer", "riposo" ], - "desc": "Imposta il timer per entrare in modalità Riposo " + "desc": "Imposta il timer per entrare in modalità Riposo [minuti/secondi]" }, "ShutdownTimeout": { "text2": [ "Timer", "spegnimento" ], - "desc": "Imposta il timer per lo spegnimento " + "desc": "Imposta il timer per lo spegnimento [minuti]" }, "MotionSensitivity": { "text2": [ "Sensibilità", "al movimento" ], - "desc": "Imposta la sensibilità al movimento per uscire dalla modalità Riposo <0: nessuna; 1: minima; 9: massima>" + "desc": "Imposta la sensibilità al movimento per uscire dalla modalità Riposo [0: nessuna; 1: minima; 9: massima]" }, "TemperatureUnit": { "text2": [ "Unità di", "temperatura" ], - "desc": "Scegli l'unità di misura per la temperatura " + "desc": "Scegli l'unità di misura per la temperatura [C: grado Celsius; F: grado Farenheit]" }, "AdvancedIdle": { "text2": [ @@ -143,21 +143,21 @@ "Orientamento", "display" ], - "desc": "Imposta l'orientamento del display " + "desc": "Imposta l'orientamento del display [A: automatico; S: mano sinistra; D: mano destra]" }, "BoostTemperature": { "text2": [ "Temp", - "«Turbo»" + "Turbo" ], - "desc": "Imposta la temperatura della funzione «Turbo» <°C/°F>" + "desc": "Imposta la temperatura della funzione Turbo [°C/°F]" }, "AutoStart": { "text2": [ "Avvio", "automatico" ], - "desc": "Attiva automaticamente il saldatore quando viene alimentato " + "desc": "Attiva automaticamente il saldatore quando viene alimentato [D: disattiva; S: saldatura; R: riposo; A: temperatura ambiente]" }, "CooldownBlink": { "text2": [ @@ -199,7 +199,7 @@ "Velocità", "testo" ], - "desc": "Imposta la velocità di scorrimento del testo " + "desc": "Imposta la velocità di scorrimento del testo [L: lenta; V: veloce]" }, "TipModel": { "text2": [ @@ -213,7 +213,7 @@ "Calibrazione", "semplice" ], - "desc": "Calibra le rilevazioni di temperatura tramite l'utilizzo di acqua calda" + "desc": "Calibra le rilevazioni di temperatura tramite l'utilizzo di acqua in ebollizione" }, "AdvancedCalibrationMode": { "text2": [ @@ -227,14 +227,14 @@ "Voltaggio", "Quick Charge" ], - "desc": "Imposta il massimo voltaggio necessario alla negoziazione con un alimentatore Quick Charge" + "desc": "Imposta il massimo voltaggio negoziabile con un alimentatore Quick Charge" }, "PowerLimit": { "text2": [ "Limite", "potenza" ], - "desc": "Imposta il valore di potenza massima erogabile al saldatore " + "desc": "Imposta il valore di potenza massima erogabile al saldatore [watt]" }, "ReverseButtonTempChange": { "text2": [ @@ -248,21 +248,21 @@ "Temp passo", "breve" ], - "desc": "Imposta il «passo» dei valori di temperatura ad una breve pressione dei tasti" + "desc": "Imposta il \"passo\" dei valori di temperatura per una breve pressione dei tasti" }, "TempChangeLongStep": { "text2": [ "Temp passo", "lungo" ], - "desc": "Imposta il «passo» dei valori di temperatura ad una lunga pressione dei tasti" + "desc": "Imposta il \"passo\" dei valori di temperatura per una lunga pressione dei tasti" }, "PowerPulsePower": { "text2": [ "Potenza", "impulso" ], - "desc": "Regola la potenza d'impulso per prevenire lo standby eventuale dell'alimentatore " + "desc": "Regola la potenza di un \"impulso sveglia\" atto a prevenire lo standby eventuale dell'alimentatore [watt]" }, "TipGain": { "text2": [ @@ -276,49 +276,49 @@ "Effetto", "Hall" ], - "desc": "Regola la sensibilità alla rilevazione di supporti metallici per entrare in modalità Riposo " + "desc": "Regola la sensibilità alla rilevazione di supporti metallici per entrare in modalità Riposo [O: OFF; B: bassa; M: media; A: alta]" }, "LockingMode": { "text2": [ "Blocco", "tasti" ], - "desc": "Blocca i tasti durante la modalità Saldatura; tieni premuto entrambi per bloccare/sbloccare " + "desc": "Blocca i tasti durante la modalità Saldatura; tieni premuto entrambi per bloccare o sbloccare [D: disattiva; T: blocca Turbo; C: blocco completo]" }, "MinVolCell": { "text2": [ - "Minimum", - "voltage" + "Tensione", + "min celle" ], - "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + "desc": "Modifica il valore di tensione minima \"di scaricamento\" per le celle di una batteria Li-Po [3S: 3,0-3,7 V; 4S/5S/6S: 2,4-3,7 V]" }, "AnimLoop": { "text2": [ - "Anim.", - "loop" + "Ciclo", + "animazioni" ], - "desc": "Loop icon animations in root menu" + "desc": "Abilita la riproduzione ciclica delle animazioni del menù principale" }, "AnimSpeed": { "text2": [ - "Anim.", - "speed" + "Velocità", + "animazioni" ], - "desc": "Speed of icon animations in menu " + "desc": "Imposta la velocità di riproduzione delle animazioni del menù principale [O: OFF; L: lenta; M: media; V: veloce]" }, "PowerPulseWait": { "text2": [ - "Power pulse", - "wait time" + "Distanza", + "impulsi" ], - "desc": "Time to wait before triggering every keep-awake pulse (x 2.5s)" + "desc": "Imposta il tempo che deve intercorrere tra due \"impulsi sveglia\" [multipli di 2,5 s]" }, "PowerPulseDuration": { "text2": [ - "Power pulse", - "duration" + "Durata", + "impulso" ], - "desc": "Keep-awake-pulse duration (x 250ms)" + "desc": "Regola la durata dell'«impulso sveglia» [multipli di 250 ms]" } } } diff --git a/build.sh b/build.sh deleted file mode 100644 index 10f26c0d..00000000 --- a/build.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -docker-compose run --rm builder /bin/bash /build/ci/buildAll.sh \ No newline at end of file diff --git a/source/Core/BSP/Miniware/flash.c b/source/Core/BSP/Miniware/flash.c index d764df93..1d5469ee 100644 --- a/source/Core/BSP/Miniware/flash.c +++ b/source/Core/BSP/Miniware/flash.c @@ -30,7 +30,7 @@ uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) { // now we program it uint16_t *data = (uint16_t *)buffer; HAL_FLASH_Unlock(); - for (uint8_t i = 0; i < (length / 2); i++) { + for (uint16_t i = 0; i < (length / 2); i++) { resetWatchdog(); HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, (uint32_t)&settings_page[i], data[i]); } diff --git a/source/Core/BSP/Pine64/flash.c b/source/Core/BSP/Pine64/flash.c index 95aa4fe5..8c0ce3f5 100644 --- a/source/Core/BSP/Pine64/flash.c +++ b/source/Core/BSP/Pine64/flash.c @@ -26,7 +26,7 @@ uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) { fmc_page_erase((uint32_t)SETTINGS_START_PAGE); resetWatchdog(); uint16_t *data = (uint16_t *)buffer; - for (uint8_t i = 0; i < (length / 2); i++) { + for (uint16_t i = 0; i < (length / 2); i++) { fmc_halfword_program((uint32_t)SETTINGS_START_PAGE + (i * 2), data[i]); fmc_flag_clear(FMC_FLAG_END); fmc_flag_clear(FMC_FLAG_WPERR); diff --git a/source/Core/Drivers/FUSB302/policy_engine.cpp b/source/Core/Drivers/FUSB302/policy_engine.cpp index e8358f5b..2ab7f99a 100644 --- a/source/Core/Drivers/FUSB302/policy_engine.cpp +++ b/source/Core/Drivers/FUSB302/policy_engine.cpp @@ -213,7 +213,7 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_eval_cap() { * than the maximum possible) */ _pps_index = 8; /* Search for the first PPS APDO */ - for (int8_t i = 0; i < PD_NUMOBJ_GET(&tempMessage); i++) { + for (int i = 0; i < PD_NUMOBJ_GET(&tempMessage); i++) { if ((tempMessage.obj[i] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED && (tempMessage.obj[i] & PD_APDO_TYPE) == PD_APDO_TYPE_PPS) { _pps_index = i + 1; break;