-
Notifications
You must be signed in to change notification settings - Fork 61
OpenSSF gold badge: hardening #1241
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
Draft
mgovers
wants to merge
26
commits into
main
Choose a base branch
from
feature/hardening
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+46
−4
Draft
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
147a479
add ubsan + hardening for gcc
mgovers 2c7c085
enable hardening for clang
mgovers a482a73
fix typo
mgovers 43b2aa6
windows hardening
mgovers 0a6a25e
revert
mgovers d95c9d3
remove rtc1
mgovers ffdac64
Merge remote-tracking branch 'origin/main' into feature/hardening
mgovers 70c0d1a
partial revert
mgovers 8c718b4
cleanup + fix clang-cl linking issues
mgovers 44ebe4c
fix cmakepresets
mgovers b026dad
clang also compiles now
mgovers c2af03b
cleanup forgotten dereference
mgovers b9b19e0
Apply suggestion from @mgovers
mgovers 00a23d7
use gcc-14 to build python, install lubsan
mgovers 422112b
attempt to fix gcc CI
mgovers 036a32c
safeguards for columnar attribute range proxy
mgovers 4ca6f14
small fix
mgovers 7507da7
test whether it works now
mgovers 46f8519
verbose python compilation
mgovers 2258e0c
before-all cibw reinstall gcc
mgovers f87f5c3
re-enable github
mgovers 2f4597b
install gcc-toolset instead
mgovers da8a3dd
use correct version
mgovers 53e2856
remove old comment regarding disabling python3.14
mgovers a703a3b
Merge branch 'fix/c-api-opaque-type' into feature/hardening
mgovers 0798af3
Merge branch 'pgm/feature/hardening-fixes' into feature/hardening
mgovers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,7 +109,7 @@ | |
| { | ||
| "name": "unix-sanitizer", | ||
| "environment": { | ||
| "SANITIZER_FLAGS": "-fsanitize=address" | ||
| "SANITIZER_FLAGS": "-fstack-protector -fsanitize=address,pointer-compare,undefined" | ||
| }, | ||
| "inherits": "unix-base", | ||
| "hidden": true | ||
|
|
@@ -137,6 +137,9 @@ | |
| { | ||
| "name": "msvc-debug", | ||
| "displayName": "Debug (MSVC)", | ||
| "environment": { | ||
| "SANITIZER_FLAGS": "/RTC1" | ||
| }, | ||
|
Comment on lines
+143
to
+145
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we move this also to the CMakeLists? |
||
| "inherits": [ | ||
| "msvc-base", | ||
| "debug" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,4 +31,9 @@ target_compile_definitions( | |
| PRIVATE PGM_ENABLE_EXPERIMENTAL | ||
| ) | ||
|
|
||
| set_target_properties( | ||
| power_grid_model_api_tests | ||
| PROPERTIES BUILD_RPATH $<TARGET_FILE_DIR:power_grid_model_c> | ||
| ) | ||
|
|
||
|
Comment on lines
+35
to
+39
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to be removed |
||
| doctest_discover_tests(power_grid_model_api_tests) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think enable it by default is logical. Disable by default and only enable in the our dev preset is logical.
In the Python build we do not enable it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardening is intended to be used in production
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardened code self (so the adjustment to make compilation to pass with hardening check flag) is intended to be used in production. The compilation flags to check hardening are not intended to be used in production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the GCC command line options (https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fhardened)
See also https://www.youtube.com/watch?v=GtYD-AIXBHk&list=PLHTh1InhhwT57vblPGsVag5MkTm_Z9-uq&index=2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still has huge doubt for the default. This goes against the other golden rule of open-source cmake project: make as little as needed for extra compile and link flag in the default cmake build.
Also, enabling address sanitizing for production is questionable.
We need more in-depth consideration and discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also let CIBW set the compiler flags for hardening