Compare commits

..

18 Commits

Author SHA1 Message Date
Kenji Berthold
11af5c3471 Merge pull request 'docs: docs-integrity enable UTF-8 support' (#5413) from kenji/ke-html-proofer into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5413
2025-10-07 11:23:06 +00:00
a-kenji
dac8a40b9f docs: docs-integrity enable UTF-8 support 2025-10-07 13:13:55 +02:00
Mic92
668067080d Merge pull request 'sops: don't leak secret key in debug logs' (#5411) from no-leaks into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5411
2025-10-07 10:00:47 +00:00
Jörg Thalheim
10ed2cc7f7 sops: don't leak secret key in debug logs 2025-10-07 11:31:12 +02:00
Kenji Berthold
060b22cf21 Merge pull request 'docs: Fix nixpkgs hierarchy' (#5410) from kenji/ke-qa-nixpkgs-input into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5410
2025-10-07 08:50:00 +00:00
a-kenji
965dddfee1 docs: Fix nixpkgs hierarchy 2025-10-07 10:34:22 +02:00
clan-bot
6e5d74ba22 Merge pull request 'Update nixpkgs-dev in devFlake' (#5408) from update-devFlake-nixpkgs-dev into main 2025-10-07 05:06:29 +00:00
clan-bot
4257f47a1a Merge pull request 'Update clan-core-for-checks in devFlake' (#5407) from update-devFlake-clan-core-for-checks into main 2025-10-07 05:06:22 +00:00
clan-bot
72b64a8b70 Update nixpkgs-dev in devFlake 2025-10-07 05:02:09 +00:00
clan-bot
e46e0543cd Update clan-core-for-checks in devFlake 2025-10-07 05:01:51 +00:00
clan-bot
0de79962ea Merge pull request 'Update clan-core-for-checks in devFlake' (#5406) from update-devFlake-clan-core-for-checks into main 2025-10-07 00:06:50 +00:00
clan-bot
6209816115 Update clan-core-for-checks in devFlake 2025-10-07 00:01:50 +00:00
clan-bot
ec21cda0cf Merge pull request 'Update clan-core-for-checks in devFlake' (#5404) from update-devFlake-clan-core-for-checks into main 2025-10-06 20:06:46 +00:00
clan-bot
8a29d102cd Merge pull request 'Update nixpkgs-dev in devFlake' (#5405) from update-devFlake-nixpkgs-dev into main 2025-10-06 20:06:28 +00:00
clan-bot
22787e7c93 Update nixpkgs-dev in devFlake 2025-10-06 20:02:12 +00:00
clan-bot
19fd72e075 Update clan-core-for-checks in devFlake 2025-10-06 20:01:53 +00:00
clan-bot
50be33088c Merge pull request 'Update clan-core-for-checks in devFlake' (#5403) from update-devFlake-clan-core-for-checks into main 2025-10-06 15:06:19 +00:00
clan-bot
6e7a67c830 Update clan-core-for-checks in devFlake 2025-10-06 15:01:51 +00:00
5 changed files with 30 additions and 76 deletions

12
devFlake/flake.lock generated
View File

@@ -3,10 +3,10 @@
"clan-core-for-checks": {
"flake": false,
"locked": {
"lastModified": 1759727242,
"narHash": "sha256-15Q9eXbfsLmzIbYWasZ3Nuqafnc5o9al9RmGuBGVK74=",
"lastModified": 1759795610,
"narHash": "sha256-YFOK+aoJjWLfMHj2spvrQIe0ufIsv6P8o44NqoFPwp0=",
"ref": "main",
"rev": "c737271585ff3df308feab22c09967fce8f278d3",
"rev": "0de79962eacfe6f09d7aabca2a7305deef4fde0c",
"shallow": true,
"type": "git",
"url": "https://git.clan.lol/clan/clan-core"
@@ -105,11 +105,11 @@
},
"nixpkgs-dev": {
"locked": {
"lastModified": 1759670943,
"narHash": "sha256-JBjTDfwzAwtd8+5X/Weg27WE/3hVYOP3uggP2JPaQVQ=",
"lastModified": 1759794031,
"narHash": "sha256-Zruni/00BlDHSWVJf3mb0o+OHnxIvJNuXkPloY9c+PU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "21980a9c20f34648121f60bda15f419fa568db21",
"rev": "09c221b2f0726da85b124efb60a1d123971dfa08",
"type": "github"
},
"original": {

View File

@@ -121,6 +121,7 @@
pkgs.runCommand "docs-integrity"
{
nativeBuildInputs = [ pkgs.html-proofer ];
LANG = "C.UTF-8";
}
''
# External links should be avoided in the docs, because they often break

View File

@@ -5,11 +5,11 @@
## Option 1: Follow `clan-core`
- **Pros**:
- Recommended for most users.
- Verified by our CI and widely used by others.
- Recommended for most users.
- Verified by our CI and widely used by others.
- **Cons**:
- Coupled to version bumps in `clan-core`.
- Upstream features and packages may take longer to land.
- Coupled to version bumps in `clan-core`.
- Upstream features and packages may take longer to land.
Example:
@@ -24,10 +24,10 @@ inputs = {
## Option 2: Use Your Own `nixpkgs` Version
- **Pros**:
- Faster access to new upstream features and packages.
- Faster access to new upstream features and packages.
- **Cons**:
- Recommended for advanced users.
- Not covered by our CI — youre on the frontier.
- Recommended for advanced users.
- Not covered by our CI — youre on the frontier.
Example:

View File

@@ -355,7 +355,10 @@ def get_public_age_key_from_private_key(privkey: str) -> str:
cmd = nix_shell(["age"], ["age-keygen", "-y"])
error_msg = "Failed to get public key for age private key. Is the key malformed?"
res = run(cmd, RunOpts(input=privkey.encode(), error_msg=error_msg))
res = run(
cmd,
RunOpts(input=privkey.encode(), error_msg=error_msg, sensitive_input=True),
)
return res.stdout.rstrip(os.linesep).rstrip()

View File

@@ -74,9 +74,6 @@ def handle_io(
) # wlist is a list of file descriptors to be monitored for write events
stdout_buf = b""
stderr_buf = b""
# Buffers for incomplete lines (no trailing newline yet)
stdout_line_buf = ""
stderr_line_buf = ""
start = time.time()
# Function to handle file descriptors
@@ -88,40 +85,6 @@ def handle_io(
rlist.remove(fd)
return b""
# Function to process output with proper carriage return handling
def process_output(
chunk: bytes, line_buf: str, extra: dict[str, str], cmdlog_func: Any
) -> str:
"""Process output chunk, handling carriage returns properly.
Returns the updated line buffer (incomplete lines).
"""
if not chunk:
return line_buf
# Decode the chunk and append to line buffer
decoded = chunk.decode("utf-8", "replace")
line_buf += decoded
# Split by newlines to get complete lines
lines = line_buf.split("\n")
# The last element might be an incomplete line
line_buf = lines[-1]
complete_lines = lines[:-1]
# Process each complete line
for line in complete_lines:
if "\r" in line:
# Handle carriage return: only keep the last segment after final \r
# This is what would be visible on a terminal
visible_line = line.split("\r")[-1]
if visible_line: # Only log non-empty lines
cmdlog_func(visible_line, extra=extra)
elif line: # Only log non-empty lines
cmdlog_func(line, extra=extra)
return line_buf
# Extra information passed to the logger
stdout_extra = {}
stderr_extra = {}
@@ -163,9 +126,9 @@ def handle_io(
# If Log.STDOUT is set, log the stdout output
if ret and log in [Log.STDOUT, Log.BOTH]:
stdout_line_buf = process_output(
ret, stdout_line_buf, stdout_extra, cmdlog.info
)
lines = ret.decode("utf-8", "replace").rstrip("\n").rstrip().split("\n")
for line in lines:
cmdlog.info(line, extra=stdout_extra)
# If stdout file is set, stream the stdout output
if ret and stdout:
@@ -180,9 +143,9 @@ def handle_io(
# If Log.STDERR is set, log the stderr output
if ret and log in [Log.STDERR, Log.BOTH]:
stderr_line_buf = process_output(
ret, stderr_line_buf, stderr_extra, cmdlog.info
)
lines = ret.decode("utf-8", "replace").rstrip("\n").rstrip().split("\n")
for line in lines:
cmdlog.info(line, extra=stderr_extra)
# If stderr file is set, stream the stderr output
if ret and stderr:
@@ -210,24 +173,6 @@ def handle_io(
process.stdin.close()
else:
wlist.remove(process.stdin)
# Flush any remaining buffered lines at the end
if stdout_line_buf and log in [Log.STDOUT, Log.BOTH]:
if "\r" in stdout_line_buf:
visible_line = stdout_line_buf.split("\r")[-1]
if visible_line:
cmdlog.info(visible_line, extra=stdout_extra)
elif stdout_line_buf:
cmdlog.info(stdout_line_buf, extra=stdout_extra)
if stderr_line_buf and log in [Log.STDERR, Log.BOTH]:
if "\r" in stderr_line_buf:
visible_line = stderr_line_buf.split("\r")[-1]
if visible_line:
cmdlog.info(visible_line, extra=stderr_extra)
elif stderr_line_buf:
cmdlog.info(stderr_line_buf, extra=stderr_extra)
return stdout_buf.decode("utf-8", "replace"), stderr_buf.decode("utf-8", "replace")
@@ -349,6 +294,8 @@ class RunOpts:
# This is needed for GUI applications
graphical_perm: bool = False
trace: bool = True
# Mark input as sensitive to prevent it from being logged (e.g., private keys, passwords)
sensitive_input: bool = False
def cmd_with_root(cmd: list[str], graphical: bool = False) -> list[str]:
@@ -404,7 +351,10 @@ def run(
if cmdlog.isEnabledFor(logging.DEBUG) and options.trace:
if options.input and isinstance(options.input, bytes):
if any(
# Always redact sensitive input (e.g., private keys, passwords)
if options.sensitive_input:
filtered_input = "<<REDACTED>>"
elif any(
not ch.isprintable() for ch in options.input.decode("ascii", "replace")
):
filtered_input = "<<binary_blob>>"