17 Commits

Author SHA1 Message Date
Bob Farrell
036aec1682 Misc. tidying 2024-11-23 13:14:11 +00:00
Bob Farrell
6e6f1bec1b Closes #108: Anti-CSRF middleware
Add to middleware in app's `src/main.zig`:

```zig
pub const jetzig_options = struct {
    pub const middleware: []const type = &.{
        jetzig.middleware.AntiCsrfMiddleware,
    };
};
```

CSRF token available in Zmpl templates:

```
{{context.authenticityToken()}}
```
or render a hidden form element:
```
{{context.authenticityFormElement()}}
```

The following HTML requests are rejected (403 Forbidden) if the
submitted query param does not match the value stored in the encrypted
session (added automatically when the token is generated for a template
value):

* POST
* PUT
* PATCH
* DELETE

JSON requests are not impacted - users should either disable JSON
endpoints or implement a different authentication method to protect
them.
2024-11-23 12:49:49 +00:00
Bob Farrell
b1dc086afb GH actions fixes
Fix `/.json` root path detection
2024-11-14 18:54:26 +00:00
Bob Farrell
634ce40bb4 Fix GH workflow 2024-06-03 22:00:04 +01:00
Bob Farrell
a46bc0ed19 Test helpers
Add `jetzig test` command which runs build step `jetzig:test`.

Add `jetzig.testing` namespace which provides test helpers and a test
app.

Add tests to view generator (i.e. include tests for generated routes).
2024-06-03 21:56:32 +01:00
axispx
d0b69200b9 Fix CI silent failure bug
CI failed silently during "Build artifacts" stage when build failed in
the bash for loop causing the overall job to be successful even when it
wasn't.
2024-03-26 13:38:37 +05:45
rimuspp
2a25084de6
Merge pull request #15 from jetzig-framework/CI-pr-skip
Not running on pull requests
2024-03-09 14:14:13 -05:00
rimuspp
fe37f51494
Not running on pull requests
We could, but that's wasteful
2024-03-09 14:08:02 -05:00
bobf
647833ca5a
Merge pull request #14 from jetzig-framework/cli-generate
CLI generate command
2024-03-09 19:07:45 +00:00
Bob Farrell
804bfb54ed Run CI workflow on PR to main 2024-03-09 18:54:23 +00:00
Bob Farrell
f954439489 CLI generate command
Provide `jetzig generate ...` commands for views, middleware, and
partials.
2024-03-09 18:47:08 +00:00
rimuspp
c71886a574
We now have CLI CI =D 2024-03-06 18:33:47 -05:00
rimuspp
63f8236521
Update CI.yml 2024-03-06 18:29:17 -05:00
rimuspp
c08fe7c1e9
Update CI.yml 2024-03-06 18:23:09 -05:00
rimuspp
f165ffe73f
Update CI.yml 2024-03-06 18:16:50 -05:00
rimuspp
01ac93ce81
Remove cache on builds
We are constantly getting master, this is not a good idea haha
2024-03-03 09:26:21 -05:00
rimuspp
ba68afcc43
Create CI.yml
Welcome to jetzig nightly
2024-03-03 09:14:31 -05:00