bugGNU nano - Bugs: bug #54732, [Request] allow syntax...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #54732: [Request] allow syntax highlighting in Restricted Mode

Submitter:  Mark Webb-Johnson <markwj>
Submitted:  Wed 26 Sep 2018 06:13:07 AM UTC
   
 
Severity:  1 - Wish Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Mon 12 Nov 2018 06:49:00 PM UTC, comment #10: 

Released in 3.2.

Benno Schulenberg <bens>
Group administrator
Tue 02 Oct 2018 05:34:53 PM UTC, comment #9: 

Restricted mode now reads nanorc files -- pushed to git, commit 5ca444e5.

Benno Schulenberg <bens>
Group administrator
Sun 30 Sep 2018 08:23:54 AM UTC, comment #8: 

Attached version disables a 'set operatingdir' in a nanorc file but allows one on the command line.

In the past [1] we decided that "file locking" should be allowed in restricted mode.  But now... I'm not so sure.  When the user creates a symlink upfront for the lock file (when the user can guess what the file name is going to be), this would cause nano to read an unknown file, and would overwrite that file when the user answers Yes.  Not good.

[1] http://lists.gnu.org/archive/html/nano-devel/2018-03/msg00107.html

(file #45119)

Benno Schulenberg <bens>
Group administrator
Sat 29 Sep 2018 10:10:19 AM UTC, comment #7: 

Well, when allowing 'set operatingdir /some/user/accessible/path', then it will create the file given with 'rnano' in that path (when the given file is just a name) or it will allow writing an arbitrary file in that path (when the given file has an absolute path).  Clearly this should not be allowed.  But --operatingdir should be allowed on the command line, so the script that invokes rnano can make use of it.  Hmmm...  This isn't as simple as it looked.

Also, when the user has 'set locking' in their nanorc, and when the directory that contains the file that you want the user to edit is not writable by the user, then the user gets a message on the status bar saying that "[ Directory 'hmhm' is not writable ]", instead of the usual "[ Read xxx lines ]".  That is not nice.

Benno Schulenberg <bens>
Group administrator
Sat 29 Sep 2018 06:57:18 AM UTC, comment #6: 

Thanks for reporting back.  When on the mailing list no one objects, this will be available from version 3.2.

Benno Schulenberg <bens>
Group administrator
Fri 28 Sep 2018 05:00:39 AM UTC, comment #5: 

Looks good, and works perfectly for me. Great solution. Thanks.

Mark Webb-Johnson <markwj>
Thu 27 Sep 2018 06:20:38 PM UTC, comment #4: 

Okay.  Please try the attached patch.  It should apply without problem to any recent nano.

Let me know if this fully does what you want.  Should any other options be disabled in restricted mode?  locking?  operatingdir?  view?

(file #45108)

Benno Schulenberg <bens>
Group administrator
Thu 27 Sep 2018 12:40:05 AM UTC, comment #3: 

I just read the last comment at:

http://lists.gnu.org/archive/html/nano-devel/2018-03/msg00112.html

Yes, that approach would be fine for our use case. Allow rnano to process nanorc files as normal (but ignore directives in those files that are inconsistent with the restricted mode - such as suspend mode, backups, etc). The user can --ignorerc if they don't want this behaviour.

Mark Webb-Johnson <markwj>
Thu 27 Sep 2018 12:36:37 AM UTC, comment #2: 

I would suggest caution modelling behaviour from rvim. That really is unsuitable, as the restrictions are way too open. In rvim you can, for instance, arbitrarily read files from disk.

We use restricted mode something like a simple chroot. We write a temporary file to disk, call the editor to allow the user to edit that file, and then read back the changes. Something like an embedded editor. We don't want the user accessing anything outside that one file.

I think the overall goal of restricted mode should be to restrict the USER from access to that one file being edited. So no reading other files, no writing out anywhere else, no suspend mode, etc. But, I don't think there is any issue with allowing the EDITOR access to other things (such as nanorc files). But care should be taken because that the nanorc file could for instance enable suspend mode, etc (which could allow the user to break out of the restriction). I don't see an issue with allowing the invoker to specify a specific nanorc file to use, on the command line.

Mark Webb-Johnson <markwj>
Wed 26 Sep 2018 07:02:14 PM UTC, comment #1: 

Yeah, retricted mode disallows all customization of nano, which kind off sucks.  So I have recently suggested that rnano should read the rcfiles anyway (see at the end of http://lists.gnu.org/archive/html/nano-devel/2018-03/msg00111.html), just like rvim seems to do.  But I haven't looked into it because I knew of no one who used restricted mode.  So... my question is: what do you use restricted mode for?  How often do you use it?

Benno Schulenberg <bens>
Group administrator
Wed 26 Sep 2018 06:13:07 AM UTC, original submission:  

At the moment, the restricted mode disables a bunch of things including the ability to process nanorc files. Unfortunately, that means syntax highlighting cannot be done in restricted mode.

Can we either (a) allow to specify the location of a nanorc file to run (on the command line) even if in restricted mode, or (b) allow a nanorc file to enable restricted mode (after setting up syntax highlighting)? Either or those would provide the functionality required.

Mark Webb-Johnson <markwj>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by markwj (Submitted the item)
  • -email is unavailable- added by markwj (NANO restricted mode syntax highlighting)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-11-12 bens Open/ClosedOpen Closed
    2018-10-02 bens StatusIn Progress Fixed
    2018-09-30 bens Attached File- Added 0001-startup-allow-reading-nanorc-in-restricted-mode-to-p.patch, #45119
    2018-09-27 bens Attached File- Added 0001-startup-allow-reading-nanorc-in-restricted-mode-to-p.patch, #45108
        StatusNone In Progress
        Assigned toNone bens
    2018-09-26 bens Severity3 - Normal 1 - Wish
        SummarySyntax highlighting in Restricted Mode [Request] allow syntax highlighting in Restricted Mode
    2018-09-26 markwj Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code