Skip to content

Commit f4a7f15

Browse files
authored
Merge pull request #18 from Project-Ro-ASD/codex/global-distro-cli-hardening
Codex/global distro cli hardening
2 parents 2496af8 + 7ec676e commit f4a7f15

48 files changed

Lines changed: 2861 additions & 3885 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
# ro-Control clang-format configuration
3-
# CI bu dosyayı kullanır — değişiklik yapılırsa tüm kaynak dosyalar yeniden formatlanmalı.
4-
# Kullanım: find src/ -name "*.cpp" -o -name "*.h" | xargs clang-format -i
3+
# CI bu dosyayı kullanır; değişirse tüm C++ kaynakları yeniden formatlanmalıdır.
4+
# Kullanım:
5+
# find src \( -name "*.cpp" -o -name "*.h" \) -print0 | xargs -0 clang-format -i
56

67
BasedOnStyle: LLVM
78
Language: Cpp

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ What actually happened.
3737
## Logs
3838

3939
```
40-
# Paste relevant output from:
41-
# journalctl --user -u ro-control --no-pager -n 50
40+
# Paste any relevant output from one or more of these:
41+
# ro-control started from a terminal
42+
# coredumpctl info ro-control
43+
# journalctl --since "10 minutes ago" --no-pager
44+
# dnf history info
4245
```
4346

4447
## Additional Context

.github/workflows/ci.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
ninja-build \
3434
qt6-qtbase-devel \
3535
qt6-qtdeclarative-devel \
36+
qt6-qttools-devel \
3637
qt6-qtwayland-devel \
3738
kf6-qqc2-desktop-style \
3839
polkit-devel \
@@ -44,7 +45,8 @@ jobs:
4445
cmake -B build \
4546
-GNinja \
4647
-DCMAKE_BUILD_TYPE=Release \
47-
-DBUILD_TESTS=ON
48+
-DBUILD_TESTS=ON \
49+
-DREQUIRE_TRANSLATIONS=ON
4850
4951
- name: Build
5052
run: cmake --build build --parallel
@@ -80,6 +82,7 @@ jobs:
8082
qt6-qtbase-devel \
8183
qt6-qtbase-private-devel \
8284
qt6-qtdeclarative-devel \
85+
qt6-qttools-devel \
8386
qt6-qtwayland-devel \
8487
kf6-qqc2-desktop-style \
8588
polkit-devel
@@ -93,13 +96,13 @@ jobs:
9396
fi
9497
ARCHIVE_BASENAME="ro-control-${VERSION}"
9598
mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/SPECS
96-
tar \
97-
--exclude-vcs \
98-
--exclude='./build' \
99-
--exclude='./build-*' \
100-
--transform="s,^,${ARCHIVE_BASENAME}/," \
101-
-czf "${HOME}/rpmbuild/SOURCES/${ARCHIVE_BASENAME}.tar.gz" \
102-
.
99+
STAGE_DIR="$(mktemp -d)"
100+
cp -a . "${STAGE_DIR}/${ARCHIVE_BASENAME}"
101+
rm -rf "${STAGE_DIR}/${ARCHIVE_BASENAME}/.git" \
102+
"${STAGE_DIR}/${ARCHIVE_BASENAME}/build" \
103+
"${STAGE_DIR}/${ARCHIVE_BASENAME}/build-"*
104+
tar -C "${STAGE_DIR}" -czf "${HOME}/rpmbuild/SOURCES/${ARCHIVE_BASENAME}.tar.gz" "${ARCHIVE_BASENAME}"
105+
rm -rf "${STAGE_DIR}"
103106
cp packaging/rpm/ro-control.spec "${HOME}/rpmbuild/SPECS/ro-control.spec"
104107
105108
- name: Build RPM

.github/workflows/release.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,21 @@ jobs:
1818
- name: Checkout repository
1919
uses: actions/checkout@v4
2020

21+
- name: Derive release version
22+
run: |
23+
VERSION="${GITHUB_REF_NAME#v}"
24+
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
25+
2126
- name: Create source archives
2227
run: |
23-
git archive --format=tar.gz --output=ro-control-${GITHUB_REF_NAME}.tar.gz ${GITHUB_SHA}
24-
git archive --format=zip --output=ro-control-${GITHUB_REF_NAME}.zip ${GITHUB_SHA}
28+
PREFIX="ro-control-${VERSION}"
29+
git archive --format=tar.gz --prefix="${PREFIX}/" --output="${PREFIX}.tar.gz" "${GITHUB_SHA}"
30+
git archive --format=zip --prefix="${PREFIX}/" --output="${PREFIX}.zip" "${GITHUB_SHA}"
2531
2632
- name: Publish release
2733
uses: softprops/action-gh-release@v2
2834
with:
2935
generate_release_notes: true
3036
files: |
31-
ro-control-${{ github.ref_name }}.tar.gz
32-
ro-control-${{ github.ref_name }}.zip
37+
ro-control-${{ env.VERSION }}.tar.gz
38+
ro-control-${{ env.VERSION }}.zip

