Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24m11a #43

Merged
merged 17 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
5430382
添加新的测试文件和更新推荐引擎类以支持隐式反馈和评估功能
AstroAir Nov 2, 2024
2a9a892
添加网络管理器和进程信息结构,更新字符串处理函数,增强配置管理功能
AstroAir Nov 3, 2024
6ae3365
更新头文件引用,修复类成员类型,添加新的 TCP 代理功能,优化组件管理器
AstroAir Nov 4, 2024
c82e365
重构命名空间,优化代码结构,添加 SHA1 算法实现,更新 CMake 配置以支持 Python 模块
AstroAir Nov 6, 2024
f6238e6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 6, 2024
09efb50
Fix code scanning alert no. 242: Clear-text logging of sensitive info…
AstroAir Nov 6, 2024
bff073e
添加 MimeTypes 类以支持 MIME 类型处理,重构 LCG 类以内联最小和最大值函数,优化 XML 头文件包含,更新插件管理器中…
AstroAir Nov 6, 2024
cecaaad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 7, 2024
c961407
重构代码结构,优化依赖管理,新增 Preloader 类及其功能,添加 Python 支持,更新存储监控类,增强 JSON 处理能力
AstroAir Nov 7, 2024
eab1e33
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 7, 2024
4d09888
新增多个模块的 CMakeLists.txt 文件,重命名项目以统一命名规范,添加 atom.async、atom.algorithm、a…
AstroAir Nov 8, 2024
7873e97
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 8, 2024
fcf1577
新增 CMake 配置文件以支持多个依赖项,重构模块扫描功能,更新安装路径设置,删除过时的 CMake 模块
AstroAir Nov 9, 2024
ebd9ec5
Merge branch 'dev' of https://github.com/ElementAstro/Lithium into dev
AstroAir Nov 9, 2024
13c671f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 9, 2024
a49a6ef
新增 GPIO 类,添加任务等待功能,重命名波特率枚举,更新相机和配置管理器接口,优化打印格式,增加 INDI 服务器中间件功能
AstroAir Nov 9, 2024
7df7c23
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ Alternatively, utilize the provided quick-build scripts to streamline the proces
### Intellectual Inspiration

Embarking on the journey with Lithium, we embrace curiosity and an unwavering pursuit of knowledge, echoing the adapted verse which reminds us that every attempt, though fraught with challenges and setbacks, is a necessary step toward wisdom and understanding. Together, let us navigate the vast cosmos of astronomical imaging, our technology the vessel, innovation our sail, advancing relentlessly forward.

<figure><embed src="https://wakatime.com/share/@018d39f0-57c9-4a13-aedb-90454b61e6cc/e1b2b694-2ecc-4cfd-9c75-2d01b8581e4d.svg"></embed></figure>
<figure><embed src="https://wakatime.com/share/@018d39f0-57c9-4a13-aedb-90454b61e6cc/d6c29fb7-c5b3-4ffc-8e17-16634c7b669a.svg"></embed></figure>
62 changes: 62 additions & 0 deletions cmake_modules/FindGlib.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# - Try to find Glib-2.0 (with gobject)
# Once done, this will define
#
# Glib_FOUND - system has Glib
# Glib_INCLUDE_DIRS - the Glib include directories
# Glib_LIBRARIES - link these to use Glib

include(LibFindMacros)

# Use pkg-config to get hints about paths
libfind_pkg_check_modules(Glib_PKGCONF glib-2.0>=2.16)

