Add local login, agent extra log paths, IPv4/IPv6 metrics; remediate security audit findings

This is a large squashed commit covering two batches of prior uncommitted
work plus a full security-audit remediation pass, kept together because
go.mod/go.sum and several shared files (main.go, handler.go) were touched
by both and splitting risked non-building intermediate commits.

Features (built earlier, previously uncommitted):
- Local username/password login for single-tenant deployments with no
  SSO configured (api/localauth, alerting/internal/sessioncheck,
  sentryctl users, web/src/routes/login, metadata migrations 0040/0041).
- Remotely-editable additional log file paths for agents, on top of
  their existing primary source (api/agents, agent/sentry-agent
  extra-file-path diffing, web agent config UI).
- IPv4/IPv6 addresses reported alongside other host system metrics.

Security audit remediation (this pass, all live-verified in production):
- Critical: block ClickHouse SSRF table functions (url/remote/file/s3/...)
  in the raw-SQL query escape hatch.
- High: deny sensitive paths and require Admin to add agent
  extra_file_paths (Editor could previously point an agent at /etc/shadow
  or an SSH key); alerting webhook targets now validate against
  internal/metadata/loopback addresses, both at creation and send time;
  alerting's session middleware now enforces an Editor+ floor on
  mutating requests instead of "any authenticated session"; bumped
  goxmldsig to close a SAML signature-verification bypass (GO-2026-4753).
- Medium: per-IP login rate limiting; security response headers
  (HSTS/CSP/nosniff/X-Frame-Options/Referrer-Policy/Permissions-Policy)
  on web/nginx.conf; a DevCredentialWarnings check in every Go service's
  config loader, logging loudly at startup if a deployment is still on
  docker-compose.yml's literal dev-only credentials; dependency bumps
  (golang.org/x/text, grpc, x/net, quick-xml, h2) across every affected
  Go module and both Rust crates, including a previously-uncovered x/net
  vulnerability in deploy/operator; a new security-scan.yml CI workflow
  running cargo-deny/govulncheck/npm-audit, mirroring the existing
  license-compliance.yml matrix shape.
- Low: removed sentryctl's plaintext --password flag (shell
  history/`ps` exposure) in favor of stdin and a --password-stdin flag
  for reset-password's optional specific-password path; a dummy bcrypt
  comparison closes a login response-time username-enumeration
  side-channel.
This commit is contained in:
2026-08-18 23:53:20 -07:00
parent d2bb9de245
commit 4b5dae5879
87 changed files with 5095 additions and 164 deletions
+24 -5
View File
@@ -272,9 +272,20 @@ type DesiredOverride struct {
// agent's only obligation is to echo it back as
// CheckInRequest.applied_override_version once applied -- it never
// interprets the value itself.
Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"`
// Extra file paths this agent should tail in addition to whatever its
// local [source] already is -- never a replacement for the primary
// source (an agent whose local source is journald can still be told
// to also tail a file, and vice versa). Unlike every field above,
// there's no real "unset" state for a list: the web UI/CLI always
// resubmit the complete desired list on every edit (same "PUT
// replaces the whole override" convention every other field already
// follows -- see api/agents/handler.go's handleSetConfig), so an
// empty list unambiguously means "no extra paths right now," not
// "don't touch this."
ExtraFilePaths []string `protobuf:"bytes,7,rep,name=extra_file_paths,json=extraFilePaths,proto3" json:"extra_file_paths,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DesiredOverride) Reset() {
@@ -349,6 +360,13 @@ func (x *DesiredOverride) GetVersion() string {
return ""
}
func (x *DesiredOverride) GetExtraFilePaths() []string {
if x != nil {
return x.ExtraFilePaths
}
return nil
}
type CheckInResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// False when no override has ever been set for this agent -- it
@@ -442,14 +460,15 @@ const file_sentry_agent_v1_agent_control_proto_rawDesc = "" +
"\x04host\x18\x01 \x01(\tR\x04host\x12\x18\n" +
"\aservice\x18\x02 \x01(\tR\aservice\x12F\n" +
"\x0ecurrent_config\x18\x03 \x01(\v2\x1f.sentry.agent.v1.ReportedConfigR\rcurrentConfig\x128\n" +
"\x18applied_override_version\x18\x04 \x01(\tR\x16appliedOverrideVersion\"\x98\x03\n" +
"\x18applied_override_version\x18\x04 \x01(\tR\x16appliedOverrideVersion\"\xc2\x03\n" +
"\x0fDesiredOverride\x12)\n" +
"\x0ebatch_max_size\x18\x01 \x01(\x04H\x00R\fbatchMaxSize\x88\x01\x01\x12:\n" +
"\x17batch_flush_interval_ms\x18\x02 \x01(\x04H\x01R\x14batchFlushIntervalMs\x88\x01\x01\x120\n" +
"\x11heartbeat_enabled\x18\x03 \x01(\bH\x02R\x10heartbeatEnabled\x88\x01\x01\x127\n" +
"\x15heartbeat_interval_ms\x18\x04 \x01(\x04H\x03R\x13heartbeatIntervalMs\x88\x01\x01\x12(\n" +
"\rjournald_unit\x18\x05 \x01(\tH\x04R\fjournaldUnit\x88\x01\x01\x12\x18\n" +
"\aversion\x18\x06 \x01(\tR\aversionB\x11\n" +
"\aversion\x18\x06 \x01(\tR\aversion\x12(\n" +
"\x10extra_file_paths\x18\a \x03(\tR\x0eextraFilePathsB\x11\n" +
"\x0f_batch_max_sizeB\x1a\n" +
"\x18_batch_flush_interval_msB\x14\n" +
"\x12_heartbeat_enabledB\x18\n" +
+11
View File
@@ -69,6 +69,17 @@ message DesiredOverride {
// CheckInRequest.applied_override_version once applied -- it never
// interprets the value itself.
string version = 6;
// Extra file paths this agent should tail in addition to whatever its
// local [source] already is -- never a replacement for the primary
// source (an agent whose local source is journald can still be told
// to also tail a file, and vice versa). Unlike every field above,
// there's no real "unset" state for a list: the web UI/CLI always
// resubmit the complete desired list on every edit (same "PUT
// replaces the whole override" convention every other field already
// follows -- see api/agents/handler.go's handleSetConfig), so an
// empty list unambiguously means "no extra paths right now," not
// "don't touch this."
repeated string extra_file_paths = 7;
}
// AgentCommand is a one-shot action, not a persistent desired state like