Skip to content

Commit 70bba41

Browse files
committed
pythongh-121996: Introduce configure --disable-openssf-guide
1 parent 7b36b67 commit 70bba41

File tree

4 files changed

+51
-6
lines changed

4 files changed

+51
-6
lines changed

Doc/using/configure.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,15 @@ Security Options
907907
The settings ``python`` and *STRING* also set TLS 1.2 as minimum
908908
protocol version.
909909

910+
.. option:: --disable-openssf-guide=[yes|no|default=no]
911+
912+
Disable compiler options that are recommended by `OpenSSF`_ for security reasons.
913+
914+
.. _OpenSSF: https://openssf.org/
915+
916+
.. versionadded:: 3.14
917+
918+
910919
macOS Options
911920
-------------
912921

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Introduce ./configure --disable-openssf-guide option. Patch by Donghee Na.

configure

Lines changed: 28 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,9 +2458,19 @@ AS_VAR_IF([with_strict_overflow], [yes],
24582458

24592459
# Enable flags that warn and protect for potential security vulnerabilities.
24602460
# These flags should be enabled by default for all builds.
2461-
AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [BASECFLAGS="$BASECFLAGS -fstack-protector-strong"], [AC_MSG_WARN([-fstack-protector-strong not supported])], [-Werror])
2462-
AX_CHECK_COMPILE_FLAG([-Wtrampolines], [BASECFLAGS="$BASECFLAGS -Wtrampolines"], [AC_MSG_WARN([-Wtrampolines not supported])], [-Werror])
2463-
AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=3], [BASECFLAGS="$BASECFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"], [AC_MSG_WARN([-D_FORTIFY_SOURCE=3 not supported])])
2461+
2462+
AC_MSG_CHECKING([for --disable-openssf-guide])
2463+
AC_ARG_ENABLE([openssf_guide],
2464+
[AS_HELP_STRING([--disable-openssf-guide], [disable usage of the security compiler options (default is no)])],
2465+
[AS_VAR_IF([enable_openssf_guide], [yes], [disable_openssf_guide=no], [disable_openssf_guide=yes])], [disable_openssf_guide=no])
2466+
AC_MSG_RESULT([$disable_openssf_guide])
2467+
2468+
if test "$disable_openssf_guide" = "no"
2469+
then
2470+
AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [BASECFLAGS="$BASECFLAGS -fstack-protector-strong"], [AC_MSG_WARN([-fstack-protector-strong not supported])], [-Werror])
2471+
AX_CHECK_COMPILE_FLAG([-Wtrampolines], [BASECFLAGS="$BASECFLAGS -Wtrampolines"], [AC_MSG_WARN([-Wtrampolines not supported])], [-Werror])
2472+
AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=3], [BASECFLAGS="$BASECFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"], [AC_MSG_WARN([-D_FORTIFY_SOURCE=3 not supported])])
2473+
fi
24642474

24652475
case $GCC in
24662476
yes)

0 commit comments

Comments
 (0)