.gitignore

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ ui_*.h
3838
CMakeLists.txt.user
3939

4040
# VS Code
41-
.vscode/
41+
.vscode/*
42+
!.vscode/settings.json
4243
*.code-workspace
4344

4445
# CLion / JetBrains
@@ -81,23 +82,3 @@ test_results/
8182
vgcore.*
8283
callgrind.out.*
8384
massif.out.*
84-
85-
# Build
86-
build/
87-
88-
# CMake
89-
CMakeFiles/
90-
CMakeCache.txt
91-
cmake_install.cmake
92-
Makefile
93-
94-
# Qt
95-
*_autogen/
96-
moc_*
97-
qmltypes
98-
99-
# Binary
100-
*.o
101-
*.so
102-
*.a
103-
.DS_Store

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"qt-qml.qmlls.enabled": true,
3+
"qt-qml.qmlls.useQmlImportPathEnvVar": true,
4+
"qt-qml.qmlls.additionalImportPaths": [
5+
"${workspaceFolder}/src/qml",
6+
"${workspaceFolder}/src/qml/pages",
7+
"${workspaceFolder}/build/rocontrol"
8+
]
9+
}

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- Session-aware post-install and post-update handling for Wayland/X11
1717
- Real system monitors for CPU, GPU, and RAM with live QML bindings
1818
- Driver update check/apply flow and deep-clean operation support
19-
- Fedora build and test workflow with CMake + Qt6
19+
- Linux build and test workflow with CMake + Qt6
2020

2121
### Changed
2222
- Driver management UI is wired to backend operations instead of placeholders
2323
- Documentation updated for current architecture and build instructions
2424
- Test suite expanded to cover monitor metric ranges and detector reporting
25+
- Repository metadata and packaging references aligned with the active GitHub organization
26+
- Privileged command flow now uses a dedicated allowlisted helper instead of raw `pkexec` command dispatch
2527

2628
### Fixed
2729
- Command execution path preserves stdout reliably
28-
- RPM Fusion URL resolution and repository failure handling improved
30+
- RPM repository URL resolution and repository failure handling improved
2931
- Updater API/header alignment and monitor test compatibility issues resolved
3032
- Repository cleanup for stray macOS metadata files
33+
- PolicyKit metadata, helper install path, and packaged action identifiers are now consistent
3134

3235
---
3336

CMakeLists.txt

Lines changed: 81 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ project(ro-control
77
LANGUAGES CXX
88
)
99

10+
set(RO_CONTROL_POLICY_ID "io.github.ProjectRoASD.rocontrol.manage-drivers")
11+
set(RO_CONTROL_HELPER_NAME "ro-control-helper")
12+
set(RO_CONTROL_HELPER_BUILD_PATH
13+
"${CMAKE_CURRENT_BINARY_DIR}/${RO_CONTROL_HELPER_NAME}"
14+
)
15+
1016
# ─── C++ Standard ────────────────────────────────────────────────────────────
1117
set(CMAKE_CXX_STANDARD 20)
1218
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -33,6 +39,18 @@ find_package(Qt6 REQUIRED COMPONENTS
3339

3440
find_package(Qt6 QUIET COMPONENTS LinguistTools)
3541

42+
option(REQUIRE_TRANSLATIONS
43+
"Fail configuration when Qt Linguist tools are unavailable"
44+
ON
45+
)
46+
47+
if(REQUIRE_TRANSLATIONS AND NOT Qt6LinguistTools_FOUND)
48+
message(FATAL_ERROR
49+
"Qt6 LinguistTools were not found. Install the Qt tools development "
50+
"package or configure with -DREQUIRE_TRANSLATIONS=OFF for local-only builds."
51+
)
52+
endif()
53+
3654
qt_standard_project_setup()
3755

3856
if(COMMAND qt_policy)
@@ -56,6 +74,7 @@ set(BACKEND_SOURCES
5674

5775
set(APP_SOURCES
5876
src/main.cpp
77+
src/cli/cli.cpp
5978
${BACKEND_SOURCES}
6079
)
6180

@@ -93,15 +112,10 @@ if(Qt6LinguistTools_FOUND)
93112

94113
qt_add_translations(ro-control
95114
TS_FILES ${TS_FILES}
115+
RESOURCE_PREFIX "/i18n"
96116
)
97117
endif()
98118

99-
# ─── Include Directories ──────────────────────────────────────────────────────
100-
target_include_directories(ro-control PRIVATE
101-
${CMAKE_CURRENT_SOURCE_DIR}/src
102-
${CMAKE_CURRENT_SOURCE_DIR}/src/backend
103-
)
104-
105119
# ─── Link Qt Libraries ────────────────────────────────────────────────────────
106120
target_link_libraries(ro-control PRIVATE
107121
Qt6::Core
@@ -123,30 +137,87 @@ target_compile_options(ro-control PRIVATE
123137
# ─── Install Targets ──────────────────────────────────────────────────────────
124138
include(GNUInstallDirs)
125139

140+
set(RO_CONTROL_HELPER_INSTALL_PATH
141+
"${CMAKE_INSTALL_FULL_LIBEXECDIR}/${RO_CONTROL_HELPER_NAME}"
142+
)
143+
set(RO_CONTROL_POLICY_BUILD_PATH
144+
"${CMAKE_CURRENT_BINARY_DIR}/io.github.ProjectRoASD.rocontrol.policy"
145+
)
146+
147+
# ─── Include Directories ──────────────────────────────────────────────────────
148+
target_include_directories(ro-control PRIVATE
149+
${CMAKE_CURRENT_SOURCE_DIR}/src
150+
${CMAKE_CURRENT_SOURCE_DIR}/src/backend
151+
)
152+
153+
target_compile_definitions(ro-control PRIVATE
154+
RO_CONTROL_POLICY_ID="${RO_CONTROL_POLICY_ID}"
155+
RO_CONTROL_HELPER_BUILD_PATH="${RO_CONTROL_HELPER_BUILD_PATH}"
156+
RO_CONTROL_HELPER_INSTALL_PATH="${RO_CONTROL_HELPER_INSTALL_PATH}"
157+
)
158+
159+
configure_file(
160+
data/helpers/ro-control-helper.sh.in
161+
${RO_CONTROL_HELPER_BUILD_PATH}
162+
@ONLY
163+
NEWLINE_STYLE UNIX
164+
)
165+
166+
configure_file(
167+
data/polkit/io.github.ProjectRoASD.rocontrol.policy.in
168+
${RO_CONTROL_POLICY_BUILD_PATH}
169+
@ONLY
170+
NEWLINE_STYLE UNIX
171+
)
172+
126173
install(TARGETS ro-control
127174
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
128175
)
129176

177+
install(PROGRAMS ${RO_CONTROL_HELPER_BUILD_PATH}
178+
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
179+
RENAME ${RO_CONTROL_HELPER_NAME}
180+
)
181+
130182
install(FILES data/icons/ro-control.desktop
131183
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
132184
)
133185

134-
install(DIRECTORY data/icons/hicolor/
135-
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor
186+
install(FILES
187+
data/icons/hicolor/scalable/apps/ro-control.svg
188+
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps
136189
)
137190

138-
install(FILES data/icons/hicolor/256x256/apps/ro-control.png
191+
install(FILES
192+
data/icons/hicolor/256x256/apps/ro-control.png
139193
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/256x256/apps
140194
)
141195

142196
install(FILES data/icons/ro-control.metainfo.xml
143197
DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo
144198
)
145199

146-
install(FILES data/polkit/com.github.AcikKaynakGelistirmeToplulugu.rocontrol.policy
200+
install(FILES ${RO_CONTROL_POLICY_BUILD_PATH}
147201
DESTINATION ${CMAKE_INSTALL_DATADIR}/polkit-1/actions
148202
)
149203

204+
install(FILES docs/man/ro-control.1
205+
DESTINATION ${CMAKE_INSTALL_DATADIR}/man/man1
206+
)
207+
208+
install(FILES data/completions/ro-control.bash
209+
DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions
210+
RENAME ro-control
211+
)
212+
213+
install(FILES data/completions/_ro-control
214+
DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions
215+
)
216+
217+
install(FILES data/completions/ro-control.fish
218+
DESTINATION ${CMAKE_INSTALL_DATADIR}/fish/vendor_completions.d
219+
)
220+
150221
# ─── Tests ───────────────────────────────────────────────────────────────────
151222
option(BUILD_TESTS "Build unit tests" OFF)
152223

CODE_OF_CONDUCT.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,26 @@ We as members, contributors, and maintainers pledge to make participation in ro-
2121

2222
## Enforcement
2323

24-
Instances of unacceptable behavior may be reported by opening a GitHub issue or contacting the maintainers directly. All complaints will be reviewed and investigated promptly.
24+
Instances of unacceptable behavior should not be reported through a public GitHub issue.
25+
Please contact the maintainers privately through GitHub's direct contact channels.
26+
All complaints will be reviewed and investigated promptly and handled with as much confidentiality as possible.
2527

2628
Maintainers have the right to remove, edit, or reject comments, commits, issues, and other contributions that do not align with this Code of Conduct.
2729

30+
## Scope
31+
32+
This Code of Conduct applies within project spaces and in public spaces when an
33+
individual is officially representing the project or its community.
34+
35+
## Enforcement Guidelines
36+
37+
Project maintainers may apply any action they deem appropriate, including:
38+
39+
- Warning contributors about unacceptable behavior
40+
- Removing or editing content
41+
- Temporarily restricting participation
42+
- Permanently banning contributors from project spaces
43+
2844
## Attribution
2945

3046
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.

0 commit comments

Comments
 (0)