# Main include dir
find_path(Glib_INCLUDE_DIR
NAMES glib.h
PATHS ${Glib_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES glib-2.0
)

# Glib-related libraries also use a separate config header, which is in lib dir
find_path(GlibConfig_INCLUDE_DIR
NAMES glibconfig.h
PATHS ${Glib_PKGCONF_INCLUDE_DIRS} /usr
PATH_SUFFIXES lib/glib-2.0/include
)

# Finally the library itself
find_library(Glib_LIBRARY
NAMES glib-2.0
PATHS ${Glib_PKGCONF_LIBRARY_DIRS}
)

# Find gobject library
find_library(GObject_LIBRARY
NAMES gobject-2.0
PATHS ${Glib_PKGCONF_LIBRARY_DIRS}
)

# Find gthread library
find_library(GThread_LIBRARY
NAMES gthread-2.0
PATHS ${Glib_PKGCONF_LIBRARY_DIRS}
)

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(Glib_PROCESS_INCLUDES Glib_INCLUDE_DIR GlibConfig_INCLUDE_DIR)
set(Glib_PROCESS_LIBS Glib_LIBRARY GObject_LIBRARY GThread_LIBRARY)
libfind_process(Glib)

# Redefine variables for backward compatibility
set(GLIB_INCLUDE_DIRS ${Glib_INCLUDE_DIRS})
set(GLIB_LIBRARIES ${Glib_LIBRARIES})
set(GLIB_FOUND ${Glib_FOUND})

# Provide a summary of the found libraries
if(Glib_FOUND)
message(STATUS "Found Glib: ${Glib_LIBRARIES}")
message(STATUS "Glib include directories: ${Glib_INCLUDE_DIRS}")
else()
message(WARNING "Glib not found")
endif()
29 changes: 29 additions & 0 deletions cmake_modules/FindLibSecret.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# - Try to find LIBSECRET-1
# Once done, this will define
#
# LIBSECRET_FOUND - system has LIBSECRET
# LIBSECRET_INCLUDE_DIRS - the LIBSECRET include directories
# LIBSECRET_LIBRARIES - link these to use LIBSECRET

include(LibFindMacros)

# Use pkg-config to get hints about paths
libfind_pkg_check_modules(LIBSECRET_PKGCONF LIBSECRET-1)

# Main include dir
find_path(LIBSECRET_INCLUDE_DIR
NAMES LIBSECRET/secret.h
PATHS ${LIBSECRET_PKGCONF_INCLUDE_DIRS}
)

# Finally the library itself
find_library(LIBSECRET_LIBRARY
NAMES secret-1
PATHS ${LIBSECRET_PKGCONF_LIBRARY_DIRS}
)

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(LIBSECRET_PROCESS_INCLUDES LIBSECRET_INCLUDE_DIR)
set(LIBSECRET_PROCESS_LIBS LIBSECRET_LIBRARY)
libfind_process(LIBSECRET)
98 changes: 98 additions & 0 deletions cmake_modules/LibFindMacros.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments
# used for the current package. For this to work, the first parameter must be the
# prefix of the current package, then the prefix of the new package etc, which are
# passed to find_package.
macro (libfind_package PREFIX)
set (LIBFIND_PACKAGE_ARGS ${ARGN})
if (${PREFIX}_FIND_QUIETLY)
set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET)
endif (${PREFIX}_FIND_QUIETLY)
if (${PREFIX}_FIND_REQUIRED)
set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED)
endif (${PREFIX}_FIND_REQUIRED)
find_package(${LIBFIND_PACKAGE_ARGS})
endmacro (libfind_package)

# CMake developers made the UsePkgConfig system deprecated in the same release (2.6)
# where they added pkg_check_modules. Consequently I need to support both in my scripts
# to avoid those deprecated warnings. Here's a helper that does just that.
# Works identically to pkg_check_modules, except that no checks are needed prior to use.
macro (libfind_pkg_check_modules PREFIX PKGNAME)
if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
include(UsePkgConfig)
pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS)
else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(${PREFIX} ${PKGNAME})
endif (PKG_CONFIG_FOUND)
endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
endmacro (libfind_pkg_check_modules)

# Do the final processing once the paths have been detected.
# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
# all the variables, each of which contain one include directory.
# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
# Also handles errors in case library detection was required, etc.
macro (libfind_process PREFIX)
# Skip processing if already processed during this run
if (NOT ${PREFIX}_FOUND)
# Start with the assumption that the library was found
set (${PREFIX}_FOUND TRUE)

# Process all includes and set _FOUND to false if any are missing
foreach (i ${${PREFIX}_PROCESS_INCLUDES})
if (${i})
set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
mark_as_advanced(${i})
else (${i})
set (${PREFIX}_FOUND FALSE)
endif (${i})
endforeach (i)

# Process all libraries and set _FOUND to false if any are missing
foreach (i ${${PREFIX}_PROCESS_LIBS})
if (${i})
set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
mark_as_advanced(${i})
else (${i})
set (${PREFIX}_FOUND FALSE)
endif (${i})
endforeach (i)

# Print message and/or exit on fatal error
if (${PREFIX}_FOUND)
if (NOT ${PREFIX}_FIND_QUIETLY)
message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
endif (NOT ${PREFIX}_FIND_QUIETLY)
else (${PREFIX}_FOUND)
if (${PREFIX}_FIND_REQUIRED)
foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
message("${i}=${${i}}")
endforeach (i)
message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
endif (${PREFIX}_FIND_REQUIRED)
endif (${PREFIX}_FOUND)
endif (NOT ${PREFIX}_FOUND)
endmacro (libfind_process)

