mirror of
https://github.com/samsonjs/agate.git
synced 2026-04-27 15:07:46 +00:00
test: use .env/.secret fixtures for percent-encoded dotfile bypass
This commit is contained in:
parent
cda2e102f8
commit
afdcdf7b8d
3 changed files with 4 additions and 3 deletions
1
tests/data/content/.env
Normal file
1
tests/data/content/.env
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
SECRET_KEY=not-a-real-secret
|
||||||
1
tests/data/content/.secret/hidden-file
Normal file
1
tests/data/content/.secret/hidden-file
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
This file should never be served by default.
|
||||||
|
|
@ -445,7 +445,7 @@ fn serve_secret_meta_config_subdir() {
|
||||||
/// - hidden files should stay hidden even when the dot is percent-encoded
|
/// - hidden files should stay hidden even when the dot is percent-encoded
|
||||||
fn secret_percent_encoded_dot() {
|
fn secret_percent_encoded_dot() {
|
||||||
avoid_default_port_conflict();
|
avoid_default_port_conflict();
|
||||||
let page = get(&[], "gemini://localhost/%2emeta").expect("could not get page");
|
let page = get(&[], "gemini://localhost/%2eenv").expect("could not get page");
|
||||||
|
|
||||||
assert_eq!(page.status, Status::Gone.value());
|
assert_eq!(page.status, Status::Gone.value());
|
||||||
}
|
}
|
||||||
|
|
@ -454,8 +454,7 @@ fn secret_percent_encoded_dot() {
|
||||||
/// - hidden subdirectory segments should stay hidden even when dot is encoded
|
/// - hidden subdirectory segments should stay hidden even when dot is encoded
|
||||||
fn secret_subdir_percent_encoded_dot() {
|
fn secret_subdir_percent_encoded_dot() {
|
||||||
avoid_default_port_conflict();
|
avoid_default_port_conflict();
|
||||||
let page =
|
let page = get(&[], "gemini://localhost/%2esecret/hidden-file").expect("could not get page");
|
||||||
get(&["-C"], "gemini://localhost/%2Ewell-known/hidden-file").expect("could not get page");
|
|
||||||
|
|
||||||
assert_eq!(page.status, Status::Gone.value());
|
assert_eq!(page.status, Status::Gone.value());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue