Compare commits

...
Author SHA1 Message Date
dependabot[bot] 37abdae785 build(deps): bump pnpm dependencies 2026-07-22 17:07:22 +05:45
112 changed files with 2222 additions and 1168 deletions

No files matched your search

+16 -16
View File
@@ -10,10 +10,10 @@ require (
github.com/MicahParks/keyfunc/v2 v2.1.0
github.com/Nerzal/gocloak/v13 v13.9.0
github.com/bbalet/stopwords v1.0.0
github.com/beevik/etree v1.6.0
github.com/beevik/etree v1.7.0
github.com/blevesearch/bleve/v2 v2.6.0
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.19.0
github.com/coreos/go-oidc/v3 v3.20.0
github.com/cs3org/go-cs3apis v0.0.0-20241105092511-3ad35d174fc1
github.com/davidbyttow/govips/v2 v2.18.0
github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8
@@ -21,10 +21,10 @@ require (
github.com/egirna/icap-client v0.1.1
github.com/gabriel-vasile/mimetype v1.4.13
github.com/ggwhite/go-masker v1.1.0
github.com/go-chi/chi/v5 v5.3.0
github.com/go-chi/chi/v5 v5.3.1
github.com/go-chi/httprate v0.16.0
github.com/go-chi/render v1.0.3
github.com/go-ldap/ldap/v3 v3.4.13
github.com/go-ldap/ldap/v3 v3.4.14
github.com/go-ldap/ldif v0.0.0-20200320164324-fd88d9b715b3
github.com/go-micro/plugins/v4/client/grpc v1.2.1
github.com/go-micro/plugins/v4/logger/zerolog v1.2.0
@@ -50,7 +50,7 @@ require (
github.com/jellydator/ttlcache/v3 v3.4.1
github.com/jinzhu/now v1.1.5
github.com/justinas/alice v1.2.0
github.com/kovidgoyal/imaging v1.8.22
github.com/kovidgoyal/imaging v1.8.23
github.com/leonelquinteros/gotext v1.7.2
github.com/libregraph/idm v0.5.0
github.com/libregraph/lico v0.67.0
@@ -96,16 +96,16 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0
go.opentelemetry.io/otel/sdk v1.44.0
go.opentelemetry.io/otel/trace v1.44.0
golang.org/x/crypto v0.53.0
golang.org/x/crypto v0.54.0
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
golang.org/x/image v0.43.0
golang.org/x/net v0.56.0
golang.org/x/image v0.44.0
golang.org/x/net v0.57.0
golang.org/x/oauth2 v0.36.0
golang.org/x/sync v0.21.0
golang.org/x/term v0.44.0
golang.org/x/text v0.38.0
golang.org/x/sync v0.22.0
golang.org/x/term v0.45.0
golang.org/x/text v0.40.0
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa
google.golang.org/grpc v1.82.0
google.golang.org/grpc v1.82.1
google.golang.org/protobuf v1.36.11
gopkg.in/yaml.v2 v2.4.0
gotest.tools/v3 v3.5.2
@@ -186,7 +186,7 @@ require (
github.com/fsnotify/fsnotify v1.10.1 // indirect
github.com/gdexlab/go-render v1.0.1 // indirect
github.com/go-acme/lego/v4 v4.34.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.8 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.9.0 // indirect
github.com/go-git/go-git/v5 v5.19.1 // indirect
@@ -341,10 +341,10 @@ require (
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v2 v2.4.4 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/mod v0.36.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/mod v0.37.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/time v0.15.0 // indirect
golang.org/x/tools v0.45.0 // indirect
golang.org/x/tools v0.47.0 // indirect
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
+32 -32
View File
@@ -104,8 +104,8 @@ github.com/aws/aws-sdk-go v1.55.8 h1:JRmEUbU52aJQZ2AjX4q4Wu7t4uZjOu71uyNmaWlUkJQ
github.com/aws/aws-sdk-go v1.55.8/go.mod h1:ZkViS9AqA6otK+JBBNH2++sx1sgxrPKcSzPPvQkUtXk=
github.com/bbalet/stopwords v1.0.0 h1:0TnGycCtY0zZi4ltKoOGRFIlZHv0WqpoIGUsObjztfo=
github.com/bbalet/stopwords v1.0.0/go.mod h1:sAWrQoDMfqARGIn4s6dp7OW7ISrshUD8IP2q3KoqPjc=
github.com/beevik/etree v1.6.0 h1:u8Kwy8pp9D9XeITj2Z0XtA5qqZEmtJtuXZRQi+j03eE=
github.com/beevik/etree v1.6.0/go.mod h1:bh4zJxiIr62SOf9pRzN7UUYaEDa9HEKafK25+sLc0Gc=
github.com/beevik/etree v1.7.0 h1:xjBk9O4p4x7D1YajePjfLzdaFC4/uYUENA7P0pv6gXA=
github.com/beevik/etree v1.7.0/go.mod h1:bh4zJxiIr62SOf9pRzN7UUYaEDa9HEKafK25+sLc0Gc=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
@@ -188,8 +188,8 @@ github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJ
github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8=
github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/coreos/go-oidc/v3 v3.19.0 h1:F/xyOi3x1UnG1U27YVnM1N6bHiL1K2upi6U/0qr8r+I=
github.com/coreos/go-oidc/v3 v3.19.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
github.com/coreos/go-oidc/v3 v3.20.0 h1:EtE0WIBHk03N+DqGkY4+UONzzZHk7amKt6IyNd7OsZE=
github.com/coreos/go-oidc/v3 v3.20.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA=
@@ -286,10 +286,10 @@ github.com/go-acme/lego/v4 v4.34.0 h1:oRsIuPJ4ORX7ufviXvelUpBSez2XxeKGwo5pNG9BVe
github.com/go-acme/lego/v4 v4.34.0/go.mod h1:gsmdlx/ZS6OUeXbOj0U+VnCLLfEFj4WCYRkcGpZw+pc=
github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-asn1-ber/asn1-ber v1.4.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 h1:BP4M0CvQ4S3TGls2FvczZtj5Re/2ZzkV9VwqPHH/3Bo=
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-chi/chi/v5 v5.3.0 h1:halUjDxhshgXHMrao5bB8eNBXo/rnzwr8m5m36glehM=
github.com/go-chi/chi/v5 v5.3.0/go.mod h1:R+tYY2hNuVUUjxoPtqUdgBqevM9s9njzkTLutVsOCto=
github.com/go-asn1-ber/asn1-ber v1.5.8 h1:H9AZkK22UOmfX8J84ubyaZxKJZ3FMHVwn8swoMML7iQ=
github.com/go-asn1-ber/asn1-ber v1.5.8/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-chi/chi/v5 v5.3.1 h1:3j4HZLGZQ3JpMCrPJF/Jl3mYJfWLKBfNJ6quurUGCf8=
github.com/go-chi/chi/v5 v5.3.1/go.mod h1:R+tYY2hNuVUUjxoPtqUdgBqevM9s9njzkTLutVsOCto=
github.com/go-chi/httprate v0.16.0 h1:8V5DH9j6pSK6UQoBsTpvMyFxycqaKEIToyPKzHJjUa8=
github.com/go-chi/httprate v0.16.0/go.mod h1:A8lo+qRhk+s9LiuP5saS7XCGDXRXMcrueq0NfIuCa/I=
github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4=
@@ -317,8 +317,8 @@ github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBj
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-ldap/ldap/v3 v3.1.7/go.mod h1:5Zun81jBTabRaI8lzN7E1JjyEl1g6zI6u9pd8luAK4Q=
github.com/go-ldap/ldap/v3 v3.4.13 h1:+x1nG9h+MZN7h/lUi5Q3UZ0fJ1GyDQYbPvbuH38baDQ=
github.com/go-ldap/ldap/v3 v3.4.13/go.mod h1:LxsGZV6vbaK0sIvYfsv47rfh4ca0JXokCoKjZxsszv0=
github.com/go-ldap/ldap/v3 v3.4.14 h1:D6PYdEgsaVzsXyr6w/yDC06Ria4uUhWm+Rb+er8lfAs=
github.com/go-ldap/ldap/v3 v3.4.14/go.mod h1:S4eJUMUNjDkE0ZJtIZdybwyb03sGGLW6gxXT1Hs8VKA=
github.com/go-ldap/ldif v0.0.0-20200320164324-fd88d9b715b3 h1:sfz1YppV05y4sYaW7kXZtrocU/+vimnIWt4cxAYh7+o=
github.com/go-ldap/ldif v0.0.0-20200320164324-fd88d9b715b3/go.mod h1:ZXFhGda43Z2TVbfGZefXyMJzsDHhCh0go3bZUcwTx7o=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
@@ -597,8 +597,8 @@ github.com/kovidgoyal/go-parallel v1.1.1 h1:1OzpNjtrUkBPq3UaqrnvOoB2F9RttSt811ui
github.com/kovidgoyal/go-parallel v1.1.1/go.mod h1:BJNIbe6+hxyFWv7n6oEDPj3PA5qSw5OCtf0hcVxWJiw=
github.com/kovidgoyal/go-shm v1.0.0 h1:HJEel9D1F9YhULvClEHJLawoRSj/1u/EDV7MJbBPgQo=
github.com/kovidgoyal/go-shm v1.0.0/go.mod h1:Yzb80Xf9L3kaoB2RGok9hHwMIt7Oif61kT6t3+VnZds=
github.com/kovidgoyal/imaging v1.8.22 h1:CtpoRXQpS79xxJsKu8+LUJJE/0i4FLquJZy0QH+QNlM=
github.com/kovidgoyal/imaging v1.8.22/go.mod h1:y8wo4JTv4D+skbtQf6fHg8nA1qtagvCcn8J2Nu5k2Jg=
github.com/kovidgoyal/imaging v1.8.23 h1:4WsboyQ/E8tic2kX49P93Rvscg33SPsCwTBG5EZZF54=
github.com/kovidgoyal/imaging v1.8.23/go.mod h1:k3Iot3H0v2rSWXIxQISfT3e9wIryqzAHLHCuhG7z9lM=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
@@ -1015,8 +1015,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.53.0 h1:QZ4Muo8THX6CizN2vPPd5fBGHyogrdK9fG4wLPFUsto=
golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio=
golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw=
golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -1031,8 +1031,8 @@ golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJk
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.43.0 h1:FLxcP4ec2350nTfOC8ysKtqYSIFbk/QGjw1ZHNP4tsY=
golang.org/x/image v0.43.0/go.mod h1:rrpelvGFt+kLPAjPM4HeWPgrl0FtafueU//e5N0qk/Q=
golang.org/x/image v0.44.0 h1:+tDekMZED9+LrtB3G5xzRggpVh9CARjZqROla3R3R+I=
golang.org/x/image v0.44.0/go.mod h1:V8K3KE9KKKE+pLpQDOeN18w9oacNSvy1tDOirTu4xtY=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -1054,8 +1054,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4=
golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ=
golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ=
golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -1099,8 +1099,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o=
golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec=
golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE=
golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1124,8 +1124,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM=
golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -1188,8 +1188,8 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -1197,8 +1197,8 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.44.0 h1:0rLvDRCtNj0gZkyIXhCyOb2OAzEhLVqc4B+hrsBhrmc=
golang.org/x/term v0.44.0/go.mod h1:7ze4MdzUzLXpSAoFP1H0bOI9aXDqveSvatT5vKcFh2Y=
golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0=
golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1210,8 +1210,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE=
golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4=
golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs=
golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -1264,8 +1264,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.0.0-20210112230658-8b4aab62c064/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8=
golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0=
golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q=
golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -1343,8 +1343,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.82.0 h1:vguDnZUPjE26w09A63VoxZPnvPjB5Riyc0mkXPFmAIU=
google.golang.org/grpc v1.82.0/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA=
google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE=
google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA=
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e h1:m7aQHHqd0q89mRwhwS9Bx2rjyl/hsFAeta+uGrHsQaU=
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e/go.mod h1:gID3PKrg7pWKntu9Ss6zTLJ0ttC0X9IHgREOCZwbCVU=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+24
View File
@@ -1,3 +1,27 @@
Release 1.7.0
=============
**Changes**
**Breaking changes**
* To address a security issue, it was necessary to add a `MaxDepth` option to
`ReadSettings` to limit the depth of XML trees during parsing. A generous
default value of 1024 was chosen to avoid breaking most existing code.
However, if your code is processing XML hierarchies with a depth greater
than 1024, you will need to assign your `Document` a `ReadSettings` that has
a `MaxDepth` set to a higher value.
**Security Fixes**
* Limited the depth of XML trees processed by all `ReadFrom` functions during
parsing.
* Fixed a `CompilePath` index-out-of-range panic that could be caused by a
missing path filter key.
* Sanitized the contents of XML text, comment, ProcInst and Directive tokens
provided by the user.
Release 1.6.0
=============
+31 -17
View File
@@ -13,6 +13,7 @@ import (
"errors"
"io"
"iter"
"maps"
"os"
"slices"
"strings"
@@ -27,6 +28,10 @@ const (
// ErrXML is returned when XML parsing fails due to incorrect formatting.
var ErrXML = errors.New("etree: invalid XML format")
// ErrMaxDepth is returned when the depth of the XML tree being read exceeds
// the maximum depth allowed by ReadSettings.MaxDepth.
var ErrMaxDepth = errors.New("etree: XML tree exceeds maximum depth")
// cdataPrefix is used to detect CDATA text when ReadSettings.PreserveCData is
// true.
var cdataPrefix = []byte("<![CDATA[")
@@ -76,8 +81,18 @@ type ReadSettings struct {
// whether an end element is present. Commonly set to xml.HTMLAutoClose.
// Default: nil.
AutoClose []string
// MaxDepth is the maximum depth of the XML tree to parse. If the depth of
// the XML tree exceeds this value, all ReadFrom* functions return the
// error ErrMaxDepth. If MaxDepth is zero or negative, a depth limit of
// 1024 is used. Default: 0 (i.e., a limit of 1024).
MaxDepth int
}
// defaultMaxDepth is the maximum depth of an XML tree parsed by ReadFrom*
// functions when ReadSettings.MaxDepth is not set to a positive value.
const defaultMaxDepth = 1024
// defaultCharsetReader is used by the xml decoder when the ReadSettings
// CharsetReader value is nil. It behaves as a "pass-through", ignoring
// the requested charset parameter and skipping conversion altogether.
@@ -87,18 +102,9 @@ func defaultCharsetReader(charset string, input io.Reader) (io.Reader, error) {
// dup creates a duplicate of the ReadSettings object.
func (s *ReadSettings) dup() ReadSettings {
var entityCopy map[string]string
if s.Entity != nil {
entityCopy = make(map[string]string)
for k, v := range s.Entity {
entityCopy[k] = v
}
}
return ReadSettings{
CharsetReader: s.CharsetReader,
Permissive: s.Permissive,
Entity: entityCopy,
}
c := *s
c.Entity = maps.Clone(s.Entity)
return c
}
// WriteSettings determine the behavior of the Document's WriteTo* functions.
@@ -913,6 +919,11 @@ func (e *Element) readFrom(ri io.Reader, settings ReadSettings) (n int64, err er
attrCheck := make(map[xml.Name]int)
dec := newDecoder(r, settings)
maxDepth := settings.MaxDepth
if maxDepth <= 0 {
maxDepth = defaultMaxDepth
}
var stack stack[*Element]
stack.push(e)
for {
@@ -942,6 +953,9 @@ func (e *Element) readFrom(ri io.Reader, settings ReadSettings) (n int64, err er
switch t := t.(type) {
case xml.StartElement:
if len(stack.data) > maxDepth {
return r.Bytes(), ErrMaxDepth
}
e := newElement(t.Name.Space, t.Name.Local, top)
if settings.PreserveDuplicateAttrs || len(t.Attr) < 2 {
for _, a := range t.Attr {
@@ -1622,7 +1636,7 @@ func (c *CharData) Index() int {
func (c *CharData) WriteTo(w Writer, s *WriteSettings) {
if c.IsCData() {
w.WriteString(`<![CDATA[`)
w.WriteString(c.Data)
sanitizeCData(w, c.Data)
w.WriteString(`]]>`)
} else {
var m escapeMode
@@ -1704,7 +1718,7 @@ func (c *Comment) Index() int {
// WriteTo serialies the comment to the writer.
func (c *Comment) WriteTo(w Writer, s *WriteSettings) {
w.WriteString("<!--")
w.WriteString(c.Data)
sanitizeComment(w, c.Data)
w.WriteString("-->")
}
@@ -1769,7 +1783,7 @@ func (d *Directive) Index() int {
// WriteTo serializes the XML directive to the writer.
func (d *Directive) WriteTo(w Writer, s *WriteSettings) {
w.WriteString("<!")
w.WriteString(d.Data)
sanitizeDirective(w, d.Data)
w.WriteString(">")
}
@@ -1837,10 +1851,10 @@ func (p *ProcInst) Index() int {
// WriteTo serializes the processing instruction to the writer.
func (p *ProcInst) WriteTo(w Writer, s *WriteSettings) {
w.WriteString("<?")
w.WriteString(p.Target)
sanitizeProcInst(w, p.Target)
if p.Inst != "" {
w.WriteByte(' ')
w.WriteString(p.Inst)
sanitizeProcInst(w, p.Inst)
}
w.WriteString("?>")
}
+114
View File
@@ -384,6 +384,120 @@ func escapeString(w Writer, s string, m escapeMode) {
w.WriteString(s[last:])
}
// sanitizeCData writes the sanitized contents of a CDATA section to the
// writer. XML provides no way to escape the "]]>" sequence within a CDATA
// section, so any occurrence of it is split across two CDATA sections.
func sanitizeCData(w Writer, s string) {
for {
i := strings.Index(s, "]]>")
if i < 0 {
break
}
w.WriteString(s[:i+2])
w.WriteString("]]><![CDATA[")
s = s[i+2:]
}
w.WriteString(s)
}
// sanitizeComment writes the sanitized contents of a comment to the writer.
// An XML comment may not contain the string "--", and it may not end with a
// '-'. Because XML provides no way to escape these sequences, spaces are
// inserted where necessary.
func sanitizeComment(w Writer, s string) {
last, hyphen := 0, false
for i := 0; i < len(s); i++ {
if s[i] != '-' {
hyphen = false
continue
}
if hyphen {
w.WriteString(s[last:i])
w.WriteByte(' ')
last = i
}
hyphen = true
}
w.WriteString(s[last:])
if hyphen {
w.WriteByte(' ')
}
}
// sanitizeProcInst writes the contents of a sanitized processing instruction
// to the writer. XML provides no way to escape the "?>" sequence within a
// processing instruction, so a space is inserted between the two characters.
func sanitizeProcInst(w Writer, s string) {
for {
i := strings.Index(s, "?>")
if i < 0 {
break
}
w.WriteString(s[:i+1])
w.WriteByte(' ')
s = s[i+1:]
}
w.WriteString(s)
}
// sanitizeDirective writes the sanitized contents of an XML directive to the
// writer.
func sanitizeDirective(w Writer, s string) {
// The XML decoder reserves the character following "<!" for comments
// ('-') and CDATA sections ('['), and it treats "<!>" as an unterminated
// directive. Insert a space to avoid conflicts with reserved sequences.
scan := s
if s == "" || s[0] == '-' || s[0] == '[' {
w.WriteByte(' ')
} else {
scan = s[1:]
}
// A directive's contents may legitimately contain '<' and '>' characters,
// so write them without modification when they are balanced.
if isDirectiveBalanced(scan) {
w.WriteString(s)
return
}
// The contents are unbalanced, so escape every character in the string.
escapeString(w, s, escapeNormal)
}
// isDirectiveBalanced returns true if the interpreted portion of an XML
// directive's contents may be enclosed by "<!" and ">" without changing the
// extents of the resulting directive.
func isDirectiveBalanced(s string) bool {
var quote byte
var depth int
for i := 0; i < len(s); i++ {
switch c := s[i]; {
case quote != 0:
if c == quote {
quote = 0
}
case c == '\'' || c == '"':
quote = c
case c == '>':
if depth == 0 {
return false
}
depth--
case c == '<':
if !strings.HasPrefix(s[i+1:], "!--") {
depth++
break
}
j := strings.Index(s[i+4:], "-->")
if j < 0 {
return false
}
i += 4 + j + 2
}
}
return quote == 0 && depth == 0
}
func isInCharacterRange(r rune) bool {
return r == 0x09 ||
r == 0x0A ||
+14 -2
View File
@@ -281,7 +281,11 @@ func (c *compiler) parseSegment(path string) segment {
c.err = ErrPath("path has invalid filter [brackets].")
break
}
seg.filters = append(seg.filters, c.parseFilter(fpath[:len(fpath)-1]))
filter := c.parseFilter(fpath[:len(fpath)-1])
if c.err != ErrPath("") {
break
}
seg.filters = append(seg.filters, filter)
}
return seg
}
@@ -320,7 +324,11 @@ func (c *compiler) parseFilter(path string) filter {
// Filter contains [@attr='val'], [@attr="val"], [fn()='val'],
// [fn()="val"], [tag='val'] or [tag="val"]?
eqindex := strings.IndexByte(path, '=')
if eqindex >= 0 && eqindex+1 < len(path) {
if eqindex == 0 {
c.err = ErrPath("path contains a filter expression with no key.")
return nil
}
if eqindex > 0 && eqindex+1 < len(path) {
quote := path[eqindex+1]
if quote == '\'' || quote == '"' {
rindex := nextIndex(path, quote, eqindex+2)
@@ -334,6 +342,10 @@ func (c *compiler) parseFilter(path string) filter {
switch {
case key[0] == '@':
if len(key) == 1 {
c.err = ErrPath("path contains a filter expression with no key.")
return nil
}
return newFilterAttrVal(key[1:], value)
case strings.HasSuffix(key, "()"):
name := key[:len(key)-2]
+65
View File
@@ -0,0 +1,65 @@
// Package oidc implements OpenID Connect client logic for the golang.org/x/oauth2 package.
//
// Construct a [Provider] and [oauth2.Config] through the identity provider's
// discovery document with [NewProvider], and construct an ID Token verifier
// with [Provider.Verifier]:
//
// provider, err := oidc.NewProvider(ctx, "https://accounts.google.com")
// if err != nil {
// // handle error
// }
//
// // Configure an OpenID Connect aware OAuth2 client.
// oauth2Config := oauth2.Config{
// ClientID: clientID,
// ClientSecret: clientSecret,
// RedirectURL: redirectURL,
// // Discovery returns the OAuth2 endpoints.
// Endpoint: provider.Endpoint(),
// // "openid" is a required scope for OpenID Connect flows.
// Scopes: []string{oidc.ScopeOpenID, oidc.ScopeProfile, oidc.ScopeEmail},
// }
//
// idTokenVerifier := provider.Verifier(&oidc.Config{ClientID: clientID})
//
// OAuth 2.0 redirects then opt into the OpenID Connect flow with [ScopeOpenID]:
//
// func handleRedirect(w http.ResponseWriter, r *http.Request) {
// http.Redirect(w, r, oauth2Config.AuthCodeURL(state), http.StatusFound)
// }
//
// When handling an OAuth 2.0 response, an [IDTokenVerifier] can be used to
// validate the "id_token" payload, containing well-known fields such as the
// user's email, name, and picture URL:
//
// func handleOAuth2Callback(w http.ResponseWriter, r *http.Request) {
// // Verify state and other OAuth 2.0 responses.
//
// // Perform standard token exchange.
// oauth2Token, err := oauth2Config.Exchange(r.Context(), r.URL.Query().Get("code"))
// if err != nil {
// // ...
// }
// // Extract the ID Token from OAuth2 token.
// rawIDToken, ok := oauth2Token.Extra("id_token").(string)
// if !ok {
// // ...
// }
// // Parse and verify ID Token payload.
// idToken, err := idTokenVerifier.Verify(r.Context(), rawIDToken)
// if err != nil {
// // ...
// }
// // Parse well-known claims from the token.
// // https://openid.net/specs/openid-connect-core-1_0.html#Claims
// var claims struct {
// Email string `json:"email"`
// EmailVerified bool `json:"email_verified"`
// Name string `json:"name"`
// Picture string `json:"picture"`
// }
// if err := idToken.Claims(&claims); err != nil {
// // ...
// }
// }
package oidc
+8
View File
@@ -30,3 +30,11 @@ var allAlgs = []jose.SignatureAlgorithm{
jose.PS512,
jose.EdDSA,
}
var supportedJOSEAlgs = map[string]bool{}
func init() {
for _, alg := range allAlgs {
supportedJOSEAlgs[string(alg)] = true
}
}
+58 -6
View File
@@ -6,6 +6,7 @@ import (
"crypto/ecdsa"
"crypto/ed25519"
"crypto/rsa"
"encoding/json"
"errors"
"fmt"
"io"
@@ -17,8 +18,8 @@ import (
// StaticKeySet is a verifier that validates JWT against a static set of public keys.
type StaticKeySet struct {
// PublicKeys used to verify the JWT. Supported types are *rsa.PublicKey and
// *ecdsa.PublicKey.
// PublicKeys used to verify the JWT. Supported types are *rsa.PublicKey,
// *ecdsa.PublicKey, and ed25519.PublicKey.
PublicKeys []crypto.PublicKey
}
@@ -53,8 +54,10 @@ func (s *StaticKeySet) VerifySignature(ctx context.Context, jwt string) ([]byte,
// exposed for providers that don't support discovery or to prevent round trips to the
// discovery URL.
//
// The returned KeySet is a long lived verifier that caches keys based on any
// keys change. Reuse a common remote key set instead of creating new ones as needed.
// The returned KeySet is a long lived verifier that caches keys in memory,
// re-fetching from the remote URL when it encounters a key ID it hasn't seen.
// Reuse a single remote key set rather than creating a new one for each
// verification.
func NewRemoteKeySet(ctx context.Context, jwksURL string) *RemoteKeySet {
return newRemoteKeySet(ctx, jwksURL)
}
@@ -123,7 +126,7 @@ func (i *inflight) result() ([]jose.JSONWebKey, error) {
return i.keys, i.err
}
// paresdJWTKey is a context key that allows common setups to avoid parsing the
// parsedJWTKey is a context key that allows common setups to avoid parsing the
// JWT twice. It holds a *jose.JSONWebSignature value.
var parsedJWTKey contextKey
@@ -233,6 +236,55 @@ func (r *RemoteKeySet) keysFromRemote(ctx context.Context) ([]jose.JSONWebKey, e
}
}
// jwkJSON implements custom logic for unmarshaling JSON Web Key Sets.
type jwkJSON struct {
Keys []jose.JSONWebKey
}
func (j *jwkJSON) UnmarshalJSON(data []byte) error {
var raw struct {
Keys []json.RawMessage `json:"keys"`
}
if err := json.Unmarshal(data, &raw); err != nil {
return err
}
// For each key, attempt to determine if the algorithm is supported before
// unmarshaling the key. This allows us to ignore keys with unsupported
// algorithms, rather than failing to load the entire set.
for _, key := range raw.Keys {
var metadata struct {
Alg string `json:"alg"`
}
if err := json.Unmarshal(key, &metadata); err != nil {
return err
}
if metadata.Alg != "" {
// Algorithms are technically optional, but if the key advertises an
// algorithm we don't support, ignore it rather than failing to load
// the entire key set.
//
// https://datatracker.ietf.org/doc/html/rfc7517#section-4.4
//
// This skip is currently implemented due to secp256k1, which some
// providers use for signing with "ES256K". While we could also
// ignore the curve, this seems like a more general check in case
// providers start throwing in post-quantum algorithims or something
// like that.
//
// https://github.com/coreos/go-oidc/issues/490
if !supportedJOSEAlgs[metadata.Alg] {
continue
}
}
var jwk jose.JSONWebKey
if err := json.Unmarshal(key, &jwk); err != nil {
return err
}
j.Keys = append(j.Keys, jwk)
}
return nil
}
func (r *RemoteKeySet) updateKeys() ([]jose.JSONWebKey, error) {
req, err := http.NewRequest("GET", r.jwksURL, nil)
if err != nil {
@@ -255,7 +307,7 @@ func (r *RemoteKeySet) updateKeys() ([]jose.JSONWebKey, error) {
return nil, fmt.Errorf("oidc: get keys failed: %s %s", resp.Status, body)
}
var keySet jose.JSONWebKeySet
var keySet jwkJSON
err = unmarshalResp(resp, body, &keySet)
if err != nil {
return nil, fmt.Errorf("oidc: failed to decode keys: %v %s", err, body)
+4 -3
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"slices"
"time"
)
@@ -37,7 +38,7 @@ type LogoutToken struct {
Expiry time.Time
// Optional session ID claim ("sid").
//
// The exact semantics of session IDs very between identity providers. Use
// The exact semantics of session IDs vary between identity providers. Use
// your provider's documentation to determine what this correlates to and
// how it should be handled.
SessionID string
@@ -98,7 +99,7 @@ type logoutTokenJSON struct {
// }
// verifier := provider.Verifier(oidcConfig)
//
// mux.HandleFunc("POST /logout", func(w http.ResponseWriter, r *http.Reequest) {
// mux.HandleFunc("POST /logout", func(w http.ResponseWriter, r *http.Request) {
// rawLogoutToken := r.PostFormValue("logout_token")
// if rawLogoutToken == "" {
// // ...
@@ -163,7 +164,7 @@ func (v *IDTokenVerifier) VerifyLogout(ctx context.Context, rawLogoutToken strin
if !v.config.SkipClientIDCheck {
if v.config.ClientID != "" {
if !contains(t.Audience, v.config.ClientID) {
if !slices.Contains(t.Audience, v.config.ClientID) {
return nil, fmt.Errorf("oidc: expected logout token audience %q got %q", v.config.ClientID, t.Audience)
}
} else {
+115 -12
View File
@@ -1,4 +1,3 @@
// Package oidc implements OpenID Connect client logic for the golang.org/x/oauth2 package.
package oidc
import (
@@ -24,6 +23,26 @@ const (
// ScopeOpenID is the mandatory scope for all OpenID Connect OAuth2 requests.
ScopeOpenID = "openid"
// ScopeProfile can be used to request information about the user's profile,
// such as "name", "picture", etc.
//
// The exact set of claims supported by identity providers differs widely,
// though "name" and "picture" are commonly returned.
//
// See: https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims
ScopeProfile = "profile"
// ScopeEmail can be used to request the user's email address through the
// "email" and "email_verified" claims.
//
// What it means to verify an email isn't well defined. Clients can
// generally throw out emails when the "emvail_verified" claim is false, but
// should consult identity provider specific docs if attempting to ensure
// that the user controls the returned email address.
//
// See: https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims
ScopeEmail = "email"
// ScopeOfflineAccess is an optional scope defined by OpenID Connect for requesting
// OAuth2 refresh tokens.
//
@@ -92,7 +111,24 @@ func doRequest(ctx context.Context, req *http.Request) (*http.Response, error) {
return client.Do(req.WithContext(ctx))
}
// Provider represents an OpenID Connect server's configuration.
// Provider represents an OpenID Connect server's configuration, fetched from
// the discovery document.
//
// To access fields in the discovery document that aren't exposed directly
// through this package's API, use the [Provider.Claims] method. For example, to
// access the registration or end session endpoints:
//
// p, err := oidc.NewProvider(ctx, "https://issuer.example.com")
// if err != nil {
// // ...
// }
// var metadata struct {
// EndSessionEndpoint string `json:"end_session_endpoint"`
// RegistrationEndpoint string `json:"registration_endpoint"`
// }
// if err := p.Claims(&metadata); err != nil {
// // ...
// }
type Provider struct {
issuer string
authURL string
@@ -213,6 +249,8 @@ type ProviderConfig struct {
//
// The provided context is only used for [http.Client] configuration through
// [ClientContext], not cancelation.
//
// For providers that implement discovery, use [NewProvider] instead.
func (p *ProviderConfig) NewProvider(ctx context.Context) *Provider {
return &Provider{
issuer: p.IssuerURL,
@@ -226,12 +264,36 @@ func (p *ProviderConfig) NewProvider(ctx context.Context) *Provider {
}
}
// IssuerMismatchError is returned by [NewProvider] when the "iss" value
// reported by the upstream is different than the expected value.
//
// Issuer mismatches can occur due to trailing slashes ("https://example.com"
// vs. "https://example.com/") or represent significant misconfiguration for
// multi-tenant issuers.
//
// Issuers must match exactly as they are also used to validate ID Tokens.
//
// https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
type IssuerMismatchError struct {
// The value provided to this package. The expected value.
Provided string
// The value advertised by the discovery document.
Discovered string
}
func (e *IssuerMismatchError) Error() string {
return fmt.Sprintf("oidc: issuer URL provided to client (%q) did not match the issuer URL returned by provider (%q)", e.Provided, e.Discovered)
}
// NewProvider uses the OpenID Connect discovery mechanism to construct a Provider.
// The issuer is the URL identifier for the service. For example: "https://accounts.google.com"
// or "https://login.salesforce.com".
//
// If the "iss" value returned in the discovery document doesn't match the value
// provided here, [IssuerMismatchError] is returned.
//
// OpenID Connect providers that don't implement discovery or host the discovery
// document at a non-spec complaint path (such as requiring a URL parameter),
// document at a non-spec compliant path (such as requiring a URL parameter),
// should use [ProviderConfig] instead.
//
// See: https://openid.net/specs/openid-connect-discovery-1_0.html
@@ -267,7 +329,10 @@ func NewProvider(ctx context.Context, issuer string) (*Provider, error) {
issuerURL = issuer
}
if p.Issuer != issuerURL && !skipIssuerValidation {
return nil, fmt.Errorf("oidc: issuer URL provided to client (%q) did not match the issuer URL returned by provider (%q)", issuer, p.Issuer)
return nil, &IssuerMismatchError{
Provided: issuerURL,
Discovered: p.Issuer,
}
}
var algs []string
for _, a := range p.Algorithms {
@@ -301,7 +366,7 @@ func NewProvider(ctx context.Context, issuer string) (*Provider, error) {
//
// For a list of fields defined by the OpenID Connect spec see:
// https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
func (p *Provider) Claims(v interface{}) error {
func (p *Provider) Claims(v any) error {
if p.rawClaims == nil {
return errors.New("oidc: claims not set")
}
@@ -340,7 +405,7 @@ type userInfoRaw struct {
}
// Claims unmarshals the raw JSON object claims into the provided object.
func (u *UserInfo) Claims(v interface{}) error {
func (u *UserInfo) Claims(v any) error {
if u.claims == nil {
return errors.New("oidc: claims not set")
}
@@ -348,6 +413,44 @@ func (u *UserInfo) Claims(v interface{}) error {
}
// UserInfo uses the token source to query the provider's user info endpoint.
//
// It's fewer round trips and better supported to validate the ID Token with
// [Provider.Verifier], rather than using the UserInfo endpoint. The ID Token
// contains all information [UserInfo] provides:
//
// p, err := oidc.NewProvider(ctx, "https://issuer.example.com")
// if err != nil {
// // ...
// }
// config := &oidc.Config{
// ClientID: clientID,
// }
// v := p.Verifier(config)
// http.HandleFunc("/callback", func(w http.ResponseWriter, r *http.Request) {
// oauth2Token, err := config.Exchange(ctx, r.URL.Query().Get("code"))
// if err != nil {
// // ...
// }
// rawIDToken, ok := oauth2Token.Extra("id_token").(string)
// if !ok {
// // ...
// }
// idToken, err := verifier.Verify(ctx, rawIDToken)
// if err != nil {
// // ...
// }
// // https://openid.net/specs/openid-connect-core-1_0.html#Claims
// var claims struct {
// Email string `json:"email"`
// EmailVerified bool `json:"email_verified"`
// Name string `json:"name"`
// Picture string `json:"picture"`
// }
// if err := idToken.Claims(&claims); err != nil {
// // ...
// }
// // Use claims...
// })
func (p *Provider) UserInfo(ctx context.Context, tokenSource oauth2.TokenSource) (*UserInfo, error) {
if p.userInfoURL == "" {
return nil, errors.New("oidc: user info endpoint is not supported by this provider")
@@ -425,7 +528,7 @@ type IDToken struct {
// A unique string which identifies the end user.
Subject string
// Expiry of the token. Ths package will not process tokens that have
// Expiry of the token. This package will not process tokens that have
// expired unless that validation is explicitly turned off.
Expiry time.Time
// When the token was issued by the provider.
@@ -433,7 +536,7 @@ type IDToken struct {
// Initial nonce provided during the authentication redirect.
//
// This package does NOT provided verification on the value of this field
// This package does NOT provide verification on the value of this field
// and it's the user's responsibility to ensure it contains a valid value.
Nonce string
@@ -465,15 +568,15 @@ type IDToken struct {
// if err := idToken.Claims(&claims); err != nil {
// // handle error
// }
func (i *IDToken) Claims(v interface{}) error {
func (i *IDToken) Claims(v any) error {
if i.claims == nil {
return errors.New("oidc: claims not set")
}
return json.Unmarshal(i.claims, v)
}
// VerifyAccessToken verifies that the hash of the access token that corresponds to the iD token
// matches the hash in the id token. It returns an error if the hashes don't match.
// VerifyAccessToken verifies that the hash of the access token that corresponds to the ID token
// matches the hash in the ID token. It returns an error if the hashes don't match.
// It is the caller's responsibility to ensure that the optional access token hash is present for the ID token
// before calling this method. See https://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken
func (i *IDToken) VerifyAccessToken(accessToken string) error {
@@ -570,7 +673,7 @@ func (j *jsonTime) UnmarshalJSON(b []byte) error {
return nil
}
func unmarshalResp(r *http.Response, body []byte, v interface{}) error {
func unmarshalResp(r *http.Response, body []byte, v any) error {
err := json.Unmarshal(body, &v)
if err == nil {
return nil
+17 -24
View File
@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net/http"
"slices"
"time"
jose "github.com/go-jose/go-jose/v4"
@@ -17,10 +18,10 @@ const (
issuerGoogleAccountsNoScheme = "accounts.google.com"
)
// TokenExpiredError indicates that Verify or VerifyLogout failed because the
// token was expired. This error does NOT indicate that the token is not also
// invalid for other reasons. Other checks might have failed if the expiration
// check had not failed.
// TokenExpiredError indicates that [IDTokenVerifier.Verify] or
// [IDTokenVerifier.VerifyLogout] failed because the token was expired. This
// error does NOT indicate that the token is not also invalid for other reasons.
// Other checks might have failed if the expiration check had not failed.
type TokenExpiredError struct {
// Expiry is the time when the token expired.
Expiry time.Time
@@ -30,7 +31,7 @@ func (e *TokenExpiredError) Error() string {
return fmt.Sprintf("oidc: token is expired (Token Expiry: %v)", e.Expiry)
}
// KeySet is a set of publc JSON Web Keys that can be used to validate the signature
// KeySet is a set of public JSON Web Keys that can be used to validate the signature
// of JSON web tokens. This is expected to be backed by a remote key set through
// provider metadata discovery or an in-memory set of keys delivered out-of-band.
type KeySet interface {
@@ -55,8 +56,8 @@ type IDTokenVerifier struct {
// NewVerifier returns a verifier manually constructed from a key set and issuer URL.
//
// It's easier to use provider discovery to construct an IDTokenVerifier than creating
// one directly. This method is intended to be used with provider that don't support
// metadata discovery, or avoiding round trips when the key set URL is already known.
// one directly. This method is intended to be used with providers that don't support
// metadata discovery, or to avoid round trips when the key set URL is already known.
//
// This constructor can be used to create a verifier directly using the issuer URL and
// JSON Web Key Set URL without using discovery:
@@ -82,8 +83,8 @@ type Config struct {
ClientID string
// If specified, only this set of algorithms may be used to sign the JWT.
//
// If the IDTokenVerifier is created from a provider with (*Provider).Verifier, this
// defaults to the set of algorithms the provider supports. Otherwise this values
// If the IDTokenVerifier is created from a provider with [Provider.Verifier], this
// defaults to the set of algorithms the provider supports. Otherwise this value
// defaults to RS256.
SupportedSigningAlgs []string
@@ -92,7 +93,7 @@ type Config struct {
// If true, token expiry is not checked.
SkipExpiryCheck bool
// SkipIssuerCheck is intended for specialized cases where the the caller wishes to
// SkipIssuerCheck is intended for specialized cases where the caller wishes to
// defer issuer validation. When enabled, callers MUST independently verify the Token's
// Issuer is a known good value.
//
@@ -117,8 +118,9 @@ type Config struct {
}
// VerifierContext returns an IDTokenVerifier that uses the provider's key set to
// verify JWTs. As opposed to Verifier, the context is used to configure requests
// to the upstream JWKs endpoint. The provided context's cancellation is ignored.
// verify JWTs. As opposed to [Provider.Verifier], the context is used to configure
// requests to the upstream JWKs endpoint. The provided context's cancellation is
// ignored.
func (p *Provider) VerifierContext(ctx context.Context, config *Config) *IDTokenVerifier {
return p.newVerifier(NewRemoteKeySet(ctx, p.jwksURL), config)
}
@@ -126,7 +128,7 @@ func (p *Provider) VerifierContext(ctx context.Context, config *Config) *IDToken
// Verifier returns an IDTokenVerifier that uses the provider's key set to verify JWTs.
//
// The returned verifier uses a background context for all requests to the upstream
// JWKs endpoint. To control that context, use VerifierContext instead.
// JWKs endpoint. To control that context, use [Provider.VerifierContext] instead.
func (p *Provider) Verifier(config *Config) *IDTokenVerifier {
return p.newVerifier(p.remoteKeySet(), config)
}
@@ -142,15 +144,6 @@ func (p *Provider) newVerifier(keySet KeySet, config *Config) *IDTokenVerifier {
return NewVerifier(p.issuer, keySet, config)
}
func contains(sli []string, ele string) bool {
for _, s := range sli {
if s == ele {
return true
}
}
return false
}
// Returns the Claims from the distributed JWT token
func resolveDistributedClaim(ctx context.Context, verifier *IDTokenVerifier, src claimSource) ([]byte, error) {
req, err := http.NewRequest("GET", src.Endpoint, nil)
@@ -187,7 +180,7 @@ func resolveDistributedClaim(ctx context.Context, verifier *IDTokenVerifier, src
// Verify parses a raw ID Token, verifies it's been signed by the provider, performs
// any additional checks depending on the Config, and returns the payload.
//
// Verify does NOT do nonce validation, which is the callers responsibility.
// Verify does NOT do nonce validation, which is the caller's responsibility.
//
// See: https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation
//
@@ -257,7 +250,7 @@ func (v *IDTokenVerifier) Verify(ctx context.Context, rawIDToken string) (*IDTok
// This check DOES NOT ensure that the ClientID is the party to which the ID Token was issued (i.e. Authorized party).
if !v.config.SkipClientIDCheck {
if v.config.ClientID != "" {
if !contains(t.Audience, v.config.ClientID) {
if !slices.Contains(t.Audience, v.config.ClientID) {
return nil, fmt.Errorf("oidc: expected audience %q got %q", v.config.ClientID, t.Audience)
}
} else {
+23 -10
View File
@@ -19,6 +19,10 @@ import (
// no limit.
var MaxPacketLengthBytes int64 = math.MaxInt32
// MaxNestingDepth specifies the maximum allowed nesting depth when calling ReadPacket, DecodePacket, or
// DecodePacketErr. Set to 0 for no limit.
var MaxNestingDepth int = 1000
type Packet struct {
Identifier
Value interface{}
@@ -218,7 +222,7 @@ func printPacket(out io.Writer, p *Packet, indent int, printBytes bool) {
// ReadPacket reads a single Packet from the reader.
func ReadPacket(reader io.Reader) (*Packet, error) {
p, _, err := readPacket(reader)
p, _, err := readPacket(reader, 0)
if err != nil {
return nil, err
}
@@ -278,7 +282,7 @@ func int64Length(i int64) (numBytes int) {
// DecodePacket decodes the given bytes into a single Packet
// If a decode error is encountered, nil is returned.
func DecodePacket(data []byte) *Packet {
p, _, _ := readPacket(bytes.NewBuffer(data))
p, _, _ := readPacket(bytes.NewBuffer(data), 0)
return p
}
@@ -286,7 +290,7 @@ func DecodePacket(data []byte) *Packet {
// DecodePacketErr decodes the given bytes into a single Packet
// If a decode error is encountered, nil is returned.
func DecodePacketErr(data []byte) (*Packet, error) {
p, _, err := readPacket(bytes.NewBuffer(data))
p, _, err := readPacket(bytes.NewBuffer(data), 0)
if err != nil {
return nil, err
}
@@ -294,12 +298,20 @@ func DecodePacketErr(data []byte) (*Packet, error) {
}
// readPacket reads a single Packet from the reader, returning the number of bytes read.
func readPacket(reader io.Reader) (*Packet, int, error) {
func readPacket(reader io.Reader, depth int) (*Packet, int, error) {
if MaxNestingDepth > 0 && depth >= MaxNestingDepth {
return nil, 0, fmt.Errorf("nesting depth %d exceeds maximum %d", depth, MaxNestingDepth)
}
identifier, length, read, err := readHeader(reader)
if err != nil {
return nil, read, err
}
if length != LengthIndefinite && MaxPacketLengthBytes > 0 && int64(length) > MaxPacketLengthBytes {
return nil, read, fmt.Errorf("length %d greater than maximum %d", length, MaxPacketLengthBytes)
}
p := &Packet{
Identifier: identifier,
}
@@ -326,13 +338,19 @@ func readPacket(reader io.Reader) (*Packet, int, error) {
}
// Read the next packet
child, r, err := readPacket(reader)
child, r, err := readPacket(reader, depth+1)
if err != nil {
return nil, read, unexpectedEOF(err)
}
contentRead += r
read += r
// Enforce the aggregate size limit for constructed packets. Indefinite length declares
// no bound up front, so the content bytes are only known as they are read.
if MaxPacketLengthBytes > 0 && int64(contentRead) > MaxPacketLengthBytes {
return nil, read, fmt.Errorf("length %d greater than maximum %d", contentRead, MaxPacketLengthBytes)
}
// Test is this is the EOC marker for our packet
if isEOCPacket(child) {
if length == LengthIndefinite {
@@ -351,11 +369,6 @@ func readPacket(reader io.Reader) (*Packet, int, error) {
return nil, read, errors.New("indefinite length used with primitive type")
}
// Read definite-length content
if MaxPacketLengthBytes > 0 && int64(length) > MaxPacketLengthBytes {
return nil, read, fmt.Errorf("length %d greater than maximum %d", length, MaxPacketLengthBytes)
}
var content []byte
if length > 0 {
// Read the content and limit it to the parsed length.
+5 -4
View File
@@ -40,7 +40,7 @@ func readLength(reader io.Reader) (length int, read int, err error) {
}
// Accumulate into a 64-bit variable
var length64 int64
var length64 uint64
for i := 0; i < lengthBytes; i++ {
b, err = readByte(reader)
if err != nil {
@@ -53,13 +53,14 @@ func readLength(reader io.Reader) (length int, read int, err error) {
// x.600, 8.1.3.5
length64 <<= 8
length64 |= int64(b)
length64 |= uint64(b)
}
// Cast to a platform-specific integer
length = int(length64)
// Ensure we didn't overflow
if int64(length) != length64 {
// Ensure we didn't overflow or wrap negative. Length octets are unsigned
// (x.600, 8.1.3.5), so a negative result is unrepresentable, not indefinite.
if length < 0 || uint64(length) != length64 {
return 0, read, errors.New("long-form length overflow")
}
+1
View File
@@ -221,6 +221,7 @@ type Router interface {
Patch(pattern string, h http.HandlerFunc)
Post(pattern string, h http.HandlerFunc)
Put(pattern string, h http.HandlerFunc)
Query(pattern string, h http.HandlerFunc)
Trace(pattern string, h http.HandlerFunc)
// NotFound defines a handler to respond whenever a route could
+1
View File
@@ -102,6 +102,7 @@ type Router interface {
Patch(pattern string, h http.HandlerFunc)
Post(pattern string, h http.HandlerFunc)
Put(pattern string, h http.HandlerFunc)
Query(pattern string, h http.HandlerFunc)
Trace(pattern string, h http.HandlerFunc)
// NotFound defines a handler to respond whenever a route could
+2
View File
@@ -23,6 +23,8 @@ var defaultCompressibleContentTypes = []string{
"application/json",
"application/atom+xml",
"application/rss+xml",
"application/xml",
"text/xml",
"image/svg+xml",
}
+1 -1
View File
@@ -166,7 +166,7 @@ func (l *defaultLogEntry) Write(status, bytes int, header http.Header, elapsed t
}
func (l *defaultLogEntry) Panic(v interface{}, stack []byte) {
PrintPrettyStack(v)
printPrettyStack(v, l.useColor)
}
func init() {
-1
View File
@@ -1,5 +1,4 @@
//go:build !tinygo
// +build !tinygo
package middleware
+9 -3
View File
@@ -52,9 +52,16 @@ func Recoverer(next http.Handler) http.Handler {
var recovererErrorWriter io.Writer = os.Stderr
func PrintPrettyStack(rvr interface{}) {
printPrettyStack(rvr, true)
}
// printPrettyStack prints a formatted stack trace to stderr. When useColor is
// false, ANSI colour codes are suppressed, which is useful for terminals that
// do not support them (e.g. on Windows) or when output is being captured.
func printPrettyStack(rvr interface{}, useColor bool) {
debugStack := debug.Stack()
s := prettyStack{}
out, err := s.parse(debugStack, rvr)
out, err := s.parse(debugStack, rvr, useColor)
if err == nil {
recovererErrorWriter.Write(out)
} else {
@@ -66,9 +73,8 @@ func PrintPrettyStack(rvr interface{}) {
type prettyStack struct {
}
func (s prettyStack) parse(debugStack []byte, rvr interface{}) ([]byte, error) {
func (s prettyStack) parse(debugStack []byte, rvr interface{}, useColor bool) ([]byte, error) {
var err error
useColor := true
buf := &bytes.Buffer{}
cW(buf, false, bRed, "\n")
+6 -4
View File
@@ -207,10 +207,12 @@ func (f *http2FancyWriter) Push(target string, opts *http.PushOptions) error {
}
func (f *httpFancyWriter) ReadFrom(r io.Reader) (int64, error) {
if f.basicWriter.tee != nil {
// Route through basicWriter.Write so that data is also written to the
// tee writer. basicWriter.Write already increments basicWriter.bytes,
// so we must NOT add n again here (that would double-count).
if f.basicWriter.tee != nil || f.basicWriter.discard {
// Route through basicWriter.Write so that the tee and discard semantics
// are honored (the fast ReaderFrom path below would bypass both, writing
// straight to the original ResponseWriter). basicWriter.Write already
// increments basicWriter.bytes, so we must NOT add n again here (that
// would double-count).
n, err := io.Copy(&f.basicWriter, r)
return n, err
}
+6
View File
@@ -186,6 +186,12 @@ func (mx *Mux) Put(pattern string, handlerFn http.HandlerFunc) {
mx.handle(mPUT, pattern, handlerFn)
}
// Query adds the route `pattern` that matches a QUERY http method to
// execute the `handlerFn` http.HandlerFunc.
func (mx *Mux) Query(pattern string, handlerFn http.HandlerFunc) {
mx.handle(mQUERY, pattern, handlerFn)
}
// Trace adds the route `pattern` that matches a TRACE http method to
// execute the `handlerFn` http.HandlerFunc.
func (mx *Mux) Trace(pattern string, handlerFn http.HandlerFunc) {
+9 -1
View File
@@ -26,11 +26,17 @@ const (
mPATCH
mPOST
mPUT
mQUERY
mTRACE
)
var mALL = mCONNECT | mDELETE | mGET | mHEAD |
mOPTIONS | mPATCH | mPOST | mPUT | mTRACE
mOPTIONS | mPATCH | mPOST | mPUT | mQUERY | mTRACE
// methodQuery is the HTTP QUERY method (RFC 10008), a safe, idempotent
// method that conveys a request body. It is defined here until net/http
// provides an equivalent constant, at which point this is a 1-1 swap.
const methodQuery = "QUERY"
var methodMap = map[string]methodTyp{
http.MethodConnect: mCONNECT,
@@ -41,6 +47,7 @@ var methodMap = map[string]methodTyp{
http.MethodPatch: mPATCH,
http.MethodPost: mPOST,
http.MethodPut: mPUT,
methodQuery: mQUERY,
http.MethodTrace: mTRACE,
}
@@ -53,6 +60,7 @@ var reverseMethodMap = map[methodTyp]string{
mPATCH: http.MethodPatch,
mPOST: http.MethodPost,
mPUT: http.MethodPut,
mQUERY: methodQuery,
mTRACE: http.MethodTrace,
}
+3
View File
@@ -83,6 +83,9 @@ func (l *Conn) Add(addRequest *AddRequest) error {
return err
}
if len(packet.Children) < 2 {
return fmt.Errorf("ldap: malformed response: expected at least 2 children, got %d", len(packet.Children))
}
if packet.Children[1].Tag == ApplicationAddResponse {
err := GetLDAPError(packet)
if err != nil {
+61 -16
View File
@@ -3,13 +3,13 @@ package ldap
import (
"bytes"
"crypto/md5"
"crypto/rand"
"encoding/binary"
"encoding/hex"
enchex "encoding/hex"
"errors"
"fmt"
"io/ioutil"
"math/rand"
"strings"
"unicode/utf16"
@@ -221,12 +221,15 @@ func (l *Conn) DigestMD5Bind(digestMD5BindRequest *DigestMD5BindRequest) (*Diges
}
if len(params) > 0 {
resp := computeResponse(
resp, err := computeResponse(
params,
"ldap/"+strings.ToLower(digestMD5BindRequest.Host),
digestMD5BindRequest.Username,
digestMD5BindRequest.Password,
)
if err != nil {
return nil, fmt.Errorf("compute digest-md5 response: %s", err)
}
packet = ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
@@ -291,12 +294,22 @@ func parseParams(str string) (map[string]string, error) {
m := make(map[string]string)
var key, value string
var state int
var escaped bool
for i := 0; i <= len(str); i++ {
switch state {
case 0: // reading key
if i == len(str) {
return nil, fmt.Errorf("syntax error on %d", i)
}
// The digest-challenge is an RFC 2068 #rule (RFC 2831 section 2.1.1),
// which permits optional linear whitespace around the comma directive
// separators. Directive names are tokens that never contain
// whitespace, so skip it here; otherwise a directive following
// "..., name" is keyed with a leading space and the lookups in
// computeResponse (realm, nonce, authzid) miss it.
if str[i] == ' ' || str[i] == '\t' {
continue
}
if str[i] != '=' {
key += string(str[i])
continue
@@ -307,6 +320,14 @@ func parseParams(str string) (map[string]string, error) {
m[key] = value
break
}
// Linear whitespace outside a quoted string is not part of the
// value: an unquoted value is a token and a quoted value's content
// is read in the quoted state below. Skipping it lets a challenge
// using the whitespace the #rule allows (e.g. `nonce="n" , qop=auth`)
// parse the same as the unspaced form.
if str[i] == ' ' || str[i] == '\t' {
continue
}
switch str[i] {
case ',':
m[key] = value
@@ -325,20 +346,34 @@ func parseParams(str string) (map[string]string, error) {
if i == len(str) {
return nil, fmt.Errorf("syntax error on %d", i)
}
if str[i] != '"' {
switch {
case escaped:
// RFC 2831 section 7.1 quoted-pair: a backslash escapes the
// following character, so the next byte is taken literally
// (this is how a server sends a literal " or \ in a realm or
// nonce).
value += string(str[i])
} else {
escaped = false
case str[i] == '\\':
escaped = true
case str[i] == '"':
state = 1
default:
value += string(str[i])
}
}
}
return m, nil
}
func computeResponse(params map[string]string, uri, username, password string) string {
func computeResponse(params map[string]string, uri, username, password string) (string, error) {
nc := "00000001"
qop := "auth"
cnonce := enchex.EncodeToString(randomBytes(16))
rb, err := randomBytes(16)
if err != nil {
return "", err
}
cnonce := enchex.EncodeToString(rb)
x := username + ":" + params["realm"] + ":" + password
y := md5Hash([]byte(x))
@@ -361,14 +396,24 @@ func computeResponse(params map[string]string, uri, username, password string) s
resp := enchex.EncodeToString(md5Hash([]byte(kd)))
return fmt.Sprintf(
`username="%s",realm="%s",nonce="%s",cnonce="%s",nc=00000001,qop=%s,digest-uri="%s",response=%s`,
username,
params["realm"],
params["nonce"],
quotedStringEscape(username),
quotedStringEscape(params["realm"]),
quotedStringEscape(params["nonce"]),
cnonce,
qop,
uri,
quotedStringEscape(uri),
resp,
)
), nil
}
// quotedStringEscape escapes the two characters that may not appear unescaped
// inside a DIGEST-MD5 quoted string per RFC 2831 section 7.1: the backslash
// and the double quote. The backslash is replaced first so the quotes escaped
// afterwards are not doubled.
func quotedStringEscape(s string) string {
s = strings.ReplaceAll(s, `\`, `\\`)
s = strings.ReplaceAll(s, `"`, `\"`)
return s
}
func md5Hash(b []byte) []byte {
@@ -377,12 +422,12 @@ func md5Hash(b []byte) []byte {
return hasher.Sum(nil)
}
func randomBytes(len int) []byte {
b := make([]byte, len)
for i := 0; i < len; i++ {
b[i] = byte(rand.Intn(256))
func randomBytes(length int) ([]byte, error) {
b := make([]byte, length)
if _, err := rand.Read(b); err != nil {
return nil, err
}
return b
return b, nil
}
var externalBindRequest = requestFunc(func(envelope *ber.Packet) error {
+3
View File
@@ -46,6 +46,9 @@ func (l *Conn) Compare(dn, attribute, value string) (bool, error) {
return false, err
}
if len(packet.Children) < 2 {
return false, fmt.Errorf("ldap: malformed response: expected at least 2 children, got %d", len(packet.Children))
}
if packet.Children[1].Tag == ApplicationCompareResponse {
err := GetLDAPError(packet)
+55 -11
View File
@@ -8,6 +8,7 @@ import (
"fmt"
"net"
"net/url"
"strings"
"sync"
"sync/atomic"
"time"
@@ -112,7 +113,11 @@ type Conn struct {
outstandingRequests uint
messageMutex sync.Mutex
err error
// errMutex guards err only. It is a leaf lock: processMessages and reader
// record errors while another goroutine may hold messageMutex, so err must
// not share messageMutex or those writers could deadlock.
errMutex sync.Mutex
err error
}
var _ Client = &Conn{}
@@ -160,10 +165,18 @@ type DialContext struct {
func (dc *DialContext) dial(u *url.URL) (net.Conn, error) {
if u.Scheme == "ldapi" {
if u.Path == "" || u.Path == "/" {
u.Path = "/var/run/slapd/ldapi"
// RFC 4516 (and draft-chu-ldap-ldapi) put the socket path in the
// host component, percent-encoded; the path is an optional DN.
// parseLDAPURL has already decoded the host. Accept the older
// ldapi:///path form too so existing callers keep working.
path := u.Host
if path == "" {
path = u.Path
}
return dc.dialer.Dial("unix", u.Path)
if path == "" || path == "/" {
path = "/var/run/slapd/ldapi"
}
return dc.dialer.Dial("unix", path)
}
host, port, err := net.SplitHostPort(u.Host)
@@ -222,12 +235,33 @@ func DialTLS(network, addr string, config *tls.Config) (*Conn, error) {
return conn, nil
}
// parseLDAPURL parses an LDAP URL. It defers to net/url for the common
// ldap/ldaps/cldap schemes, but handles ldapi specially: the spec puts the
// unix socket path in the host, percent-encoded with %2F, and net/url rejects
// that as invalid. Pull the host out manually and decode it.
func parseLDAPURL(addr string) (*url.URL, error) {
const ldapi = "ldapi://"
if !strings.HasPrefix(addr, ldapi) {
return url.Parse(addr)
}
rest := addr[len(ldapi):]
host, path := rest, ""
if i := strings.IndexByte(rest, '/'); i >= 0 {
host, path = rest[:i], rest[i:]
}
decodedHost, err := url.PathUnescape(host)
if err != nil {
return nil, fmt.Errorf("ldapi: invalid host %q: %w", host, err)
}
return &url.URL{Scheme: "ldapi", Host: decodedHost, Path: path}, nil
}
// DialURL connects to the given ldap URL.
// The following schemas are supported: ldap://, ldaps://, ldapi://,
// and cldap:// (RFC1798, deprecated but used by Active Directory).
// On success a new Conn for the connection is returned.
func DialURL(addr string, opts ...DialOpt) (*Conn, error) {
u, err := url.Parse(addr)
u, err := parseLDAPURL(addr)
if err != nil {
return nil, NewError(ErrorNetwork, err)
}
@@ -338,11 +372,21 @@ func (l *Conn) nextMessageID() int64 {
// GetLastError returns the last recorded error from goroutines like processMessages and reader.
// Only the last recorded error will be returned.
func (l *Conn) GetLastError() error {
l.messageMutex.Lock()
defer l.messageMutex.Unlock()
l.errMutex.Lock()
defer l.errMutex.Unlock()
return l.err
}
// setError records the connection's last error. The background goroutines that
// call it (processMessages, reader, the per-request timeout helper and the
// SearchAsync worker) run concurrently with callers of GetLastError, so the
// write must take the mutex the getter reads under.
func (l *Conn) setError(err error) {
l.errMutex.Lock()
defer l.errMutex.Unlock()
l.err = err
}
// StartTLS sends the command to start a TLS session and then creates a new TLS Client
func (l *Conn) StartTLS(config *tls.Config) error {
if l.isTLS {
@@ -491,7 +535,7 @@ func (l *Conn) sendProcessMessage(message *messagePacket) bool {
func (l *Conn) processMessages() {
defer func() {
if err := recover(); err != nil {
l.err = fmt.Errorf("ldap: recovered panic in processMessages: %v", err)
l.setError(fmt.Errorf("ldap: recovered panic in processMessages: %v", err))
}
for messageID, msgCtx := range l.messageContexts {
// If we are closing due to an error, inform anyone who
@@ -541,7 +585,7 @@ func (l *Conn) processMessages() {
timer := time.NewTimer(time.Duration(requestTimeout))
defer func() {
if err := recover(); err != nil {
l.err = fmt.Errorf("ldap: recovered panic in RequestTimeout: %v", err)
l.setError(fmt.Errorf("ldap: recovered panic in RequestTimeout: %v", err))
}
timer.Stop()
@@ -563,7 +607,7 @@ func (l *Conn) processMessages() {
if msgCtx, ok := l.messageContexts[message.MessageID]; ok {
msgCtx.sendResponse(&PacketResponse{message.Packet, nil}, time.Duration(l.getTimeout()))
} else {
l.err = fmt.Errorf("ldap: received unexpected message %d, %v", message.MessageID, l.IsClosing())
l.setError(fmt.Errorf("ldap: received unexpected message %d, %v", message.MessageID, l.IsClosing()))
l.Debug.PrintPacket(message.Packet)
}
case MessageTimeout:
@@ -590,7 +634,7 @@ func (l *Conn) reader() {
cleanstop := false
defer func() {
if err := recover(); err != nil {
l.err = fmt.Errorf("ldap: recovered panic in reader: %v", err)
l.setError(fmt.Errorf("ldap: recovered panic in reader: %v", err))
}
if !cleanstop {
l.Close()
+84 -27
View File
@@ -565,12 +565,20 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
case 1:
// just type, no criticality or value
packet.Children[0].Description = "Control Type (" + ControlTypeMap[ControlType] + ")"
ControlType = packet.Children[0].Value.(string)
ct, ok := packet.Children[0].Value.(string)
if !ok {
return nil, fmt.Errorf("control type is not a string: %T", packet.Children[0].Value)
}
ControlType = ct
case 2:
packet.Children[0].Description = "Control Type (" + ControlTypeMap[ControlType] + ")"
if packet.Children[0].Value != nil {
ControlType = packet.Children[0].Value.(string)
ct, ok := packet.Children[0].Value.(string)
if !ok {
return nil, fmt.Errorf("control type is not a string: %T", packet.Children[0].Value)
}
ControlType = ct
} else if packet.Children[0].Data != nil {
ControlType = packet.Children[0].Data.String()
} else {
@@ -579,9 +587,9 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
// Children[1] could be criticality or value (both are optional)
// duck-type on whether this is a boolean
if _, ok := packet.Children[1].Value.(bool); ok {
if crit, ok := packet.Children[1].Value.(bool); ok {
packet.Children[1].Description = "Criticality"
Criticality = packet.Children[1].Value.(bool)
Criticality = crit
} else {
packet.Children[1].Description = "Control Value"
value = packet.Children[1]
@@ -589,10 +597,18 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
case 3:
packet.Children[0].Description = "Control Type (" + ControlTypeMap[ControlType] + ")"
ControlType = packet.Children[0].Value.(string)
ct, ok := packet.Children[0].Value.(string)
if !ok {
return nil, fmt.Errorf("control type is not a string: %T", packet.Children[0].Value)
}
ControlType = ct
packet.Children[1].Description = "Criticality"
Criticality = packet.Children[1].Value.(bool)
crit, ok := packet.Children[1].Value.(bool)
if !ok {
return nil, fmt.Errorf("criticality is not a bool: %T", packet.Children[1].Value)
}
Criticality = crit
packet.Children[2].Description = "Control Value"
value = packet.Children[2]
@@ -606,6 +622,9 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
case ControlTypeManageDsaIT:
return NewControlManageDsaIT(Criticality), nil
case ControlTypePaging:
if value == nil {
return nil, fmt.Errorf("paging control value is missing")
}
value.Description += " (Paging)"
c := new(ControlPaging)
if value.Value != nil {
@@ -617,11 +636,21 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
value.Value = nil
value.AppendChild(valueChildren)
}
if len(value.Children) == 0 {
return nil, fmt.Errorf("paging control value is empty")
}
value = value.Children[0]
value.Description = "Search Control Value"
if len(value.Children) < 2 {
return nil, fmt.Errorf("paging control value has %d children, expected 2", len(value.Children))
}
value.Children[0].Description = "Paging Size"
value.Children[1].Description = "Cookie"
c.PagingSize = uint32(value.Children[0].Value.(int64))
pagingSize, ok := value.Children[0].Value.(int64)
if !ok {
return nil, fmt.Errorf("paging size is not an integer: %T", value.Children[0].Value)
}
c.PagingSize = uint32(pagingSize)
c.Cookie = value.Children[1].Data.Bytes()
value.Children[1].Value = c.Cookie
return c, nil
@@ -729,7 +758,16 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
c.ControlType = ControlType
c.Criticality = Criticality
if value != nil {
c.ControlValue = value.Value.(string)
// A non-conforming or malicious server can send a non-string
// (or nil) value here; the previous unchecked cast panicked
// the calling goroutine, see #561. Fall back to the raw bytes
// when the value isn't a string so we surface an error
// instead of crashing.
if s, ok := value.Value.(string); ok {
c.ControlValue = s
} else if value.Data != nil {
c.ControlValue = value.Data.String()
}
}
return c, nil
}
@@ -921,28 +959,44 @@ func (c *ControlServerSideSorting) GetControlType() string {
}
func NewControlServerSideSorting(value *ber.Packet) (*ControlServerSideSorting, error) {
sortKeys := []*SortKey{}
val, err := ber.DecodePacketErr(value.Data.Bytes())
if err != nil {
return nil, fmt.Errorf("decode packet err: %s", err)
}
val := value.Children[1].Children
if len(val) != 1 {
if len(val.Children) == 0 {
return nil, fmt.Errorf("no sequence value in packet")
}
sequences := val[0].Children
var sortKeys []*SortKey
for i, sequence := range sequences {
sortKey := new(SortKey)
if len(sequence.Children) < 2 {
return nil, fmt.Errorf("attributeType or matchingRule is missing from sequence %d", i)
for i, sequence := range val.Children {
if len(sequence.Children) < 1 || len(sequence.Children) > 3 {
return nil, fmt.Errorf("attributeType is missing from sequence %d", i)
}
sortKey.AttributeType = sequence.Children[0].Value.(string)
sortKey.MatchingRule = sequence.Children[1].Value.(string)
sortKey := new(SortKey)
if len(sequence.Children) == 3 {
sortKey.Reverse = sequence.Children[2].Value.(bool)
for _, child := range sequence.Children {
switch {
case child.ClassType == ber.ClassUniversal && child.Tag == ber.TagOctetString:
// A constructed-form OCTET STRING matches this case but leaves
// Value nil; guard the assertion so a malformed attributeType is
// rejected below rather than panicking.
if attrType, ok := child.Value.(string); ok {
sortKey.AttributeType = attrType
}
case child.ClassType == ber.ClassContext && child.Tag == 0:
sortKey.MatchingRule = child.Data.String()
case child.ClassType == ber.ClassContext && child.Tag == 1:
b := child.Data.Bytes()
sortKey.Reverse = len(b) > 0 && b[0] != 0
}
}
if sortKey.AttributeType == "" {
return nil, fmt.Errorf("attributeType is missing from sequence %d", i)
}
sortKeys = append(sortKeys, sortKey)
@@ -959,7 +1013,6 @@ func (c *ControlServerSideSorting) Encode() *ber.Packet {
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
control := ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, c.GetControlType(), "Control Type")
value := ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, nil, "Control Value")
seqs := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "SortKeyList")
for _, f := range c.SortKeys {
@@ -968,9 +1021,11 @@ func (c *ControlServerSideSorting) Encode() *ber.Packet {
seq.AppendChild(
ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, f.AttributeType, "attributeType"),
)
seq.AppendChild(
ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, f.MatchingRule, "orderingRule"),
)
if f.MatchingRule != "" {
seq.AppendChild(
ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, f.MatchingRule, "orderingRule"),
)
}
if f.Reverse {
seq.AppendChild(
ber.NewBoolean(ber.ClassContext, ber.TypePrimitive, 1, f.Reverse, "reverseOrder"),
@@ -980,7 +1035,7 @@ func (c *ControlServerSideSorting) Encode() *ber.Packet {
seqs.AppendChild(seq)
}
value.AppendChild(seqs)
value := ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, string(seqs.Bytes()), "Control Value")
packet.AppendChild(control)
packet.AppendChild(value)
@@ -1060,6 +1115,8 @@ func NewControlServerSideSortingResult(pkt *ber.Packet) (*ControlServerSideSorti
return nil, err
}
control.Result = ControlServerSideSortingCode(codeInt)
return control, nil
}
+3
View File
@@ -52,6 +52,9 @@ func (l *Conn) Del(delRequest *DelRequest) error {
return err
}
if len(packet.Children) < 2 {
return fmt.Errorf("ldap: malformed response: expected at least 2 children, got %d", len(packet.Children))
}
if packet.Children[1].Tag == ApplicationDelResponse {
err := GetLDAPError(packet)
if err != nil {
+54 -7
View File
@@ -1,14 +1,16 @@
package ldap
import (
"bytes"
"encoding/hex"
"errors"
"fmt"
ber "github.com/go-asn1-ber/asn1-ber"
"sort"
"strings"
"unicode"
"unicode/utf8"
ber "github.com/go-asn1-ber/asn1-ber"
)
// AttributeTypeAndValue represents an attributeTypeAndValue from https://tools.ietf.org/html/rfc4514
@@ -94,9 +96,21 @@ func (d *DN) String() string {
func stripLeadingAndTrailingSpaces(inVal string) string {
noSpaces := strings.Trim(inVal, " ")
// Re-add the trailing space if it was an escaped space
if len(noSpaces) > 0 && noSpaces[len(noSpaces)-1] == '\\' && inVal[len(inVal)-1] == ' ' {
noSpaces = noSpaces + " "
// Re-add the trailing space only if it was escaped. A trailing space is
// escaped when it is preceded by an odd number of backslashes; an even
// number leaves the space unescaped (each "\\" is a literal backslash), so
// the space is insignificant and stays stripped. Counting only the final
// backslash treated "\\ " (a literal backslash plus an insignificant
// space) as an escaped space, keeping a spurious trailing space in the
// decoded value.
if len(noSpaces) > 0 && inVal[len(inVal)-1] == ' ' {
backslashes := 0
for i := len(noSpaces) - 1; i >= 0 && noSpaces[i] == '\\'; i-- {
backslashes++
}
if backslashes%2 == 1 {
noSpaces = noSpaces + " "
}
}
return noSpaces
@@ -116,6 +130,16 @@ func decodeString(str string) (string, error) {
// If the character is not an escape character, just add it to the
// builder and continue
if char != '\\' {
// RFC 4514 section 2.4: these characters must appear escaped
// (either as "\X" or as "\XX" hex) when present in an AttributeValue.
// Reject the raw form here so that callers don't silently accept
// input that violates the grammar.
switch char {
case '"', ';', '<', '>':
return "", fmt.Errorf("got unescaped character: '%s'", string(char))
case 0:
return "", fmt.Errorf("got unescaped NULL character")
}
builder.WriteRune(char)
continue
}
@@ -233,10 +257,18 @@ func decodeEncodedString(str string) (string, error) {
return "", fmt.Errorf("failed to decode BER encoding: %w", err)
}
packet, err := ber.DecodePacketErr(decoded)
// RFC 4514 section 2.4: the value following '#' is the hex encoding of the
// BER encoding of a single AttributeValue. Read exactly one element and
// reject any leftover octets, otherwise bytes appended after the value are
// silently dropped and two different DN strings decode to the same value.
reader := bytes.NewBuffer(decoded)
packet, err := ber.ReadPacket(reader)
if err != nil {
return "", fmt.Errorf("failed to decode BER encoding: %w", err)
}
if reader.Len() != 0 {
return "", errors.New("failed to decode BER encoding: trailing bytes after value")
}
return packet.Data.String(), nil
}
@@ -352,10 +384,19 @@ func (r *RelativeDN) Equal(other *RelativeDN) bool {
}
func (r *RelativeDN) hasAllAttributes(attrs []*AttributeTypeAndValue) bool {
// Each candidate attribute must match a distinct attribute of the receiver.
// Without consuming matches this is a set containment test, so a multi-valued
// RDN that repeats an attributeTypeAndValue would compare equal to one that
// repeats a different pair the same number of times.
matched := make([]bool, len(r.Attributes))
for _, attr := range attrs {
found := false
for _, myattr := range r.Attributes {
for i, myattr := range r.Attributes {
if matched[i] {
continue
}
if myattr.Equal(attr) {
matched[i] = true
found = true
break
}
@@ -415,10 +456,16 @@ func (r *RelativeDN) EqualFold(other *RelativeDN) bool {
}
func (r *RelativeDN) hasAllAttributesFold(attrs []*AttributeTypeAndValue) bool {
// See hasAllAttributes: matches are consumed so multiplicity is respected.
matched := make([]bool, len(r.Attributes))
for _, attr := range attrs {
found := false
for _, myattr := range r.Attributes {
for i, myattr := range r.Attributes {
if matched[i] {
continue
}
if myattr.EqualFold(attr) {
matched[i] = true
found = true
break
}
+8
View File
@@ -89,6 +89,14 @@ func (l *Conn) Extended(er *ExtendedRequest) (*ExtendedResponse, error) {
}
for _, child := range extResp.Children {
// responseName [10] and responseValue [11] are context-class and
// optional. The preceding resultCode is a universal ENUMERATED whose
// tag number (10) is the same as responseName, so a child must be
// matched on its class as well, otherwise the resultCode is read as
// the responseName whenever the server omits the latter.
if child.ClassType != ber.ClassContext {
continue
}
switch child.Tag {
case ber.TagEnumerated:
response.Name = child.Data.String()
+8 -8
View File
@@ -131,7 +131,7 @@ func DecompileFilter(packet *ber.Packet) (_ string, err error) {
buf.WriteString(childStr)
case FilterSubstrings:
buf.WriteString(ber.DecodeString(packet.Children[0].Data.Bytes()))
buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[0].Data.Bytes())))
buf.WriteByte('=')
for i, child := range packet.Children[1].Children {
if i == 0 && child.Tag != FilterSubstringsInitial {
@@ -143,22 +143,22 @@ func DecompileFilter(packet *ber.Packet) (_ string, err error) {
}
}
case FilterEqualityMatch:
buf.WriteString(ber.DecodeString(packet.Children[0].Data.Bytes()))
buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[0].Data.Bytes())))
buf.WriteByte('=')
buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes())))
case FilterGreaterOrEqual:
buf.WriteString(ber.DecodeString(packet.Children[0].Data.Bytes()))
buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[0].Data.Bytes())))
buf.WriteString(">=")
buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes())))
case FilterLessOrEqual:
buf.WriteString(ber.DecodeString(packet.Children[0].Data.Bytes()))
buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[0].Data.Bytes())))
buf.WriteString("<=")
buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes())))
case FilterPresent:
buf.WriteString(ber.DecodeString(packet.Data.Bytes()))
buf.WriteString(EscapeFilter(ber.DecodeString(packet.Data.Bytes())))
buf.WriteString("=*")
case FilterApproxMatch:
buf.WriteString(ber.DecodeString(packet.Children[0].Data.Bytes()))
buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[0].Data.Bytes())))
buf.WriteString("~=")
buf.WriteString(EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes())))
case FilterExtensibleMatch:
@@ -181,14 +181,14 @@ func DecompileFilter(packet *ber.Packet) (_ string, err error) {
}
if len(attr) > 0 {
buf.WriteString(attr)
buf.WriteString(EscapeFilter(attr))
}
if dnAttributes {
buf.WriteString(":dn")
}
if len(matchingRule) > 0 {
buf.WriteString(":")
buf.WriteString(matchingRule)
buf.WriteString(EscapeFilter(matchingRule))
}
buf.WriteString(":=")
buf.WriteString(EscapeFilter(value))
+3
View File
@@ -89,6 +89,9 @@ func (l *Conn) ModifyDN(m *ModifyDNRequest) error {
return err
}
if len(packet.Children) < 2 {
return fmt.Errorf("ldap: malformed response: expected at least 2 children, got %d", len(packet.Children))
}
if packet.Children[1].Tag == ApplicationModifyDNResponse {
err := GetLDAPError(packet)
if err != nil {
+7
View File
@@ -121,6 +121,9 @@ func (l *Conn) Modify(modifyRequest *ModifyRequest) error {
return err
}
if len(packet.Children) < 2 {
return fmt.Errorf("ldap: malformed response: expected at least 2 children, got %d", len(packet.Children))
}
if packet.Children[1].Tag == ApplicationModifyResponse {
err := GetLDAPError(packet)
if err != nil {
@@ -159,6 +162,10 @@ func (l *Conn) ModifyWithResult(modifyRequest *ModifyRequest) (*ModifyResult, er
return nil, err
}
if len(packet.Children) < 2 {
return nil, fmt.Errorf("ldap: malformed response: expected at least 2 children, got %d", len(packet.Children))
}
switch packet.Children[1].Tag {
case ApplicationModifyResponse:
if err = GetLDAPError(packet); err != nil {
+7 -1
View File
@@ -93,6 +93,9 @@ func (l *Conn) PasswordModify(passwordModifyRequest *PasswordModifyRequest) (*Pa
result := &PasswordModifyResult{}
if len(packet.Children) < 2 {
return nil, fmt.Errorf("ldap: malformed response: expected at least 2 children, got %d", len(packet.Children))
}
if packet.Children[1].Tag == ApplicationExtendedResponse {
if err = GetLDAPError(packet); err != nil {
result.Referral = getReferral(err, packet)
@@ -106,7 +109,10 @@ func (l *Conn) PasswordModify(passwordModifyRequest *PasswordModifyRequest) (*Pa
extendedResponse := packet.Children[1]
for _, child := range extendedResponse.Children {
if child.Tag == ber.TagEmbeddedPDV {
passwordModifyResponseValue := ber.DecodePacket(child.Data.Bytes())
passwordModifyResponseValue, err := ber.DecodePacketErr(child.Data.Bytes())
if err != nil {
return nil, fmt.Errorf("ldap: failed to decode PasswordModifyResponseValue: %s", err)
}
if len(passwordModifyResponseValue.Children) == 1 {
if passwordModifyResponseValue.Children[0].Tag == ber.TagEOC {
result.GeneratedPassword = ber.DecodeString(passwordModifyResponseValue.Children[0].Data.Bytes())
+8
View File
@@ -101,6 +101,14 @@ func getReferral(err error, packet *ber.Packet) (referral string) {
continue
}
// A Referral is a SEQUENCE SIZE (1..MAX) OF uri, but a non-conforming or
// malicious server can send an empty SEQUENCE. Skip it instead of indexing
// child.Children[0], which would panic the goroutine that called Modify or
// PasswordModify.
if len(child.Children) == 0 {
continue
}
if referral, ok = child.Children[0].Value.(string); ok {
return referral
}
+40 -16
View File
@@ -66,12 +66,28 @@ func (r *searchResponse) Next() bool {
return true
}
// send enqueues a result on the result channel, giving up when ctx is
// cancelled so an abandoned consumer cannot block the search goroutine
// forever on a full buffer. It reports whether the result was handed off to
// the channel; a true return does not mean the consumer received it. The
// give-up is best-effort: if ctx is already cancelled but buffer space is
// available, the result may still be enqueued. Callers that terminate the
// stream regardless of the outcome may ignore the return value.
func (r *searchResponse) send(ctx context.Context, res *SearchSingleResult) bool {
select {
case r.ch <- res:
return true
case <-ctx.Done():
return false
}
}
func (r *searchResponse) start(ctx context.Context, searchRequest *SearchRequest) {
go func() {
defer func() {
close(r.ch)
if err := recover(); err != nil {
r.conn.err = fmt.Errorf("ldap: recovered panic in searchResponse: %v", err)
r.conn.setError(fmt.Errorf("ldap: recovered panic in searchResponse: %v", err))
}
}()
@@ -84,14 +100,14 @@ func (r *searchResponse) start(ctx context.Context, searchRequest *SearchRequest
// encode search request
err := searchRequest.appendTo(packet)
if err != nil {
r.ch <- &SearchSingleResult{Error: err}
r.send(ctx, &SearchSingleResult{Error: err})
return
}
r.conn.Debug.PrintPacket(packet)
msgCtx, err := r.conn.sendMessage(packet)
if err != nil {
r.ch <- &SearchSingleResult{Error: err}
r.send(ctx, &SearchSingleResult{Error: err})
return
}
defer r.conn.finishMessage(msgCtx)
@@ -106,19 +122,19 @@ func (r *searchResponse) start(ctx context.Context, searchRequest *SearchRequest
case packetResponse, ok := <-msgCtx.responses:
if !ok {
err := NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
r.ch <- &SearchSingleResult{Error: err}
r.send(ctx, &SearchSingleResult{Error: err})
return
}
packet, err = packetResponse.ReadPacket()
r.conn.Debug.Printf("%d: got response %p", msgCtx.id, packet)
if err != nil {
r.ch <- &SearchSingleResult{Error: err}
r.send(ctx, &SearchSingleResult{Error: err})
return
}
if r.conn.Debug {
if err := addLDAPDescriptions(packet); err != nil {
r.ch <- &SearchSingleResult{Error: err}
r.send(ctx, &SearchSingleResult{Error: err})
return
}
ber.PrintPacket(packet)
@@ -133,22 +149,26 @@ func (r *searchResponse) start(ctx context.Context, searchRequest *SearchRequest
},
}
if len(packet.Children) != 3 {
r.ch <- result
if !r.send(ctx, result) {
return
}
continue
}
decoded, err := DecodeControl(packet.Children[2].Children[0])
if err != nil {
werr := fmt.Errorf("failed to decode search result entry: %w", err)
result.Error = werr
r.ch <- result
r.send(ctx, result)
return
}
result.Controls = append(result.Controls, decoded)
r.ch <- result
if !r.send(ctx, result) {
return
}
case ApplicationSearchResultDone:
if err := GetLDAPError(packet); err != nil {
r.ch <- &SearchSingleResult{Error: err}
r.send(ctx, &SearchSingleResult{Error: err})
return
}
if len(packet.Children) == 3 {
@@ -157,33 +177,37 @@ func (r *searchResponse) start(ctx context.Context, searchRequest *SearchRequest
decodedChild, err := DecodeControl(child)
if err != nil {
werr := fmt.Errorf("failed to decode child control: %w", err)
r.ch <- &SearchSingleResult{Error: werr}
r.send(ctx, &SearchSingleResult{Error: werr})
return
}
result.Controls = append(result.Controls, decodedChild)
}
r.ch <- result
r.send(ctx, result)
}
foundSearchSingleResultDone = true
case ApplicationSearchResultReference:
ref := packet.Children[1].Children[0].Value.(string)
r.ch <- &SearchSingleResult{Referral: ref}
if !r.send(ctx, &SearchSingleResult{Referral: ref}) {
return
}
case ApplicationIntermediateResponse:
decoded, err := DecodeControl(packet.Children[1])
if err != nil {
werr := fmt.Errorf("failed to decode intermediate response: %w", err)
r.ch <- &SearchSingleResult{Error: werr}
r.send(ctx, &SearchSingleResult{Error: werr})
return
}
result := &SearchSingleResult{}
result.Controls = append(result.Controls, decoded)
r.ch <- result
if !r.send(ctx, result) {
return
}
default:
err := fmt.Errorf("unknown tag: %d", packet.Children[1].Tag)
r.ch <- &SearchSingleResult{Error: err}
r.send(ctx, &SearchSingleResult{Error: err})
return
}
}
+6 -2
View File
@@ -624,7 +624,10 @@ func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
// SearchAsync performs a search request and returns all search results asynchronously.
// This means you get all results until an error happens (or the search successfully finished),
// e.g. for size / time limited requests all are received until the limit is reached.
// To stop the search, call cancel function of the context.
// To stop the search, call the cancel function of the context; Next may
// still deliver a few results received before the cancellation took effect.
// Cancellation is not reported as an error: Err returns nil, same as a
// successfully completed search.
func (l *Conn) SearchAsync(
ctx context.Context, searchRequest *SearchRequest, bufferSize int) Response {
r := newSearchResponse(l, bufferSize)
@@ -635,7 +638,8 @@ func (l *Conn) SearchAsync(
// Syncrepl is a short name for LDAP Sync Replication engine that works on the
// consumer-side. This can perform a persistent search and returns an entry
// when the entry is updated on the server side.
// To stop the search, call cancel function of the context.
// To stop the search, call the cancel function of the context; cancellation
// is not reported as an error, Err returns nil.
func (l *Conn) Syncrepl(
ctx context.Context, searchRequest *SearchRequest, bufferSize int,
mode ControlSyncRequestMode, cookie []byte, reloadHint bool,
+8 -1
View File
@@ -24,11 +24,18 @@ func (l *Conn) Unbind() error {
return ErrConnUnbound
}
_, err := l.doRequest(unbindRequest{})
msgCtx, err := l.doRequest(unbindRequest{})
if err != nil {
return err
}
// Finish the message context so its done channel is closed. Without
// this, a server-initiated disconnect racing with Close can deadlock:
// processMessages cleanup tries to deliver closeErr to the orphaned
// context via sendResponse, which blocks forever on the unclosed done
// channel, preventing chanConfirm from being signalled.
l.finishMessage(msgCtx)
// Sending an unbindRequest will make the connection unusable.
// Pending requests will fail with:
// LDAP Result Code 200 "Network Error": ldap: response channel closed
+7 -1
View File
@@ -19,5 +19,11 @@ func (l *Conn) WhoAmI(controls []Control) (*WhoAmIResult, error) {
return nil, err
}
return &WhoAmIResult{AuthzID: resp.Value.Data.String()}, nil
// responseValue is OPTIONAL (RFC 4532); Extended leaves Value nil when the
// server omits it. Guard the dereference and report an empty authzId.
result := &WhoAmIResult{}
if resp.Value != nil {
result.AuthzID = resp.Value.Data.String()
}
return result, nil
}
+1 -1
View File
@@ -5,7 +5,7 @@ import os
import subprocess
VERSION = "1.8.22"
VERSION = "1.8.23"
def run(*args: str):
+30 -6
View File
@@ -5,6 +5,7 @@
package webp
import (
"bufio"
"bytes"
"errors"
"image"
@@ -123,16 +124,39 @@ func decode(r io.Reader, configOnly bool) (image.Image, image.Config, error) {
c, err := vp8l.DecodeConfig(chunkData)
return nil, c, err
}
if seenVP8X {
// Verify the VP8L chunk dimensions match before
// calling vp8l.Decode, to catch malicious images
// following a small VP8X header with a huge VP8L chunk.
//
// Peek the VP8L header.
//
// chunkData is always an unbuffered riff.chunkReader.
// Creating a bufio.Reader here doesn't add any
// inefficiency, since the vp8l package will do it
// if we don't.
bufReader := bufio.NewReader(chunkData)
chunkData = bufReader
const vp8lHeaderSize = 5
vp8lHeader, err := bufReader.Peek(vp8lHeaderSize)
if err != nil {
if err == io.EOF {
err = errInvalidFormat
}
return nil, image.Config{}, err
}
c, err := vp8l.DecodeConfig(bytes.NewReader(vp8lHeader))
if err != nil {
return nil, image.Config{}, err
}
if c.Width != int(widthMinusOne)+1 || c.Height != int(heightMinusOne)+1 {
return nil, image.Config{}, errInvalidFormat
}
}
m, err := vp8l.Decode(chunkData)
if err != nil {
return nil, image.Config{}, err
}
if seenVP8X {
bounds := m.Bounds()
if bounds.Dx() != int(widthMinusOne)+1 || bounds.Dy() != int(heightMinusOne)+1 {
return nil, image.Config{}, errInvalidFormat
}
}
return m, image.Config{}, nil
case fccVP8X:
if seenVP8X {
+18 -17
View File
@@ -17,8 +17,8 @@
// It uses data-independent memory access, which is preferred for password
// hashing and password-based key derivation. Argon2i requires more passes over
// memory than Argon2id to protect from trade-off attacks. The recommended
// parameters (taken from [RFC 9106 Section 7.3]) for non-interactive operations are time=3 and to
// use the maximum available memory.
// parameters (taken from [RFC 9106 Section 7.3]) for non-interactive
// operations are time=3 and to use the maximum available memory.
//
// # Argon2id
//
@@ -26,11 +26,14 @@
// Argon2i and Argon2d. It uses data-independent memory access for the first
// half of the first iteration over the memory and data-dependent memory access
// for the rest. Argon2id is side-channel resistant and provides better brute-
// force cost savings due to time-memory tradeoffs than Argon2i. The recommended
// parameters for non-interactive operations (taken from [RFC 9106 Section 7.3]) are time=1 and to
// use the maximum available memory.
// force cost savings due to time-memory tradeoffs than Argon2i. [RFC 9106
// Section 4] recommends time=1, memory=2*1024*1024 KiB (2 GiB), and threads=4
// as the first recommended option. If much less memory is available, it
// recommends time=3, memory=64*1024 KiB (64 MiB), and threads=4 as the second
// recommended option.
//
// [argon2-specs.pdf]: https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf
// [RFC 9106 Section 4]: https://www.rfc-editor.org/rfc/rfc9106.html#section-4
// [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3
package argon2
@@ -59,9 +62,9 @@ const (
//
// key := argon2.Key([]byte("some password"), salt, 3, 32*1024, 4, 32)
//
// [RFC 9106 Section 7.3] recommends time=3, and memory=32*1024 as a sensible number.
// If using that amount of memory (32 MB) is not possible in some contexts then
// the time parameter can be increased to compensate.
// The example above uses time=3 and memory=32*1024. Argon2i generally
// requires more passes over memory than Argon2id. If in doubt, prefer IDKey
// and its Argon2id parameter recommendations.
//
// The time parameter specifies the number of passes over the memory and the
// memory parameter specifies the size of the memory in KiB. For example
@@ -69,8 +72,6 @@ const (
// adjusted to the number of available CPUs. The cost parameters should be
// increased as memory latency and CPU parallelism increases. Remember to get a
// good random salt.
//
// [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3
func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte {
return deriveKey(argon2i, password, salt, nil, nil, time, memory, threads, keyLen)
}
@@ -83,20 +84,20 @@ func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint3
// For example, you can get a derived key for e.g. AES-256 (which needs a
// 32-byte key) by doing:
//
// key := argon2.IDKey([]byte("some password"), salt, 1, 64*1024, 4, 32)
// key := argon2.IDKey([]byte("some password"), salt, 1, 2*1024*1024, 4, 32)
//
// [RFC 9106 Section 7.3] recommends time=1, and memory=64*1024 as a sensible number.
// If using that amount of memory (64 MB) is not possible in some contexts then
// the time parameter can be increased to compensate.
// The example above uses the first [RFC 9106 Section 4] recommended option.
// If much less memory is available, the second recommended option is time=3,
// memory=64*1024 KiB (64 MiB), and threads=4.
//
// The time parameter specifies the number of passes over the memory and the
// memory parameter specifies the size of the memory in KiB. For example
// memory=64*1024 sets the memory cost to ~64 MB. The number of threads can be
// adjusted to the numbers of available CPUs. The cost parameters should be
// memory=2*1024*1024 sets the memory cost to ~2 GiB. The number of threads can
// be adjusted to the numbers of available CPUs. The cost parameters should be
// increased as memory latency and CPU parallelism increases. Remember to get a
// good random salt.
//
// [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3
// [RFC 9106 Section 4]: https://www.rfc-editor.org/rfc/rfc9106.html#section-4
func IDKey(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte {
return deriveKey(argon2id, password, salt, nil, nil, time, memory, threads, keyLen)
}
+2
View File
@@ -41,6 +41,7 @@ func ForwardToAgent(client *ssh.Client, keyring Agent) error {
continue
}
go ssh.DiscardRequests(reqs)
go io.Copy(io.Discard, channel.Stderr())
go func() {
ServeAgent(keyring, channel)
channel.Close()
@@ -72,6 +73,7 @@ func ForwardToRemote(client *ssh.Client, addr string) error {
continue
}
go ssh.DiscardRequests(reqs)
go io.Copy(io.Discard, channel.Stderr())
go forwardUnixSocket(channel, addr)
}
}()
+47 -6
View File
@@ -304,19 +304,60 @@ func parseEd25519Key(req []byte) (*AddedKey, error) {
return addedKey, nil
}
func checkDSAParams(param *dsa.Parameters) error {
// SSH specifies FIPS 186-2, which only provided a single size
// (1024 bits) DSA key. FIPS 186-3 allows for larger key
// sizes, which would confuse SSH.
if l := param.P.BitLen(); l != 1024 {
return fmt.Errorf("ssh: unsupported DSA key size %d", l)
}
// FIPS 186-2 specifies that Q must be exactly 160 bits. We must enforce
// this to prevent DoS attacks where an attacker sends a huge Q which makes
// verification slow.
if l := param.Q.BitLen(); l != 160 {
return fmt.Errorf("ssh: unsupported DSA sub-prime size %d", l)
}
// The generator G is an element of the group, so it must be strictly less
// than the modulus P.
if param.G.Cmp(param.P) >= 0 {
return errors.New("ssh: DSA generator larger than modulus")
}
// G must be positive.
if param.G.Sign() <= 0 {
return errors.New("ssh: DSA generator must be positive")
}
return nil
}
func parseDSAKey(req []byte) (*AddedKey, error) {
var k dsaKeyMsg
if err := ssh.Unmarshal(req, &k); err != nil {
return nil, err
}
params := dsa.Parameters{
P: k.P,
Q: k.Q,
G: k.G,
}
if err := checkDSAParams(&params); err != nil {
return nil, err
}
// The public value Y must be a non-zero element of the group, i.e. strictly
// between 0 and P, to prevent a maliciously oversized Y from slowing
// signature operations.
if k.Y.Sign() <= 0 || k.Y.Cmp(k.P) >= 0 {
return nil, errors.New("agent: DSA public value Y out of range")
}
priv := &dsa.PrivateKey{
PublicKey: dsa.PublicKey{
Parameters: dsa.Parameters{
P: k.P,
Q: k.Q,
G: k.G,
},
Y: k.Y,
Parameters: params,
Y: k.Y,
},
X: k.X,
}
+26 -10
View File
@@ -182,14 +182,19 @@ func ParseKnownHosts(in []byte) (marker string, hosts []string, pubKey PublicKey
}
hosts := string(keyFields[0])
// keyFields[1] contains the key type (e.g. “ssh-rsa”).
// However, that information is duplicated inside the
// base64-encoded key and so is ignored here.
// keyFields[1] contains the key type (e.g. "ssh-rsa"). This information
// is duplicated within the base64-encoded key blob. As OpenSSH's
// sshkey_read does, we verify that the declared key type matches the
// type embedded in the key blob.
wantType := string(keyFields[1])
key := bytes.Join(keyFields[2:], []byte(" "))
if pubKey, comment, err = parseAuthorizedKey(key); err != nil {
return "", nil, nil, "", nil, err
}
if pubKey.Type() != wantType {
return "", nil, nil, "", nil, fmt.Errorf("ssh: known hosts key type mismatch: human-readable type %q, encoded type %q", wantType, pubKey.Type())
}
return marker, strings.Split(hosts, ","), pubKey, comment, rest, nil
}
@@ -228,10 +233,17 @@ func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []str
}
if out, comment, err = parseAuthorizedKey(in[i:]); err == nil {
return out, comment, options, rest, nil
} else {
lastErr = err
// The first field contains the declared key type. As OpenSSH's
// sshkey_read does, we verify that it matches the type embedded in
// the key blob. Without this check, a single-token option (e.g.
// "restrict") appearing in the key type position could be silently
// discarded along with its intended effect.
if string(in[:i]) == out.Type() {
return out, comment, options, rest, nil
}
err = fmt.Errorf("ssh: authorized keys key type mismatch: human-readable type %q, encoded type %q", in[:i], out.Type())
}
lastErr = err
// No key type recognised. Maybe there's an options field at
// the beginning.
@@ -271,11 +283,15 @@ func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []str
}
if out, comment, err = parseAuthorizedKey(in[i:]); err == nil {
options = candidateOptions
return out, comment, options, rest, nil
} else {
lastErr = err
// As above, the declared key type (here following the options
// field) must match the type embedded in the key blob.
if string(in[:i]) == out.Type() {
options = candidateOptions
return out, comment, options, rest, nil
}
err = fmt.Errorf("ssh: authorized keys key type mismatch: human-readable type %q, encoded type %q", in[:i], out.Type())
}
lastErr = err
in = rest
continue
+10 -1
View File
@@ -44,7 +44,16 @@ type disconnectMsg struct {
}
func (d *disconnectMsg) Error() string {
return fmt.Sprintf("ssh: disconnect, reason %d: %s", d.Reason, d.Message)
return fmt.Sprintf("ssh: disconnect, reason %d: %q", d.Reason, sanitizeString(d.Message))
}
func sanitizeString(s string) string {
return strings.Map(func(r rune) rune {
if r == '\t' || (r >= ' ' && r < 0x7f) {
return r
}
return -1
}, s)
}
// See RFC 4253, section 7.1.
+7
View File
@@ -9,6 +9,13 @@
// implementing the golang.org/x/image/font.Face interface.
//
// The sibling golang.org/x/image/font/sfnt package provides a low-level API.
//
// # Security Considerations
//
// This package is not hardened against malicious inputs.
// Crashes, excessive CPU or memory consumption, or similar misbehavior
// caused by malicious or corrupt inputs will be handled as ordinary bugs,
// not vulnerabilities.
package opentype // import "golang.org/x/image/font/opentype"
import (
+7
View File
@@ -28,6 +28,13 @@
// another io.Writer, copying the underlying TTF file, but this package does
// not provide an encoder. Specifically, there is no API to build a different
// TTF file, whether 'from scratch' or by modifying an existing one.
//
// # Security Considerations
//
// This package is not hardened against malicious inputs.
// Crashes, excessive CPU or memory consumption, or similar misbehavior
// caused by malicious or corrupt inputs will be handled as ordinary bugs,
// not vulnerabilities.
package sfnt // import "golang.org/x/image/font/sfnt"
// This implementation was written primarily to the
+24 -5
View File
@@ -342,13 +342,25 @@ func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error {
}
}
// calcRowBytes returns the number of bytes in a row with numSamples samples per pixel
// and bytesPerSample bytes per sample.
calcRowBytes := func(xmin, xmax, numSamples int, bitsPerSample uint) int {
return int((int64(xmax-xmin)*int64(numSamples)*int64(bitsPerSample) + 7) / 8)
}
// calcRowOff returns the offset of the next row.
calcRowOff := func(y, ymin, rowBytes int) int {
return (y - ymin) * rowBytes
}
rMaxX := minInt(xmax, dst.Bounds().Max.X)
rMaxY := minInt(ymax, dst.Bounds().Max.Y)
switch d.mode {
case mGray, mGrayInvert:
rowBytes := calcRowBytes(xmin, xmax, 1, d.bpp)
if d.bpp == 16 {
img := dst.(*image.Gray16)
for y := ymin; y < rMaxY; y++ {
d.off = calcRowOff(y, ymin, rowBytes)
for x := xmin; x < rMaxX; x++ {
if d.off+2 > len(d.buf) {
return errNoPixels
@@ -360,14 +372,13 @@ func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error {
}
img.SetGray16(x, y, color.Gray16{v})
}
if rMaxX == img.Bounds().Max.X {
d.off += 2 * (xmax - img.Bounds().Max.X)
}
}
} else {
img := dst.(*image.Gray)
max := uint32((1 << d.bpp) - 1)
for y := ymin; y < rMaxY; y++ {
d.off = calcRowOff(y, ymin, rowBytes)
d.flushBits()
for x := xmin; x < rMaxX; x++ {
v, ok := d.readBits(d.bpp)
if !ok {
@@ -379,13 +390,15 @@ func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error {
}
img.SetGray(x, y, color.Gray{uint8(v)})
}
d.flushBits()
}
}
case mPaletted:
img := dst.(*image.Paletted)
pLen := len(d.palette)
rowBytes := calcRowBytes(xmin, xmax, 1, d.bpp)
for y := ymin; y < rMaxY; y++ {
d.off = calcRowOff(y, ymin, rowBytes)
d.flushBits()
for x := xmin; x < rMaxX; x++ {
v, ok := d.readBits(d.bpp)
if !ok {
@@ -397,12 +410,13 @@ func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error {
}
img.SetColorIndex(x, y, idx)
}
d.flushBits()
}
case mRGB:
rowBytes := calcRowBytes(xmin, xmax, 3, d.bpp)
if d.bpp == 16 {
img := dst.(*image.RGBA64)
for y := ymin; y < rMaxY; y++ {
d.off = calcRowOff(y, ymin, rowBytes)
for x := xmin; x < rMaxX; x++ {
if d.off+6 > len(d.buf) {
return errNoPixels
@@ -417,6 +431,7 @@ func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error {
} else {
img := dst.(*image.RGBA)
for y := ymin; y < rMaxY; y++ {
d.off = calcRowOff(y, ymin, rowBytes)
min := img.PixOffset(xmin, y)
max := img.PixOffset(rMaxX, y)
off := (y - ymin) * (xmax - xmin) * 3
@@ -433,9 +448,11 @@ func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error {
}
}
case mNRGBA:
rowBytes := calcRowBytes(xmin, xmax, 4, d.bpp)
if d.bpp == 16 {
img := dst.(*image.NRGBA64)
for y := ymin; y < rMaxY; y++ {
d.off = calcRowOff(y, ymin, rowBytes)
for x := xmin; x < rMaxX; x++ {
if d.off+8 > len(d.buf) {
return errNoPixels
@@ -461,9 +478,11 @@ func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error {
}
}
case mRGBA:
rowBytes := calcRowBytes(xmin, xmax, 4, d.bpp)
if d.bpp == 16 {
img := dst.(*image.RGBA64)
for y := ymin; y < rMaxY; y++ {
d.off = calcRowOff(y, ymin, rowBytes)
for x := xmin; x < rMaxX; x++ {
if d.off+8 > len(d.buf) {
return errNoPixels
+30 -6
View File
@@ -5,6 +5,7 @@
package webp
import (
"bufio"
"bytes"
"errors"
"image"
@@ -113,16 +114,39 @@ func decode(r io.Reader, configOnly bool) (image.Image, image.Config, error) {
c, err := vp8l.DecodeConfig(chunkData)
return nil, c, err
}
if seenVP8X {
// Verify the VP8L chunk dimensions match before
// calling vp8l.Decode, to catch malicious images
// following a small VP8X header with a huge VP8L chunk.
//
// Peek the VP8L header.
//
// chunkData is always an unbuffered riff.chunkReader.
// Creating a bufio.Reader here doesn't add any
// inefficiency, since the vp8l package will do it
// if we don't.
bufReader := bufio.NewReader(chunkData)
chunkData = bufReader
const vp8lHeaderSize = 5
vp8lHeader, err := bufReader.Peek(vp8lHeaderSize)
if err != nil {
if err == io.EOF {
err = errInvalidFormat
}
return nil, image.Config{}, err
}
c, err := vp8l.DecodeConfig(bytes.NewReader(vp8lHeader))
if err != nil {
return nil, image.Config{}, err
}
if c.Width != int(widthMinusOne)+1 || c.Height != int(heightMinusOne)+1 {
return nil, image.Config{}, errInvalidFormat
}
}
m, err := vp8l.Decode(chunkData)
if err != nil {
return nil, image.Config{}, err
}
if seenVP8X {
bounds := m.Bounds()
if bounds.Dx() != int(widthMinusOne)+1 || bounds.Dy() != int(heightMinusOne)+1 {
return nil, image.Config{}, errInvalidFormat
}
}
return m, image.Config{}, nil
case fccVP8X:
+7
View File
@@ -49,6 +49,13 @@ to extensions, which are essentially calls to kernel utility
functions. Currently, the only extensions supported by this package
are the Linux packet filter extensions.
# Security Considerations
The implementation of the BPF VM in this package is suitable for
testing BPF programs. It aims for consistency with other BPF VM
implementations, but divergence in behavior is not considered a
security issue.
# Examples
This packet filter selects all ARP packets.
+13 -11
View File
@@ -55,7 +55,7 @@ type transportConfig struct {
// Registered is called by net/http.Transport.RegisterProtocol,
// to let us know that it understands the registration mechanism we're using.
func (t transportConfig) Registered(t1 *http.Transport) {
t.t.t1 = t1
t.t.lazyt1 = t1
}
func (t transportConfig) DisableCompression() bool {
@@ -145,29 +145,30 @@ func (t transportConfig) DialFromContext(ctx context.Context, network, address s
type transportInternal struct {
initOnce sync.Once
t1 *http.Transport
lazyt1 *http.Transport
}
func (t *Transport) init() {
func (t *Transport) init() *http.Transport {
t.initOnce.Do(func() {
if t.t1 != nil {
if t.lazyt1 != nil {
return
}
t1 := &http.Transport{}
t.configure(t1)
})
return t.lazyt1
}
func (t *Transport) configure(t1 *http.Transport) {
t1.RegisterProtocol("http/2", transportConfig{t})
// tr2.t1 is set by transportConfig.Registered.
if t.t1 != t1 {
// tr2.lazyt1 is set by transportConfig.Registered.
if t.lazyt1 != t1 {
panic("http2: net/http does not support this version of x/net/http2")
}
}
func (t *Transport) roundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Response, error) {
t.init()
t1 := t.init()
if req.URL.Scheme == "http" && !t.AllowHTTP {
return nil, errors.New("http2: unencrypted HTTP/2 not enabled")
@@ -188,22 +189,23 @@ func (t *Transport) roundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res
ctx := context.WithValue(req.Context(), http2TransportContextKey{}, t)
req = req.WithContext(ctx)
return t.t1.RoundTrip(req)
return t1.RoundTrip(req)
}
func (t *Transport) closeIdleConnections() {
t.init()
t.t1.CloseIdleConnections()
t1 := t.init()
t1.CloseIdleConnections()
}
func (t *Transport) newUserClientConn(c net.Conn) (*ClientConn, error) {
t1 := t.init()
// http.Transport's NewClientConn doesn't provide a supported way to create
// a connection from a net.Conn. (This might be useful to add in the future?)
// We're going to craftily sneak one in via the context key, with the
// scheme of "http/2" telling NewClientConn to look for it.
ctx := context.WithValue(context.Background(), netConnContextKey{}, c)
nhcc, err := t.t1.NewClientConn(ctx, "http/2", "")
nhcc, err := t1.NewClientConn(ctx, "http/2", "")
if err != nil {
return nil, err
}
+5 -1
View File
@@ -400,7 +400,11 @@ func (p *Profile) process(s string, toASCII bool) (string, error) {
// Spec says keep the old label.
continue
}
if unicode16 && err == nil && len(u) > 0 && isASCII(u) {
if err == nil && len(u) > 0 && isASCII(u) {
// UTS 43 pre-revision 33 doesn't classify a xn-- label
// which contains only ASCII characters as an error,
// but that's a specification bug and a security issue.
// Always return an error in this case.
err = punyError(enc)
}
isBidi = isBidi || bidirule.DirectionString(u) != bidi.LeftToRight
+13 -4
View File
@@ -24,7 +24,7 @@ func NewWeighted(n int64) *Weighted {
}
// Weighted provides a way to bound concurrent access to a resource.
// The callers can request access with a given weight.
// The callers can request access with a given non-negative weight.
type Weighted struct {
size int64
cur int64
@@ -32,10 +32,13 @@ type Weighted struct {
waiters list.List
}
// Acquire acquires the semaphore with a weight of n, blocking until resources
// Acquire acquires the semaphore with a non-negative weight of n, blocking until resources
// are available or ctx is done. On success, returns nil. On failure, returns
// ctx.Err() and leaves the semaphore unchanged.
func (s *Weighted) Acquire(ctx context.Context, n int64) error {
if n < 0 {
panic("semaphore: n < 0")
}
done := ctx.Done()
s.mu.Lock()
@@ -106,9 +109,12 @@ func (s *Weighted) Acquire(ctx context.Context, n int64) error {
}
}
// TryAcquire acquires the semaphore with a weight of n without blocking.
// TryAcquire acquires the semaphore with a non-negative weight of n without blocking.
// On success, returns true. On failure, returns false and leaves the semaphore unchanged.
func (s *Weighted) TryAcquire(n int64) bool {
if n < 0 {
panic("semaphore: n < 0")
}
s.mu.Lock()
success := s.size-s.cur >= n && s.waiters.Len() == 0
if success {
@@ -118,8 +124,11 @@ func (s *Weighted) TryAcquire(n int64) bool {
return success
}
// Release releases the semaphore with a weight of n.
// Release releases the semaphore with a non-negative weight of n.
func (s *Weighted) Release(n int64) {
if n < 0 {
panic("semaphore: n < 0")
}
s.mu.Lock()
s.cur -= n
if s.cur < 0 {
+37 -25
View File
@@ -6,38 +6,50 @@ package cpu
import "strconv"
// parseRelease parses a dot-separated version number. It follows the semver
// syntax, but allows the minor and patch versions to be elided.
// parseRelease parses a dot-separated version number from the prefix
// of rel. It returns ok=true only if at least the major and minor
// components were successfully parsed; the patch component is
// best-effort. Trailing vendor or build suffixes such as
// "-generic", "+", "_hi3535", or "-rc1" are ignored.
//
// This is a copy of the Go runtime's parseRelease from
// https://golang.org/cl/209597.
// https://golang.org/cl/209597, updated in https://golang.org/cl/781800.
func parseRelease(rel string) (major, minor, patch int, ok bool) {
// Strip anything after a dash or plus.
for i := range len(rel) {
if rel[i] == '-' || rel[i] == '+' {
rel = rel[:i]
break
// next consumes a run of decimal digits from the front of rel,
// returning the parsed value. If the digits are followed by a
// '.', it is consumed and more is set so the caller knows to
// parse another component; otherwise scanning terminates and
// the rest of rel is discarded.
next := func() (n int, more, ok bool) {
i := 0
for i < len(rel) && rel[i] >= '0' && rel[i] <= '9' {
i++
}
if i == 0 {
return 0, false, false
}
n, err := strconv.Atoi(rel[:i])
if err != nil {
return 0, false, false
}
if i < len(rel) && rel[i] == '.' {
rel = rel[i+1:]
return n, true, true
}
rel = ""
return n, false, true
}
next := func() (int, bool) {
for i := range len(rel) {
if rel[i] == '.' {
ver, err := strconv.Atoi(rel[:i])
rel = rel[i+1:]
return ver, err == nil
}
}
ver, err := strconv.Atoi(rel)
rel = ""
return ver, err == nil
var more bool
if major, more, ok = next(); !ok || !more {
return 0, 0, 0, false
}
if major, ok = next(); !ok || rel == "" {
return
if minor, more, ok = next(); !ok {
return 0, 0, 0, false
}
if minor, ok = next(); !ok || rel == "" {
return
if !more {
return major, minor, 0, true
}
patch, ok = next()
return
patch, _, _ = next()
return major, minor, patch, true
}
+1
View File
@@ -1874,6 +1874,7 @@ func Dup2(oldfd, newfd int) error {
//sys Dup3(oldfd int, newfd int, flags int) (err error)
//sysnb EpollCreate1(flag int) (fd int, err error)
//sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
//sys Eventfd(initval uint, flags int) (fd int, err error) = SYS_EVENTFD2
//sys Exit(code int) = SYS_EXIT_GROUP
//sys Fallocate(fd int, mode uint32, off int64, len int64) (err error)
-1
View File
@@ -20,7 +20,6 @@ func setTimeval(sec, usec int64) Timeval {
// 64-bit file system and 32-bit uid calls
// (386 default is 32-bit file system and 16-bit uid).
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64
//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
-1
View File
@@ -6,7 +6,6 @@
package unix
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
-1
View File
@@ -44,7 +44,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
// 64-bit file system and 32-bit uid calls
// (16-bit uid calls are not always supported in newer kernels)
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
-1
View File
@@ -8,7 +8,6 @@ package unix
import "unsafe"
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
-1
View File
@@ -8,7 +8,6 @@ package unix
import "unsafe"
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
-1
View File
@@ -6,7 +6,6 @@
package unix
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
-1
View File
@@ -13,7 +13,6 @@ import (
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
-1
View File
@@ -11,7 +11,6 @@ import (
"unsafe"
)
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
-1
View File
@@ -6,7 +6,6 @@
package unix
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
-1
View File
@@ -8,7 +8,6 @@ package unix
import "unsafe"
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
-1
View File
@@ -10,7 +10,6 @@ import (
"unsafe"
)
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
-1
View File
@@ -6,7 +6,6 @@
package unix
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
+7 -1
View File
@@ -1359,6 +1359,7 @@ const (
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_PIDFS_ROOT = -0x2712
FD_SETSIZE = 0x400
FF0 = 0x0
FIB_RULE_DEV_DETACHED = 0x8
@@ -1970,6 +1971,8 @@ const (
MADV_DONTNEED = 0x4
MADV_DONTNEED_LOCKED = 0x18
MADV_FREE = 0x8
MADV_GUARD_INSTALL = 0x66
MADV_GUARD_REMOVE = 0x67
MADV_HUGEPAGE = 0xe
MADV_HWPOISON = 0x64
MADV_KEEPONFORK = 0x13
@@ -2114,7 +2117,7 @@ const (
MS_NOSEC = 0x10000000
MS_NOSUID = 0x2
MS_NOSYMFOLLOW = 0x100
MS_NOUSER = -0x80000000
MS_NOUSER = 0x80000000
MS_POSIXACL = 0x10000
MS_PRIVATE = 0x40000
MS_RDONLY = 0x1
@@ -3786,6 +3789,9 @@ const (
TCPOPT_TIMESTAMP = 0x8
TCPOPT_TSTAMP_HDR = 0x101080a
TCPOPT_WINDOW = 0x3
TCP_AO_KEYF_EXCLUDE_OPT = 0x2
TCP_AO_KEYF_IFINDEX = 0x1
TCP_AO_MAXKEYLEN = 0x50
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
+17
View File
@@ -700,6 +700,23 @@ func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Eventfd(initval uint, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_EVENTFD2, uintptr(initval), uintptr(flags), 0)
fd = int(r0)
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64_64, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32), uintptr(advice))
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -213,23 +213,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchown(fd int, uid int, gid int) (err error) {
_, _, e1 := Syscall(SYS_FCHOWN32, uintptr(fd), uintptr(uid), uintptr(gid))
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall9(SYS_FADVISE64, uintptr(fd), 0, uintptr(offset>>32), uintptr(offset), uintptr(length>>32), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall9(SYS_FADVISE64, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchown(fd int, uid int, gid int) (err error) {
_, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
-17
View File
@@ -45,23 +45,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
if e1 != 0 {
+36
View File
@@ -1109,17 +1109,53 @@ const (
)
// This type is the union inside of TRUSTEE and must be created using one of the TrusteeValueFrom* functions.
//
// Go pointers stored in a TrusteeValue must be pinned using [runtime.Pinner]
// for the lifetime of the TrusteeValue.
type TrusteeValue uintptr
// TrusteeValueFromString is unsafe and should not be used.
//
// It returns a uintptr containing a reference to newly-allocated memory
// which will be freed by the garbage collector.
// There is no way for the caller to safely reference this memory.
//
// To create a [TrusteeValue] from a string, use:
//
// p, err := windows.UTF16PtrFromString(s)
// if err != nil {
// // handle error
// }
//
// // Pin the string for as long as it is used.
// var pinner runtime.Pinner
// pinner.Pin(p)
// defer pinner.Unpin()
//
// tv := TrusteeValue(unsafe.Pointer(p))
//
// Deprecated: TrusteeValueFromString is unsafe and should not be used.
func TrusteeValueFromString(str string) TrusteeValue {
return TrusteeValue(unsafe.Pointer(StringToUTF16Ptr(str)))
}
// TrusteeValueFromSID returns a [TrusteeValue] referencing sid.
//
// The caller must pin sid using a [runtime.Pinner] for the lifetime of the TrusteeValue.
func TrusteeValueFromSID(sid *SID) TrusteeValue {
return TrusteeValue(unsafe.Pointer(sid))
}
// TrusteeValueFromObjectsAndSid returns a [TrusteeValue] referencing objectsAndSid.
//
// The caller must pin objectsAndSid using a [runtime.Pinner] for the lifetime of the TrusteeValue.
func TrusteeValueFromObjectsAndSid(objectsAndSid *OBJECTS_AND_SID) TrusteeValue {
return TrusteeValue(unsafe.Pointer(objectsAndSid))
}
// TrusteeValueFromObjectsAndName returns a [TrusteeValue] referencing objectsAndName.
//
// The caller must pin objectsAndName using a [runtime.Pinner] for the lifetime of the TrusteeValue.
func TrusteeValueFromObjectsAndName(objectsAndName *OBJECTS_AND_NAME) TrusteeValue {
return TrusteeValue(unsafe.Pointer(objectsAndName))
}
+6 -2
View File
@@ -1728,11 +1728,15 @@ func (s *NTUnicodeString) String() string {
// the more common *uint16 string type.
func NewNTString(s string) (*NTString, error) {
var nts NTString
s8, err := BytePtrFromString(s)
s8, err := ByteSliceFromString(s)
if err != nil {
return nil, err
}
RtlInitString(&nts, s8)
// The source string plus its terminating NUL must fit within MAX_USHORT.
if len(s8) > MAX_USHORT {
return nil, syscall.EINVAL
}
RtlInitString(&nts, &s8[0])
return &nts, nil
}
+1
View File
@@ -169,6 +169,7 @@ const (
FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192
FORMAT_MESSAGE_MAX_WIDTH_MASK = 255
MAX_USHORT = 0xffff
MAX_PATH = 260
MAX_LONG_PATH = 32768
+1 -1
View File
@@ -249,7 +249,7 @@ func upper(c *context) bool {
return c.copy()
}
// isUpper writes the isUppercase version of the current rune to dst.
// isUpper reports whether the current rune is in upper case.
func isUpper(c *context) bool {
ct := c.caseType()
if c.info&hasMappingMask == 0 || ct == cUpper {
+2 -2
View File
@@ -774,7 +774,7 @@ func nlTitle(c *context) bool {
// From CLDR:
// # Special titlecasing for Dutch initial "ij".
// ::Any-Title();
// # Fix up Ij at the beginning of a "word" (per Any-Title, notUAX #29)
// # Fix up Ij at the beginning of a "word" (per Any-Title, not UAX #29)
// [:^WB=ALetter:] [:WB=Extend:]* [[:WB=MidLetter:][:WB=MidNumLet:]]? { Ij } → IJ ;
if c.src[c.pSrc] != 'I' && c.src[c.pSrc] != 'i' {
return title(c)
@@ -794,7 +794,7 @@ func nlTitleSpan(c *context) bool {
// From CLDR:
// # Special titlecasing for Dutch initial "ij".
// ::Any-Title();
// # Fix up Ij at the beginning of a "word" (per Any-Title, notUAX #29)
// # Fix up Ij at the beginning of a "word" (per Any-Title, not UAX #29)
// [:^WB=ALetter:] [:WB=Extend:]* [[:WB=MidLetter:][:WB=MidNumLet:]]? { Ij } → IJ ;
if c.src[c.pSrc] != 'I' {
return isTitle(c)
+8 -1
View File
@@ -121,8 +121,12 @@ func (p Properties) BoundaryAfter() bool {
//
// When all 6 bits are zero, the character is inert, meaning it is never
// influenced by normalization.
//
// We set flags to 0x80 (high bit 7 unused in quick check data) to indicate an invalid rune.
type qcInfo uint8
func (p Properties) isInvalid() bool { return p.flags == 0x80 }
func (p Properties) isYesC() bool { return p.flags&0x10 == 0 }
func (p Properties) isYesD() bool { return p.flags&0x4 == 0 }
@@ -247,6 +251,9 @@ func (f Form) PropertiesString(s string) Properties {
// to a Properties. See the comment at the top of the file
// for more information on the format.
func compInfo(v uint16, sz int) Properties {
if sz == 0 {
return Properties{flags: 0x80, size: 1}
}
if v == 0 {
return Properties{size: uint8(sz)}
} else if v >= 0x8000 {
@@ -254,7 +261,7 @@ func compInfo(v uint16, sz int) Properties {
size: uint8(sz),
ccc: uint8(v),
tccc: uint8(v),
flags: qcInfo(v >> 8),
flags: qcInfo(v>>8) & 0x3f,
}
if p.ccc > 0 || p.combinesBackward() {
p.nLead = uint8(p.flags & 0x3)
+2 -6
View File
@@ -376,16 +376,12 @@ func nextComposed(i *Iter) []byte {
goto doNorm
}
prevCC = i.info.tccc
sz := int(i.info.size)
if sz == 0 {
sz = 1 // illegal rune: copy byte-by-byte
}
p := outp + sz
p := outp + int(i.info.size)
if p > len(i.buf) {
break
}
outp = p
i.p += sz
i.p += int(i.info.size)
if i.p >= i.rb.nsrc {
i.setDone()
break
+10 -10
View File
@@ -148,7 +148,7 @@ func (f Form) IsNormalString(s string) bool {
// patched buffer and whether the decomposition is still in progress.
func patchTail(rb *reorderBuffer) bool {
info, p := lastRuneStart(&rb.f, rb.out)
if p == -1 || info.size == 0 {
if p == -1 || info.isInvalid() {
return true
}
end := p + int(info.size)
@@ -225,7 +225,7 @@ func doAppend(rb *reorderBuffer, out []byte, p int) []byte {
}
fd := &rb.f
if doMerge {
var info Properties
info := Properties{flags: 0x80, size: 1} // invalid rune
if p < n {
info = fd.info(src, p)
if !info.BoundaryBefore() || info.nLeadingNonStarters() > 0 {
@@ -235,7 +235,7 @@ func doAppend(rb *reorderBuffer, out []byte, p int) []byte {
p = decomposeSegment(rb, p, true)
}
}
if info.size == 0 {
if info.isInvalid() {
rb.doFlush()
// Append incomplete UTF-8 encoding.
return src.appendSlice(rb.out, p, n)
@@ -314,7 +314,7 @@ func (f *formInfo) quickSpan(src input, i, end int, atEOF bool) (n int, ok bool)
continue
}
info := f.info(src, i)
if info.size == 0 {
if info.isInvalid() {
if atEOF {
// include incomplete runes
return n, true
@@ -379,7 +379,7 @@ func (f Form) firstBoundary(src input, nsrc int) int {
// CGJ insertion points correctly. Luckily it doesn't have to.
for {
info := fd.info(src, i)
if info.size == 0 {
if info.isInvalid() {
return -1
}
if s := ss.next(info); s != ssSuccess {
@@ -424,7 +424,7 @@ func (f Form) nextBoundary(src input, nsrc int, atEOF bool) int {
}
fd := formTable[f]
info := fd.info(src, 0)
if info.size == 0 {
if info.isInvalid() {
if atEOF {
return 1
}
@@ -435,7 +435,7 @@ func (f Form) nextBoundary(src input, nsrc int, atEOF bool) int {
for i := int(info.size); i < nsrc; i += int(info.size) {
info = fd.info(src, i)
if info.size == 0 {
if info.isInvalid() {
if atEOF {
return i
}
@@ -465,7 +465,7 @@ func lastBoundary(fd *formInfo, b []byte) int {
if p == -1 {
return -1
}
if info.size == 0 { // ends with incomplete rune
if info.isInvalid() { // ends with incomplete rune
if p == 0 { // starts with incomplete rune
return -1
}
@@ -504,7 +504,7 @@ func lastBoundary(fd *formInfo, b []byte) int {
func decomposeSegment(rb *reorderBuffer, sp int, atEOF bool) int {
// Force one character to be consumed.
info := rb.f.info(rb.src, sp)
if info.size == 0 {
if info.isInvalid() {
return 0
}
if s := rb.ss.next(info); s == ssStarter {
@@ -528,7 +528,7 @@ func decomposeSegment(rb *reorderBuffer, sp int, atEOF bool) int {
break
}
info = rb.f.info(rb.src, sp)
if info.size == 0 {
if info.isInvalid() {
if !atEOF {
return int(iShortSrc)
}
+14
View File
@@ -815,6 +815,12 @@ func (ld *loader) refine(response *DriverResponse) ([]*Package, error) {
needsrc: needsrc,
goVersion: response.GoVersion,
}
// Don't trust the driver to respond with duplicate-free
// package names (go.dev/issue/63822).
if _, ok := ld.pkgs[lpkg.ID]; ok {
return nil, fmt.Errorf("%s response contained duplicate packages for ID %q",
cond(ld.externalDriver, "go/packages driver", "go list"), lpkg.ID)
}
ld.pkgs[lpkg.ID] = lpkg
if rootIndex >= 0 {
initial[rootIndex] = lpkg
@@ -1589,3 +1595,11 @@ func usesExportData(cfg *Config) bool {
}
type unit struct{}
func cond[T any](cond bool, t, f T) T {
if cond {
return t
} else {
return f
}
}
+3
View File
@@ -823,6 +823,9 @@ func (p *iexporter) doDecl(obj types.Object) {
w.pos(m.Pos())
w.string(m.Name())
sig, _ := m.Type().(*types.Signature)
if w.p.version >= iexportVersionGenericMethods && w.bool(sig.TypeParams().Len() > 0) {
w.tparamList(obj.Name()+"."+m.Name(), sig.TypeParams(), obj.Pkg())
}
// Receiver type parameters are type arguments of the receiver type, so
// their name must be qualified before exporting recv.
+14 -10
View File
@@ -48,13 +48,14 @@ func (r *intReader) uint64() uint64 {
// Keep this in sync with constants in iexport.go.
const (
iexportVersionGo1_11 = 0
iexportVersionPosCol = 1
iexportVersionGo1_18 = 2
iexportVersionGenerics = 2
iexportVersion = iexportVersionGenerics
iexportVersionGo1_11 = 0
iexportVersionPosCol = 1
iexportVersionGo1_18 = 2
iexportVersionGenerics = 2
iexportVersionGenericMethods = 3
iexportVersion = iexportVersionGenericMethods
iexportVersionCurrent = 2
iexportVersionCurrent = 3
)
type ident struct {
@@ -179,9 +180,9 @@ func iimportCommon(fset *token.FileSet, getPackages GetPackagesFunc, data []byte
version = int64(r.uint64())
switch version {
case iexportVersionGo1_18, iexportVersionPosCol, iexportVersionGo1_11:
case iexportVersionGenericMethods, iexportVersionGo1_18, iexportVersionPosCol, iexportVersionGo1_11:
default:
if version > iexportVersionGo1_18 {
if version > iexportVersionGenericMethods {
errorf("unstable iexport format version %d, just rebuild compiler and std library", version)
} else {
errorf("unknown iexport format version %d", version)
@@ -614,6 +615,10 @@ func (r *importReader) obj(pkg *types.Package, name string) {
for n := r.uint64(); n > 0; n-- {
mpos := r.pos()
mname := r.ident()
var tpars []*types.TypeParam
if r.p.version >= iexportVersionGenericMethods && r.bool() {
tpars = r.tparamList()
}
recv := r.param(pkg)
// If the receiver has any targs, set those as the
@@ -628,8 +633,7 @@ func (r *importReader) obj(pkg *types.Package, name string) {
rparams[i] = types.Unalias(targs.At(i)).(*types.TypeParam)
}
}
msig := r.signature(pkg, recv, rparams, nil)
msig := r.signature(pkg, recv, rparams, tpars)
named.AddMethod(types.NewFunc(mpos, pkg, mname, msig))
}
}
-1
View File
@@ -273,7 +273,6 @@ func (p *pass) loadPackageNames(ctx context.Context, imports []*ImportInfo) erro
}
unknown = append(unknown, imp.ImportPath)
}
names, err := p.source.LoadPackageNames(ctx, p.srcDir, unknown)
if err != nil {
return err
+4
View File
@@ -74,6 +74,10 @@ func Process(filename string, src []byte, opt *Options) (formatted []byte, err e
// Note that filename's directory influences which imports can be chosen,
// so it is important that filename be accurate.
func FixImports(ctx context.Context, filename string, src []byte, goroot string, logf func(string, ...any), source Source) (fixes []*ImportFix, err error) {
if source == nil {
// In case someone adds a defective call from a new place
panic("source is nil")
}
ctx, done := event.Start(ctx, "imports.FixImports")
defer done()
+338 -316
View File
@@ -12,366 +12,386 @@ type pkginfo struct {
}
var deps = [...]pkginfo{
{"archive/tar", "\x03q\x03F=\x01\n\x01$\x01\x01\x02\x05\b\x02\x01\x02\x02\r"},
{"archive/zip", "\x02\x04g\a\x03\x13\x021=\x01+\x05\x01\x0f\x03\x02\x0f\x04"},
{"bufio", "\x03q\x86\x01D\x15"},
{"bytes", "t+[\x03\fH\x02\x02"},
{"archive/tar", "\x03{\x03F>\x01\n\x01&\x01\x01\x02\x05\b\x02\x01\x02\x02\r"},
{"archive/zip", "\x02\x04j\x0e\x03\x12\x022>\x01-\x05\x01\x0f\x03\x02\x0f\x04"},
{"bufio", "\x03{\x87\x01F\x15"},
{"bytes", "~*]\x03\fJ\x02\x02"},
{"cmp", ""},
{"compress/bzip2", "\x02\x02\xf6\x01A"},
{"compress/flate", "\x02r\x03\x83\x01\f\x033\x01\x03"},
{"compress/gzip", "\x02\x04g\a\x03\x15nU"},
{"compress/lzw", "\x02r\x03\x83\x01"},
{"compress/zlib", "\x02\x04g\a\x03\x13\x01o"},
{"container/heap", "\xbc\x02"},
{"compress/bzip2", "\x02\x02\x81\x02C"},
{"compress/flate", "\x02|\x03\x84\x01\f\x034\x02\x03"},
{"compress/gzip", "\x02\x04j\x0e\x03\x14pW"},
{"compress/lzw", "\x02|\x03\x84\x01"},
{"compress/zlib", "\x02\x04j\x0e\x03\x12\x01q"},
{"container/heap", "\xc9\x02"},
{"container/list", ""},
{"container/ring", ""},
{"context", "t\\p\x01\x0e"},
{"crypto", "\x8a\x01pC"},
{"crypto/aes", "\x10\v\t\x99\x02"},
{"crypto/cipher", "\x03!\x01\x01 \x12\x1c,Z"},
{"crypto/des", "\x10\x16 .,\x9d\x01\x03"},
{"crypto/dsa", "F\x03+\x86\x01\r"},
{"crypto/ecdh", "\x03\v\r\x10\x04\x17\x03\x0f\x1c\x86\x01"},
{"crypto/ecdsa", "\x0e\x05\x03\x05\x01\x10\b\v\x06\x01\x03\x0e\x01\x1c\x86\x01\r\x05L\x01"},
{"crypto/ed25519", "\x0e\x1f\x12\a\x03\b\a\x1cI=C"},
{"crypto/elliptic", "4@\x86\x01\r9"},
{"crypto/fips140", "#\x05\x95\x01\x98\x01"},
{"crypto/hkdf", "0\x15\x01.\x16"},
{"crypto/hmac", "\x1b\x16\x14\x01\x122"},
{"crypto/hpke", "\x03\v\x02\x03\x04\x01\f\x01\x05\x1f\x05\a\x01\x01\x1d\x03\x13\x16\x9b\x01\x1c"},
{"crypto/internal/boring", "\x0e\x02\x0el"},
{"crypto/internal/boring/bbig", "\x1b\xec\x01N"},
{"crypto/internal/boring/bcache", "\xc1\x02\x14"},
{"context", "~]r\x01\x0e"},
{"crypto", "\x93\x01rE"},
{"crypto/aes", "\x10\v\n\xa5\x02"},
{"crypto/cipher", "\x03\"\x01\x01 \x13$+\\"},
{"crypto/des", "\x10\x17 7+\xa1\x01\x03"},
{"crypto/dsa", "G\x034\x87\x01\r"},
{"crypto/ecdh", "\x03\v\r\x11\x04\x17\x03\x10$\x87\x01"},
{"crypto/ecdsa", "\x0e\x05\x03\x05\x01\x11\b\v\x06\x01\x03\x0f\x01$\x87\x01\r\x05O\x01"},
{"crypto/ed25519", "\x0e \x12\a\x03\t\a$I>E"},
{"crypto/elliptic", "5I\x87\x01\r;"},
{"crypto/fips140", "$\x05\x9e\x01\x9b\x01"},
{"crypto/hkdf", "1\x15\x017\x15"},
{"crypto/hmac", "\x1b\x17\x14\x01\x139"},
{"crypto/hpke", "\x03\v\x02\x03\x04\x01\r\x01\x05\x1f\x06\a\x01\x01%\x03\x12\x16\x9f\x01\x1d"},
{"crypto/internal/boring", "\x0e\x02\x0eu"},
{"crypto/internal/boring/bbig", "\x1b\xf7\x01P"},
{"crypto/internal/boring/bcache", "\xce\x02\x14"},
{"crypto/internal/boring/sig", ""},
{"crypto/internal/constanttime", ""},
{"crypto/internal/cryptotest", "\x03\r\v\b%\x10\x19\x06\x13\x12 \x04\x06\t\x19\x01\x11\x11\x1b\x01\a\x05\b\x03\x05\f"},
{"crypto/internal/entropy", "K"},
{"crypto/internal/entropy/v1.0.0", "D0\x95\x018\x14"},
{"crypto/internal/fips140", "C1\xbf\x01\v\x17"},
{"crypto/internal/fips140/aes", "\x03 \x03\x02\x14\x05\x01\x01\x05,\x95\x014"},
{"crypto/internal/fips140/aes/gcm", "#\x01\x02\x02\x02\x12\x05\x01\x06,\x92\x01"},
{"crypto/internal/fips140/alias", "\xd5\x02"},
{"crypto/internal/fips140/bigmod", "(\x19\x01\x06,\x95\x01"},
{"crypto/internal/fips140/check", "#\x0e\a\t\x02\xb7\x01["},
{"crypto/internal/fips140/check/checktest", "(\x8b\x02\""},
{"crypto/internal/fips140/drbg", "\x03\x1f\x01\x01\x04\x14\x05\n)\x86\x01\x0f7\x01"},
{"crypto/internal/fips140/ecdh", "\x03 \x05\x02\n\r3\x86\x01\x0f7"},
{"crypto/internal/fips140/ecdsa", "\x03 \x04\x01\x02\a\x03\x06:\x16pF"},
{"crypto/internal/fips140/ed25519", "\x03 \x05\x02\x04\f:\xc9\x01\x03"},
{"crypto/internal/fips140/edwards25519", "\x1f\t\a\x123\x95\x017"},
{"crypto/internal/fips140/edwards25519/field", "(\x14\x053\x95\x01"},
{"crypto/internal/fips140/hkdf", "\x03 \x05\t\a<\x16"},
{"crypto/internal/fips140/hmac", "\x03 \x15\x01\x01:\x16"},
{"crypto/internal/fips140/mldsa", "\x03\x1c\x04\x05\x02\x0e\x01\x03\x053\x95\x017"},
{"crypto/internal/fips140/mlkem", "\x03 \x05\x02\x0f\x03\x053\xcc\x01"},
{"crypto/internal/fips140/nistec", "\x1f\t\r\f3\x95\x01*\r\x15"},
{"crypto/internal/fips140/nistec/fiat", "(\x148\x95\x01"},
{"crypto/internal/fips140/pbkdf2", "\x03 \x05\t\a<\x16"},
{"crypto/internal/fips140/rsa", "\x03\x1c\x04\x04\x01\x02\x0e\x01\x01\x028\x16pF"},
{"crypto/internal/fips140/sha256", "\x03 \x1e\x01\x06,\x16\x7f"},
{"crypto/internal/fips140/sha3", "\x03 \x19\x05\x012\x95\x01L"},
{"crypto/internal/fips140/sha512", "\x03 \x1e\x01\x06,\x16\x7f"},
{"crypto/internal/fips140/ssh", "(b"},
{"crypto/internal/fips140/subtle", "\x1f\a\x1b\xc8\x01"},
{"crypto/internal/fips140/tls12", "\x03 \x05\t\a\x02:\x16"},
{"crypto/internal/fips140/tls13", "\x03 \x05\b\b\t3\x16"},
{"crypto/internal/fips140cache", "\xb3\x02\r'"},
{"crypto/internal/cryptotest", "\x03\r\v\t%\x11\x1a\r\x12\x12!\x04\x06\n\x19\x01\x11\x11\x1d\x01\a\x03\x02\b\x02\x01\x05\f"},
{"crypto/internal/cryptotest/wycheproof", "\x0e\x12S\x01\f\x01r@\x05\x03\x15\x10"},
{"crypto/internal/entropy", "L"},
{"crypto/internal/entropy/v1.0.0", "E9\x96\x01:\x14"},
{"crypto/internal/fips140", "D:\xc2\x01\v\x17"},
{"crypto/internal/fips140/aes", "\x03!\x03\x02\x14\x05\x01\x01\x055\x96\x016"},
{"crypto/internal/fips140/aes/gcm", "$\x01\x02\x02\x02\x12\x05\x01\x065\x93\x01"},
{"crypto/internal/fips140/alias", "\xe2\x02"},
{"crypto/internal/fips140/bigmod", ")\x19\x01\x065\x96\x01"},
{"crypto/internal/fips140/check", "$\x0e\a\t\x02\xc1\x01]"},
{"crypto/internal/fips140/check/checktest", ")\x97\x02\""},
{"crypto/internal/fips140/drbg", "\x03 \x01\x01\x04\x14\x05\n2\x87\x01\x0f9\x01"},
{"crypto/internal/fips140/ecdh", "\x03!\x05\x02\n\r<\x87\x01\x0f9"},
{"crypto/internal/fips140/ecdsa", "\x03!\x04\x01\x02\a\x03\x06C\x15r\x0f9"},
{"crypto/internal/fips140/ed25519", "\x03!\x05\x02\x04\fC\xcc\x01\x03"},
{"crypto/internal/fips140/edwards25519", "\x1f\n\a\x12<\x96\x019"},
{"crypto/internal/fips140/edwards25519/field", ")\x14\x05<\x96\x01"},
{"crypto/internal/fips140/hkdf", "\x03!\x05\t\aE\x15"},
{"crypto/internal/fips140/hmac", "\x03!\x15\x01\x01C\x15"},
{"crypto/internal/fips140/mldsa", "\x03\x1c\x05\x05\x02\x0e\x01\x03\x05<\x96\x019"},
{"crypto/internal/fips140/mlkem", "\x03!\x05\x02\x0f\x03\x05<\xcf\x01"},
{"crypto/internal/fips140/nistec", "\x1f\n\r\f<\x96\x01,\r\x15"},
{"crypto/internal/fips140/nistec/fiat", ")\x14A\x96\x01"},
{"crypto/internal/fips140/pbkdf2", "\x03!\x05\t\aE\x15"},
{"crypto/internal/fips140/rsa", "\x03\x1c\x05\x04\x01\x02\x0e\x01\x01\x02A\x15rH"},
{"crypto/internal/fips140/sha256", "\x03!\x1e\x01\x065\x15\x81\x01"},
{"crypto/internal/fips140/sha3", "\x03!\x19\x05\x01;\x96\x01N"},
{"crypto/internal/fips140/sha512", "\x03!\x1e\x01\x065\x15\x81\x01"},
{"crypto/internal/fips140/ssh", ")j"},
{"crypto/internal/fips140/subtle", "\x1f\b\x1b\xd2\x01"},
{"crypto/internal/fips140/tls12", "\x03!\x05\t\a\x02C\x15"},
{"crypto/internal/fips140/tls13", "\x03!\x05\b\b\t<\x15"},
{"crypto/internal/fips140cache", "\xc0\x02\r."},
{"crypto/internal/fips140deps", ""},
{"crypto/internal/fips140deps/byteorder", "\xa0\x01"},
{"crypto/internal/fips140deps/cpu", "\xb5\x01\a"},
{"crypto/internal/fips140deps/godebug", "\xbd\x01"},
{"crypto/internal/fips140deps/time", "\xcf\x02"},
{"crypto/internal/fips140hash", "9\x1d4\xcb\x01"},
{"crypto/internal/fips140only", "\x17\x13\x0e\x01\x01Pp"},
{"crypto/internal/fips140deps/byteorder", "\xa9\x01"},
{"crypto/internal/fips140deps/cpu", "\xbe\x01\b"},
{"crypto/internal/fips140deps/godebug", "\xc7\x01"},
{"crypto/internal/fips140deps/time", "\xe2\x02"},
{"crypto/internal/fips140hash", ":\x1e;\xcf\x01"},
{"crypto/internal/fips140only", "\x17\x14\x0e\x01\x01Xr"},
{"crypto/internal/fips140test", ""},
{"crypto/internal/impl", "\xbe\x02"},
{"crypto/internal/rand", "\x1b\x0f s=["},
{"crypto/internal/randutil", "\xfa\x01\x12"},
{"crypto/internal/sysrand", "tq! \r\r\x01\x01\r\x06"},
{"crypto/internal/sysrand/internal/seccomp", "t"},
{"crypto/md5", "\x0e8.\x16\x16i"},
{"crypto/mlkem", "\x0e%"},
{"crypto/mlkem/mlkemtest", "3\x13\b&"},
{"crypto/pbkdf2", "6\x0f\x01.\x16"},
{"crypto/rand", "\x1b\x0f\x1c\x03+\x86\x01\rN"},
{"crypto/rc4", "& .\xc9\x01"},
{"crypto/rsa", "\x0e\r\x01\v\x10\x0e\x01\x03\b\a\x1c\x03\x133=\f\x01"},
{"crypto/sha1", "\x0e\r+\x02,\x16\x16\x15T"},
{"crypto/sha256", "\x0e\r\x1dR"},
{"crypto/sha3", "\x0e+Q\xcb\x01"},
{"crypto/sha512", "\x0e\r\x1fP"},
{"crypto/subtle", "\x1f\x1d\x9f\x01z"},
{"crypto/tls", "\x03\b\x02\x01\x01\x01\x01\x02\x01\x01\x01\x02\x01\x01\x01\t\x01\x18\x01\x0f\x01\x03\x01\x01\x01\x01\x02\x01\x02\x01\x17\x02\x03\x13\x16\x15\b=\x16\x16\r\b\x01\x01\x01\x02\x01\x0e\x06\x02\x01\x0f"},
{"crypto/tls/internal/fips140tls", "\x17\xaa\x02"},
{"crypto/x509", "\x03\v\x01\x01\x01\x01\x01\x01\x01\x017\x06\x01\x01\x02\x05\x0e\x06\x02\x02\x03F\x03:\x01\x02\b\x01\x01\x02\a\x10\x05\x01\x06\a\b\x02\x01\x02\x0f\x02\x01\x01\x02\x03\x01"},
{"crypto/x509/pkix", "j\x06\a\x90\x01H"},
{"database/sql", "\x03\nQ\x16\x03\x83\x01\v\a\"\x05\b\x02\x03\x01\x0e\x02\x02\x02"},
{"database/sql/driver", "\rg\x03\xb7\x01\x0f\x12"},
{"debug/buildinfo", "\x03^\x02\x01\x01\b\a\x03g\x1a\x02\x01+\x0f "},
{"debug/dwarf", "\x03j\a\x03\x83\x011\x11\x01\x01"},
{"debug/elf", "\x03\x06W\r\a\x03g\x1b\x01\f \x17\x01\x17"},
{"debug/gosym", "\x03j\n$\xa1\x01\x01\x01\x02"},
{"debug/macho", "\x03\x06W\r\ng\x1c,\x17\x01"},
{"debug/pe", "\x03\x06W\r\a\x03g\x1c,\x17\x01\x17"},
{"debug/plan9obj", "m\a\x03g\x1c,"},
{"embed", "t+B\x19\x01T"},
{"crypto/internal/impl", "\xcb\x02"},
{"crypto/internal/rand", "\x1b\x10 |>]"},
{"crypto/internal/randutil", "\x85\x02\x12"},
{"crypto/internal/sysrand", "~r!\"\r\r\x01\x01\r\x06"},
{"crypto/internal/sysrand/internal/seccomp", "~"},
{"crypto/md5", "\x0e97\x15\x16k"},
{"crypto/mldsa", "\x0e%K\x87\x01"},
{"crypto/mlkem", "\x0e&"},
{"crypto/mlkem/mlkemtest", "4\x13\t."},
{"crypto/pbkdf2", "7\x0f\x017\x15"},
{"crypto/rand", "\x1b\x10\x1c\x034\x87\x01\rP"},
{"crypto/rc4", "' 7\xcc\x01"},
{"crypto/rsa", "\x0e\r\x01\f\x10\x0e\x01\x03\t\a$\x03\x124>\f\x01"},
{"crypto/sha1", "\x0e\r,\x025\x15\x16\x15V"},
{"crypto/sha256", "\x0e\r\x1eZ"},
{"crypto/sha3", "\x0e,Y\xcf\x01"},
{"crypto/sha512", "\x0e\r X"},
{"crypto/subtle", "\x1f\x1e\xa9\x01|"},
{"crypto/tls", "\x03\b\x02\x01\x01\x01\x01\x02\x01\x01\x01\x01\x01\x01\x01\x01\n\x01\x18\x01\x0f\x01\x01\x03\x01\x01\x01\x01\x02\x01\x02\x01\x1f\x02\x03\x12\x16\x15\t>\x16\x18\r\b\x01\x01\x01\x02\x01\x0e\x06\x03\x01\x15"},
{"crypto/tls/internal/fips140tls", "\x17\xb7\x02"},
{"crypto/x509", "\x03\v\x01\x01\x01\x01\x01\x01\x01\x01\x017\x01\x06\x01\x01\x02\x05\x0f\x06\t\x02\x03F\x03;\x01\x02\b\x01\x01\x02\a\x12\x05\x01\x06\a\b\x02\x01\x02\x0f\x02\x01\x01\x02\x04\x01"},
{"crypto/x509/pkix", "m\x06\x0e\x91\x019\x11"},
{"database/sql", "\x03\nS\x01\x1d\x03\x84\x01\v\a$\x05\b\x02\x03\x01\x0e\x02\x02\x02\x01"},
{"database/sql/driver", "\rT\x1d\x03\xba\x01\x0f\x12\a"},
{"database/sql/internal", ""},
{"debug/buildinfo", "\x03a\x02\x01\x01\b\x0e\x03h\x1a\x02\x01-\x0f "},
{"debug/dwarf", "\x03m\x0e\x03\x84\x013\x11\x01\x01"},
{"debug/elf", "\x03\x06Z\r\x0e\x03h\x1b\x01\f\"\x17\x01\x17"},
{"debug/gosym", "\x03m\x11#\xa5\x01\x01\x01\x02"},
{"debug/macho", "\x03\x06Z\r\x11h\x1c.\x17\x01"},
{"debug/pe", "\x03\x06Z\r\x0e\x03h\x1c.\x17\x01\x17"},
{"debug/plan9obj", "p\x0e\x03h\x1c."},
{"embed", "~*D\x19\x01V"},
{"embed/internal/embedtest", ""},
{"encoding", ""},
{"encoding/ascii85", "\xfa\x01C"},
{"encoding/asn1", "\x03q\x03g(\x01'\r\x02\x01\x11\x03\x01"},
{"encoding/base32", "\xfa\x01A\x02"},
{"encoding/base64", "\xa0\x01ZA\x02"},
{"encoding/binary", "t\x86\x01\f(\r\x05"},
{"encoding/csv", "\x02\x01q\x03\x83\x01D\x13\x02"},
{"encoding/gob", "\x02f\x05\a\x03g\x1c\v\x01\x03\x1d\b\x12\x01\x10\x02"},
{"encoding/hex", "t\x03\x83\x01A\x03"},
{"encoding/json", "\x03\x01d\x04\b\x03\x83\x01\f(\r\x02\x01\x02\x11\x01\x01\x02"},
{"encoding/pem", "\x03i\b\x86\x01A\x03"},
{"encoding/xml", "\x02\x01e\f\x03\x83\x014\x05\n\x01\x02\x11\x02"},
{"errors", "\xd0\x01\x85\x01"},
{"expvar", "qLA\b\v\x15\r\b\x02\x03\x01\x12"},
{"flag", "h\f\x03\x83\x01,\b\x05\b\x02\x01\x11"},
{"fmt", "tF'\x19\f \b\r\x02\x03\x13"},
{"go/ast", "\x03\x01s\x0f\x01s\x03)\b\r\x02\x01\x13\x02"},
{"go/build", "\x02\x01q\x03\x01\x02\x02\b\x02\x01\x17\x1f\x04\x02\b\x1c\x13\x01+\x01\x04\x01\a\b\x02\x01\x13\x02\x02"},
{"go/build/constraint", "t\xc9\x01\x01\x13\x02"},
{"go/constant", "w\x10\x7f\x01\x024\x01\x02\x13"},
{"go/doc", "\x04s\x01\x05\n=61\x10\x02\x01\x13\x02"},
{"go/doc/comment", "\x03t\xc4\x01\x01\x01\x01\x13\x02"},
{"go/format", "\x03t\x01\f\x01\x02sD"},
{"go/importer", "y\a\x01\x02\x04\x01r9"},
{"go/internal/gccgoimporter", "\x02\x01^\x13\x03\x04\f\x01p\x02,\x01\x05\x11\x01\r\b"},
{"go/internal/gcimporter", "\x02u\x10\x010\x05\r0,\x15\x03\x02"},
{"go/internal/scannerhooks", "\x87\x01"},
{"go/internal/srcimporter", "w\x01\x01\v\x03\x01r,\x01\x05\x12\x02\x15"},
{"go/parser", "\x03q\x03\x01\x02\b\x04\x01s\x01+\x06\x12"},
{"go/printer", "w\x01\x02\x03\ns\f \x15\x02\x01\x02\f\x05\x02"},
{"go/scanner", "\x03t\v\x05s2\x10\x01\x14\x02"},
{"go/token", "\x04s\x86\x01>\x02\x03\x01\x10\x02"},
{"go/types", "\x03\x01\x06j\x03\x01\x03\t\x03\x024\x063\x04\x03\t \x06\a\b\x01\x01\x01\x02\x01\x10\x02\x02"},
{"go/version", "\xc2\x01|"},
{"hash", "\xfa\x01"},
{"hash/adler32", "t\x16\x16"},
{"hash/crc32", "t\x16\x16\x15\x8b\x01\x01\x14"},
{"hash/crc64", "t\x16\x16\xa0\x01"},
{"hash/fnv", "t\x16\x16i"},
{"hash/maphash", "\x8a\x01\x11<~"},
{"html", "\xbe\x02\x02\x13"},
{"html/template", "\x03n\x06\x19-=\x01\n!\x05\x01\x02\x03\f\x01\x02\r\x01\x03\x02"},
{"image", "\x02r\x1fg\x0f4\x03\x01"},
{"encoding/ascii85", "\x85\x02E"},
{"encoding/asn1", "\x03{\x03h(\x01)\r\x02\x01\x11\x03\x01"},
{"encoding/base32", "\x85\x02C\x02"},
{"encoding/base64", "\xa9\x01\\C\x02"},
{"encoding/binary", "~\x87\x01\f*\r\x05"},
{"encoding/csv", "\x02\x01{\x03\x84\x01F\x13\x02"},
{"encoding/gob", "\x02i\x05\x0e\x03h\x1c\v\x01\x03\x1f\b\x12\x01\x10\x02"},
{"encoding/hex", "~\x03\x84\x01C\x03"},
{"encoding/json", "\x03\x01g\n\x01\x01\x02\x01\x01\x03\x03\x84\x016\x0f\x01"},
{"encoding/json/internal", "~"},
{"encoding/json/internal/jsonflags", "u"},
{"encoding/json/internal/jsonopts", "u\x01"},
{"encoding/json/internal/jsontest", "\x03f\x15\x03\x83\x01\x01\x012\b\b\x03\x02\x0f"},
{"encoding/json/internal/jsonwire", "\x04r\b\x87\x01\f7\x02\x01\x13\x01\x01"},
{"encoding/json/jsontext", "\x03r\x01\x01\x02\x05\x87\x01\x03\t\x034\x02\x01\x02\x13"},
{"encoding/json/v2", "\x03\x01g\x03\x01\x01\x03\x02\x01\x01\x02\x01\x04\x03\x84\x01\f\x03'\r\x02\x01\x02\x0f\x02\x02"},
{"encoding/pem", "\x03l\x0f\x87\x01C\x03"},
{"encoding/xml", "\x02\x01h\x13\x03\x84\x016\x05\n\x01\x02\x11\x02"},
{"errors", "\xdb\x01\x87\x01"},
{"expvar", "tSB\b\v\x17\r\b\x02\x03\x01\x12"},
{"flag", "k\x13\x03\x84\x01.\b\x05\b\x02\x01\x11"},
{"fmt", "~E)\x19\f\"\b\r\x02\x03\x13"},
{"go/ast", "\x03\x01}\x0e\x01u\x03+\b\r\x02\x01\x13\x02"},
{"go/build", "\x02\x01{\x03\x01\x02\x02\a\x02\x01\x17 \x04\x02\t\x1c\x13\x01-\x01\x04\x01\a\b\x02\x01\x13\x02\x02"},
{"go/build/constraint", "~\xcc\x01\x01\x13\x02"},
{"go/constant", "\x81\x01\x0f\x81\x01\x01\x026\x01\x02\x13"},
{"go/doc", "\x04}\x01\x05\t>73\x10\x02\x01\x13\x02"},
{"go/doc/comment", "\x03~\xc7\x01\x01\x01\x01\x13\x02"},
{"go/format", "\x03~\x01\v\x01\x02uF"},
{"go/importer", "\x83\x01\a\x01\x01\x04\x01t;"},
{"go/internal/gccgoimporter", "\x02\x01a\x1a\x03\x04\v\x01r\x02.\x01\x05\x11\x01\r\b"},
{"go/internal/gcimporter", "\x02\x7f\x0f\x010\x140.\x15\x03\x02"},
{"go/internal/srcimporter", "\x81\x01\x01\x01\n\x03\x01t.\x01\x05\x12\x02\x15"},
{"go/parser", "\x03{\x03\x01\x02\v\x01u\x01-\x06\x12"},
{"go/printer", "\x81\x01\x01\x02\x03\tu\f\"\x15\x02\x01\x02\f\x05\x02"},
{"go/scanner", "\x03~\x0fu4\x10\x01\x14\x02"},
{"go/token", "\x04}\x87\x01@\x02\x03\x01\x10\x02"},
{"go/types", "\x03\x01\x06t\x03\x01\x03\b\x03\x02\x0654\x04\x03\t\"\x06\a\b\x01\x01\x01\x02\x01\x10\x02\x02"},
{"go/version", "\xcc\x01\x7f"},
{"hash", "\x85\x02"},
{"hash/adler32", "~\x15\x16"},
{"hash/crc32", "~\x15\x16\x15\x8f\x01\x01\x14"},
{"hash/crc64", "~\x15\x16\xa4\x01"},
{"hash/fnv", "~\x15\x16k"},
{"hash/maphash", "\x93\x01\x11>\x80\x01"},
{"html", "\xcb\x02\x02\x13"},
{"html/template", "\x03q\r\x18.>\x01\n#\x05\x01\x02\x03\n\x02\x01\x02\r\x01\x03\x02"},
{"image", "\x02|\x1ei\x0f6\x03\x01"},
{"image/color", ""},
{"image/color/palette", "\x93\x01"},
{"image/draw", "\x92\x01\x01\x04"},
{"image/gif", "\x02\x01\x05l\x03\x1b\x01\x01\x01\vZ\x0f"},
{"image/internal/imageutil", "\x92\x01"},
{"image/jpeg", "\x02r\x1e\x01\x04c"},
{"image/png", "\x02\ad\n\x13\x02\x06\x01gC"},
{"index/suffixarray", "\x03j\a\x86\x01\f+\n\x01"},
{"internal/abi", "\xbc\x01\x99\x01"},
{"internal/asan", "\xd5\x02"},
{"internal/bisect", "\xb3\x02\r\x01"},
{"internal/buildcfg", "wHg\x06\x02\x05\n\x01"},
{"internal/bytealg", "\xb5\x01\xa0\x01"},
{"image/color/palette", "\x9c\x01"},
{"image/draw", "\x9b\x01\x01\x04"},
{"image/gif", "\x02\x01\x05v\x03\x1a\x01\x01\x01\v\\\x0f"},
{"image/internal/imageutil", "\x9b\x01"},
{"image/jpeg", "\x02|\x1d\x01\x04e"},
{"image/png", "\x02\ag\x11\x12\x02\x06\x01iE"},
{"index/suffixarray", "\x03m\x0e\x87\x01\f-\n\x01"},
{"internal/abi", "\xc6\x01\x9c\x01"},
{"internal/asan", "\xe2\x02"},
{"internal/bisect", "\xc0\x02\r\x01"},
{"internal/buildcfg", "\x81\x01Hj\x06\x02\x05\n\x01"},
{"internal/bytealg", "\xbe\x01\xa4\x01"},
{"internal/byteorder", ""},
{"internal/cfg", ""},
{"internal/cgrouptest", "w[T\x06\x0f\x02\x01\x04\x01"},
{"internal/chacha8rand", "\xa0\x01\x15\a\x99\x01"},
{"internal/cgrouptest", "\x81\x01\\V\x06\x0f\x02\x01\x04\x01"},
{"internal/chacha8rand", "\xa9\x01\x15\b\x9c\x01"},
{"internal/copyright", ""},
{"internal/coverage", ""},
{"internal/coverage/calloc", ""},
{"internal/coverage/cfile", "q\x06\x17\x17\x01\x02\x01\x01\x01\x01\x01\x01\x01\"\x02',\x06\a\n\x01\x03\x0e\x06"},
{"internal/coverage/cformat", "\x04s.\x04Q\v6\x01\x02\x0e"},
{"internal/coverage/cmerge", "w.a"},
{"internal/coverage/decodecounter", "m\n.\v\x02H,\x17\x18"},
{"internal/coverage/decodemeta", "\x02k\n\x17\x17\v\x02H,"},
{"internal/coverage/encodecounter", "\x02k\n.\f\x01\x02F\v!\x15"},
{"internal/coverage/encodemeta", "\x02\x01j\n\x13\x04\x17\r\x02F,/"},
{"internal/coverage/pods", "\x04s.\x81\x01\x06\x05\n\x02\x01"},
{"internal/coverage/rtcov", "\xd5\x02"},
{"internal/coverage/slicereader", "m\n\x83\x01["},
{"internal/coverage/slicewriter", "w\x83\x01"},
{"internal/coverage/stringtab", "w9\x04F"},
{"internal/coverage/cfile", "t\r\x16\x17\x01\x02\x01\x01\x01\x01\x01\x01\x01$\x02'.\x06\a\n\x01\x03\x0e\x06"},
{"internal/coverage/cformat", "\x04}-\x04S\v8\x01\x02\x0e"},
{"internal/coverage/cmerge", "\x81\x01-c"},
{"internal/coverage/decodecounter", "p\x11-\v\x02J.\x17\x18"},
{"internal/coverage/decodemeta", "\x02n\x11\x16\x17\v\x02J."},
{"internal/coverage/encodecounter", "\x02n\x11-\f\x01\x02H\v#\x15"},
{"internal/coverage/encodemeta", "\x02\x01m\x11\x12\x04\x17\r\x02H./"},
{"internal/coverage/pods", "\x04}-\x85\x01\x06\x05\n\x02\x01"},
{"internal/coverage/rtcov", "\xe2\x02"},
{"internal/coverage/slicereader", "p\x11\x84\x01]"},
{"internal/coverage/slicewriter", "\x81\x01\x84\x01"},
{"internal/coverage/stringtab", "\x81\x018\x04H"},
{"internal/coverage/test", ""},
{"internal/coverage/uleb128", ""},
{"internal/cpu", "\xd5\x02"},
{"internal/dag", "\x04s\xc4\x01\x03"},
{"internal/diff", "\x03t\xc5\x01\x02"},
{"internal/exportdata", "\x02\x01q\x03\x02e\x1c,\x01\x05\x11\x01\x02"},
{"internal/filepathlite", "t+B\x1a@"},
{"internal/fmtsort", "\x04\xaa\x02\r"},
{"internal/fuzz", "\x03\nH\x18\x04\x03\x03\x01\f\x036=\f\x03\x1d\x01\x05\x02\x05\n\x01\x02\x01\x01\r\x04\x02"},
{"internal/cpu", "\xe2\x02"},
{"internal/dag", "\x04}\xc7\x01\x03"},
{"internal/diff", "\x03~\xc8\x01\x02"},
{"internal/exportdata", "\x02\x01{\x03\x02f\x1c.\x01\x05\x11\x01\x02"},
{"internal/filepathlite", "~*D\x1aB"},
{"internal/fmtsort", "\x04\xb7\x02\r"},
{"internal/fuzz", "\x03\nJ\x19\x04\n\x03\x01\v\x037>\f\x03\x1f\x01\x05\x02\x05\n\x01\x02\x01\x01\r\x04\x02"},
{"internal/gate", "\r"},
{"internal/goarch", ""},
{"internal/godebug", "\x9d\x01!\x82\x01\x01\x14"},
{"internal/godebug", "\xa6\x01\"\x85\x01\x01\x14"},
{"internal/godebugs", ""},
{"internal/goexperiment", ""},
{"internal/goos", ""},
{"internal/goroot", "\xa6\x02\x01\x05\x12\x02"},
{"internal/goroot", "\xb3\x02\x01\x05\x12\x02"},
{"internal/gover", "\x04"},
{"internal/goversion", ""},
{"internal/lazyregexp", "\xa6\x02\v\r\x02"},
{"internal/lazytemplate", "\xfa\x01,\x18\x02\r"},
{"internal/msan", "\xd5\x02"},
{"internal/lazyregexp", "\xb3\x02\v\r\x02"},
{"internal/lazytemplate", "\x85\x02.\x18\x02\r"},
{"internal/msan", "\xe2\x02"},
{"internal/nettest", "\x03\nqG@\f\n\x12\x06\x15\x05\x0f"},
{"internal/nettrace", ""},
{"internal/obscuretestdata", "l\x8e\x01,"},
{"internal/oserror", "t"},
{"internal/pkgbits", "\x03R\x18\a\x03\x04\fs\r\x1f\r\n\x01"},
{"internal/obscuretestdata", "o\x96\x01."},
{"internal/oserror", "~"},
{"internal/pkgbits", "\x03T\x19\x0e\x03\x04\vu\r!\r\n\x01"},
{"internal/platform", ""},
{"internal/poll", "tl\x05\x159\r\x01\x01\r\x06"},
{"internal/profile", "\x03\x04m\x03\x83\x017\n\x01\x01\x01\x11"},
{"internal/poll", "~m\x05\x15;\r\x01\x01\r\x06"},
{"internal/profile", "\x03\x04w\x03\x84\x019\n\x01\x01\x01\x11"},
{"internal/profilerecord", ""},
{"internal/race", "\x9b\x01\xba\x01"},
{"internal/reflectlite", "\x9b\x01!;<\""},
{"internal/runtime/atomic", "\xbc\x01\x99\x01"},
{"internal/runtime/cgroup", "\x9f\x01=\x04u"},
{"internal/runtime/exithook", "\xd1\x01\x84\x01"},
{"internal/runtime/gc", "\xbc\x01"},
{"internal/runtime/gc/internal/gen", "\nc\n\x18k\x04\v\x1d\b\x10\x02"},
{"internal/runtime/gc/scan", "\xb5\x01\a\x18\az"},
{"internal/runtime/maps", "\x9b\x01\x01 \n\t\t\x03z"},
{"internal/runtime/math", "\xbc\x01"},
{"internal/race", "\xa4\x01\xbe\x01"},
{"internal/reflectlite", "\xa4\x01\"<>\""},
{"internal/runtime/atomic", "\xc6\x01\x9c\x01"},
{"internal/runtime/cgroup", "\xa8\x01?\x04w"},
{"internal/runtime/exithook", "\xdc\x01\x86\x01"},
{"internal/runtime/gc", "\xc6\x01"},
{"internal/runtime/gc/internal/gen", "\nf\x11\x17m\x04\v\x1f\b\x10\x02"},
{"internal/runtime/gc/scan", "\xbe\x01\b\x19\a|"},
{"internal/runtime/maps", "\xa4\x01\x01\x04\x15\b\x03\a\n\t\x03.N"},
{"internal/runtime/math", "\xc6\x01"},
{"internal/runtime/pprof/label", ""},
{"internal/runtime/startlinetest", ""},
{"internal/runtime/sys", "\xbc\x01\x04"},
{"internal/runtime/syscall/linux", "\xbc\x01\x99\x01"},
{"internal/runtime/sys", "\xc6\x01\x04"},
{"internal/runtime/syscall/linux", "\xc6\x01\x9c\x01"},
{"internal/runtime/wasitest", ""},
{"internal/saferio", "\xfa\x01["},
{"internal/singleflight", "\xc0\x02"},
{"internal/strconv", "\x89\x02L"},
{"internal/stringslite", "\x9f\x01\xb6\x01"},
{"internal/sync", "\x9b\x01!\x13r\x14"},
{"internal/synctest", "\x9b\x01\xba\x01"},
{"internal/syscall/execenv", "\xc2\x02"},
{"internal/syscall/unix", "\xb3\x02\x0e\x01\x13"},
{"internal/sysinfo", "\x02\x01\xb2\x01E,\x18\x02"},
{"internal/saferio", "\x85\x02]"},
{"internal/singleflight", "\xcd\x02"},
{"internal/strconv", "\x94\x02N"},
{"internal/stringslite", "\xa8\x01\xba\x01"},
{"internal/sync", "\xa4\x01\"\x14t\x14"},
{"internal/synctest", "\xa4\x01\xbe\x01"},
{"internal/syscall/execenv", "\xcf\x02"},
{"internal/syscall/unix", "\xeb\x01U\x0e\x01\x13"},
{"internal/sysinfo", "\x02\x01\xbb\x01G.\x18\x02"},
{"internal/syslist", ""},
{"internal/testenv", "\x03\ng\x02\x01*\x1b\x0f0+\x01\x05\a\n\x01\x02\x02\x01\f"},
{"internal/testhash", "\x03\x87\x01p\x118\f"},
{"internal/testlog", "\xc0\x02\x01\x14"},
{"internal/testpty", "t\x03\xaf\x01"},
{"internal/trace", "\x02\x01\x01\x06c\a\x03w\x03\x03\x06\x03\t+\n\x01\x01\x01\x11\x06"},
{"internal/trace/internal/testgen", "\x03j\nu\x03\x02\x03\x011\v\r\x11"},
{"internal/trace/internal/tracev1", "\x03\x01i\a\x03}\x06\f5\x01"},
{"internal/trace/raw", "\x02k\nz\x03\x06C\x01\x13"},
{"internal/trace/testtrace", "\x02\x01q\x03q\x04\x03\x05\x01\x05,\v\x02\b\x02\x01\x05"},
{"internal/testenv", "\x03\nq\x02\x01)\x1c\x100-\x01\x05\a\n\x01\x02\x02\x01\f"},
{"internal/testhash", "\x03\x90\x01r\x11:\f"},
{"internal/testlog", "\xcd\x02\x01\x14"},
{"internal/testpty", "~\x03\xb2\x01"},
{"internal/trace", "\x02\x01\x01\x06f\x0e\x03x\x03\x03\x06\x03\t-\n\x01\x01\x01\x11\x06"},
{"internal/trace/internal/testgen", "\x03m\x11v\x03\x02\x03\x013\v\r\x11"},
{"internal/trace/internal/tracev1", "\x03\x01l\x0e\x03~\x06\f7\x01"},
{"internal/trace/raw", "\x02n\x11{\x03\x06E\x01\x13"},
{"internal/trace/testtrace", "\x02\x01{\x03r\x04\x03\x05\x01\x05.\v\x02\b\x02\x01\x05"},
{"internal/trace/tracev2", ""},
{"internal/trace/traceviewer", "\x02d\v\x06\x1a<\x1f\a\a\x04\b\v\x15\x01\x05\a\n\x01\x02\x0f"},
{"internal/trace/traceviewer", "\x02g\v\r\x19>\x1f\a\a\x04\b\v\x17\x01\x05\a\n\x01\x02\x0f"},
{"internal/trace/traceviewer/format", ""},
{"internal/trace/version", "wz\t"},
{"internal/txtar", "\x03t\xaf\x01\x18"},
{"internal/types/errors", "\xbd\x02"},
{"internal/unsafeheader", "\xd5\x02"},
{"internal/xcoff", "`\r\a\x03g\x1c,\x17\x01"},
{"internal/zstd", "m\a\x03\x83\x01\x0f"},
{"io", "t\xcc\x01"},
{"io/fs", "t+*11\x10\x14\x04"},
{"io/ioutil", "\xfa\x01\x01+\x15\x03"},
{"iter", "\xcf\x01d\""},
{"log", "w\x83\x01\x05'\r\r\x01\x0e"},
{"internal/trace/version", "\x81\x01{\t"},
{"internal/txtar", "\x03~\xb2\x01\x18"},
{"internal/types/errors", "\xca\x02"},
{"internal/unsafeheader", "\xe2\x02"},
{"internal/xcoff", "c\r\x0e\x03h\x1c.\x17\x01"},
{"internal/zstd", "p\x0e\x03\x84\x01\x0f"},
{"io", "~\xcf\x01"},
{"io/fs", "~*,13\x10\x14\x04"},
{"io/ioutil", "\x85\x02\x01-\x15\x03"},
{"iter", "\xda\x01f\""},
{"log", "\x81\x01\x84\x01\x05)\r\r\x01\x0e"},
{"log/internal", ""},
{"log/slog", "\x03\n[\t\x03\x03\x83\x01\x04\x01\x02\x02\x03(\x05\b\x02\x01\x02\x01\x0e\x02\x02\x02"},
{"log/slog", "\x03\n^\t\n\x03H<\x04\x01\x02\x02\x03*\x05\b\x02\x01\x02\x01\x0e\x02\x02\x02"},
{"log/slog/internal", ""},
{"log/slog/internal/benchmarks", "\rg\x03\x83\x01\x06\x03:\x12"},
{"log/slog/internal/buffer", "\xc0\x02"},
{"log/syslog", "t\x03\x87\x01\x12\x16\x18\x02\x0f"},
{"maps", "\xfd\x01X"},
{"math", "\xb5\x01TL"},
{"math/big", "\x03q\x03)\x15E\f\x03\x020\x02\x01\x02\x15"},
{"math/big/internal/asmgen", "\x03\x01s\x92\x012\x03"},
{"math/bits", "\xd5\x02"},
{"math/cmplx", "\x86\x02\x03"},
{"math/rand", "\xbd\x01I:\x01\x14"},
{"math/rand/v2", "t,\x03c\x03L"},
{"mime", "\x02\x01i\b\x03\x83\x01\v!\x15\x03\x02\x11\x02"},
{"mime/multipart", "\x02\x01N#\x03F=\v\x01\a\x02\x15\x02\x06\x0f\x02\x01\x17"},
{"mime/quotedprintable", "\x02\x01t\x83\x01"},
{"net", "\x04\tg+\x1e\n\x05\x13\x01\x01\x04\x15\x01%\x06\r\b\x05\x01\x01\r\x06\a"},
{"net/http", "\x02\x01\x03\x01\x04\x02D\b\x13\x01\a\x03F=\x01\x03\a\x01\x03\x02\x02\x01\x02\x06\x02\x01\x01\n\x01\x01\x05\x01\x02\x05\b\x01\x01\x01\x02\x01\x0e\x02\x02\x02\b\x01\x01\x01"},
{"net/http/cgi", "\x02W\x1b\x03\x83\x01\x04\a\v\x01\x13\x01\x01\x01\x04\x01\x05\x02\b\x02\x01\x11\x0e"},
{"net/http/cookiejar", "\x04p\x03\x99\x01\x01\b\a\x05\x16\x03\x02\x0f\x04"},
{"net/http/fcgi", "\x02\x01\n`\a\x03\x83\x01\x16\x01\x01\x14\x18\x02\x0f"},
{"net/http/httptest", "\x02\x01\nL\x02\x1b\x01\x83\x01\x04\x12\x01\n\t\x02\x17\x01\x02\x0f\x0e"},
{"net/http/httptrace", "\rLnI\x14\n!"},
{"net/http/httputil", "\x02\x01\ng\x03\x83\x01\x04\x0f\x03\x01\x05\x02\x01\v\x01\x19\x02\x01\x0e\x0e"},
{"net/http/internal", "\x02\x01q\x03\x83\x01"},
{"net/http/internal/ascii", "\xbe\x02\x13"},
{"net/http/internal/httpcommon", "\rg\x03\x9f\x01\x0e\x01\x17\x01\x01\x02\x1d\x02"},
{"net/http/internal/testcert", "\xbe\x02"},
{"net/http/pprof", "\x02\x01\nj\x19-\x02\x0e-\x04\x13\x14\x01\r\x04\x03\x01\x02\x01\x11"},
{"log/slog/internal/benchmarks", "\rq\x03\x84\x01\x06\x03<\x12"},
{"log/slog/internal/buffer", "\xcd\x02"},
{"log/syslog", "~\x03\x88\x01\x12\x18\x18\x02\x0f"},
{"maps", "\x88\x02Z"},
{"math", "\xbe\x01VN"},
{"math/big", "\x03{\x03(\x15G\f\x03\x022\x02\x01\x02\x15"},
{"math/big/internal/asmgen", "\x03\x01}\x93\x014\x03"},
{"math/bits", "\xe2\x02"},
{"math/cmplx", "\x91\x02\x03"},
{"math/rand", "\xc7\x01J<\x01\x14"},
{"math/rand/v2", "~+\x03e\x03N"},
{"mime", "\x02\x01l\x0f\x03\x84\x01\v#\x15\x03\x02\x11\x02"},
{"mime/multipart", "\x02\x01P+\x03F>\v\x01\a\x02\x17\x02\x06\x0f\x02\x01\x17"},
{"mime/quotedprintable", "\x02\x01~\x84\x01"},
{"net", "\x04\tq*\x1f\v\x05\x13\x01\x01\x04\x15\x01'\x06\r\b\x05\x01\x01\r\x06\t"},
{"net/http", "\x02\x01\x03\x01\x04\x02N\x14\x0f\x03F>\x01\x03\a\x01\x06\x01\x01\x02\x06\x02\x01\x01\f\x01\x01\x05\x01\x02\x05\b\x01\x01\x01\x02\x01\x0e\x02\x02\x02\n\x01\x03"},
{"net/http/cgi", "\x02Y#\x03\x84\x01\x04\a\v\x01\x15\x01\x01\x01\x04\x01\x05\x02\b\x02\x01\x11\x10"},
{"net/http/cookiejar", "\x04z\x03\x9a\x01\x01\b\t\x05\x16\x03\x02\x0f\x04"},
{"net/http/fcgi", "\x02\x01\nc\x0e\x03\x84\x01\x16\x01\x01\x16\x18\x02\x0f"},
{"net/http/httptest", "\x02\x01\nN\x02#\x01P4\x04\x12\x01\f\t\x02\r\n\x01\x02\x03\f\x06\n"},
{"net/http/httptrace", "\rNwI\x16+"},
{"net/http/httputil", "\x02\x01\nq\x03F>\x04\x0f\x03\x01\x05\x02\x01\r\x01\x19\x02\x01\x0e\x10"},
{"net/http/internal", "\x02\x01m\x0e\x03\x84\x01"},
{"net/http/internal/ascii", "\xcb\x02\x13"},
{"net/http/internal/http2", "\x02\x01\x03\x01\x06F\b\x15\x0e\x03\x84\x01\x01\x03\b\x03\x02\x03\x02\x06\x02\x03\x01\n\x01\x01\b\x05\b\x02\x01\x02\x01\x0e\x10\x02\x02"},
{"net/http/internal/httpcommon", "\rq\x03\xa0\x01\x10\x01\x17\x01\x01\x02\x1f\x02"},
{"net/http/internal/httpsfv", "\xc8\x02\x02\x01\x11\x04"},
{"net/http/internal/testcert", "\xcb\x02"},
{"net/http/pprof", "\x02\x01\nt\x18.\x11-\x04\x13\x16\x01\r\x04\x03\x01\x02\x01\x11"},
{"net/internal/cgotest", ""},
{"net/internal/socktest", "w\xc9\x01\x02"},
{"net/mail", "\x02r\x03\x83\x01\x04\x0f\x03\x14\x1a\x02\x0f\x04"},
{"net/netip", "\x04p+\x01f\x034\x17"},
{"net/rpc", "\x02m\x05\x03\x10\ni\x04\x12\x01\x1d\r\x03\x02"},
{"net/rpc/jsonrpc", "q\x03\x03\x83\x01\x16\x11\x1f"},
{"net/smtp", "\x194\f\x13\b\x03\x83\x01\x16\x14\x1a"},
{"net/textproto", "\x02\x01q\x03\x83\x01\f\n-\x01\x02\x15"},
{"net/url", "t\x03Fc\v\x10\x02\x01\x17"},
{"os", "t+\x01\x19\x03\x10\x14\x01\x03\x01\x05\x10\x018\b\x05\x01\x01\r\x06"},
{"os/exec", "\x03\ngI'\x01\x15\x01+\x06\a\n\x01\x03\x01\r"},
{"os/exec/internal/fdtest", "\xc2\x02"},
{"os/signal", "\r\x99\x02\x15\x05\x02"},
{"os/user", "\x02\x01q\x03\x83\x01,\r\n\x01\x02"},
{"path", "t+\xb4\x01"},
{"path/filepath", "t+\x1aB+\r\b\x03\x04\x11"},
{"plugin", "t"},
{"reflect", "t'\x04\x1d\x13\b\x04\x05\x17\x06\t-\n\x03\x11\x02\x02"},
{"net/internal/socktest", "\x81\x01\xcc\x01\x02"},
{"net/mail", "\x02|\x03\x84\x01\x04\x0f\x03\x16\x1a\x02\x0f\x04"},
{"net/netip", "\x04z*\x01h\x036\x17"},
{"net/rpc", "\x02p\f\x03\x0f\nk\x04\x12\x01\x1f\r\x03\x02"},
{"net/rpc/jsonrpc", "t\n\x03\x84\x01\x16\x13\x1f"},
{"net/smtp", "\x195\r\x14\x0f\x03\x84\x01\x16\x16\x1a"},
{"net/textproto", "\x02\x01{\x03\x84\x01\f\n/\x01\x02\x15"},
{"net/url", "~\x03Ff\v\x10\x02\x01\x17"},
{"os", "~*\x01\x19\x04\x11\x14\x01\x03\x01\x05\x10\x01:\b\x05\x01\x01\r\x06"},
{"os/exec", "\x03\nqI(\x01\x15\x01-\x06\a\n\x01\x03\x01\r"},
{"os/exec/internal/fdtest", "\xcf\x02"},
{"os/signal", "\r\xa6\x02\x15\x05\x02"},
{"os/user", "\x02\x01{\x03\x84\x01.\r\n\x01\x02"},
{"path", "~*\xb8\x01"},
{"path/filepath", "~*\x1aD-\r\b\x03\x04\x11"},
{"plugin", "~"},
{"reflect", "~&\x04\x1e\x03\x11\b\x04\x05\x17\x06\t/\n\x03\x11\x02\x02"},
{"reflect/internal/example1", ""},
{"reflect/internal/example2", ""},
{"regexp", "\x03\xf7\x018\t\x02\x01\x02\x11\x02"},
{"regexp/syntax", "\xbb\x02\x01\x01\x01\x02\x11\x02"},
{"runtime", "\x9b\x01\x04\x01\x03\f\x06\a\x02\x01\x01\x0e\x03\x01\x01\x01\x02\x01\x01\x01\x02\x01\x04\x01\x10\x18L"},
{"runtime/coverage", "\xa7\x01S"},
{"runtime/debug", "wUZ\r\b\x02\x01\x11\x06"},
{"runtime/metrics", "\xbe\x01H-\""},
{"runtime/pprof", "\x02\x01\x01\x03\x06`\a\x03$$\x0f\v!\f \r\b\x01\x01\x01\x02\x02\n\x03\x06"},
{"runtime/race", "\xb9\x02"},
{"regexp", "\x03\x82\x02\x037\t\x02\x01\x02\x11\x02"},
{"regexp/syntax", "\xc8\x02\x01\x01\x01\x02\x11\x02"},
{"runtime", "\xa4\x01\x04\x01\x03\f\x06\b\x02\x01\x01\x0f\x03\x01\x01\x01\x02\x01\x01\x01\x02\x01\x04\x01\x10\x18N"},
{"runtime/coverage", "\xb0\x01U"},
{"runtime/debug", "\x81\x01V\\\r\b\x02\x01\x11\x06"},
{"runtime/metrics", "\xc8\x01I/\""},
{"runtime/pprof", "\x02\x01\x01\x03\x06c\x0e\x03#5\v!\f\"\r\b\x01\x01\x01\x02\x02\n\x03\x06"},
{"runtime/race", "\xc6\x02"},
{"runtime/race/internal/amd64v1", ""},
{"runtime/trace", "\rg\x03z\t9\b\x05\x01\x0e\x06"},
{"slices", "\x04\xf9\x01\fL"},
{"sort", "\xd0\x0192"},
{"strconv", "t+A\x01r"},
{"strings", "t'\x04B\x19\x03\f7\x11\x02\x02"},
{"runtime/trace", "\rq\x03{\t;\b\x05\x01\x0e\x06"},
{"slices", "\x04\x84\x02\fN"},
{"sort", "\xdb\x0194"},
{"strconv", "~*C\x01t"},
{"strings", "~&\x04D\x19\x03\f9\x11\x02\x02"},
{"structs", ""},
{"sync", "\xcf\x01\x13\x01P\x0e\x14"},
{"sync/atomic", "\xd5\x02"},
{"syscall", "t(\x03\x01\x1c\n\x03\x06\r\x04S\b\x05\x01\x14"},
{"testing", "\x03\ng\x02\x01X\x17\x14\f\x05\x1b\x06\x02\x05\x02\x05\x01\x02\x01\x02\x01\x0e\x02\x04"},
{"testing/cryptotest", "QOZ\x124\x03\x12"},
{"testing/fstest", "t\x03\x83\x01\x01\n&\x10\x03\t\b"},
{"testing/internal/testdeps", "\x02\v\xae\x01/\x10,\x03\x05\x03\x06\a\x02\x0f"},
{"testing/iotest", "\x03q\x03\x83\x01\x04"},
{"testing/quick", "v\x01\x8f\x01\x05#\x10\x11"},
{"testing/slogtest", "\rg\x03\x89\x01.\x05\x10\f"},
{"testing/synctest", "\xe3\x01`\x12"},
{"text/scanner", "\x03t\x83\x01,+\x02"},
{"text/tabwriter", "w\x83\x01Y"},
{"text/template", "t\x03C@\x01\n \x01\x05\x01\x02\x05\v\x02\x0e\x03\x02"},
{"text/template/parse", "\x03t\xbc\x01\n\x01\x13\x02"},
{"time", "t+\x1e$(*\r\x02\x13"},
{"time/tzdata", "t\xce\x01\x13"},
{"sync", "\xda\x01\x02\x11\x01R\x0e\x14"},
{"sync/atomic", "\xe2\x02"},
{"syscall", "~'\x03\x01\x1d\n\x04\x06\r\x04U\b\x05\x01\x14"},
{"testing", "\x03\nq\x02\x01Y\x17\x14\f\x05\x1d\x06\x02\x05\x02\x05\x01\x02\x01\x02\x01\x0e\x02\x04"},
{"testing/cryptotest", "SV\\\x126\x03\x12"},
{"testing/fstest", "~\x03\x84\x01\x01\n(\x10\x03\t\b"},
{"testing/internal/testdeps", "\x02\v\xb7\x011\x10.\x03\x05\x03\x06\a\x02\x0f"},
{"testing/iotest", "\x03{\x03\x84\x01\x04"},
{"testing/quick", "\x80\x01\x01\x90\x01\x05%\x10\x11"},
{"testing/slogtest", "\rq\x03\x8a\x010\x05\x10\f"},
{"testing/synctest", "\xee\x01b\f\x06"},
{"text/scanner", "\x03~\x84\x01.+\x02"},
{"text/tabwriter", "\x81\x01\x84\x01["},
{"text/template", "~\x03BB\x01\n\"\x01\x05\x01\x02\x05\v\x02\x0e\x03\x02"},
{"text/template/parse", "\x03~\xbf\x01\n\x01\x13\x02"},
{"time", "~*D(,\r\x02\x13"},
{"time/tzdata", "~\xd1\x01\x13"},
{"unicode", ""},
{"unicode/utf16", ""},
{"unicode/utf8", ""},
{"unique", "\x9b\x01!%\x01Q\r\x01\x14\x12"},
{"unique", "\xa4\x01\"&\x01S\r\x01\x14\x19"},
{"unsafe", ""},
{"vendor/golang.org/x/crypto/chacha20", "\x10]\a\x95\x01*'"},
{"vendor/golang.org/x/crypto/chacha20poly1305", "\x10\aV\a\xe2\x01\x04\x01\a"},
{"vendor/golang.org/x/crypto/cryptobyte", "j\n\x03\x90\x01'!\n"},
{"uuid", "\x03\x01O\x1d\x03\v\xcf\x01\x0f"},
{"vendor/golang.org/x/crypto/chacha20", "\x10`\x0e\x96\x01,)"},
{"vendor/golang.org/x/crypto/chacha20poly1305", "\x10\aY\x0e\xe6\x01\x05\x01\f"},
{"vendor/golang.org/x/crypto/cryptobyte", "m\x11\x03\x91\x01)!\v"},
{"vendor/golang.org/x/crypto/cryptobyte/asn1", ""},
{"vendor/golang.org/x/crypto/internal/alias", "\xd5\x02"},
{"vendor/golang.org/x/crypto/internal/poly1305", "X\x15\x9c\x01"},
{"vendor/golang.org/x/net/dns/dnsmessage", "t\xc7\x01"},
{"vendor/golang.org/x/net/http/httpguts", "\x90\x02\x14\x1a\x15\r"},
{"vendor/golang.org/x/net/http/httpproxy", "t\x03\x99\x01\x10\x05\x01\x18\x15\r"},
{"vendor/golang.org/x/net/http2/hpack", "\x03q\x03\x83\x01F"},
{"vendor/golang.org/x/net/idna", "w\x8f\x018\x15\x10\x02\x01"},
{"vendor/golang.org/x/net/nettest", "\x03j\a\x03\x83\x01\x11\x05\x16\x01\f\n\x01\x02\x02\x01\f"},
{"vendor/golang.org/x/sys/cpu", "\xa6\x02\r\n\x01\x17"},
{"vendor/golang.org/x/text/secure/bidirule", "t\xdf\x01\x11\x01"},
{"vendor/golang.org/x/text/transform", "\x03q\x86\x01Y"},
{"vendor/golang.org/x/text/unicode/bidi", "\x03\bl\x87\x01>\x17"},
{"vendor/golang.org/x/text/unicode/norm", "m\n\x83\x01F\x13\x11"},
{"weak", "\x9b\x01\x98\x01\""},
{"vendor/golang.org/x/crypto/hkdf", "\x18\x01e\x15r"},
{"vendor/golang.org/x/crypto/internal/alias", "\xe2\x02"},
{"vendor/golang.org/x/crypto/internal/poly1305", "Z\x16\xa4\x01"},
{"vendor/golang.org/x/net/dns/dnsmessage", "~\xca\x01"},
{"vendor/golang.org/x/net/http/httpguts", "\x9b\x02\x16\x1a\x15\x10"},
{"vendor/golang.org/x/net/http/httpproxy", "~\x03\x9a\x01\x12\x05\x01\x18\x15\x10"},
{"vendor/golang.org/x/net/http2/hpack", "\x03{\x03\x84\x01H"},
{"vendor/golang.org/x/net/http3", "\x9c\x02@\x06\x0f\x04"},
{"vendor/golang.org/x/net/idna", "\x81\x01\x90\x01:\x13\x02\x17\x02\x01"},
{"vendor/golang.org/x/net/internal/http3", "\rN#\x03\x84\x01\v\x04\a\x01\x05\x10\x01\x16\x02\x01\x02\x0f\x10\x02\x04\x03"},
{"vendor/golang.org/x/net/internal/httpcommon", "\rq\x03\xa0\x01\x10\x01\x17\x01\x01\x02\x1f\x02"},
{"vendor/golang.org/x/net/internal/quic/quicwire", "p"},
{"vendor/golang.org/x/net/nettest", "\x03m\x0e\x03\x84\x01\x11\x05\x18\x01\f\n\x01\x02\x02\x01\f"},
{"vendor/golang.org/x/net/quic", "\x03\n\x01\x01\x01\t:\x04\x04\x15\x03\v\x03\x12r\x06\x06\x06\x04\x12\x06\x15\x02\x01\x02\x01\x01\r\x06\x02\x01\x01\x02\v"},
{"vendor/golang.org/x/sys/cpu", "\xb3\x02\r\n\x01\x17"},
{"vendor/golang.org/x/text/secure/bidirule", "~\xe2\x01\x18\x01"},
{"vendor/golang.org/x/text/transform", "\x03{\x87\x01["},
{"vendor/golang.org/x/text/unicode/bidi", "\x03\bv\x88\x01@\x17"},
{"vendor/golang.org/x/text/unicode/norm", "p\x11\x84\x01H\x13\x18"},
{"weak", "\xa4\x01\x9c\x01\""},
}
// bootstrap is the list of bootstrap packages extracted from cmd/dist.
@@ -408,6 +428,7 @@ var bootstrap = map[string]bool{
"cmd/compile/internal/logopt": true,
"cmd/compile/internal/loong64": true,
"cmd/compile/internal/loopvar": true,
"cmd/compile/internal/midway": true,
"cmd/compile/internal/mips": true,
"cmd/compile/internal/mips64": true,
"cmd/compile/internal/noder": true,
@@ -512,6 +533,7 @@ var bootstrap = map[string]bool{
"internal/race": true,
"internal/runtime/gc": true,
"internal/saferio": true,
"internal/strconv": true,
"internal/syscall/unix": true,
"internal/types/errors": true,
"internal/unsafeheader": true,
Loaded 100 of 112 files, more files were not shown because too many files have changed in this diff. Show more