mirror of
https://github.com/YGGverse/agate.git
synced 2026-04-08 12:35:28 +00:00
Adds tests for secrets serving
This commit is contained in:
parent
5f9761d907
commit
a13e8da9e7
4 changed files with 19 additions and 1 deletions
|
|
@ -8,3 +8,5 @@ test.gmi: ;lang=en ;charset=us-ascii
|
||||||
gone.txt: 52 This file is no longer available.
|
gone.txt: 52 This file is no longer available.
|
||||||
# test setting data for files in other directories
|
# test setting data for files in other directories
|
||||||
example.com/index.gmi: ;lang=en-US
|
example.com/index.gmi: ;lang=en-US
|
||||||
|
.servable-secret: text/plain
|
||||||
|
.well-known/servable-secret: text/plain
|
||||||
|
|
|
||||||
0
tests/data/content/.servable-secret
Normal file
0
tests/data/content/.servable-secret
Normal file
0
tests/data/content/.well-known/servable-secret
Normal file
0
tests/data/content/.well-known/servable-secret
Normal file
|
|
@ -451,7 +451,7 @@ fn port_check_skipped() {
|
||||||
#[test]
|
#[test]
|
||||||
/// - status for paths with hidden segments is "gone" if file does not exist
|
/// - status for paths with hidden segments is "gone" if file does not exist
|
||||||
fn secret_nonexistent() {
|
fn secret_nonexistent() {
|
||||||
let page = get(&[], "gemini://localhost/.secret").expect("could not get page");
|
let page = get(&[], "gemini://localhost/.non-existing-secret").expect("could not get page");
|
||||||
|
|
||||||
assert_eq!(page.header.status, Status::Gone);
|
assert_eq!(page.header.status, Status::Gone);
|
||||||
}
|
}
|
||||||
|
|
@ -472,6 +472,22 @@ fn serve_secret() {
|
||||||
assert_eq!(page.header.status, Status::Success);
|
assert_eq!(page.header.status, Status::Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
/// - secret file served if path is in sidecar
|
||||||
|
fn serve_secret_meta_config() {
|
||||||
|
let page = get(&[], "gemini://localhost/.servable-secret").expect("could not get page");
|
||||||
|
|
||||||
|
assert_eq!(page.header.status, Status::Success);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
/// - secret file served if path with subdir is in sidecar
|
||||||
|
fn serve_secret_meta_config_subdir() {
|
||||||
|
let page = get(&["-C"], "gemini://localhost/.well-known/servable-secret").expect("could not get page");
|
||||||
|
|
||||||
|
assert_eq!(page.header.status, Status::Success);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
/// - directory traversal attacks using percent-encoded path separators
|
/// - directory traversal attacks using percent-encoded path separators
|
||||||
/// fail (this addresses a previous vulnerability)
|
/// fail (this addresses a previous vulnerability)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue