Commit Graph

510 Commits

Author SHA1 Message Date
Kartik K. Agaram e4c0b0a3e7 sandbox: more scenarios 2021-12-25 16:16:52 -08:00
Kartik K. Agaram dbbb396003 . 2021-12-25 16:16:48 -08:00
Kartik K. Agaram a36edb74f0 mock sandbox status and some initial colors
Current plan:
  - two booleans to gate file and network access, respectively
  - false shows as green, true shows as orange
  - if _both_ booleans are true, then both show as red to indicate that
    there are no protections.
2021-12-25 16:08:31 -08:00
Kartik K. Agaram 2b5559d8eb update all places when changing color scheme 2021-12-25 15:14:33 -08:00
Kartik K. Agaram 526d37e4ac fix menu colors in all color schemes
It looks like attron doesn't actually enable colors near 256, even
though https://linux.die.net/man/3/attron suggests it does.

  > COLOR_PAIR values can only be OR'd with attributes if the pair
  > number is less than 256.
2021-12-25 14:59:18 -08:00
Kartik K. Agaram ee66da41f5 sandbox: new scenario 2021-12-25 14:36:56 -08:00
Kartik K. Agaram 399fb500f4 more sandboxing scenarios 2021-12-25 14:00:03 -08:00
Kartik K. Agaram 6eecba1b5f . 2021-12-25 13:55:29 -08:00
Kartik K. Agaram 4cb6fed4e0 . 2021-12-25 13:53:18 -08:00
Kartik K. Agaram 434d36f81f a little more reorg
Put stuff people messing with Teliva apps are likely to need above the C
interface.

The state of documentation for Teliva app creators is still quite poor.
All they really have to go on is the example apps.
2021-12-25 13:44:07 -08:00
Kartik K. Agaram bb6e79aa0d reorg: pull Teliva-specific stuff out of lua.c
It should now be easier to diff against the Lua 5.1 sources upstream.
2021-12-25 13:33:37 -08:00
Kartik K. Agaram 1fdfa8909b . 2021-12-25 12:08:55 -08:00
Kartik K. Agaram 940e1abd6a make the case for sandboxing in the Readme 2021-12-25 12:06:30 -08:00
Kartik K. Agaram 02d05d61c7 back to sandboxing; focus on files and sockets 2021-12-25 11:39:56 -08:00
Kartik K. Agaram 1e63a579d7 drop stdin/stdout/stderr and Lua default files
This isn't necessarily for sandboxing, but they don't really work right
now in the presence of ncurses, and it seems better to not include
broken stuff. Maybe we can get them to coexist with ncurses down the
road.
2021-12-25 11:35:50 -08:00
Kartik K. Agaram 5c1bf1aaff drop advent.tlv
It's not really an ideal use case for Teliva.
2021-12-25 11:07:04 -08:00
Kartik K. Agaram 917646fc9f sandbox: no popen
Again, too difficult to sandbox for now.
2021-12-25 11:04:23 -08:00
Kartik K. Agaram 6af91eb0d2 tlv format for transient editor state
Stop interpreting arbitrary Lua code when loading editor state. We don't
need that power or security risk.
2021-12-25 09:27:44 -08:00
Kartik K. Agaram 76677dbd6f sandbox: UX 2021-12-25 09:05:32 -08:00
Kartik K. Agaram 46d4438cc4 sandbox: another scenario, some UX ideas
I'd originally thought of allowing policies to be influenced by
arbitrary code. But that may be overkill:
  - it's probably not a good idea to allow policies to read/write from file system
  - it's even less a good idea to allow policies to access the network
    - particularly since it's difficult (error-prone) to distinguish GET/POST in arbitrary protocols
  - once you allow file system and network, you're pretty close to owned

So let's first focus on the simplest policy, the one that is easiest to
secure. We'll add capabilities to policies as we gain confidence we can
secure them.
2021-12-25 08:59:46 -08:00
Kartik K. Agaram 732903fc18 sandbox: record scenarios I've thought of so far 2021-12-25 08:49:52 -08:00
Kartik K. Agaram 1b25d58a4f sandbox: no system()
Too hard to sandbox. Maybe we'll get back to it if there's some use case
only it can satisfy.
2021-12-25 08:22:15 -08:00
Kartik K. Agaram 3964dd5f57 . 2021-12-25 07:34:51 -08:00
Kartik K. Agaram e2846d9a55 stop futzing around and start sandboxing 2021-12-24 10:39:06 -08:00
Kartik K. Agaram 47e42241e7 clarify 'hardcoded colors' in the Readme 2021-12-24 09:26:53 -08:00
Kartik K. Agaram 8283c0c8e7 . 2021-12-23 23:37:40 -08:00
Kartik K. Agaram bacf8fc92e toot-toot: support backspace on Mac 2021-12-23 14:53:20 -08:00
Kartik K. Agaram 3dae8ffc3b toot-toot: cursor_down now handles wrapping lines 2021-12-23 12:58:31 -08:00
Kartik K. Agaram 996519c204 clean up debug prints 2021-12-23 12:34:50 -08:00
Kartik K. Agaram a5533d7940 toot-toot: plug width into cursor movement 2021-12-23 12:33:41 -08:00
Kartik K. Agaram 916857dae0 cleaner test message
Was printing over passing tests for some reason.
2021-12-23 12:30:28 -08:00
Kartik K. Agaram 984d345089 toot-toot: reorg definitions 2021-12-23 11:24:44 -08:00
Kartik K. Agaram 34e1595922 toot-toot: clean up history 2021-12-23 11:09:01 -08:00
Kartik K. Agaram a2cb3da0c9 toot-toot: cursor_up now handles wrapping lines 2021-12-23 11:08:56 -08:00
Kartik K. Agaram c1bcd566e9 snapshot: more tests for cursor_up
I think this may be all the tests. Now to make them pass..
2021-12-23 10:42:57 -08:00
Kartik K. Agaram 7a7a334a5d toot-toot: more elaborate cursor_up 2021-12-22 20:28:58 -08:00
Kartik K. Agaram 2c76aa9ff0 toot-toot: more verbose but clearer cursor_down
I actually got all tests to pass on the first try.
2021-12-22 18:44:03 -08:00
Kartik K. Agaram 77b464fbf0 clean up my debug conlang
This isn't the ideal implementation either. Pure spaghetti. But I need
to clean up the debug prints to see that.
2021-12-22 17:48:18 -08:00
Kartik K. Agaram 940b885be7 toot-toot: redo cursor_down as an experiment
I want to support cursor movement across wrapped lines, and the old
implementation doesn't seem on the right track for that.

Interesting that this required me to add the new symmetric test.
2021-12-22 17:45:51 -08:00
Kartik K. Agaram c393528cd2 . 2021-12-22 17:39:31 -08:00
Kartik K. Agaram 348945321d errors during tests are now handled
I should have documented that I'd never actually seen that code path
trigger before. Here's a minimal test that did it just now:

  function test_foo()
    return a+1
  end

  E2: [string "test_foo"]:2: attempt to perform arithmetic on global 'a' (a nil value)

A simple missing variable doesn't do it since it just evaluates to nil.

Without this commit, the above test was silently continuing to the main
app after failing tests.
2021-12-22 15:09:57 -08:00
Kartik K. Agaram e7a73626e8 toot-toot: a few more tests
..before a change in approach.
2021-12-22 11:54:54 -08:00
Kartik K. Agaram 0a1d5d61cb . 2021-12-22 11:41:45 -08:00
Kartik K. Agaram 343316dcfa more precise control over menu order
I can't believe I didn't notice this until now.
2021-12-22 00:27:50 -08:00
Kartik K. Agaram c537e7bc2d gemini: back button 2021-12-22 00:07:16 -08:00
Kartik K. Agaram e20f464484 . 2021-12-22 00:06:26 -08:00
Kartik K. Agaram a5ce055762 . 2021-12-22 00:05:08 -08:00
Kartik K. Agaram 3dda99014c fix arrow keys in big picture view on Mac
Turns out arrow keys are considered `isprint()` on Mac.
2021-12-21 23:50:56 -08:00
Kartik K. Agaram a9e400bbb4 gemini: links 2021-12-21 23:38:04 -08:00
Kartik K. Agaram 712d80e48a bugfix: ensure definition to edit has some name 2021-12-21 21:18:16 -08:00