macro(libfind_library PREFIX basename)
set(TMP "")
if(MSVC80)
set(TMP -vc80)
endif(MSVC80)
if(MSVC90)
set(TMP -vc90)
endif(MSVC90)
set(${PREFIX}_LIBNAMES ${basename}${TMP})
if(${ARGC} GREATER 2)
set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES})
set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP})
endif(${ARGC} GREATER 2)
find_library(${PREFIX}_LIBRARY
NAMES ${${PREFIX}_LIBNAMES}
PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}
)
endmacro(libfind_library)
152 changes: 58 additions & 94 deletions config/script/check.json
Original file line number Diff line number Diff line change
@@ -1,116 +1,80 @@
{
"danger_patterns": [
"powershell_danger_patterns": [
{
"pattern": "\\brm\\s+-rf\\b",
"reason": "Potentially destructive operation"
"pattern": "Remove-Item -Recurse -Force",
"reason": "Potentially dangerous command that can delete files recursively and forcefully."
},
{
"pattern": "\\bsudo\\b",
"reason": "Elevated permissions, dangerous"
},
{
"pattern": "\\bmkfs\\b",
"reason": "Filesystem creation, dangerous operation"
},
{
"pattern": "\\|",
"reason": "Pipeline usage might lead to unintended consequences"
},
{
"pattern": "2>&1\\s*>\\s*/dev/null",
"reason": "Redirection might hide errors"
},
{
"pattern": "\\bkill\\s+-9\\b",
"reason": "Forcefully killing processes, consider using safer signal"
},
{
"pattern": "eval\\s+",
"reason": "Using eval can lead to security vulnerabilities"
},
{
"pattern": "\\bshutdown\\b",
"reason": "Potentially shuts down or restarts the system"
},
{
"pattern": "\\bdd\\s+iflag=fullblock",
"reason": "Low-level data copying can lead to data loss or corruption"
},
{
"pattern": "\\bchmod\\s+([0-7]{3,4}|[ugoa]+\\+?)\\s+[^/].*",
"reason": "Changing file permissions may lead to security issues"
},
{
"pattern": "\\bchown\\s+[^:]+:[^/]+\\s+[^/].*",
"reason": "Changing file ownership may lead to access issues"
},
{
"pattern": "\\bssh\\s+root@[^\\s]+",
"reason": "SSH access as root user can be risky"
},
{
"pattern": "\\bwget\\s+[^\\s]+",
"reason": "Downloading files might lead to unintended consequences"
},
{
"pattern": "\\bcurl\\s+[^\\s]+",
"reason": "Fetching data from the internet can be risky"
"pattern": "Stop-Process -Force",
"reason": "Forcefully stopping a process can lead to data loss."
}
],
"sensitive_patterns": [
{
"pattern": "password\\s*=\\s*['\"].*['\"]",
"reason": "Possible plaintext password"
},
{
"pattern": "AWS_SECRET_ACCESS_KEY",
"reason": "AWS secret key detected"
},
{
"pattern": "GITHUB_TOKEN",
"reason": "GitHub token detected"
},
{
"pattern": "PRIVATE_KEY",
"reason": "Private key detected"
},
{
"pattern": "DB_PASSWORD\\s*=\\s*['\"].*['\"]",
"reason": "Database password detected"
},
"windows_cmd_danger_patterns": [
{
"pattern": "SECRET_KEY\\s*=\\s*['\"].*['\"]",
"reason": "Application secret key detected"
"pattern": "del /s /q",
"reason": "Potentially dangerous command that can delete files recursively and quietly."
},
{
"pattern": "API_KEY\\s*=\\s*['\"].*['\"]",
"reason": "API key detected"
},
"pattern": "taskkill /F",
"reason": "Forcefully killing a task can lead to data loss."
}
],
"bash_danger_patterns": [
{
"pattern": "TOKEN\\s*=\\s*['\"].*['\"]",
"reason": "Authorization token detected"
"pattern": "rm -rf /",
"reason": "Potentially dangerous command that can delete all files recursively and forcefully."
},
{
"pattern": "PASSWORD\\s*=\\s*['\"].*['\"]",
"reason": "Password detected"
"pattern": "kill -9",
"reason": "Forcefully killing a process can lead to data loss."
}
],
"environment_patterns": [
"python_danger_patterns": [
{
"pattern": "\\$\\{?\\w+\\}?",
"reason": "Environment variable dependency detected"
"pattern": "os.system",
"reason": "Using os.system can be dangerous as it allows execution of arbitrary commands."
},
{
"pattern": "\\$\\{[^\\}]+\\}",
"reason": "Environment variable with braces detected"
},
"pattern": "subprocess.call",
"reason": "Using subprocess.call can be dangerous as it allows execution of arbitrary commands."
}
],
"ruby_danger_patterns": [
{
"pattern": "\\$\\w+",
"reason": "Environment variable placeholder detected"
"pattern": "system",
"reason": "Using system can be dangerous as it allows execution of arbitrary commands."
},
{
"pattern": "\\${HOME|USER|SHELL|PATH}",
"reason": "Common environment variables detected"
"pattern": "exec",
"reason": "Using exec can be dangerous as it allows execution of arbitrary commands."
}
]
],
"replacements": {
"Remove-Item -Recurse -Force": "Remove-Item -Recurse",
"Stop-Process -Force": "Stop-Process",
"rm -rf /": "find . -type f -delete",
"kill -9": "kill -TERM"
},
"external_commands": {
"powershell": [
"Invoke-WebRequest",
"Invoke-RestMethod"
],
"cmd": [
"curl",
"wget"
],
"bash": [
"curl",
"wget"
],
"python": [
"os.system",
"subprocess.call"
],
"ruby": [
"system",
"exec"
]
}
}
Loading
Loading