Git development
 help / color / mirror / Atom feed
* [PATCH] fast-import: do not show the path when "feature export-marks" is forbidden
@ 2026-11-17 16:03 Kaartic Sivaraam
  2026-11-18 11:21 ` Karthik Nayak
  2026-11-19 18:53 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Kaartic Sivaraam @ 2026-11-17 16:03 UTC (permalink / raw)
  To: Git mailing list

Since 68061e3470 (fast-import: disallow "feature export-marks" by
default, 2019-08-29), a stream that uses "feature export-marks=<path>"
without --allow-unsafe-features dies with

    feature 'export-marks=<path>' forbidden in input without --allow-unsafe-features

because the whole feature string, including the "=<path>" argument,
is passed to check_unsafe_feature(). The import-marks variants pass
just the feature name, so their messages do not include the path.

Pass "export-marks" to match, and make the existing test check the
message, not just that the command fails.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
---
While backporting patches for a security release, I noticed this.
Was waiting for the security fix to go out before sending it.
---
 builtin/fast-import.c  | 2 +-
 t/t9300-fast-import.sh | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index ab5d2a2344..998167794c 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3918,7 +3918,7 @@ static int parse_one_feature(struct fast_import_state *state,
 		check_unsafe_feature(state, "import-marks-if-exists");
 		option_import_marks(state, arg, 1, 1);
 	} else if (skip_prefix(feature, "export-marks=", &arg)) {
-		check_unsafe_feature(state, feature);
+		check_unsafe_feature(state, "export-marks");
 		option_export_marks(state, arg);
 	} else if (!strcmp(feature, "alias")) {
 		; /* Don't die - this feature is supported */
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 15f511fb6b..33c04e0315 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -2337,7 +2337,8 @@ test_expect_success 'R: only one import-marks feature allowed per stream' '
 
 test_expect_success 'R: export-marks feature forbidden by default' '
 	echo "feature export-marks=git.marks" >input &&
-	test_must_fail git fast-import <input
+	test_must_fail git fast-import <input 2>err &&
+	test_grep "feature .export-marks. forbidden" err
 '
 
 test_expect_success 'R: export-marks feature results in a marks file being created' '

---
base-commit: e1ec09b23c8e0deb21a0b95ac5996422277395d4
change-id: 20261104-ks-fast-import-consistent-check-unsafe-0a94ffda7518


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-19 18:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 16:03 [PATCH] fast-import: do not show the path when "feature export-marks" is forbidden Kaartic Sivaraam
2026-11-18 11:21 ` Karthik Nayak
2026-11-19 18:53 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox