about summary refs log tree commit diff stats
path: root/src/teliva.c
Commit message (Collapse)AuthorAgeFilesLines
* call app's main() from within Lua pmainKartik K. Agaram2022-03-071-5/+1
|
* zet.tlv: switch file writes to new APIKartik K. Agaram2022-03-071-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The interface for apps looks much nicer now, see 'main' in zet.tlv. However there are some open issues: - It can still be confusing to the computer owner that an app tries to write to some temporary file that isn't mentioned anywhere. - File renames can fail if /tmp is on a different volume. - What happens if an app overrides start_writing()? The computer owner may think they've audited the caller of start_writing and give it blanket file permissions. Teliva tunnels through start_writing when computing the caller. If the app can control what start_writing does, the app could be performing arbitrary malicious file operations. Right now things actually seem perfectly secure. Overriding start_writing has no effect. Our approach for loading .tlv files (in reverse chronological order, preventing older versions from overriding newer ones) has the accidentally _great_ property that Teliva apps can never override system definitions. So we have a new reason to put standard libraries in a .lua file: if we need to prevent apps from overriding it. This feels like something that needs an automated test, both to make sure I'm running the right experiment and to ensure I don't accidentally cause a regression in the future. I can totally imagine a future rewrite that tried a different approach than reverse-chronological.
* extract a common function callKartik K. Agaram2022-03-071-1/+1
|
* a simple hack to make caller apparentKartik K. Agaram2022-03-051-5/+1
| | | | | | | | | | | | | | | | | | | | Teliva isn't yet smart enough to know the caller of an indirect function where the function being called goes through a local variable. I'd expected fixing this to be a long death march. However, there's a shockingly easy fix: just make every indirect call go through an additional direct function call. My policy for zet.tlv was that function 'main' could open any file. This stopped working since I introduced spawn_main. But with this commit it's working again. I can also drop all my special-casing of 'main' since it's now a regular Lua call. We still can't rely on the caller of an indirect call. That affects start_reading and start_writing, which really need to be part of the framework.
* new API for file operationsKartik K. Agaram2022-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | File operations now always return a channel (or nil on error or permission denied). When start_reading() from a filename, you can repeatedly :recv() from the channel it returns. When :recv() returns nil, you're at the end of the file. Stop. When you start_writing() to a filename, you can repeatedly :send() to the channel it returns. When you're done writing, :close() the channel. Writes to the file won't be externally visible until you do. To make this work I'm now always starting up the scheduler, so I need to fix sieve.tlv. Transparently running the scheduler is an abstraction, and whenever I create an abstraction I always worry about how it might fail. There's a hopefully-clear error when you read past end of a file.
* simplify permissions model for file operationsKartik K. Agaram2022-03-031-3/+3
| | | | | We don't care to distinguish modes like "rw" or "a+". An app is permitted to perform either just reads or both reads and writes.
* duplicate keypress on failing testKartik K. Agaram2022-02-261-1/+0
|
* 'doc:blurb': a place to briefly describe an appKartik K. Agaram2022-02-171-1/+10
| | | | | | This is for what the app does, as opposed to 'doc:main', which is also intended to include commentary about the internal organization of the app.
* stop aborting if audit log fills upKartik K. Agaram2022-02-121-10/+32
| | | | | | | | | | | | When I started logging getch() events (which are just to help the reader orient on the log), this suddenly became more urgent. Now the log is larger, and it's also a circular buffer that rolls back to the start when it fills up. The next failure mode will be if we see the buffer filled up with just getch() calls, reducing visibility over real file and network operations. In which case we'll need to start coalescing getch() events.
* hacky support for caller main in file permissionsKartik K. Agaram2022-02-101-0/+2
|
* move most Teliva menus to the rightKartik K. Agaram2022-02-071-5/+7
| | | | | | | | | | The problem I'm running into is that apps might want to perform their own editing. So I can't take up prime estate like the ctrl-e hotkey or a menu name of 'edit'. I'm still prioritizing rendering Teliva's edit and permissions menu. If the window is too narrow the app's settings will be overwritten and Teliva's hotkeys will be preferentially displayed. Seems safer.
* don't perturb cursor when drawing menuKartik K. Agaram2022-02-041-0/+3
|
* include keys typed into audit logKartik K. Agaram2022-02-011-0/+7
| | | | | This will help people cross-correlate when the app performs specific calls.
* file permissions: decide based on calling functionKartik K. Agaram2022-02-011-10/+24
|
* try to get by with one feature macroKartik K. Agaram2022-01-291-3/+0
| | | | | | | | | | | | | | | | | I fucking hate feature macros. Egregious discharge of our division-of-labor-obsessed society. People should be able to introduce names. People should be able to give up names to lower levels of abstraction when they encounter conflicts. Feature macros seem to exist[1] to support more than two levels of abstraction. You try to build, one of your libraries fails to build because of a conflict between it and one level down. You don't want to modify this library. Just fucking https://catern.com/change_code.html already. But no, I have to litter my code with feature macros even though I just want the abstraction the original library provides. [1] https://man7.org/linux/man-pages/man7/feature_test_macros.7.html https://lwn.net/Articles/590381
* bugfix: editor was no longer saving anythingKartik K. Agaram2022-01-271-4/+2
| | | | | | I made the changes reverted here out of a mistaken sense that big-picture edits would interfere with Teliva's memory of what is currently being edited (teliva_editor_state).
* redo lua vs proseKartik K. Agaram2022-01-261-9/+5
| | | | | Previously we weren't dynamically selecting how to highlight a buffer after navigating with ctrl-g. That should work now.
* rename the custom big picture view to doc:mainKartik K. Agaram2022-01-251-1/+2
|
* override big picture view with doc:bp if it existsKartik K. Agaram2022-01-251-2/+18
| | | | | | | | | | | Going to big picture from doc:bp still goes to the default auto-generated big picture view. While doc:bp provides some programmability, it's also far klunkier than the default view. Rendering is worse, and it's always in edit mode because I'm trying to avoid complicating the UX with a notion of rendered markup. That means cursor movement is less convenient. It's also easy to accidentally edit the big-picture view.
* disable Lua colors in proseKartik K. Agaram2022-01-251-2/+6
|
* renameKartik K. Agaram2022-01-251-4/+4
|
* new section in big picture: prose (non-code)Kartik K. Agaram2022-01-251-4/+33
| | | | I've always found "Documentation" too pretentious.
* optimization: stop saving identical definitionsKartik K. Agaram2022-01-251-0/+7
| | | | This is long overdue.
* save doc: buffers to .tlv imagesKartik K. Agaram2022-01-251-2/+16
|
* delete a redundant function prototypeKartik K. Agaram2022-01-251-2/+1
|
* rename a functionKartik K. Agaram2022-01-251-4/+4
|
* start supporting non-code "buffers"Kartik K. Agaram2022-01-251-0/+6
| | | | | First step: when a "definition" starts with "doc:" it's not a definition, just a buffer. Stop trying to interpret it as Lua.
* get Teliva running on NetBSDKartik K. Agaram2022-01-241-0/+4
| | | | | | | | NetBSD still uses curses by default. One _could_ install ncurses, but I don't have access to a NetBSD box with permissions to install ncurses, so I'm experimenting to see how far we can get with just curses. So far most of the apps seem to work, with the exception of one bug that I'll commit next.
* file permissions: clear stale errorsKartik K. Agaram2022-01-161-0/+1
|
* some heuristic guidance on permissions screenKartik K. Agaram2022-01-041-2/+59
|
* try running permissions advice after editingKartik K. Agaram2022-01-041-3/+21
| | | | | This implies it must be side-effect free. We still need to figure out how to convey that to the computer owner.
* slightly better error messageKartik K. Agaram2022-01-041-1/+6
|
* reorgKartik K. Agaram2022-01-041-17/+17
|
* extract functionKartik K. Agaram2022-01-041-23/+14
|
* load permissions properly in a third placeKartik K. Agaram2022-01-041-2/+9
|
* when editing a function, show its callersKartik K. Agaram2022-01-031-6/+50
| | | | | | No way to select between them. That complicates the UI too much when we do so much with the cursor. But it's still useful to suggest things to type in after ctrl-g.
* start saving callers of functionsKartik K. Agaram2022-01-031-0/+50
| | | | | I think this is significantly slowing things down. Perhaps we should sample or something.
* commentKartik K. Agaram2022-01-031-1/+1
|
* extract a functionKartik K. Agaram2022-01-031-0/+22
|
* events view: jump to a functionKartik K. Agaram2022-01-031-7/+27
|
* rendering improvementKartik K. Agaram2022-01-021-3/+2
|
* bugfix: policies must end in newlineKartik K. Agaram2022-01-021-3/+3
| | | | I believe kilo kinda naturally enforces that. We'll see.
* start on a view of audit eventsKartik K. Agaram2022-01-021-2/+67
|
* editing file permissionsKartik K. Agaram2022-01-021-41/+54
|
* editable file permissionsKartik K. Agaram2022-01-021-48/+178
| | | | | | | | | | | | | | | | | | | | | Extremely cruddy implementation: - I'm still unclear on how to represent the advice function: - How to handle errors when loading user configuration? Currently I refuse to start. - Whole function? More errors to handle in header and so on. What if the function is renamed? - Just body? Needs more structured editing support. - Lots of duplication, particularly between the permissions in the menu and the permissions screen. I don't know how to show the hostname at the time of connect() or bind(), so networking is going to remain a boolean for now. It's also unclear what effective constraints we can impose on what gets discussed with a specific hostname. Everything outside the computer is out of one's control. One trick I learned is for consistently grabbing ASan logs on abort: It's always safe to redirect stderr with ncurses!
* fork a new editor widget for non-codeKartik K. Agaram2022-01-021-2/+2
|
* better follow kilo's naming conventionsKartik K. Agaram2022-01-021-3/+3
|
* copy tweakKartik K. Agaram2022-01-021-3/+4
|
* renameKartik K. Agaram2022-01-021-25/+25
|
* sandbox: tweaks to warning copyKartik K. Agaram2022-01-021-7/+8
|