• Stefy Lanza (nextime / spora )'s avatar
    front: forward-auth peers from env, and say why one was refused (v0.2.88) · 0945f123
    Stefy Lanza (nextime / spora ) authored
    The Digesta host reported SSO minting a session from inside the container
    (:8776) but refusing from the host through the published port (:8777), with the
    container's address in trusted_proxies and the front's own access log showing
    that very address as the client. Both that and "enabled: true in config.json
    did not switch the feature on" are one cause.
    
    The peer _fa_trusted checks is not the socket peer: uvicorn installs
    ProxyHeadersMiddleware by default with trusted_hosts="127.0.0.1", so a hop
    arriving over loopback from the internal nginx has scope["client"] rewritten
    from X-Forwarded-For before any of our middleware runs. On a container network
    that is the address the proxy was SNATed to. So the log and the check agreed and
    the peer really was 10.89.0.178 -- but the list it was compared against was the
    DEFAULT ["127.0.0.1", "::1"], because their config.json sat at a path the app
    does not read (the $CODERAI_CONFIG_DIR/coderai trap), which is equally why the
    file's `enabled` did nothing and the env var was needed. Loopback is in that
    default; the container address is not.
    
    The loader is fine and `enabled` from the file does suffice -- verified, not
    assumed. What was missing was a way to supply the peers the same way the switch
    and the secret can already be supplied, so CODERAI_ADMIN_FORWARD_AUTH_TRUSTED_
    PROXIES now overrides the list; blank or unset falls through to config.json.
    Enabling the feature from a unit file and then having it reject every request
    from your own proxy was a gap in the contract.
    
    And a refusal now says why, once per peer and reason per 60s, naming the list it
    was checked against and never the secret. A refusal is a 302 to the login form,
    indistinguishable from "no session yet"; the report had to ask for exactly this
    instrumentation, so it is permanent now.
    
    tests/test_forward_auth_peer_trust.py reproduces the peer resolution for all
    three hops, so the table in the doc is executable rather than reasoned.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    0945f123
Name
Last commit
Last update
codai Loading commit data...
docs Loading commit data...
packaging Loading commit data...
samples Loading commit data...
tests Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
AI.PROMPT Loading commit data...
CODERAI_API_DOCUMENTATION.md Loading commit data...
CoderAI.gif Loading commit data...
DISTRIBUTION.md Loading commit data...
LICENSE.md Loading commit data...
MULTIMODAL_CAPABILITIES.md Loading commit data...
MULTIMODAL_UI_EXAMPLES.md Loading commit data...
README.md Loading commit data...
REQUEST-geoclip-embeddings.md Loading commit data...
REQUEST-vpr-embeddings.md Loading commit data...
amdgpu-coredump-05000.bin Loading commit data...
build-oci.sh Loading commit data...
build.ps1 Loading commit data...
build.sh Loading commit data...
coderai Loading commit data...
coderai-broker-implementation-reference.md Loading commit data...
coderai-integration.md Loading commit data...
commands Loading commit data...
osxbuild.sh Loading commit data...
package-oci.sh Loading commit data...
package-tarball.sh Loading commit data...
requirements-crisperwhisper.txt Loading commit data...
requirements-h3.txt Loading commit data...
requirements-longcat-train.txt Loading commit data...
requirements-longcat.txt Loading commit data...
requirements-melotts.txt Loading commit data...
requirements-nemo.txt Loading commit data...
requirements-nvidia.txt Loading commit data...
requirements-ocr-paddle.txt Loading commit data...
requirements-ocr.txt Loading commit data...
requirements-pyannote.txt Loading commit data...
requirements-surya.txt Loading commit data...
requirements-vllm.txt Loading commit data...
requirements-vulkan.txt Loading commit data...
requirements.txt Loading commit data...
run-oci.sh Loading commit data...
smoke-test-oci.sh Loading commit data...
todo.md Loading commit data...